Bug #80313 [NEW]: String containing comment interpretted as comment

From: Date: Wed, 04 Nov 2020 09:10:07 +0000
Subject: Bug #80313 [NEW]: String containing comment interpretted as comment
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230098@lists.php.net to get a copy of this message
From: jab_creations at yahoo dot com Operating system: *nix/Win PHP version: 7.4.12 Package: *General Issues Bug Type: Bug Bug description:String containing comment interpretted as comment Description: ------------ When a string contains a closing comment */ PHP fails to interpret it as a string. My best guess is that the initial parser is looking for comments BEFORE interpreting the structure. Test script: --------------- <?php function xml_cleaner($xml) { /* //Remove CSS Comments (they conflict with checking for proper element nesting): $xml = str_replace('/*', '__com0', $xml); $xml = str_replace('*/', 'com1__', $xml);//Bug here. $xml = preg_replace('/__com0.*?com1__/s', '', $xml); */ } ?> Expected result: ---------------- The parser should ignore comments contained within strings. Actual result: -------------- Parse error: syntax error, unexpected 'com1__' (T_STRING) in bug.php on line 7 -- Edit bug report at https://bugs.php.net/bug.php?id=80313&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80313&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80313&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80313&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80313&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80313&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80313&r=support Expected behavior: https://bugs.php.net/fix.php?id=80313&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80313&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80313&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80313&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80313&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80313&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80313&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80313&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80313&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80313&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80313&r=mysqlcfg

« previous php.bugs (#230098) next »