[FLOW3-general] Fatal error: Encoding declaration pragma must be the very first statement in the script in ... (Clean mail)

Marco Weber marco.weber at uni-trier.de
Sun Dec 13 01:44:10 CET 2009


(CLEAN MAIL)

Hi at all,

Some people using flow3 will see the following error message:

 >> Fatal error: Encoding declaration pragma must be the very first
 >> statement in the script in
 >> /var/www/flow3/Packages/Global/FLOW3/Classes/Core/Bootstrap.php on 
line 2


Well, this happens when you compile PHP 5.3.x with the option 
'--enable-zend-multibyte'.
According to the php doc 
(http://php.net/manual/en/control-structures.declare.php):
The encoding declare value is ignored in PHP 5.3 unless php is compiled 
with --enable-zend-multibyte.
...and this will lead to a fatal error in case you have also an defined 
encoding in included files!

( I ran over this bug tonight after having compiled a new php version 
with the option '--enable-zend-multibyte'. )

i reported the bug to the php developers. It is available under the 
following URL:
http://bugs.php.net/50464


if you have php5.3.x with '--enable-zend-multibyte', there are 2 solutions:
1. Solution: compile another PHP5.3.x version WITHOUT 
'--enable-zend-multibyte'

2. Solution: remove all declare encoding lines from all php scripts:
under linux just type the following line:
find . -type f -iname '*.php' -exec sed -i -e "s/declare\(.*\)\;//" "{}" ";"


See you
    Marco Weber


BTW: This is also an answer to 
http://lists.typo3.org/pipermail/typo3-project-5_0-general/2009-July/002275.html


More information about the FLOW3-general mailing list