Bug #77678 [NEW]: 7.2.15 Empty array key recognized as string

From: Date: Thu, 28 Feb 2019 09:28:26 +0000
Subject: Bug #77678 [NEW]: 7.2.15 Empty array key recognized as string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219761@lists.php.net to get a copy of this message
From: dantaeusb at live dot com Operating system: RHEL, Ubuntu PHP version: 7.2.15 Package: Arrays related Bug Type: Bug Bug description:7.2.15 Empty array key recognized as string 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 bug report at https://bugs.php.net/bug.php?id=77678&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77678&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77678&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77678&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77678&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77678&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77678&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77678&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77678&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77678&r=support Expected behavior: https://bugs.php.net/fix.php?id=77678&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77678&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77678&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77678&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77678&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77678&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77678&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77678&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77678&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77678&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77678&r=mysqlcfg

« previous php.bugs (#219761) next »