Bug #78508 [NEW]: PHP does not emit a warning when some types are accessed with an index

From: Date: Sat, 07 Sep 2019 09:06:04 +0000
Subject: Bug #78508 [NEW]: PHP does not emit a warning when some types are accessed with an index
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222617@lists.php.net to get a copy of this message
From: michael dot vorisek at email dot cz Operating system: Linux PHP version: 7.3.9 Package: *General Issues Bug Type: Bug Bug description:PHP does not emit a warning when some types are accessed with an index Description: ------------ I found out that current PHP does not emit warnings at least for the following expressions: a) if boolean is accessed with index: false['x'] b) if null is accessed with index: null['x'] in contrary with string type, which emits the following message: Warning: Illegal string offset 'x'... Notice: Uninitialized string offset: 0 I would expect PHP to emit at least Notice warning. Is this a bug which needs to be addressed or is this an intended behaviour for some use case/backcompatibility that requires no warning? Test script: --------------- see desc. -- Edit bug report at https://bugs.php.net/bug.php?id=78508&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78508&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78508&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78508&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78508&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78508&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78508&r=support Expected behavior: https://bugs.php.net/fix.php?id=78508&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78508&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78508&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78508&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78508&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78508&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78508&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78508&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78508&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78508&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78508&r=mysqlcfg

« previous php.bugs (#222617) next »