From: marco dot weber at uni-trier dot de Operating system: ANY PHP version: 5.3.1 PHP Bug Type: *General Issues Bug description: declare encoding doesn't work with
Description: ------------ When using the the declare encoding statement in your php script, you will get an fatal error, when you try to include a subscript with a defined encoding. This only happens with php5.3.x version that was compiled with '--enable-zend-multibyte' When i'm using a php5.3.x version WITHOUT '--enable-zend-multibyte', there is no fatal error. And everything works as expected. Reproduce code: --------------- i used a php5.3.1 with '--enable-zend-multibyte' just try to call the index.php binary index.php file: <?php declare(encoding='UTF-8'); namespace marcotest; require_once('sub.inc.php'); ?> sub.inc.php file: <?php declare(encoding='UTF-8'); namespace marcotest; echo "TEST"; //phpinfo(); ?> Expected result: ---------------- NO FATAL ERROR... ( Same result as WITHOUT '--enable-zend-multibyte' ) Actual result: -------------- Fatal error: Encoding declaration pragma must be the very first statement in the script in /home/mweber/public_html/sub.inc.php on line 2 -- Edit bug report at http://bugs.php.net/?id=50464&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50464&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50464&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50464&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50464&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50464&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50464&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50464&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50464&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50464&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50464&r=support Expected behavior: http://bugs.php.net/fix.php?id=50464&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50464&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50464&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50464&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50464&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50464&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50464&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50464&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50464&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50464&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50464&r=mysqlcfg