|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50464 declare encoding doesn't work within an included file
Submitted: 2009-12-13 00:31 UTC Modified: 2009-12-13 20:01 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: marco dot weber at uni-trier dot de Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.1 OS: ANY
Private report: No CVE-ID: None
 [2009-12-13 00:31 UTC] marco dot weber at uni-trier dot de
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:

namespace marcotest;


?> file:

namespace marcotest;

echo "TEST";


Expected result:
( 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/ on line 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-13 01:00 UTC] marco dot weber at uni-trier dot de
 [2009-12-13 15:18 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #50464 (declare encoding doesn't work with)
# The bug (BC) only happens in this branch.
 [2009-12-13 15:19 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 22:01:31 2024 UTC