|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-02-20 16:45 UTC] ircmaxell@php.net
[2015-02-22 03:01 UTC] laruence@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: laruence
[2015-02-22 03:01 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 12:00:01 2026 UTC |
Description: ------------ The current compile-time error check for declare(encoding="...") is incorrect. Declare is a parse-time only directive, which does not respect scope. The current compile-time checks for the declare(encoding) directive only check to see if it's the first opcode in the active oparray. This is fine if the active oparray is a file, however if it is a function odd behavior will be allowed. In the provided test script, "Bye" would be interpreted using the UTF-8 encoding pragma, where "Hi" would use the default. Test script: --------------- <?php echo "Hi"; function foo() { declare(encoding="UTF-8"); } echo "Bye"; Expected result: ---------------- Fatal error: Encoding declaration pragma must be the very first statement in the script Actual result: -------------- HiBye