Bug #62115 [NEW]: Issue with method array_diff_assoc

From: Date: Wed, 23 May 2012 05:29:57 +0000
Subject: Bug #62115 [NEW]: Issue with method array_diff_assoc
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170695@lists.php.net to get a copy of this message
From:             
Operating system: All
PHP version:      5.4.3
Package:          Arrays related
Bug Type:         Bug
Bug description:Issue with method array_diff_assoc

Description:
------------
While executing method array_diff_assoc error appears "Notice: Array to
string 
conversion".
The output of script:
array(2) { ["one"]=> array(2) { ["param1"]=> string(23) "First
Parameter
for 
One" ["param2"]=> string(24) "Second Parameter for One" }
["two"]=>
array(2) { 
["param1"]=> string(23) "First Parameter for Two" ["param2"]=>
string(24) 
"Second Parameter for Two" } }
string(3) "two"
array(2) { ["param1"]=> string(23) "First Parameter for Two"
["param2"]=> 
string(24) "Second Parameter for Two" }
array(1) { ["two"]=> array(2) { ["param1"]=> string(23) "First
Parameter
for 
Two" ["param2"]=> string(24) "Second Parameter for Two" } }
Notice: Array to string conversion in /usr/web/data/test_array_diff.php on
line 
14 Notice: Array to string conversion in /usr/web/data/test_array_diff.php
on 
line 14 array(1) { ["one"]=> array(2) { ["param1"]=> string(23)
"First
Parameter 
for One" ["param2"]=> string(24) "Second Parameter for One" } }

What is wrong?

Test script:
---------------
<?php
$source_packages = array(
	'one' => array ('param1' => 'First Parameter for One',
'param2' => 'Second
Parameter for One'),
	'two' => array ('param1' => 'First Parameter for Two',
'param2' => 'Second
Parameter for Two')
);
$packages_from = $source_packages;
var_dump($packages_from); echo "<br />\n";
$package_key = 'two';
var_dump($package_key); echo "<br />\n";
$package_value = $source_packages[$package_key];
var_dump($package_value); echo "<br />\n";
$packages_to = array($package_key => $package_value);
var_dump($packages_to); echo "<br />\n";
$result_packages = array_diff_assoc($packages_from, $packages_to);
var_dump($result_packages); echo "<br />\n";
?>


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62115&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=62115&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=62115&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=62115&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=62115&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62115&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=62115&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=62115&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=62115&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=62115&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=62115&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=62115&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=62115&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=62115&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=62115&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=62115&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62115&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=62115&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=62115&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=62115&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=62115&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=62115&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#170695) next »