Bug #60278 [Opn]: BC Break + warning in array_diff with nested arrays

From: Date: Tue, 15 Nov 2011 00:55:51 +0000
Subject: Bug #60278 [Opn]: BC Break + warning in array_diff with nested arrays
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165138@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60278&edit=1

 ID:                 60278
 Updated by:         felipe@php.net
 Reported by:        kontakt at beberlei dot de
 Summary:            BC Break + warning in array_diff with nested arrays
 Status:             Open
 Type:               Bug
 Package:            Arrays related
 PHP Version:        5.4.0RC1
 Block user comment: N
 Private report:     N

 New Comment:

The difference is only the E_NOTICE message, the code behaves in the sameway.


Previous Comments:
------------------------------------------------------------------------
[2011-11-12 09:55:34] kontakt at beberlei dot de

Description:
------------
A warning occurs when you call array_diff with one nested and one flat array. This code worked on
5.3.

Test script:
---------------
<?php

$a = array(0 => "id");
$b = array(0 => array("foo" => "bar"));

$d = array_diff($a, $b);

var_dump($d);

Expected result:
----------------
array(1) {
  [0]=>
  string(2) "id"
}


Actual result:
--------------
Notice: Array to string conversion in /home/benny/code/php/tests/array_diff.php on line 6
array(1) {
  [0]=>
  string(2) "id"
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60278&edit=1


Thread (3 messages)

« previous php.bugs (#165138) next »