moriyoshi Mon Jul 28 05:59:17 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/mbstring/tests zend_multibyte-13.phpt
Modified files: /ZendEngine2 zend_language_scanner.l zend_compile.h Log: - Fix __halt_compiler() weirdness with zend-mulibyte enabled http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.13.2.25&r2=1.131.2.11.2.13.2.26&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.25 ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.26 --- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.25 Sat Jul 26 15:30:25 2008 +++ ZendEngine2/zend_language_scanner.l Mon Jul 28 05:59:16 2008 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.25 2008/07/26 15:30:25 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.26 2008/07/28 05:59:16 moriyoshi Exp $ */ #if 0 # define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) @@ -444,9 +444,26 @@ } -ZEND_API int zend_get_scanned_file_offset(TSRMLS_D) +ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D) { - return SCNG(yy_cursor) - SCNG(yy_start); + size_t offset = SCNG(yy_cursor) - SCNG(yy_start); +#ifdef ZEND_MULTIBYTE + size_t original_offset = offset, length = 0; + do { + unsigned char *p = NULL; + SCNG(input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); + if (!p) { + break; + } + efree(p); + if (length > original_offset) { + offset--; + } else if (length < original_offset) { + offset++; + } + } while (original_offset != length); +#endif + return offset; } @@ -581,29 +598,19 @@ BEGIN_EXTERN_C() ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC) { - size_t offset, original_offset, length, free_flag, new_len; + size_t original_offset, offset, free_flag, new_len, length; unsigned char *p; - zend_encoding *new_encoding; /* calculate current position */ offset = original_offset = YYCURSOR - SCNG(yy_start); - if (old_input_filter && original_offset > 0) { - new_encoding = SCNG(script_encoding); + if (old_input_filter && offset > 0) { + zend_encoding *new_encoding = SCNG(script_encoding); + zend_encoding_filter new_filter = SCNG(input_filter); SCNG(script_encoding) = old_encoding; - do { - (old_input_filter)(&p, &length, SCNG(script_org), offset TSRMLS_CC); - if (!p) { - SCNG(script_encoding) = new_encoding; - return; - } - efree(p); - if (length > original_offset) { - offset--; - } else if (length < original_offset) { - offset++; - } - } while (original_offset != length); + SCNG(input_filter) = new_filter; + offset = zend_get_scanned_file_offset(TSRMLS_C); SCNG(script_encoding) = new_encoding; + SCNG(input_filter) = new_filter; } /* convert and set */ @@ -1926,7 +1933,7 @@ /* Check for ending label on the next line */ if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) { - char *end = YYCURSOR + CG(heredoc_len); + unsigned char *end = YYCURSOR + CG(heredoc_len); if (*end == ';') { end++; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.316.2.8.2.12.2.30&r2=1.316.2.8.2.12.2.31&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.316.2.8.2.12.2.30 ZendEngine2/zend_compile.h:1.316.2.8.2.12.2.31 --- ZendEngine2/zend_compile.h:1.316.2.8.2.12.2.30 Sat Jul 26 15:30:24 2008 +++ ZendEngine2/zend_compile.h Mon Jul 28 05:59:16 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.12.2.30 2008/07/26 15:30:24 dmitry Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.12.2.31 2008/07/28 05:59:16 moriyoshi Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -357,7 +357,7 @@ ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC); ZEND_API char *zend_get_compiled_filename(TSRMLS_D); ZEND_API int zend_get_compiled_lineno(TSRMLS_D); -ZEND_API int zend_get_scanned_file_offset(TSRMLS_D); +ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D); void zend_resolve_class_name(znode *class_name, ulong *fetch_type, int check_ns_name TSRMLS_DC); ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len); http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/zend_multibyte-13.phpt?view=markup&rev=1.1 Index: php-src/ext/mbstring/tests/zend_multibyte-13.phpt +++ php-src/ext/mbstring/tests/zend_multibyte-13.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php