php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65074 Array to string conversion
Submitted: 2013-06-20 18:56 UTC Modified: 2013-06-21 07:32 UTC
From: ayalarcam at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.16 OS: All
Private report: No CVE-ID: None
 [2013-06-20 18:56 UTC] ayalarcam at gmail dot com
Description:
------------
# Array to string conversion problem, in multiples functions show notice, (asort, 
array_diff, array_diff_assoc, etc.)





Test script:
---------------
$a = [1,2,3,4 => [1,2]];
$b = [1,3];

// show notice
print_r(array_diff($a, $b));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-21 07:32 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2013-06-21 07:32 UTC] rasmus@php.net
This is not a bug. These functions do not support nested arrays, so your nested 
[1,2] array is getting converted to the string "Array". This is exactly the kind 
of mistake this notice was meant to catch.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 22:01:29 2025 UTC