使WordPress成为核心

变更集57732


忽略:
时间戳:
2024年2月27日晚上10:36:09(4个月(之前)
作者:
hellofrom托尼亚
消息:

常规:还原57698兰特用于WP_List_Util::pull()。

57698兰特导致具有神奇方法和动态属性的对象数组回归。已确定修复。

然而,更深入的研究发现了其他需要不同修复的场景。

还原为解决这些场景提供了更多的时间,并为发现是否存在其他场景提供了更长的浸泡时间。

道具dd32,jamescollins,瑞士。
请参阅#59774.

位置:
大旅行箱
文件夹:
2已编辑

图例:

未修改
补充
远离的
  • trunk/src/wp-includes/class-wp-list-util.php

    57698兰特 57732兰特  
    166166foreach($this->输出为$key=>$value){
    167167if(is_object($value)){
    168 if(属性存在($value,$field)){
    169 $newlist[$key]=$value->$field;
    170                     }
     168$newlist[$key]=$value->$field;
    171169}elseif(is_array($value)){
    172 if(array_key_exists($field,$value)){
    173 $newlist[$key]=$value[$field];
    174                     }
     170$newlist[$key]=$value[$field];
    175171}其他{
    176172做错事(
     
    193189foreach($this->输出为$value){
    194190if(is_object($value)){
    195 if(属性存在($value,$field)){
    196 if(属性存在($value,$indexkey)){
    197 $newlist[$value->$index_key]=$value->$field;
    198 }其他{
    199 $newlist[]=$value->$field;
    200 }
     191if(isset($value->$indexkey)){
     192$newlist[$value->$index_key]=$value->$field;
     193}其他{
     194$newlist[]=$value->$field;
    201195                }
    202196}elseif(is_array($value)){
    203 if(array_key_exists($field,$value)){
    204 if(array_key_exists($index_key,$value)){
    205 $newlist[$value[$index_key]]=$value[$字段];
    206 }其他{
    207 $newlist[]=$value[$field];
    208                     }
     197if(isset($value[$indexkey])){
     198$newlist[$value[$index_key]]=$value[$字段];
     199}其他{
     200$newlist[]=$value[$field];
    209201                }
    210202}其他{
  • trunk/tests/phpunit/tests/functions/wpListPluck.php

    57698兰特 57732兰特  
    272272                    ),
    273273阵列(
     274'foo'=>'foo',
    274275                        '123'   => '456',
    275276“lorem”=>“ipsum”,
     
    285286阵列(
    286287“bar”,
     288“bar”=>“foo”,
    287289“value”=>“baz”,
    288                 ),
    289             ),
    290 “缺少键的数组”=>数组(
    291 阵列(
    292 阵列(
    293 “foo”=>“bar”,
    294 “bar”=>“baz”,
    295 “abc”=>“xyz”,
    296 ),
    297 阵列(
    298 'foo'=>'foo',
    299                         '123'   => '456',
    300 “lorem”=>“ipsum”,
    301 “key”=>“bar”,
    302                     ),
    303 阵列(
    304 “foo”=>“baz”,
    305 'key'=>'value',
    306                     ),
    307                 ),
    308 “密钥”,
    309 空,
    310 阵列(
    311 1=>“bar”,
    312 2=>“值”,
    313290                ),
    314291            ),
     
    366343                    ),
    367344(对象)数组(
     345'foo'=>'foo',
    368346                        '123'   => '456',
    369347“lorem”=>“ipsum”,
     
    379357阵列(
    380358“bar”,
     359“bar”=>“foo”,
    381360“value”=>“baz”,
    382361                ),
    383362            ),
    384 “缺少字段的对象”=>数组(
    385 阵列(
    386 (对象)数组(
    387 “foo”=>“bar”,
    388 “bar”=>“baz”,
    389 “abc”=>“xyz”,
    390                     ),
    391 (对象)数组(
    392 'foo'=>'foo',
    393                         '123'   => '456',
    394 “lorem”=>“ipsum”,
    395 “key”=>“bar”,
    396                     ),
    397 (对象)数组(
    398 “foo”=>“baz”,
    399 “key”=>“value”,
    400                     ),
    401 ),
    402 “密钥”,
    403 空,
    404 阵列(
    405 1=>“bar”,
    406 2=>“值”,
    407                 ),
    408             ),
    409363        );
    410364    }
注:请参阅TracChangeset(跟踪变更集)获取有关使用变更集查看器的帮助。