Bug #77678 [Com]: 7.2.15 Empty array key recognized as string
| From: | dantaeusb at live dot com | Date: | Fri, 01 Mar 2019 15:47:53 +0000 |
| Subject: | Bug #77678 [Com]: 7.2.15 Empty array key recognized as string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219794@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77678&edit=1
ID: 77678
Comment by: dantaeusb at live dot com
Reported by: dantaeusb at live dot com
Summary: 7.2.15 Empty array key recognized as string
Status: Feedback
Type: Bug
Package: Arrays related
Operating System: RHEL, Ubuntu
PHP Version: 7.2.15
Block user comment: N
Private report: N
New Comment:
Yes, seems like it's happening only if XDebug enabled! Even if the extension is only loaded and
not enabled, I can see the error. It's not happening when I disable
zend_extension=xdebug.so in config.
Previous Comments:
------------------------------------------------------------------------
[2019-02-28 10:18:26] nikic@php.net
Can you please check whether this issue goes away if you remove the xdebug and opcache extensions?
------------------------------------------------------------------------
[2019-02-28 09:28:26] dantaeusb at live dot com
Description:
------------
Under some circumstances, the following code (shortened, see link below for more info):
$selects = array();
foreach (array_keys($this->getAttributesByTable()) as $table) {
echo gettype($selects);
var_dump($selects);
echo gettype($selects[$eavType]);
$selects[$eavType][] = $this->_addLoadAttributesSelectFields($select, $table, $eavType);
}
Got executed with the following result:
array
.../Abstract.php:992: array (size=0) empty
string
( ! ) Fatal error: Uncaught Error: [] operator not supported for strings in .../Abstract.php on line
995
As you can see, it seems like for some reason type of value in an empty array got recognized like a
string. I checked a lot of options and asked for community help but as far nobody could answer why
is that happening, so I decided to make a bug report.
Unfortunately, this happens very rarely under some unknown circumstances, so I can't make test
script or make a gdb backtrace using CLI. If you can help me and explain how to grab some more
useful data about scope or execution environment
Here's the extended discussion with more info: https://stackoverflow.com/questions/54913287/under-some-circumstances-operator-not-supported-for-strings-error-occurs-whe
Reproduced on both local (7.2.15, Ubuntu 16.04 x64), dev and production (7.2.15 RHEL 6)
environments. Don't think It's related to environment or some modules, but here's the
list of installed modules (tried to pick only additionally installed modules).
[PHP Modules]
...
gd
...
iconv
igbinary
imagick
...
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
...
xdebug
xml
...
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcache
Excuse me for possible grammar errors and thanks in advance.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77678&edit=1