Bug #71598 [NEW]: Whitespace at the start of a function name counts as part of the function name.

From: Date: Mon, 15 Feb 2016 12:48:34 +0000
Subject: Bug #71598 [NEW]: Whitespace at the start of a function name counts as part of the function name.
Groups: php.standards 
Request: Send a blank email to standards-+get-1036@lists.php.net to get a copy of this message
From: lucas at lucassifoni dot info Operating system: Debian 8 PHP version: 7.0.3 Package: PHP Language Specification Bug Type: Bug Bug description:Whitespace at the start of a function name counts as part of the function name. Description: ------------ According to the PHP doc, «A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.» Some whitespace characters, like U+2000, U+2001, U+2002, U+2003, U+2004 [...], and the zero-width non breaking space (now word joiner, U+FEFF), are interpreted as a part of a function name. If this isn't a problem with a proper code editor that highlights "special" whitespace, it is still conflicting with the doc, and can be really confusing to users. The given snippet has a zero-width nonbreaking space just in front of foo(). When invoking foo(), the function is undefined, since the space is part of its referenced name. Test script: --------------- <?php function foo(){ echo 'bar'; } foo(); Expected result: ---------------- bar Actual result: -------------- Fatal error: Uncaught Error: Call to undefined function foo() in [...][...]:7 Stack trace: #0 {main} thrown in [...][...] on line 7 -- Edit bug report at https://bugs.php.net/bug.php?id=71598&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71598&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71598&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71598&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71598&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71598&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71598&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71598&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71598&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71598&r=support Expected behavior: https://bugs.php.net/fix.php?id=71598&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71598&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71598&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71598&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71598&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71598&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71598&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71598&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71598&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71598&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71598&r=mysqlcfg

« previous php.standards (#1036) next »