Bug #77273 [NEW]: array_walk_recursive corrupts value types

From: Date: Sun, 09 Dec 2018 16:29:59 +0000
Subject: Bug #77273 [NEW]: array_walk_recursive corrupts value types
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218352@lists.php.net to get a copy of this message
From: andreas at sassermann dot de Operating system: linux PHP version: 7.1.25 Package: Arrays related Bug Type: Bug Bug description:array_walk_recursive corrupts value types Description: ------------ After processing an array containing pdo options with array_walk_recursive, the PDO constructor fails with exception: PDO::__construct(): SQLSTATE[HY000]: General error: attribute value must be an integer According to vardump, the option array is perfectly fine. The assumption, that some internal structure get corrupted is triggered by the fact that by doing an is_integer() on the array values, the array becomes usable again. The problem has been reproduced using PHP 7.1.1 (cli) ( NTS ) PHP 7.2.12 (cli) (built: Nov 6 2018 15:07:37) ( NTS ) It does not occur with PHP 7.0.30-0+deb9u1 (cli) (built: Jun 14 2018 13:50:25) ( NTS ) Test script: --------------- Find testscript at github: https://gist.github.com/a-sassermann/840bd057f579169dc44bc4eee85b158a It contains 3 tests: 1. check using PDO with unmodified option array 2. do an array_walk_recursive on option array before using with PDO 3. after array_walk_recursive do an is_integer() on array values Expected result: ---------------- All tests should succeed without error. Actual result: -------------- Test 2 fails with exception PDO::__construct(): SQLSTATE[HY000]: General error: attribute value must be an integer -- Edit bug report at https://bugs.php.net/bug.php?id=77273&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77273&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77273&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77273&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77273&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77273&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77273&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77273&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77273&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77273&r=support Expected behavior: https://bugs.php.net/fix.php?id=77273&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77273&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77273&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77273&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77273&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77273&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77273&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77273&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77273&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77273&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77273&r=mysqlcfg

« previous php.bugs (#218352) next »