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

 ID:                 61118
 Comment by:         letharion at gmail dot com
 Reported by:        letharion at gmail dot com
 Summary:            array_intersect_assoc() with duplicate arrays for
                     values gives of a notice
 Status:             Not a bug
 Type:               Bug
 Package:            Arrays related
 Operating System:   Gentoo Linux
 PHP Version:        5.4.0RC7
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for pointing this out to me. Sorry about the "no-bug".


Previous Comments:
------------------------------------------------------------------------
[2012-02-17 08:37:30] ni...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected behavior: The notice indicates incorrect usage of the 
function. array_intersect does not compare the arrays but casts them to strings 
thus making both "Array" and issuing a notice.

The behavior always has been like this, but the notice was added in 5.4 :)

------------------------------------------------------------------------
[2012-02-17 07:36:55] letharion at gmail dot com

Description:
------------
Gentoo package version: dev-lang/php-5.4.0_rc7-r1

Configure: ./configure --prefix=/usr --build=x86_64-pc-linux-gnu 
--host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info 
--datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib 
--prefix=/usr/lib64/php5.4 --mandir=/usr/lib64/php5.4/man 
--infodir=/usr/lib64/php5.4/info --libdir=/usr/lib64/php5.4/lib 
--with-libdir=lib64 --without-pear --disable-maintainer-zts --disable-bcmath 
--with-bz2 --disable-calendar --enable-ctype --with-curl --with-curlwrappers 
--enable-dom --without-enchant --enable-exif --enable-fileinfo --enable-filter 
--disable-ftp --with-gettext --without-gmp --enable-hash --without-mhash 
--with-iconv --disable-intl --enable-ipv6 --enable-json --without-kerberos 
--enable-libxml --enable-mbstring --with-mcrypt --without-mssql 
--with-onig=/usr --with-openssl --with-openssl-dir=/usr --disable-pcntl 
--enable-phar --enable-pdo --without-pgsql --enable-posix --with-pspell 
--without-recode --enable-simplexml --disable-shmop --without-snmp 
--disable-soap --disable-sockets --without-sqlite3 --without-sybase-ct 
--disable-sysvmsg --disable-sysvsem --disable-sysvshm --without-tidy 
--enable-tokenizer --disable-wddx --enable-xml --disable-xmlreader 
--disable-xmlwriter --without-xmlrpc --without-xsl --disable-zip --with-zlib 
--disable-debug --enable-dba --without-cdb --with-db4 --disable-flatfile 
--with-gdbm --disable-inifile --without-qdbm --with-freetype-dir=/usr 
--with-t1lib=/usr --disable-gd-jis-conv --with-jpeg-dir=/usr 
--with-png-dir=/usr --without-xpm-dir --with-gd --with-ldap --without-ldap-sasl 
--with-mysql=mysqlnd --with-mysql-sock=/var/run/mysqld/mysqld.sock 
--with-mysqli=mysqlnd --without-pdo-dblib --with-pdo-mysql=mysqlnd 
--without-pdo-pgsql --without-pdo-sqlite --without-pdo-odbc --with-readline 
--without-libedit --without-mm --with-pcre-regex=/usr --with-pcre-dir=/usr 
--with-config-file-path=/etc/php/cli-php5.4 
--with-config-file-scan-dir=/etc/php/cli-php5.4/ext-active --disable-embed 
--enable-cli --disable-cgi --disable-fpm --without-apxs2


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

$foo = array('baz' => Array  (0 => 'X' ));
$bar = array('baz' => Array  (1 => 'Y' ));

print_r(array_intersect_assoc($foo, $bar));


Expected result:
----------------
Array
(
    [baz] => Array
        (
            [0] => X
        )

)

Actual result:
--------------
PHP Notice:  Array to string conversion in array_intersect_assoc_short.php on 
line 6

Notice: Array to string conversion in array_intersect_assoc_short.php on line 6
PHP Notice:  Array to string conversion in array_intersect_assoc_short.php on 
line 6

Notice: Array to string conversion in array_intersect_assoc_short.php on line 6

Array
(
    [baz] => Array
        (
            [0] => X
        )

)



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



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

Reply via email to