Doc #74463 [NEW]: Reserved keywords as function name?

From: Date: Tue, 18 Apr 2017 04:37:04 +0000
Subject: Doc #74463 [NEW]: Reserved keywords as function name?
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14639@lists.php.net to get a copy of this message
From: usr at airmail dot cc Operating system: Mac OS X PHP version: 7.1.4 Package: Documentation problem Bug Type: Documentation Problem Bug description:Reserved keywords as function name? Description: ------------ The documentation says: --- The following words cannot be used to name a class, interface or trait, and they are also prohibited from being used in namespaces. --- http://php.net/manual/en/reserved.other-reserved-words.php But it does not mention the use of these words in function names. Is it safe to use those in the provided manner (see test case)? Test script: --------------- <?php /* This works??? */ namespace A\B { function String() { } } namespace { A\B\String(); } ?> <?php /* This breaks */ namespace A\B { function private() { } } namespace { A\B\private(); } ?> <?php /* This also breaks */ namespace A\B { class String {} } namespace { $str = new A\B\String(); } ?> -- Edit bug report at https://bugs.php.net/bug.php?id=74463&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74463&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74463&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74463&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74463&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74463&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74463&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74463&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74463&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74463&r=support Expected behavior: https://bugs.php.net/fix.php?id=74463&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74463&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74463&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74463&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74463&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74463&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74463&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74463&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74463&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74463&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74463&r=mysqlcfg

« previous php.doc.bugs (#14639) next »