|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-02-15 13:16 UTC] requinix@php.net
-Type: Bug
+Type: Documentation Problem
-Package: PHP Language Specification
+Package: Scripting Engine problem
[2016-02-15 13:16 UTC] requinix@php.net
[2016-06-27 11:47 UTC] lkppo at free dot fr
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 21 23:00:01 2025 UTC |
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