Skip to content

Commit a8c6b99

Browse files
committed
Fixed bug #35147 (__HALT_COMPILER() breaks with --enable-zend-multibyte)
1 parent 5519008 commit a8c6b99

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
- Fixed bug #35179 (tokenizer extension needs T_HALT_COMPILER). (Greg)
1010
- Fixed bug #35176 (include()/require()/*_once() produce wrong error messages
1111
about main()). (Dmitry)
12+
- Fixed bug #35147 (__HALT_COMPILER() breaks with --enable-zend-multibyte).
13+
(Dmitry, Moriyoshi)
1214
- Fixed bug #35142 (SOAP Client/Server Complex Object Support). (Dmitry)
1315
- Fixed bug #35135 (PDOStatment without related PDO object may crash). (Ilia)
1416
- Fixed bug #35091 (SoapClient leaks memory). (Dmitry)

Zend/zend.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ static ZEND_INI_MH(OnUpdateErrorReporting)
7878
ZEND_INI_BEGIN()
7979
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
8080
STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals)
81+
#ifdef ZEND_MULTIBYTE
82+
STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
83+
#endif
8184
ZEND_INI_END()
8285

8386

Zend/zend_globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ struct _zend_compiler_globals {
135135
#ifdef ZEND_MULTIBYTE
136136
zend_encoding **script_encoding_list;
137137
int script_encoding_list_size;
138+
zend_bool detect_unicode;
138139

139140
zend_encoding *internal_encoding;
140141

Zend/zend_language_scanner.l

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ ZEND_API int zend_get_scanned_file_offset(TSRMLS_D)
506506

507507
return zend_stream_ftell(yyin TSRMLS_CC) - offset_from_the_end;
508508
} else {
509-
return -1;
509+
/* The entire file is in the buffer; probably zend multibyte
510+
is enabled */
511+
return (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf);
510512
}
511513
}
512514

Zend/zend_multibyte.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,13 @@ static zend_encoding* zend_multibyte_find_script_encoding(zend_encoding *onetime
994994
return onetime_encoding;
995995
}
996996

997-
/* check out bom(byte order mark) and see if containing wchars */
998-
script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
999-
if (script_encoding != NULL) {
1000-
/* bom or wchar detection is prior to 'script_encoding' option */
1001-
return script_encoding;
997+
if (CG(detect_unicode)) {
998+
/* check out bom(byte order mark) and see if containing wchars */
999+
script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
1000+
if (script_encoding != NULL) {
1001+
/* bom or wchar detection is prior to 'script_encoding' option */
1002+
return script_encoding;
1003+
}
10021004
}
10031005

10041006
/* if no script_encoding specified, just leave alone */

pear/Makefile.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
peardir=$(PEAR_INSTALLDIR)
44

55
# Skip all php.ini files altogether
6-
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 -derror_reporting=E_ALL
6+
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 -derror_reporting=E_ALL -ddetect_unicode=0
77

88
install-pear-installer: $(top_builddir)/sapi/cli/php
99
@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)"

0 commit comments

Comments
 (0)