Bug #77273 [Opn]: array_walk_recursive corrupts value types leading to PDO failure
| From: | cmb@php.net | Date: | Fri, 21 Dec 2018 21:23:01 +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-218560@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
Updated by: cmb@php.net
Reported by: andreas at sassermann dot de
Summary: array_walk_recursive corrupts value types leading to
PDO failure
Status: Open
Type: Bug
Package: Arrays related
Operating System: linux
-PHP Version: 7.3.0
+PHP Version: 7.2
Block user comment: N
Private report: N
New Comment:
Thanks, Andreas! Changing the affected version to 7.2, since this
is the oldest branch which would receive the bugfix.
Previous Comments:
------------------------------------------------------------------------
[2018-12-21 19:54:39] andreas at sassermann dot de
I could verify the bug with 7.3.0.
------------------------------------------------------------------------
[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