Bug #81048 [Opn->Ver]: Regression from #80915 - phpinfo(INFO_VARIABLES) "Array to string conversion"

From: Date: Wed, 19 May 2021 09:46:47 +0000
Subject: Bug #81048 [Opn->Ver]: Regression from #80915 - phpinfo(INFO_VARIABLES) "Array to string conversion"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233892@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81048&edit=1

 ID:                 81048
 Updated by:         cmb@php.net
 Reported by:        webmaster at deltik dot org
 Summary:            Regression from #80915 - phpinfo(INFO_VARIABLES)
                     "Array to string conversion"
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            Arrays related
 Operating System:   Ubuntu 20.04
 PHP Version:        8.0.6
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Prior to fixing bug #80915, argv would have been omitted from the
ouput for the given script.


Previous Comments:
------------------------------------------------------------------------
[2021-05-18 23:24:03] webmaster at deltik dot org

Description:
------------
The fix for https://bugs.php.net/bug.php?id=80915 introduced a
regression where phpinfo(INFO_VARIABLES) will emit an E_NOTICE reading:

> PHP Notice:  Array to string conversion …

This happens if array_walk() iterates over $_SERVER prior to phpinfo().

The regression was introduced in:
* PHP 8.0.5
* PHP 7.4.18

The commit that introduced the regression:
https://github.com/php/php-src/commit/206fd35a98375522a53818ec4ef6e0585b1055dd

Test script:
---------------
<?php
error_reporting(E_ALL);
ini_set("display_errors", "On");

array_walk($_SERVER, function($value, $key) {
        // NOOP
});
phpinfo(INFO_VARIABLES);

Expected result:
----------------
In the output, no match for the following string:

"Notice:  Array to string conversion"

Actual result:
--------------
PHP Notice:  Array to string conversion in /tmp/php-bug/bug.php on line 8
PHP Stack trace:
PHP   1. {main}() /tmp/php-bug/bug.php:0
PHP   2. phpinfo($what = 32) /tmp/php-bug/bug.php:8
phpinfo()

PHP Variables

Variable => Value
… [ TRUNCATED ] …
$_SERVER['argv'] => 
Notice: Array to string conversion in /tmp/php-bug/bug.php on line 8

Call Stack:
    0.0001     405000   1. {main}() /tmp/php-bug/bug.php:0
    0.0001     417176   2. phpinfo($what = 32) /tmp/php-bug/bug.php:8

Array
$_SERVER['argc'] => 1


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



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


Thread (4 messages)

« previous php.bugs (#233892) next »