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

From: Date: Tue, 18 May 2021 23:24:03 +0000
Subject: Bug #81048 [NEW]: Regression from #80915 - phpinfo(INFO_VARIABLES) "Array to string conversion"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233890@lists.php.net to get a copy of this message
From:             webmaster at deltik dot org
Operating system: Ubuntu 20.04
PHP version:      8.0.6
Package:          Arrays related
Bug Type:         Bug
Bug description:Regression from #80915 - phpinfo(INFO_VARIABLES) "Array to string
conversion"

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 bug report at https://bugs.php.net/bug.php?id=81048&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81048&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81048&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81048&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81048&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81048&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81048&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81048&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81048&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81048&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81048&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81048&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81048&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81048&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81048&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81048&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81048&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81048&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#233890) next »