Bug #71611 [NEW]: array index starting with number in double quote string

From: Date: Tue, 16 Feb 2016 18:27:29 +0000
Subject: Bug #71611 [NEW]: array index starting with number in double quote string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199271@lists.php.net to get a copy of this message
From: asylow at free dot fr Operating system: PHP version: 5.6.18 Package: *General Issues Bug Type: Bug Bug description:array index starting with number in double quote string Description: ------------ In a double quoted string, an array index beginning with numbers followed by letters is not correctly interpreted. The documentation regarding Nowdocs says : "With array indices, the closing square bracket (]) marks the end of the index." but the parser seems to stop at the first alpha character. Of course this can be treated with the "Complex (curly) syntax" but "1a" is not more complex than "a1". Test script: --------------- $array['a1'] = 'foo'; echo "$donnees[a1]"; // foo $array['1a'] = 'foo'; echo "$donnees[1a]"; // Parse error: syntax error, unexpected 'a' (T_STRING), expecting ']' Expected result: ---------------- foo foo Actual result: -------------- Parse error: syntax error, unexpected 'a' (T_STRING), expecting ']' -- Edit bug report at https://bugs.php.net/bug.php?id=71611&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71611&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71611&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71611&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71611&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71611&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71611&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71611&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71611&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71611&r=support Expected behavior: https://bugs.php.net/fix.php?id=71611&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71611&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71611&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71611&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71611&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71611&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71611&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71611&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71611&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71611&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71611&r=mysqlcfg

« previous php.bugs (#199271) next »