Bug #77273 [Opn]: array_walk_recursive corrupts value types leading to PDO failure
| From: | andreas at sassermann dot de | Date: | Fri, 21 Dec 2018 19:54:39 +0000 |
| Subject: | Bug #77273 [Opn]: array_walk_recursive corrupts value types leading to PDO failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218558@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77273&edit=1
ID: 77273
User updated by: andreas at sassermann dot de
Reported by: andreas at sassermann dot de
-Summary: array_walk_recursive corrupts value types
+Summary: array_walk_recursive corrupts value types leading to
PDO failure
Status: Open
Type: Bug
Package: Arrays related
Operating System: linux
-PHP Version: 7.1.25
+PHP Version: 7.3.0
Block user comment: N
Private report: N
New Comment:
I could verify the bug with 7.3.0.
Previous Comments:
------------------------------------------------------------------------
[2018-12-09 16:29:59] andreas at sassermann dot de
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 this bug report at https://bugs.php.net/bug.php?id=77273&edit=1