Doc #64907 [NEW]: classname regex seems invalid

From: Date: Thu, 23 May 2013 06:40:50 +0000
Subject: Doc #64907 [NEW]: classname regex seems invalid
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9871@lists.php.net to get a copy of this message
From: php at kingsquare dot nl Operating system: n/a PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:classname regex seems invalid Description: ------------ I've tried to use the given regex for testing of my classname (which is dynamically built from various sources) but it seems that the given regex allows characters which shouldnt be allowed. The page http://php.net/manual/en/language.oop5.basic.php gives the '^[a-zA- Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' regex. But this would allow not only strange characters like '»×' which might be intened but also 'a:' which ofcourse would fail from a parse error... Test script: --------------- <?php $controllerName = 'a:'; var_dump(preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $controllerName)); eval('class '.$controllerName.' {}'); exit; Expected result: ---------------- I'd expect the parse error, but also the not the valid pregmatch. thus: int 0 ( ! ) Parse error: syntax error, unexpected ':', expecting '{' in test.php(5) : eval()'d code on line 1 Actual result: -------------- int 1 ( ! ) Parse error: syntax error, unexpected ':', expecting '{' in test.php(5) : eval()'d code on line 1 -- Edit bug report at https://bugs.php.net/bug.php?id=64907&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64907&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64907&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64907&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64907&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64907&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64907&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64907&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64907&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64907&r=support Expected behavior: https://bugs.php.net/fix.php?id=64907&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64907&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64907&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64907&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64907&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64907&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64907&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64907&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64907&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64907&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64907&r=mysqlcfg

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