]> granicus.if.org Git - php/commitdiff
Fixed bug #35147 (__HALT_COMPILER() breaks with --enable-zend-multibyte)
authorDmitry Stogov <dmitry@php.net>
Tue, 15 Nov 2005 13:29:39 +0000 (13:29 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 15 Nov 2005 13:29:39 +0000 (13:29 +0000)
NEWS
Zend/zend.c
Zend/zend_globals.h
Zend/zend_language_scanner.l
Zend/zend_multibyte.c
pear/Makefile.frag

diff --git a/NEWS b/NEWS
index bb6e67f35bfee3c50cc69b2d0ee9be5209c32e8b..d2d23156b52d684aa2516e6d3065f19d174610bc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP                                                                        NEWS
 - Fixed bug #35179 (tokenizer extension needs T_HALT_COMPILER). (Greg)
 - Fixed bug #35176 (include()/require()/*_once() produce wrong error messages
   about main()). (Dmitry)
+- Fixed bug #35147 (__HALT_COMPILER() breaks with --enable-zend-multibyte).
+  (Dmitry, Moriyoshi)
 - Fixed bug #35142 (SOAP Client/Server Complex Object Support). (Dmitry)
 - Fixed bug #35135 (PDOStatment without related PDO object may crash). (Ilia)
 - Fixed bug #35091 (SoapClient leaks memory). (Dmitry)
index 2c790bf1b895f6ce6173ef88a76508ac0e602ec7..d9504d37fa61c88391938dada9449e382837070a 100644 (file)
@@ -78,6 +78,9 @@ static ZEND_INI_MH(OnUpdateErrorReporting)
 ZEND_INI_BEGIN()
        ZEND_INI_ENTRY("error_reporting",                               NULL,           ZEND_INI_ALL,           OnUpdateErrorReporting)
        STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode",     "0",    ZEND_INI_ALL,           OnUpdateBool,   ze1_compatibility_mode, zend_executor_globals,  executor_globals)
+#ifdef ZEND_MULTIBYTE
+       STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
+#endif
 ZEND_INI_END()
 
 
index bdbf72e6591a2edf8b379f8bb2cac6e4b7113939..198b3640c65d01808730b1d9227a81421b85b2cc 100644 (file)
@@ -135,6 +135,7 @@ struct _zend_compiler_globals {
 #ifdef ZEND_MULTIBYTE
        zend_encoding **script_encoding_list;
        int script_encoding_list_size;
+       zend_bool detect_unicode;
 
        zend_encoding *internal_encoding;
 
index 111af67fcf6023088f7b212d220f29a54a71e4dd..5fd23092ab553fa3f66e5a8e34d1a5a681a17f3e 100644 (file)
@@ -506,7 +506,9 @@ ZEND_API int zend_get_scanned_file_offset(TSRMLS_D)
 
                return zend_stream_ftell(yyin TSRMLS_CC) - offset_from_the_end;
        } else {
-               return -1;
+               /* The entire file is in the buffer; probably zend multibyte
+                  is enabled */
+               return (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf);
        }
 }
 
index d7a444b32e9462eb4c454855cdbaf02595905b6e..348d47f96f04fca6896ae50c71ba27e8385cc9bd 100644 (file)
@@ -994,11 +994,13 @@ static zend_encoding* zend_multibyte_find_script_encoding(zend_encoding *onetime
                return onetime_encoding;
        }
 
-       /* check out bom(byte order mark) and see if containing wchars */
-       script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
-       if (script_encoding != NULL) {
-               /* bom or wchar detection is prior to 'script_encoding' option */
-               return script_encoding;
+       if (CG(detect_unicode)) {
+               /* check out bom(byte order mark) and see if containing wchars */
+               script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
+               if (script_encoding != NULL) {
+                       /* bom or wchar detection is prior to 'script_encoding' option */
+                       return script_encoding;
+               }
        }
 
        /* if no script_encoding specified, just leave alone */
index 492f4e1af552935cf63a1a21a4e8a847903c1fd0..a8b1d68e4418497aa685cf9acbfaf26d82ff2ed5 100644 (file)
@@ -3,7 +3,7 @@
 peardir=$(PEAR_INSTALLDIR)
 
 # Skip all php.ini files altogether
-PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 -derror_reporting=E_ALL
+PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 -derror_reporting=E_ALL -ddetect_unicode=0
 
 install-pear-installer: $(top_builddir)/sapi/cli/php
        @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)"