From 4cf90e06c9834a52195384da760503ea055c726d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 30 Mar 2012 20:41:44 +0200 Subject: [PATCH 001/641] Fix lexing of nested heredoc strings in token_get_all() This fixes bug #60097. Before two global variables CG(heredoc) and CG(heredoc_len) were used to track the current heredoc label. In order to support nested heredoc strings the *previous* heredoc label was assigned as the token value of T_START_HEREDOC and the language_parser.y assigned that to CG(heredoc). This created a dependency of the lexer on the parser. Thus the token_get_all() function, which accesses the lexer directly without also running the parser, was not able to tokenize nested heredoc strings (and leaked memory). Same applies for the source-code highlighting functions. The new approach is to maintain a heredoc_label_stack in the lexer, which contains all active heredoc labels. As it is no longer required, T_START_HEREDOC and T_END_HEREDOC now don't carry a token value anymore. In order to make the work with zend_ptr_stack in this context more convenient I added a new function zend_ptr_stack_top(), which retrieves the top element of the stack (similar to zend_stack_top()). --- NEWS | 3 + Zend/zend_compile.c | 3 - Zend/zend_globals.h | 4 +- Zend/zend_highlight.c | 2 - Zend/zend_language_parser.y | 6 +- Zend/zend_language_scanner.c | 756 +++++++++++++++--------------- Zend/zend_language_scanner.h | 5 + Zend/zend_language_scanner.l | 74 +-- Zend/zend_language_scanner_defs.h | 2 +- Zend/zend_ptr_stack.h | 5 + ext/tokenizer/tests/bug60097.phpt | 121 +++++ ext/tokenizer/tokenizer.c | 5 +- 12 files changed, 561 insertions(+), 425 deletions(-) create mode 100644 ext/tokenizer/tests/bug60097.phpt diff --git a/NEWS b/NEWS index 089d0803557..9382f957dd4 100644 --- a/NEWS +++ b/NEWS @@ -41,4 +41,7 @@ PHP NEWS - pgsql . Added pg_escape_literal() and pg_escape_identifier() (Yasuo) +- Tokenizer: + . Fixed bug #60097 (token_get_all fails to lex nested heredoc). (Nikita Popov) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c3c35eb5fc6..0533bf8c180 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6708,9 +6708,6 @@ again: case T_OPEN_TAG_WITH_ECHO: retval = T_ECHO; break; - case T_END_HEREDOC: - efree(Z_STRVAL(zendlval->u.constant)); - break; } INIT_PZVAL(&zendlval->u.constant); diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index dbbcf972a44..e5aba0df678 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -89,9 +89,6 @@ struct _zend_compiler_globals { int zend_lineno; - char *heredoc; - int heredoc_len; - zend_op_array *active_op_array; HashTable *function_table; /* function symbol table */ @@ -297,6 +294,7 @@ struct _zend_php_scanner_globals { unsigned char *yy_limit; int yy_state; zend_stack state_stack; + zend_ptr_stack heredoc_label_stack; /* original (unfiltered) script */ unsigned char *script_org; diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index e9fd850e6b0..938e1c612b9 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -153,8 +153,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini efree(token.value.str.val); break; } - } else if (token_type == T_END_HEREDOC) { - efree(token.value.str.val); } token.type = 0; } diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index d0730b75d6d..47c046b44f5 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -911,8 +911,8 @@ common_scalar: | T_METHOD_C { $$ = $1; } | T_FUNC_C { $$ = $1; } | T_NS_C { $$ = $1; } - | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); } - | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); } + | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; } + | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; } ; @@ -941,7 +941,7 @@ scalar: | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } | '"' encaps_list '"' { $$ = $2; } - | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); } + | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; } | T_CLASS_C { if (Z_TYPE($1.u.constant) == IS_CONSTANT) {zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC);} else {$$ = $1;} } ; diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 3f6189efeea..8e5cc9f9d6a 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Mar 1 21:27:30 2012 */ +/* Generated by re2c 0.13.5 on Sat Mar 31 21:29:29 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -177,22 +177,23 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) void startup_scanner(TSRMLS_D) { CG(parse_error) = 0; - CG(heredoc) = NULL; - CG(heredoc_len) = 0; CG(doc_comment) = NULL; CG(doc_comment_len) = 0; zend_stack_init(&SCNG(state_stack)); + zend_ptr_stack_init(&SCNG(heredoc_label_stack)); +} + +static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) { + efree(heredoc_label->label); } void shutdown_scanner(TSRMLS_D) { - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc_len)=0; - } CG(parse_error) = 0; - zend_stack_destroy(&SCNG(state_stack)); RESET_DOC_COMMENT(); + zend_stack_destroy(&SCNG(state_stack)); + zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1); + zend_ptr_stack_destroy(&SCNG(heredoc_label_stack)); } ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) @@ -207,6 +208,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) lex_state->state_stack = SCNG(state_stack); zend_stack_init(&SCNG(state_stack)); + lex_state->heredoc_label_stack = SCNG(heredoc_label_stack); + zend_ptr_stack_init(&SCNG(heredoc_label_stack)); + lex_state->in = SCNG(yy_in); lex_state->yy_state = YYSTATE; lex_state->filename = zend_get_compiled_filename(TSRMLS_C); @@ -233,6 +237,10 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) zend_stack_destroy(&SCNG(state_stack)); SCNG(state_stack) = lex_state->state_stack; + zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1); + zend_ptr_stack_destroy(&SCNG(heredoc_label_stack)); + SCNG(heredoc_label_stack) = lex_state->heredoc_label_stack; + SCNG(yy_in) = lex_state->in; YYSETCONDITION(lex_state->yy_state); CG(zend_lineno) = lex_state->lineno; @@ -249,12 +257,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) SCNG(input_filter) = lex_state->input_filter; SCNG(output_filter) = lex_state->output_filter; SCNG(script_encoding) = lex_state->script_encoding; - - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc) = NULL; - CG(heredoc_len) = 0; - } } ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) @@ -991,7 +993,7 @@ restart: yymore_restart: -#line 995 "Zend/zend_language_scanner.c" +#line 997 "Zend/zend_language_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1090,7 +1092,7 @@ yyc_INITIAL: yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1783 "Zend/zend_language_scanner.l" +#line 1785 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1150,7 +1152,7 @@ inline_html: HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } -#line 1154 "Zend/zend_language_scanner.c" +#line 1156 "Zend/zend_language_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yych = *++YYCURSOR; @@ -1168,7 +1170,7 @@ yy5: yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1771 "Zend/zend_language_scanner.l" +#line 1773 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1180,14 +1182,14 @@ yy6: goto inline_char_handler; } } -#line 1184 "Zend/zend_language_scanner.c" +#line 1186 "Zend/zend_language_scanner.c" yy7: YYDEBUG(7, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1748 "Zend/zend_language_scanner.l" +#line 1750 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1199,7 +1201,7 @@ yy7: goto inline_char_handler; } } -#line 1203 "Zend/zend_language_scanner.c" +#line 1205 "Zend/zend_language_scanner.c" yy9: YYDEBUG(9, *YYCURSOR); yych = *++YYCURSOR; @@ -1385,7 +1387,7 @@ yy35: ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1708 "Zend/zend_language_scanner.l" +#line 1710 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1402,7 +1404,7 @@ yy35: BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1406 "Zend/zend_language_scanner.c" +#line 1408 "Zend/zend_language_scanner.c" yy39: YYDEBUG(39, *YYCURSOR); yych = *++YYCURSOR; @@ -1429,7 +1431,7 @@ yy43: ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1726 "Zend/zend_language_scanner.l" +#line 1728 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1441,13 +1443,13 @@ yy43: goto inline_char_handler; } } -#line 1445 "Zend/zend_language_scanner.c" +#line 1447 "Zend/zend_language_scanner.c" yy45: YYDEBUG(45, *YYCURSOR); ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1739 "Zend/zend_language_scanner.l" +#line 1741 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1455,7 +1457,7 @@ yy45: BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } -#line 1459 "Zend/zend_language_scanner.c" +#line 1461 "Zend/zend_language_scanner.c" yy47: YYDEBUG(47, *YYCURSOR); yych = *++YYCURSOR; @@ -1482,7 +1484,7 @@ yy50: yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1761 "Zend/zend_language_scanner.l" +#line 1763 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1491,7 +1493,7 @@ yy51: BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1495 "Zend/zend_language_scanner.c" +#line 1497 "Zend/zend_language_scanner.c" yy52: YYDEBUG(52, *YYCURSOR); ++YYCURSOR; @@ -1562,7 +1564,7 @@ yyc_ST_BACKQUOTE: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2234 "Zend/zend_language_scanner.l" +#line 2236 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1603,7 +1605,7 @@ yy56: zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1607 "Zend/zend_language_scanner.c" +#line 1609 "Zend/zend_language_scanner.c" yy57: YYDEBUG(57, *YYCURSOR); yych = *++YYCURSOR; @@ -1614,12 +1616,12 @@ yy58: ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2178 "Zend/zend_language_scanner.l" +#line 2180 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; } -#line 1623 "Zend/zend_language_scanner.c" +#line 1625 "Zend/zend_language_scanner.c" yy60: YYDEBUG(60, *YYCURSOR); yych = *++YYCURSOR; @@ -1629,14 +1631,14 @@ yy61: ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2165 "Zend/zend_language_scanner.l" +#line 2167 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1640 "Zend/zend_language_scanner.c" +#line 1642 "Zend/zend_language_scanner.c" yy63: YYDEBUG(63, *YYCURSOR); yyaccept = 0; @@ -1652,24 +1654,24 @@ yy63: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1867 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1662 "Zend/zend_language_scanner.c" +#line 1664 "Zend/zend_language_scanner.c" yy66: YYDEBUG(66, *YYCURSOR); ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1444 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1673 "Zend/zend_language_scanner.c" +#line 1675 "Zend/zend_language_scanner.c" yy68: YYDEBUG(68, *YYCURSOR); yych = *++YYCURSOR; @@ -1683,7 +1685,7 @@ yy70: ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1857 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1691,7 +1693,7 @@ yy70: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1695 "Zend/zend_language_scanner.c" +#line 1697 "Zend/zend_language_scanner.c" yy72: YYDEBUG(72, *YYCURSOR); yych = *++YYCURSOR; @@ -1709,7 +1711,7 @@ yy73: ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1847 "Zend/zend_language_scanner.l" +#line 1849 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1717,7 +1719,7 @@ yy73: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1721 "Zend/zend_language_scanner.c" +#line 1723 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_DOUBLE_QUOTES: @@ -1785,7 +1787,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2184 "Zend/zend_language_scanner.l" +#line 2186 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1834,7 +1836,7 @@ double_quotes_scan_done: zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1838 "Zend/zend_language_scanner.c" +#line 1840 "Zend/zend_language_scanner.c" yy79: YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; @@ -1845,12 +1847,12 @@ yy80: ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2175 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; } -#line 1854 "Zend/zend_language_scanner.c" +#line 1856 "Zend/zend_language_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); yych = *++YYCURSOR; @@ -1860,14 +1862,14 @@ yy83: ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2165 "Zend/zend_language_scanner.l" +#line 2167 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1871 "Zend/zend_language_scanner.c" +#line 1873 "Zend/zend_language_scanner.c" yy85: YYDEBUG(85, *YYCURSOR); yyaccept = 0; @@ -1883,24 +1885,24 @@ yy85: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1867 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1893 "Zend/zend_language_scanner.c" +#line 1895 "Zend/zend_language_scanner.c" yy88: YYDEBUG(88, *YYCURSOR); ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1444 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1904 "Zend/zend_language_scanner.c" +#line 1906 "Zend/zend_language_scanner.c" yy90: YYDEBUG(90, *YYCURSOR); yych = *++YYCURSOR; @@ -1914,7 +1916,7 @@ yy92: ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1857 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1922,7 +1924,7 @@ yy92: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1926 "Zend/zend_language_scanner.c" +#line 1928 "Zend/zend_language_scanner.c" yy94: YYDEBUG(94, *YYCURSOR); yych = *++YYCURSOR; @@ -1940,7 +1942,7 @@ yy95: ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1847 "Zend/zend_language_scanner.l" +#line 1849 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1948,7 +1950,7 @@ yy95: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 1952 "Zend/zend_language_scanner.c" +#line 1954 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_END_HEREDOC: @@ -1959,19 +1961,20 @@ yyc_ST_END_HEREDOC: ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2152 "Zend/zend_language_scanner.l" +#line 2153 "Zend/zend_language_scanner.l" { - YYCURSOR += CG(heredoc_len) - 1; - yyleng = CG(heredoc_len); + zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack)); + + YYCURSOR += heredoc_label->length - 1; + yyleng = heredoc_label->length; + + heredoc_label_dtor(heredoc_label); + efree(heredoc_label); - Z_STRVAL_P(zendlval) = CG(heredoc); - Z_STRLEN_P(zendlval) = CG(heredoc_len); - CG(heredoc) = NULL; - CG(heredoc_len) = 0; BEGIN(ST_IN_SCRIPTING); return T_END_HEREDOC; } -#line 1975 "Zend/zend_language_scanner.c" +#line 1978 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_HEREDOC: { @@ -2033,10 +2036,12 @@ yy103: yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2276 "Zend/zend_language_scanner.l" +#line 2278 "Zend/zend_language_scanner.l" { int newline = 0; + zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack)); + if (YYCURSOR > YYLIMIT) { return 0; } @@ -2052,8 +2057,8 @@ yy104: /* fall through */ case '\n': /* Check for ending label on the next line */ - if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; @@ -2104,7 +2109,7 @@ heredoc_scan_done: zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 2108 "Zend/zend_language_scanner.c" +#line 2113 "Zend/zend_language_scanner.c" yy105: YYDEBUG(105, *YYCURSOR); yych = *++YYCURSOR; @@ -2119,14 +2124,14 @@ yy107: ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2165 "Zend/zend_language_scanner.l" +#line 2167 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 2130 "Zend/zend_language_scanner.c" +#line 2135 "Zend/zend_language_scanner.c" yy109: YYDEBUG(109, *YYCURSOR); yyaccept = 0; @@ -2142,24 +2147,24 @@ yy109: yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1867 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2152 "Zend/zend_language_scanner.c" +#line 2157 "Zend/zend_language_scanner.c" yy112: YYDEBUG(112, *YYCURSOR); ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1444 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 2163 "Zend/zend_language_scanner.c" +#line 2168 "Zend/zend_language_scanner.c" yy114: YYDEBUG(114, *YYCURSOR); yych = *++YYCURSOR; @@ -2173,7 +2178,7 @@ yy116: ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1857 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -2181,7 +2186,7 @@ yy116: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2185 "Zend/zend_language_scanner.c" +#line 2190 "Zend/zend_language_scanner.c" yy118: YYDEBUG(118, *YYCURSOR); yych = *++YYCURSOR; @@ -2199,7 +2204,7 @@ yy119: ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1847 "Zend/zend_language_scanner.l" +#line 1849 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -2207,7 +2212,7 @@ yy119: zendlval->type = IS_STRING; return T_VARIABLE; } -#line 2211 "Zend/zend_language_scanner.c" +#line 2216 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_IN_SCRIPTING: @@ -2388,13 +2393,13 @@ yy123: yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1888 "Zend/zend_language_scanner.l" +#line 1890 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 2398 "Zend/zend_language_scanner.c" +#line 2403 "Zend/zend_language_scanner.c" yy125: YYDEBUG(125, *YYCURSOR); yych = *++YYCURSOR; @@ -2620,11 +2625,11 @@ yy137: yy138: YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1431 "Zend/zend_language_scanner.l" +#line 1433 "Zend/zend_language_scanner.l" { return yytext[0]; } -#line 2628 "Zend/zend_language_scanner.c" +#line 2633 "Zend/zend_language_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; @@ -2633,7 +2638,7 @@ yy139: yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1162 "Zend/zend_language_scanner.l" +#line 1164 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -2641,7 +2646,7 @@ yy140: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 2645 "Zend/zend_language_scanner.c" +#line 2650 "Zend/zend_language_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yych = *++YYCURSOR; @@ -2652,11 +2657,11 @@ yy142: ++YYCURSOR; YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1191 "Zend/zend_language_scanner.l" +#line 1193 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } -#line 2660 "Zend/zend_language_scanner.c" +#line 2665 "Zend/zend_language_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; @@ -2884,18 +2889,18 @@ yy167: ++YYCURSOR; YYDEBUG(168, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1436 "Zend/zend_language_scanner.l" +#line 1438 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; } -#line 2893 "Zend/zend_language_scanner.c" +#line 2898 "Zend/zend_language_scanner.c" yy169: YYDEBUG(169, *YYCURSOR); ++YYCURSOR; YYDEBUG(170, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1448 "Zend/zend_language_scanner.l" +#line 1450 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2903,7 +2908,7 @@ yy169: } return '}'; } -#line 2907 "Zend/zend_language_scanner.c" +#line 2912 "Zend/zend_language_scanner.c" yy171: YYDEBUG(171, *YYCURSOR); yyaccept = 2; @@ -2931,7 +2936,7 @@ yy171: yy172: YYDEBUG(172, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1498 "Zend/zend_language_scanner.l" +#line 1500 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ zendlval->value.lval = strtol(yytext, NULL, 0); @@ -2952,7 +2957,7 @@ yy172: zendlval->type = IS_LONG; return T_LNUMBER; } -#line 2956 "Zend/zend_language_scanner.c" +#line 2961 "Zend/zend_language_scanner.c" yy173: YYDEBUG(173, *YYCURSOR); yyaccept = 2; @@ -2980,7 +2985,7 @@ yy175: yy176: YYDEBUG(176, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1895 "Zend/zend_language_scanner.l" +#line 1897 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3014,14 +3019,14 @@ yy176: return T_COMMENT; } -#line 3018 "Zend/zend_language_scanner.c" +#line 3023 "Zend/zend_language_scanner.c" yy177: YYDEBUG(177, *YYCURSOR); ++YYCURSOR; yy178: YYDEBUG(178, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1986 "Zend/zend_language_scanner.l" +#line 1988 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3089,14 +3094,14 @@ yy178: } return T_CONSTANT_ENCAPSED_STRING; } -#line 3093 "Zend/zend_language_scanner.c" +#line 3098 "Zend/zend_language_scanner.c" yy179: YYDEBUG(179, *YYCURSOR); ++YYCURSOR; yy180: YYDEBUG(180, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2055 "Zend/zend_language_scanner.l" +#line 2057 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3137,24 +3142,24 @@ yy180: BEGIN(ST_DOUBLE_QUOTES); return '"'; } -#line 3141 "Zend/zend_language_scanner.c" +#line 3146 "Zend/zend_language_scanner.c" yy181: YYDEBUG(181, *YYCURSOR); ++YYCURSOR; YYDEBUG(182, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2146 "Zend/zend_language_scanner.l" +#line 2147 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; } -#line 3152 "Zend/zend_language_scanner.c" +#line 3157 "Zend/zend_language_scanner.c" yy183: YYDEBUG(183, *YYCURSOR); ++YYCURSOR; YYDEBUG(184, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2404 "Zend/zend_language_scanner.l" +#line 2410 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3163,7 +3168,7 @@ yy183: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 3167 "Zend/zend_language_scanner.c" +#line 3172 "Zend/zend_language_scanner.c" yy185: YYDEBUG(185, *YYCURSOR); ++YYCURSOR; @@ -3190,13 +3195,13 @@ yy187: yy189: YYDEBUG(189, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1563 "Zend/zend_language_scanner.l" +#line 1565 "Zend/zend_language_scanner.l" { zendlval->value.dval = zend_strtod(yytext, NULL); zendlval->type = IS_DOUBLE; return T_DNUMBER; } -#line 3200 "Zend/zend_language_scanner.c" +#line 3205 "Zend/zend_language_scanner.c" yy190: YYDEBUG(190, *YYCURSOR); yyaccept = 2; @@ -3288,7 +3293,7 @@ yy199: } YYDEBUG(201, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1473 "Zend/zend_language_scanner.l" +#line 1475 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3313,7 +3318,7 @@ yy199: return T_DNUMBER; } } -#line 3317 "Zend/zend_language_scanner.c" +#line 3322 "Zend/zend_language_scanner.c" yy202: YYDEBUG(202, *YYCURSOR); ++YYCURSOR; @@ -3325,7 +3330,7 @@ yy202: } YYDEBUG(204, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1519 "Zend/zend_language_scanner.l" +#line 1521 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3350,7 +3355,7 @@ yy202: return T_DNUMBER; } } -#line 3354 "Zend/zend_language_scanner.c" +#line 3359 "Zend/zend_language_scanner.c" yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; @@ -3359,7 +3364,7 @@ yy205: yy206: YYDEBUG(206, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1963 "Zend/zend_language_scanner.l" +#line 1965 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -3367,7 +3372,7 @@ yy206: BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } -#line 3371 "Zend/zend_language_scanner.c" +#line 3376 "Zend/zend_language_scanner.c" yy207: YYDEBUG(207, *YYCURSOR); yych = *++YYCURSOR; @@ -3401,13 +3406,13 @@ yy209: yy211: YYDEBUG(211, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1867 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 3411 "Zend/zend_language_scanner.c" +#line 3416 "Zend/zend_language_scanner.c" yy212: YYDEBUG(212, *YYCURSOR); yych = *++YYCURSOR; @@ -3421,11 +3426,11 @@ yy213: } YYDEBUG(214, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1419 "Zend/zend_language_scanner.l" +#line 1421 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } -#line 3429 "Zend/zend_language_scanner.c" +#line 3434 "Zend/zend_language_scanner.c" yy215: YYDEBUG(215, *YYCURSOR); ++YYCURSOR; @@ -3434,61 +3439,61 @@ yy215: } YYDEBUG(216, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1411 "Zend/zend_language_scanner.l" +#line 1413 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } -#line 3442 "Zend/zend_language_scanner.c" +#line 3447 "Zend/zend_language_scanner.c" yy217: YYDEBUG(217, *YYCURSOR); ++YYCURSOR; YYDEBUG(218, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1399 "Zend/zend_language_scanner.l" +#line 1401 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } -#line 3452 "Zend/zend_language_scanner.c" +#line 3457 "Zend/zend_language_scanner.c" yy219: YYDEBUG(219, *YYCURSOR); ++YYCURSOR; YYDEBUG(220, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1403 "Zend/zend_language_scanner.l" +#line 1405 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } -#line 3462 "Zend/zend_language_scanner.c" +#line 3467 "Zend/zend_language_scanner.c" yy221: YYDEBUG(221, *YYCURSOR); ++YYCURSOR; YYDEBUG(222, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1395 "Zend/zend_language_scanner.l" +#line 1397 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } -#line 3472 "Zend/zend_language_scanner.c" +#line 3477 "Zend/zend_language_scanner.c" yy223: YYDEBUG(223, *YYCURSOR); ++YYCURSOR; YYDEBUG(224, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1407 "Zend/zend_language_scanner.l" +#line 1409 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } -#line 3482 "Zend/zend_language_scanner.c" +#line 3487 "Zend/zend_language_scanner.c" yy225: YYDEBUG(225, *YYCURSOR); ++YYCURSOR; YYDEBUG(226, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1391 "Zend/zend_language_scanner.l" +#line 1393 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } -#line 3492 "Zend/zend_language_scanner.c" +#line 3497 "Zend/zend_language_scanner.c" yy227: YYDEBUG(227, *YYCURSOR); ++YYCURSOR; @@ -3497,7 +3502,7 @@ yy227: yy228: YYDEBUG(228, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1972 "Zend/zend_language_scanner.l" +#line 1974 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); @@ -3510,17 +3515,17 @@ yy228: return yytext[0]; } } -#line 3514 "Zend/zend_language_scanner.c" +#line 3519 "Zend/zend_language_scanner.c" yy229: YYDEBUG(229, *YYCURSOR); ++YYCURSOR; YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1379 "Zend/zend_language_scanner.l" +#line 1381 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } -#line 3524 "Zend/zend_language_scanner.c" +#line 3529 "Zend/zend_language_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); yych = *++YYCURSOR; @@ -3551,11 +3556,11 @@ yy235: ++YYCURSOR; YYDEBUG(236, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1375 "Zend/zend_language_scanner.l" +#line 1377 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } -#line 3559 "Zend/zend_language_scanner.c" +#line 3564 "Zend/zend_language_scanner.c" yy237: YYDEBUG(237, *YYCURSOR); yyaccept = 4; @@ -3564,7 +3569,7 @@ yy237: yy238: YYDEBUG(238, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1929 "Zend/zend_language_scanner.l" +#line 1931 "Zend/zend_language_scanner.l" { int doc_com; @@ -3598,7 +3603,7 @@ yy238: return T_COMMENT; } -#line 3602 "Zend/zend_language_scanner.c" +#line 3607 "Zend/zend_language_scanner.c" yy239: YYDEBUG(239, *YYCURSOR); yych = *++YYCURSOR; @@ -3608,11 +3613,11 @@ yy240: ++YYCURSOR; YYDEBUG(241, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1371 "Zend/zend_language_scanner.l" +#line 1373 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } -#line 3616 "Zend/zend_language_scanner.c" +#line 3621 "Zend/zend_language_scanner.c" yy242: YYDEBUG(242, *YYCURSOR); yych = *++YYCURSOR; @@ -3635,42 +3640,42 @@ yy245: ++YYCURSOR; YYDEBUG(246, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1367 "Zend/zend_language_scanner.l" +#line 1369 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } -#line 3643 "Zend/zend_language_scanner.c" +#line 3648 "Zend/zend_language_scanner.c" yy247: YYDEBUG(247, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy251; YYDEBUG(248, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1427 "Zend/zend_language_scanner.l" +#line 1429 "Zend/zend_language_scanner.l" { return T_SR; } -#line 3654 "Zend/zend_language_scanner.c" +#line 3659 "Zend/zend_language_scanner.c" yy249: YYDEBUG(249, *YYCURSOR); ++YYCURSOR; YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1355 "Zend/zend_language_scanner.l" +#line 1357 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } -#line 3664 "Zend/zend_language_scanner.c" +#line 3669 "Zend/zend_language_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); ++YYCURSOR; YYDEBUG(252, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1387 "Zend/zend_language_scanner.l" +#line 1389 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } -#line 3674 "Zend/zend_language_scanner.c" +#line 3679 "Zend/zend_language_scanner.c" yy253: YYDEBUG(253, *YYCURSOR); yyaccept = 5; @@ -3681,11 +3686,11 @@ yy253: yy254: YYDEBUG(254, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1423 "Zend/zend_language_scanner.l" +#line 1425 "Zend/zend_language_scanner.l" { return T_SL; } -#line 3689 "Zend/zend_language_scanner.c" +#line 3694 "Zend/zend_language_scanner.c" yy255: YYDEBUG(255, *YYCURSOR); yych = *++YYCURSOR; @@ -3697,22 +3702,22 @@ yy256: ++YYCURSOR; YYDEBUG(257, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1351 "Zend/zend_language_scanner.l" +#line 1353 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } -#line 3705 "Zend/zend_language_scanner.c" +#line 3710 "Zend/zend_language_scanner.c" yy258: YYDEBUG(258, *YYCURSOR); ++YYCURSOR; yy259: YYDEBUG(259, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1347 "Zend/zend_language_scanner.l" +#line 1349 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } -#line 3716 "Zend/zend_language_scanner.c" +#line 3721 "Zend/zend_language_scanner.c" yy260: YYDEBUG(260, *YYCURSOR); yych = *++YYCURSOR; @@ -3763,11 +3768,11 @@ yy267: ++YYCURSOR; YYDEBUG(268, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1383 "Zend/zend_language_scanner.l" +#line 1385 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } -#line 3771 "Zend/zend_language_scanner.c" +#line 3776 "Zend/zend_language_scanner.c" yy269: YYDEBUG(269, *YYCURSOR); ++YYCURSOR; @@ -3872,42 +3877,39 @@ yy278: yy279: YYDEBUG(279, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2097 "Zend/zend_language_scanner.l" +#line 2099 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; - - /* save old heredoc label */ - Z_STRVAL_P(zendlval) = CG(heredoc); - Z_STRLEN_P(zendlval) = CG(heredoc_len); + zend_heredoc_label *heredoc_label = emalloc(sizeof(zend_heredoc_label)); CG(zend_lineno)++; - CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); + heredoc_label->length = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); s = yytext+bprefix+3; while ((*s == ' ') || (*s == '\t')) { s++; - CG(heredoc_len)--; + heredoc_label->length--; } if (*s == '\'') { s++; - CG(heredoc_len) -= 2; + heredoc_label->length -= 2; BEGIN(ST_NOWDOC); } else { if (*s == '"') { s++; - CG(heredoc_len) -= 2; + heredoc_label->length -= 2; } BEGIN(ST_HEREDOC); } - CG(heredoc) = estrndup(s, CG(heredoc_len)); + heredoc_label->label = estrndup(s, heredoc_label->length); /* Check for ending label on the next line */ - if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; @@ -3918,9 +3920,11 @@ yy279: } } + zend_ptr_stack_push(&SCNG(heredoc_label_stack), (void *) heredoc_label); + return T_START_HEREDOC; } -#line 3924 "Zend/zend_language_scanner.c" +#line 3928 "Zend/zend_language_scanner.c" yy280: YYDEBUG(280, *YYCURSOR); yych = *++YYCURSOR; @@ -3960,31 +3964,31 @@ yy283: ++YYCURSOR; YYDEBUG(285, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1339 "Zend/zend_language_scanner.l" +#line 1341 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } -#line 3968 "Zend/zend_language_scanner.c" +#line 3972 "Zend/zend_language_scanner.c" yy286: YYDEBUG(286, *YYCURSOR); ++YYCURSOR; YYDEBUG(287, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1359 "Zend/zend_language_scanner.l" +#line 1361 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } -#line 3978 "Zend/zend_language_scanner.c" +#line 3982 "Zend/zend_language_scanner.c" yy288: YYDEBUG(288, *YYCURSOR); ++YYCURSOR; YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1327 "Zend/zend_language_scanner.l" +#line 1329 "Zend/zend_language_scanner.l" { return T_INC; } -#line 3988 "Zend/zend_language_scanner.c" +#line 3992 "Zend/zend_language_scanner.c" yy290: YYDEBUG(290, *YYCURSOR); yych = *++YYCURSOR; @@ -4003,42 +4007,42 @@ yy292: } YYDEBUG(293, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1315 "Zend/zend_language_scanner.l" +#line 1317 "Zend/zend_language_scanner.l" { return T_LIST; } -#line 4011 "Zend/zend_language_scanner.c" +#line 4015 "Zend/zend_language_scanner.c" yy294: YYDEBUG(294, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy298; YYDEBUG(295, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1343 "Zend/zend_language_scanner.l" +#line 1345 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } -#line 4022 "Zend/zend_language_scanner.c" +#line 4026 "Zend/zend_language_scanner.c" yy296: YYDEBUG(296, *YYCURSOR); ++YYCURSOR; YYDEBUG(297, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1311 "Zend/zend_language_scanner.l" +#line 1313 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } -#line 4032 "Zend/zend_language_scanner.c" +#line 4036 "Zend/zend_language_scanner.c" yy298: YYDEBUG(298, *YYCURSOR); ++YYCURSOR; YYDEBUG(299, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1335 "Zend/zend_language_scanner.l" +#line 1337 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } -#line 4042 "Zend/zend_language_scanner.c" +#line 4046 "Zend/zend_language_scanner.c" yy300: YYDEBUG(300, *YYCURSOR); yych = *++YYCURSOR; @@ -4168,7 +4172,7 @@ yy316: } YYDEBUG(319, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1698 "Zend/zend_language_scanner.l" +#line 1700 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -4178,7 +4182,7 @@ yy316: } return T_NS_C; } -#line 4182 "Zend/zend_language_scanner.c" +#line 4186 "Zend/zend_language_scanner.c" yy320: YYDEBUG(320, *YYCURSOR); yych = *++YYCURSOR; @@ -4198,7 +4202,7 @@ yy321: } YYDEBUG(324, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1671 "Zend/zend_language_scanner.l" +#line 1673 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -4225,7 +4229,7 @@ yy321: zendlval->type = IS_STRING; return T_DIR; } -#line 4229 "Zend/zend_language_scanner.c" +#line 4233 "Zend/zend_language_scanner.c" yy325: YYDEBUG(325, *YYCURSOR); yych = *++YYCURSOR; @@ -4250,13 +4254,13 @@ yy327: } YYDEBUG(330, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1653 "Zend/zend_language_scanner.l" +#line 1655 "Zend/zend_language_scanner.l" { zendlval->value.lval = CG(zend_lineno); zendlval->type = IS_LONG; return T_LINE; } -#line 4260 "Zend/zend_language_scanner.c" +#line 4264 "Zend/zend_language_scanner.c" yy331: YYDEBUG(331, *YYCURSOR); yych = *++YYCURSOR; @@ -4291,7 +4295,7 @@ yy335: } YYDEBUG(338, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1632 "Zend/zend_language_scanner.l" +#line 1634 "Zend/zend_language_scanner.l" { const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; @@ -4312,7 +4316,7 @@ yy335: zendlval->type = IS_STRING; return T_METHOD_C; } -#line 4316 "Zend/zend_language_scanner.c" +#line 4320 "Zend/zend_language_scanner.c" yy339: YYDEBUG(339, *YYCURSOR); yych = *++YYCURSOR; @@ -4363,7 +4367,7 @@ yy346: } YYDEBUG(349, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1616 "Zend/zend_language_scanner.l" +#line 1618 "Zend/zend_language_scanner.l" { const char *func_name = NULL; @@ -4379,7 +4383,7 @@ yy346: zendlval->type = IS_STRING; return T_FUNC_C; } -#line 4383 "Zend/zend_language_scanner.c" +#line 4387 "Zend/zend_language_scanner.c" yy350: YYDEBUG(350, *YYCURSOR); yych = *++YYCURSOR; @@ -4399,7 +4403,7 @@ yy351: } YYDEBUG(354, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1659 "Zend/zend_language_scanner.l" +#line 1661 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); @@ -4411,7 +4415,7 @@ yy351: zendlval->type = IS_STRING; return T_FILE; } -#line 4415 "Zend/zend_language_scanner.c" +#line 4419 "Zend/zend_language_scanner.c" yy355: YYDEBUG(355, *YYCURSOR); yych = *++YYCURSOR; @@ -4441,7 +4445,7 @@ yy358: } YYDEBUG(361, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1596 "Zend/zend_language_scanner.l" +#line 1598 "Zend/zend_language_scanner.l" { const char *trait_name = NULL; @@ -4461,7 +4465,7 @@ yy358: return T_TRAIT_C; } -#line 4465 "Zend/zend_language_scanner.c" +#line 4469 "Zend/zend_language_scanner.c" yy362: YYDEBUG(362, *YYCURSOR); yych = *++YYCURSOR; @@ -4491,7 +4495,7 @@ yy365: } YYDEBUG(368, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1569 "Zend/zend_language_scanner.l" +#line 1571 "Zend/zend_language_scanner.l" { const char *class_name = NULL; @@ -4518,7 +4522,7 @@ yy365: } return T_CLASS_C; } -#line 4522 "Zend/zend_language_scanner.c" +#line 4526 "Zend/zend_language_scanner.c" yy369: YYDEBUG(369, *YYCURSOR); yych = *++YYCURSOR; @@ -4580,11 +4584,11 @@ yy380: } YYDEBUG(381, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1279 "Zend/zend_language_scanner.l" +#line 1281 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } -#line 4588 "Zend/zend_language_scanner.c" +#line 4592 "Zend/zend_language_scanner.c" yy382: YYDEBUG(382, *YYCURSOR); yych = *++YYCURSOR; @@ -4604,11 +4608,11 @@ yy384: } YYDEBUG(385, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1259 "Zend/zend_language_scanner.l" +#line 1261 "Zend/zend_language_scanner.l" { return T_USE; } -#line 4612 "Zend/zend_language_scanner.c" +#line 4616 "Zend/zend_language_scanner.c" yy386: YYDEBUG(386, *YYCURSOR); yych = *++YYCURSOR; @@ -4627,11 +4631,11 @@ yy388: } YYDEBUG(389, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1307 "Zend/zend_language_scanner.l" +#line 1309 "Zend/zend_language_scanner.l" { return T_UNSET; } -#line 4635 "Zend/zend_language_scanner.c" +#line 4639 "Zend/zend_language_scanner.c" yy390: YYDEBUG(390, *YYCURSOR); ++YYCURSOR; @@ -4803,11 +4807,11 @@ yy405: ++YYCURSOR; YYDEBUG(407, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1207 "Zend/zend_language_scanner.l" +#line 1209 "Zend/zend_language_scanner.l" { return T_INT_CAST; } -#line 4811 "Zend/zend_language_scanner.c" +#line 4815 "Zend/zend_language_scanner.c" yy408: YYDEBUG(408, *YYCURSOR); yych = *++YYCURSOR; @@ -4851,11 +4855,11 @@ yy413: ++YYCURSOR; YYDEBUG(416, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1211 "Zend/zend_language_scanner.l" +#line 1213 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } -#line 4859 "Zend/zend_language_scanner.c" +#line 4863 "Zend/zend_language_scanner.c" yy417: YYDEBUG(417, *YYCURSOR); yych = *++YYCURSOR; @@ -4925,11 +4929,11 @@ yy427: ++YYCURSOR; YYDEBUG(430, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1215 "Zend/zend_language_scanner.l" +#line 1217 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } -#line 4933 "Zend/zend_language_scanner.c" +#line 4937 "Zend/zend_language_scanner.c" yy431: YYDEBUG(431, *YYCURSOR); yych = *++YYCURSOR; @@ -4962,11 +4966,11 @@ yy434: ++YYCURSOR; YYDEBUG(437, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1219 "Zend/zend_language_scanner.l" +#line 1221 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } -#line 4970 "Zend/zend_language_scanner.c" +#line 4974 "Zend/zend_language_scanner.c" yy438: YYDEBUG(438, *YYCURSOR); yych = *++YYCURSOR; @@ -5004,11 +5008,11 @@ yy442: ++YYCURSOR; YYDEBUG(445, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1223 "Zend/zend_language_scanner.l" +#line 1225 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } -#line 5012 "Zend/zend_language_scanner.c" +#line 5016 "Zend/zend_language_scanner.c" yy446: YYDEBUG(446, *YYCURSOR); yych = *++YYCURSOR; @@ -5049,11 +5053,11 @@ yy451: ++YYCURSOR; YYDEBUG(453, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1227 "Zend/zend_language_scanner.l" +#line 1229 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } -#line 5057 "Zend/zend_language_scanner.c" +#line 5061 "Zend/zend_language_scanner.c" yy454: YYDEBUG(454, *YYCURSOR); yych = *++YYCURSOR; @@ -5113,11 +5117,11 @@ yy462: ++YYCURSOR; YYDEBUG(465, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1231 "Zend/zend_language_scanner.l" +#line 1233 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } -#line 5121 "Zend/zend_language_scanner.c" +#line 5125 "Zend/zend_language_scanner.c" yy466: YYDEBUG(466, *YYCURSOR); yych = *++YYCURSOR; @@ -5131,11 +5135,11 @@ yy467: } YYDEBUG(468, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1203 "Zend/zend_language_scanner.l" +#line 1205 "Zend/zend_language_scanner.l" { return T_VAR; } -#line 5139 "Zend/zend_language_scanner.c" +#line 5143 "Zend/zend_language_scanner.c" yy469: YYDEBUG(469, *YYCURSOR); yych = *++YYCURSOR; @@ -5155,11 +5159,11 @@ yy471: } YYDEBUG(472, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1195 "Zend/zend_language_scanner.l" +#line 1197 "Zend/zend_language_scanner.l" { return T_NEW; } -#line 5163 "Zend/zend_language_scanner.c" +#line 5167 "Zend/zend_language_scanner.c" yy473: YYDEBUG(473, *YYCURSOR); yych = *++YYCURSOR; @@ -5198,21 +5202,21 @@ yy479: } YYDEBUG(480, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1255 "Zend/zend_language_scanner.l" +#line 1257 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } -#line 5206 "Zend/zend_language_scanner.c" +#line 5210 "Zend/zend_language_scanner.c" yy481: YYDEBUG(481, *YYCURSOR); ++YYCURSOR; YYDEBUG(482, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1187 "Zend/zend_language_scanner.l" +#line 1189 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } -#line 5216 "Zend/zend_language_scanner.c" +#line 5220 "Zend/zend_language_scanner.c" yy483: YYDEBUG(483, *YYCURSOR); ++YYCURSOR; @@ -5234,32 +5238,32 @@ yy485: ++YYCURSOR; YYDEBUG(486, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1363 "Zend/zend_language_scanner.l" +#line 1365 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } -#line 5242 "Zend/zend_language_scanner.c" +#line 5246 "Zend/zend_language_scanner.c" yy487: YYDEBUG(487, *YYCURSOR); ++YYCURSOR; YYDEBUG(488, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1331 "Zend/zend_language_scanner.l" +#line 1333 "Zend/zend_language_scanner.l" { return T_DEC; } -#line 5252 "Zend/zend_language_scanner.c" +#line 5256 "Zend/zend_language_scanner.c" yy489: YYDEBUG(489, *YYCURSOR); ++YYCURSOR; YYDEBUG(490, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1157 "Zend/zend_language_scanner.l" +#line 1159 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } -#line 5263 "Zend/zend_language_scanner.c" +#line 5267 "Zend/zend_language_scanner.c" yy491: YYDEBUG(491, *YYCURSOR); yych = *++YYCURSOR; @@ -5304,11 +5308,11 @@ yy496: } YYDEBUG(497, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1303 "Zend/zend_language_scanner.l" +#line 1305 "Zend/zend_language_scanner.l" { return T_PUBLIC; } -#line 5312 "Zend/zend_language_scanner.c" +#line 5316 "Zend/zend_language_scanner.c" yy498: YYDEBUG(498, *YYCURSOR); yych = *++YYCURSOR; @@ -5363,11 +5367,11 @@ yy505: } YYDEBUG(506, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1299 "Zend/zend_language_scanner.l" +#line 1301 "Zend/zend_language_scanner.l" { return T_PROTECTED; } -#line 5371 "Zend/zend_language_scanner.c" +#line 5375 "Zend/zend_language_scanner.c" yy507: YYDEBUG(507, *YYCURSOR); yych = *++YYCURSOR; @@ -5397,11 +5401,11 @@ yy511: } YYDEBUG(512, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1295 "Zend/zend_language_scanner.l" +#line 1297 "Zend/zend_language_scanner.l" { return T_PRIVATE; } -#line 5405 "Zend/zend_language_scanner.c" +#line 5409 "Zend/zend_language_scanner.c" yy513: YYDEBUG(513, *YYCURSOR); ++YYCURSOR; @@ -5410,11 +5414,11 @@ yy513: } YYDEBUG(514, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1133 "Zend/zend_language_scanner.l" +#line 1135 "Zend/zend_language_scanner.l" { return T_PRINT; } -#line 5418 "Zend/zend_language_scanner.c" +#line 5422 "Zend/zend_language_scanner.c" yy515: YYDEBUG(515, *YYCURSOR); yych = *++YYCURSOR; @@ -5439,11 +5443,11 @@ yy518: } YYDEBUG(519, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1125 "Zend/zend_language_scanner.l" +#line 1127 "Zend/zend_language_scanner.l" { return T_GOTO; } -#line 5447 "Zend/zend_language_scanner.c" +#line 5451 "Zend/zend_language_scanner.c" yy520: YYDEBUG(520, *YYCURSOR); yych = *++YYCURSOR; @@ -5467,11 +5471,11 @@ yy523: } YYDEBUG(524, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1267 "Zend/zend_language_scanner.l" +#line 1269 "Zend/zend_language_scanner.l" { return T_GLOBAL; } -#line 5475 "Zend/zend_language_scanner.c" +#line 5479 "Zend/zend_language_scanner.c" yy525: YYDEBUG(525, *YYCURSOR); yych = *++YYCURSOR; @@ -5508,11 +5512,11 @@ yy531: } YYDEBUG(532, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1117 "Zend/zend_language_scanner.l" +#line 1119 "Zend/zend_language_scanner.l" { return T_BREAK; } -#line 5516 "Zend/zend_language_scanner.c" +#line 5520 "Zend/zend_language_scanner.c" yy533: YYDEBUG(533, *YYCURSOR); yych = *++YYCURSOR; @@ -5552,11 +5556,11 @@ yy539: } YYDEBUG(540, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1101 "Zend/zend_language_scanner.l" +#line 1103 "Zend/zend_language_scanner.l" { return T_SWITCH; } -#line 5560 "Zend/zend_language_scanner.c" +#line 5564 "Zend/zend_language_scanner.c" yy541: YYDEBUG(541, *YYCURSOR); yych = *++YYCURSOR; @@ -5580,11 +5584,11 @@ yy544: } YYDEBUG(545, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1283 "Zend/zend_language_scanner.l" +#line 1285 "Zend/zend_language_scanner.l" { return T_STATIC; } -#line 5588 "Zend/zend_language_scanner.c" +#line 5592 "Zend/zend_language_scanner.c" yy546: YYDEBUG(546, *YYCURSOR); yych = *++YYCURSOR; @@ -5611,11 +5615,11 @@ yy549: } YYDEBUG(550, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1097 "Zend/zend_language_scanner.l" +#line 1099 "Zend/zend_language_scanner.l" { return T_AS; } -#line 5619 "Zend/zend_language_scanner.c" +#line 5623 "Zend/zend_language_scanner.c" yy551: YYDEBUG(551, *YYCURSOR); yych = *++YYCURSOR; @@ -5634,11 +5638,11 @@ yy553: } YYDEBUG(554, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1319 "Zend/zend_language_scanner.l" +#line 1321 "Zend/zend_language_scanner.l" { return T_ARRAY; } -#line 5642 "Zend/zend_language_scanner.c" +#line 5646 "Zend/zend_language_scanner.c" yy555: YYDEBUG(555, *YYCURSOR); ++YYCURSOR; @@ -5647,11 +5651,11 @@ yy555: } YYDEBUG(556, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1415 "Zend/zend_language_scanner.l" +#line 1417 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } -#line 5655 "Zend/zend_language_scanner.c" +#line 5659 "Zend/zend_language_scanner.c" yy557: YYDEBUG(557, *YYCURSOR); yych = *++YYCURSOR; @@ -5685,11 +5689,11 @@ yy562: } YYDEBUG(563, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1287 "Zend/zend_language_scanner.l" +#line 1289 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } -#line 5693 "Zend/zend_language_scanner.c" +#line 5697 "Zend/zend_language_scanner.c" yy564: YYDEBUG(564, *YYCURSOR); yych = *++YYCURSOR; @@ -5713,11 +5717,11 @@ yy567: } YYDEBUG(568, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1057 "Zend/zend_language_scanner.l" +#line 1059 "Zend/zend_language_scanner.l" { return T_WHILE; } -#line 5721 "Zend/zend_language_scanner.c" +#line 5725 "Zend/zend_language_scanner.c" yy569: YYDEBUG(569, *YYCURSOR); ++YYCURSOR; @@ -5726,11 +5730,11 @@ yy569: } YYDEBUG(570, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1041 "Zend/zend_language_scanner.l" +#line 1043 "Zend/zend_language_scanner.l" { return T_IF; } -#line 5734 "Zend/zend_language_scanner.c" +#line 5738 "Zend/zend_language_scanner.c" yy571: YYDEBUG(571, *YYCURSOR); yych = *++YYCURSOR; @@ -5782,11 +5786,11 @@ yy576: } YYDEBUG(577, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1271 "Zend/zend_language_scanner.l" +#line 1273 "Zend/zend_language_scanner.l" { return T_ISSET; } -#line 5790 "Zend/zend_language_scanner.c" +#line 5794 "Zend/zend_language_scanner.c" yy578: YYDEBUG(578, *YYCURSOR); yych = *++YYCURSOR; @@ -5840,11 +5844,11 @@ yy584: yy585: YYDEBUG(585, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1239 "Zend/zend_language_scanner.l" +#line 1241 "Zend/zend_language_scanner.l" { return T_INCLUDE; } -#line 5848 "Zend/zend_language_scanner.c" +#line 5852 "Zend/zend_language_scanner.c" yy586: YYDEBUG(586, *YYCURSOR); yych = *++YYCURSOR; @@ -5873,11 +5877,11 @@ yy590: } YYDEBUG(591, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1243 "Zend/zend_language_scanner.l" +#line 1245 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } -#line 5881 "Zend/zend_language_scanner.c" +#line 5885 "Zend/zend_language_scanner.c" yy592: YYDEBUG(592, *YYCURSOR); yych = *++YYCURSOR; @@ -5911,11 +5915,11 @@ yy597: } YYDEBUG(598, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1141 "Zend/zend_language_scanner.l" +#line 1143 "Zend/zend_language_scanner.l" { return T_INTERFACE; } -#line 5919 "Zend/zend_language_scanner.c" +#line 5923 "Zend/zend_language_scanner.c" yy599: YYDEBUG(599, *YYCURSOR); yych = *++YYCURSOR; @@ -5965,11 +5969,11 @@ yy605: } YYDEBUG(606, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1263 "Zend/zend_language_scanner.l" +#line 1265 "Zend/zend_language_scanner.l" { return T_INSTEADOF; } -#line 5973 "Zend/zend_language_scanner.c" +#line 5977 "Zend/zend_language_scanner.c" yy607: YYDEBUG(607, *YYCURSOR); yych = *++YYCURSOR; @@ -5998,11 +6002,11 @@ yy611: } YYDEBUG(612, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1093 "Zend/zend_language_scanner.l" +#line 1095 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } -#line 6006 "Zend/zend_language_scanner.c" +#line 6010 "Zend/zend_language_scanner.c" yy613: YYDEBUG(613, *YYCURSOR); yych = *++YYCURSOR; @@ -6046,11 +6050,11 @@ yy620: } YYDEBUG(621, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1153 "Zend/zend_language_scanner.l" +#line 1155 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } -#line 6054 "Zend/zend_language_scanner.c" +#line 6058 "Zend/zend_language_scanner.c" yy622: YYDEBUG(622, *YYCURSOR); yych = *++YYCURSOR; @@ -6078,11 +6082,11 @@ yy623: } YYDEBUG(625, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1029 "Zend/zend_language_scanner.l" +#line 1031 "Zend/zend_language_scanner.l" { return T_TRY; } -#line 6086 "Zend/zend_language_scanner.c" +#line 6090 "Zend/zend_language_scanner.c" yy626: YYDEBUG(626, *YYCURSOR); yych = *++YYCURSOR; @@ -6101,11 +6105,11 @@ yy628: } YYDEBUG(629, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1145 "Zend/zend_language_scanner.l" +#line 1147 "Zend/zend_language_scanner.l" { return T_TRAIT; } -#line 6109 "Zend/zend_language_scanner.c" +#line 6113 "Zend/zend_language_scanner.c" yy630: YYDEBUG(630, *YYCURSOR); yych = *++YYCURSOR; @@ -6124,11 +6128,11 @@ yy632: } YYDEBUG(633, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1037 "Zend/zend_language_scanner.l" +#line 1039 "Zend/zend_language_scanner.l" { return T_THROW; } -#line 6132 "Zend/zend_language_scanner.c" +#line 6136 "Zend/zend_language_scanner.c" yy634: YYDEBUG(634, *YYCURSOR); yych = *++YYCURSOR; @@ -6189,11 +6193,11 @@ yy640: yy641: YYDEBUG(641, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1247 "Zend/zend_language_scanner.l" +#line 1249 "Zend/zend_language_scanner.l" { return T_REQUIRE; } -#line 6197 "Zend/zend_language_scanner.c" +#line 6201 "Zend/zend_language_scanner.c" yy642: YYDEBUG(642, *YYCURSOR); yych = *++YYCURSOR; @@ -6222,11 +6226,11 @@ yy646: } YYDEBUG(647, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1251 "Zend/zend_language_scanner.l" +#line 1253 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } -#line 6230 "Zend/zend_language_scanner.c" +#line 6234 "Zend/zend_language_scanner.c" yy648: YYDEBUG(648, *YYCURSOR); yych = *++YYCURSOR; @@ -6245,11 +6249,11 @@ yy650: } YYDEBUG(651, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1025 "Zend/zend_language_scanner.l" +#line 1027 "Zend/zend_language_scanner.l" { return T_RETURN; } -#line 6253 "Zend/zend_language_scanner.c" +#line 6257 "Zend/zend_language_scanner.c" yy652: YYDEBUG(652, *YYCURSOR); yych = *++YYCURSOR; @@ -6339,11 +6343,11 @@ yy661: } YYDEBUG(662, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1121 "Zend/zend_language_scanner.l" +#line 1123 "Zend/zend_language_scanner.l" { return T_CONTINUE; } -#line 6347 "Zend/zend_language_scanner.c" +#line 6351 "Zend/zend_language_scanner.c" yy663: YYDEBUG(663, *YYCURSOR); ++YYCURSOR; @@ -6352,11 +6356,11 @@ yy663: } YYDEBUG(664, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1021 "Zend/zend_language_scanner.l" +#line 1023 "Zend/zend_language_scanner.l" { return T_CONST; } -#line 6360 "Zend/zend_language_scanner.c" +#line 6364 "Zend/zend_language_scanner.c" yy665: YYDEBUG(665, *YYCURSOR); yych = *++YYCURSOR; @@ -6381,11 +6385,11 @@ yy668: } YYDEBUG(669, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1199 "Zend/zend_language_scanner.l" +#line 1201 "Zend/zend_language_scanner.l" { return T_CLONE; } -#line 6389 "Zend/zend_language_scanner.c" +#line 6393 "Zend/zend_language_scanner.c" yy670: YYDEBUG(670, *YYCURSOR); yych = *++YYCURSOR; @@ -6399,11 +6403,11 @@ yy671: } YYDEBUG(672, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1137 "Zend/zend_language_scanner.l" +#line 1139 "Zend/zend_language_scanner.l" { return T_CLASS; } -#line 6407 "Zend/zend_language_scanner.c" +#line 6411 "Zend/zend_language_scanner.c" yy673: YYDEBUG(673, *YYCURSOR); yych = *++YYCURSOR; @@ -6449,11 +6453,11 @@ yy680: } YYDEBUG(681, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1323 "Zend/zend_language_scanner.l" +#line 1325 "Zend/zend_language_scanner.l" { return T_CALLABLE; } -#line 6457 "Zend/zend_language_scanner.c" +#line 6461 "Zend/zend_language_scanner.c" yy682: YYDEBUG(682, *YYCURSOR); ++YYCURSOR; @@ -6462,11 +6466,11 @@ yy682: } YYDEBUG(683, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1109 "Zend/zend_language_scanner.l" +#line 1111 "Zend/zend_language_scanner.l" { return T_CASE; } -#line 6470 "Zend/zend_language_scanner.c" +#line 6474 "Zend/zend_language_scanner.c" yy684: YYDEBUG(684, *YYCURSOR); yych = *++YYCURSOR; @@ -6480,11 +6484,11 @@ yy685: } YYDEBUG(686, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1033 "Zend/zend_language_scanner.l" +#line 1035 "Zend/zend_language_scanner.l" { return T_CATCH; } -#line 6488 "Zend/zend_language_scanner.c" +#line 6492 "Zend/zend_language_scanner.c" yy687: YYDEBUG(687, *YYCURSOR); yych = *++YYCURSOR; @@ -6535,11 +6539,11 @@ yy695: } YYDEBUG(696, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1017 "Zend/zend_language_scanner.l" +#line 1019 "Zend/zend_language_scanner.l" { return T_FUNCTION; } -#line 6543 "Zend/zend_language_scanner.c" +#line 6547 "Zend/zend_language_scanner.c" yy697: YYDEBUG(697, *YYCURSOR); ++YYCURSOR; @@ -6563,11 +6567,11 @@ yy697: yy698: YYDEBUG(698, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1069 "Zend/zend_language_scanner.l" +#line 1071 "Zend/zend_language_scanner.l" { return T_FOR; } -#line 6571 "Zend/zend_language_scanner.c" +#line 6575 "Zend/zend_language_scanner.c" yy699: YYDEBUG(699, *YYCURSOR); yych = *++YYCURSOR; @@ -6591,11 +6595,11 @@ yy702: } YYDEBUG(703, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1077 "Zend/zend_language_scanner.l" +#line 1079 "Zend/zend_language_scanner.l" { return T_FOREACH; } -#line 6599 "Zend/zend_language_scanner.c" +#line 6603 "Zend/zend_language_scanner.c" yy704: YYDEBUG(704, *YYCURSOR); yych = *++YYCURSOR; @@ -6614,11 +6618,11 @@ yy706: } YYDEBUG(707, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1291 "Zend/zend_language_scanner.l" +#line 1293 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 6622 "Zend/zend_language_scanner.c" +#line 6626 "Zend/zend_language_scanner.c" yy708: YYDEBUG(708, *YYCURSOR); yych = *++YYCURSOR; @@ -6649,11 +6653,11 @@ yy710: } YYDEBUG(711, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1065 "Zend/zend_language_scanner.l" +#line 1067 "Zend/zend_language_scanner.l" { return T_DO; } -#line 6657 "Zend/zend_language_scanner.c" +#line 6661 "Zend/zend_language_scanner.c" yy712: YYDEBUG(712, *YYCURSOR); ++YYCURSOR; @@ -6662,11 +6666,11 @@ yy712: } YYDEBUG(713, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1013 "Zend/zend_language_scanner.l" +#line 1015 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6670 "Zend/zend_language_scanner.c" +#line 6674 "Zend/zend_language_scanner.c" yy714: YYDEBUG(714, *YYCURSOR); yych = *++YYCURSOR; @@ -6701,11 +6705,11 @@ yy719: } YYDEBUG(720, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1113 "Zend/zend_language_scanner.l" +#line 1115 "Zend/zend_language_scanner.l" { return T_DEFAULT; } -#line 6709 "Zend/zend_language_scanner.c" +#line 6713 "Zend/zend_language_scanner.c" yy721: YYDEBUG(721, *YYCURSOR); yych = *++YYCURSOR; @@ -6729,11 +6733,11 @@ yy724: } YYDEBUG(725, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1085 "Zend/zend_language_scanner.l" +#line 1087 "Zend/zend_language_scanner.l" { return T_DECLARE; } -#line 6737 "Zend/zend_language_scanner.c" +#line 6741 "Zend/zend_language_scanner.c" yy726: YYDEBUG(726, *YYCURSOR); yych = *++YYCURSOR; @@ -6813,11 +6817,11 @@ yy737: } YYDEBUG(738, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1149 "Zend/zend_language_scanner.l" +#line 1151 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6821 "Zend/zend_language_scanner.c" +#line 6825 "Zend/zend_language_scanner.c" yy739: YYDEBUG(739, *YYCURSOR); ++YYCURSOR; @@ -6826,11 +6830,11 @@ yy739: } YYDEBUG(740, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1009 "Zend/zend_language_scanner.l" +#line 1011 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6834 "Zend/zend_language_scanner.c" +#line 6838 "Zend/zend_language_scanner.c" yy741: YYDEBUG(741, *YYCURSOR); yych = *++YYCURSOR; @@ -6844,11 +6848,11 @@ yy742: } YYDEBUG(743, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1235 "Zend/zend_language_scanner.l" +#line 1237 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6852 "Zend/zend_language_scanner.c" +#line 6856 "Zend/zend_language_scanner.c" yy744: YYDEBUG(744, *YYCURSOR); yych = *++YYCURSOR; @@ -6918,11 +6922,11 @@ yy753: } YYDEBUG(754, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1061 "Zend/zend_language_scanner.l" +#line 1063 "Zend/zend_language_scanner.l" { return T_ENDWHILE; } -#line 6926 "Zend/zend_language_scanner.c" +#line 6930 "Zend/zend_language_scanner.c" yy755: YYDEBUG(755, *YYCURSOR); yych = *++YYCURSOR; @@ -6951,11 +6955,11 @@ yy759: } YYDEBUG(760, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1105 "Zend/zend_language_scanner.l" +#line 1107 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 6959 "Zend/zend_language_scanner.c" +#line 6963 "Zend/zend_language_scanner.c" yy761: YYDEBUG(761, *YYCURSOR); ++YYCURSOR; @@ -6964,11 +6968,11 @@ yy761: } YYDEBUG(762, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1049 "Zend/zend_language_scanner.l" +#line 1051 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 6972 "Zend/zend_language_scanner.c" +#line 6976 "Zend/zend_language_scanner.c" yy763: YYDEBUG(763, *YYCURSOR); yych = *++YYCURSOR; @@ -6997,11 +7001,11 @@ yy764: yy765: YYDEBUG(765, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1073 "Zend/zend_language_scanner.l" +#line 1075 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 7005 "Zend/zend_language_scanner.c" +#line 7009 "Zend/zend_language_scanner.c" yy766: YYDEBUG(766, *YYCURSOR); yych = *++YYCURSOR; @@ -7025,11 +7029,11 @@ yy769: } YYDEBUG(770, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1081 "Zend/zend_language_scanner.l" +#line 1083 "Zend/zend_language_scanner.l" { return T_ENDFOREACH; } -#line 7033 "Zend/zend_language_scanner.c" +#line 7037 "Zend/zend_language_scanner.c" yy771: YYDEBUG(771, *YYCURSOR); yych = *++YYCURSOR; @@ -7063,11 +7067,11 @@ yy776: } YYDEBUG(777, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1089 "Zend/zend_language_scanner.l" +#line 1091 "Zend/zend_language_scanner.l" { return T_ENDDECLARE; } -#line 7071 "Zend/zend_language_scanner.c" +#line 7075 "Zend/zend_language_scanner.c" yy778: YYDEBUG(778, *YYCURSOR); yych = *++YYCURSOR; @@ -7086,11 +7090,11 @@ yy780: } YYDEBUG(781, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1275 "Zend/zend_language_scanner.l" +#line 1277 "Zend/zend_language_scanner.l" { return T_EMPTY; } -#line 7094 "Zend/zend_language_scanner.c" +#line 7098 "Zend/zend_language_scanner.c" yy782: YYDEBUG(782, *YYCURSOR); yych = *++YYCURSOR; @@ -7119,11 +7123,11 @@ yy783: yy784: YYDEBUG(784, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1053 "Zend/zend_language_scanner.l" +#line 1055 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 7127 "Zend/zend_language_scanner.c" +#line 7131 "Zend/zend_language_scanner.c" yy785: YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; @@ -7137,11 +7141,11 @@ yy786: } YYDEBUG(787, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1045 "Zend/zend_language_scanner.l" +#line 1047 "Zend/zend_language_scanner.l" { return T_ELSEIF; } -#line 7145 "Zend/zend_language_scanner.c" +#line 7149 "Zend/zend_language_scanner.c" yy788: YYDEBUG(788, *YYCURSOR); yych = *++YYCURSOR; @@ -7155,11 +7159,11 @@ yy789: } YYDEBUG(790, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1129 "Zend/zend_language_scanner.l" +#line 1131 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7163 "Zend/zend_language_scanner.c" +#line 7167 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7232,7 +7236,7 @@ yy793: yy794: YYDEBUG(794, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1162 "Zend/zend_language_scanner.l" +#line 1164 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -7240,7 +7244,7 @@ yy794: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7244 "Zend/zend_language_scanner.c" +#line 7248 "Zend/zend_language_scanner.c" yy795: YYDEBUG(795, *YYCURSOR); ++YYCURSOR; @@ -7248,13 +7252,13 @@ yy795: yy796: YYDEBUG(796, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1181 "Zend/zend_language_scanner.l" +#line 1183 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7258 "Zend/zend_language_scanner.c" +#line 7262 "Zend/zend_language_scanner.c" yy797: YYDEBUG(797, *YYCURSOR); ++YYCURSOR; @@ -7263,14 +7267,14 @@ yy797: yy798: YYDEBUG(798, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1174 "Zend/zend_language_scanner.l" +#line 1176 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7274 "Zend/zend_language_scanner.c" +#line 7278 "Zend/zend_language_scanner.c" yy799: YYDEBUG(799, *YYCURSOR); yych = *++YYCURSOR; @@ -7291,11 +7295,11 @@ yy802: ++YYCURSOR; YYDEBUG(803, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1170 "Zend/zend_language_scanner.l" +#line 1172 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7299 "Zend/zend_language_scanner.c" +#line 7303 "Zend/zend_language_scanner.c" yy804: YYDEBUG(804, *YYCURSOR); ++YYCURSOR; @@ -7365,7 +7369,7 @@ yy808: yy809: YYDEBUG(809, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1457 "Zend/zend_language_scanner.l" +#line 1459 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; @@ -7373,20 +7377,20 @@ yy809: yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7377 "Zend/zend_language_scanner.c" +#line 7381 "Zend/zend_language_scanner.c" yy810: YYDEBUG(810, *YYCURSOR); ++YYCURSOR; YYDEBUG(811, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1466 "Zend/zend_language_scanner.l" +#line 1468 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 7390 "Zend/zend_language_scanner.c" +#line 7394 "Zend/zend_language_scanner.c" yy812: YYDEBUG(812, *YYCURSOR); ++YYCURSOR; @@ -7408,10 +7412,12 @@ yyc_ST_NOWDOC: ++YYCURSOR; YYDEBUG(817, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2348 "Zend/zend_language_scanner.l" +#line 2352 "Zend/zend_language_scanner.l" { int newline = 0; + zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack)); + if (YYCURSOR > YYLIMIT) { return 0; } @@ -7427,8 +7433,8 @@ yyc_ST_NOWDOC: /* fall through */ case '\n': /* Check for ending label on the next line */ - if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; @@ -7463,7 +7469,7 @@ nowdoc_scan_done: HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7467 "Zend/zend_language_scanner.c" +#line 7473 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7570,7 +7576,7 @@ yy820: yy821: YYDEBUG(821, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1544 "Zend/zend_language_scanner.l" +#line 1546 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { zendlval->value.lval = strtol(yytext, NULL, 10); @@ -7582,7 +7588,7 @@ yy821: } return T_NUM_STRING; } -#line 7586 "Zend/zend_language_scanner.c" +#line 7592 "Zend/zend_language_scanner.c" yy822: YYDEBUG(822, *YYCURSOR); yych = *++YYCURSOR; @@ -7602,23 +7608,23 @@ yy823: yy824: YYDEBUG(824, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1876 "Zend/zend_language_scanner.l" +#line 1878 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7611 "Zend/zend_language_scanner.c" +#line 7617 "Zend/zend_language_scanner.c" yy825: YYDEBUG(825, *YYCURSOR); ++YYCURSOR; YYDEBUG(826, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1871 "Zend/zend_language_scanner.l" +#line 1873 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 7622 "Zend/zend_language_scanner.c" +#line 7628 "Zend/zend_language_scanner.c" yy827: YYDEBUG(827, *YYCURSOR); yych = *++YYCURSOR; @@ -7628,14 +7634,14 @@ yy828: ++YYCURSOR; YYDEBUG(829, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1881 "Zend/zend_language_scanner.l" +#line 1883 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); return T_ENCAPSED_AND_WHITESPACE; } -#line 7639 "Zend/zend_language_scanner.c" +#line 7645 "Zend/zend_language_scanner.c" yy830: YYDEBUG(830, *YYCURSOR); ++YYCURSOR; @@ -7644,19 +7650,19 @@ yy830: yy831: YYDEBUG(831, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1888 "Zend/zend_language_scanner.l" +#line 1890 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7654 "Zend/zend_language_scanner.c" +#line 7660 "Zend/zend_language_scanner.c" yy832: YYDEBUG(832, *YYCURSOR); ++YYCURSOR; YYDEBUG(833, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2404 "Zend/zend_language_scanner.l" +#line 2410 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7665,7 +7671,7 @@ yy832: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 7669 "Zend/zend_language_scanner.c" +#line 7675 "Zend/zend_language_scanner.c" yy834: YYDEBUG(834, *YYCURSOR); ++YYCURSOR; @@ -7701,13 +7707,13 @@ yy836: yy838: YYDEBUG(838, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1867 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 7711 "Zend/zend_language_scanner.c" +#line 7717 "Zend/zend_language_scanner.c" yy839: YYDEBUG(839, *YYCURSOR); ++YYCURSOR; @@ -7747,14 +7753,14 @@ yy844: yy846: YYDEBUG(846, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1556 "Zend/zend_language_scanner.l" +#line 1558 "Zend/zend_language_scanner.l" { /* Offset must be treated as a string */ zendlval->value.str.val = (char *)estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; zendlval->type = IS_STRING; return T_NUM_STRING; } -#line 7758 "Zend/zend_language_scanner.c" +#line 7764 "Zend/zend_language_scanner.c" yy847: YYDEBUG(847, *YYCURSOR); ++YYCURSOR; @@ -7777,6 +7783,6 @@ yy849: goto yy846; } } -#line 2413 "Zend/zend_language_scanner.l" +#line 2419 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index a1a84b3bc98..c1a2313b2db 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -31,6 +31,7 @@ typedef struct _zend_lex_state { unsigned char *yy_limit; int yy_state; zend_stack state_stack; + zend_ptr_stack heredoc_label_stack; zend_file_handle *in; uint lineno; @@ -50,6 +51,10 @@ typedef struct _zend_lex_state { const zend_encoding *script_encoding; } zend_lex_state; +typedef struct _zend_heredoc_label { + char *label; + int length; +} zend_heredoc_label; BEGIN_EXTERN_C() int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index d530b53430d..948fe0c2452 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -175,22 +175,23 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC) void startup_scanner(TSRMLS_D) { CG(parse_error) = 0; - CG(heredoc) = NULL; - CG(heredoc_len) = 0; CG(doc_comment) = NULL; CG(doc_comment_len) = 0; zend_stack_init(&SCNG(state_stack)); + zend_ptr_stack_init(&SCNG(heredoc_label_stack)); +} + +static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) { + efree(heredoc_label->label); } void shutdown_scanner(TSRMLS_D) { - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc_len)=0; - } CG(parse_error) = 0; - zend_stack_destroy(&SCNG(state_stack)); RESET_DOC_COMMENT(); + zend_stack_destroy(&SCNG(state_stack)); + zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1); + zend_ptr_stack_destroy(&SCNG(heredoc_label_stack)); } ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) @@ -205,6 +206,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) lex_state->state_stack = SCNG(state_stack); zend_stack_init(&SCNG(state_stack)); + lex_state->heredoc_label_stack = SCNG(heredoc_label_stack); + zend_ptr_stack_init(&SCNG(heredoc_label_stack)); + lex_state->in = SCNG(yy_in); lex_state->yy_state = YYSTATE; lex_state->filename = zend_get_compiled_filename(TSRMLS_C); @@ -231,6 +235,10 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) zend_stack_destroy(&SCNG(state_stack)); SCNG(state_stack) = lex_state->state_stack; + zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1); + zend_ptr_stack_destroy(&SCNG(heredoc_label_stack)); + SCNG(heredoc_label_stack) = lex_state->heredoc_label_stack; + SCNG(yy_in) = lex_state->in; YYSETCONDITION(lex_state->yy_state); CG(zend_lineno) = lex_state->lineno; @@ -247,12 +255,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) SCNG(input_filter) = lex_state->input_filter; SCNG(output_filter) = lex_state->output_filter; SCNG(script_encoding) = lex_state->script_encoding; - - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc) = NULL; - CG(heredoc_len) = 0; - } } ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) @@ -2097,38 +2099,35 @@ inline_html: b?"<<<"{TABS_AND_SPACES}({LABEL}|([']{LABEL}['])|(["]{LABEL}["])){NEWLINE} { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; - - /* save old heredoc label */ - Z_STRVAL_P(zendlval) = CG(heredoc); - Z_STRLEN_P(zendlval) = CG(heredoc_len); + zend_heredoc_label *heredoc_label = emalloc(sizeof(zend_heredoc_label)); CG(zend_lineno)++; - CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); + heredoc_label->length = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); s = yytext+bprefix+3; while ((*s == ' ') || (*s == '\t')) { s++; - CG(heredoc_len)--; + heredoc_label->length--; } if (*s == '\'') { s++; - CG(heredoc_len) -= 2; + heredoc_label->length -= 2; BEGIN(ST_NOWDOC); } else { if (*s == '"') { s++; - CG(heredoc_len) -= 2; + heredoc_label->length -= 2; } BEGIN(ST_HEREDOC); } - CG(heredoc) = estrndup(s, CG(heredoc_len)); + heredoc_label->label = estrndup(s, heredoc_label->length); /* Check for ending label on the next line */ - if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; @@ -2139,6 +2138,8 @@ inline_html: } } + zend_ptr_stack_push(&SCNG(heredoc_label_stack), (void *) heredoc_label); + return T_START_HEREDOC; } @@ -2150,13 +2151,14 @@ inline_html: {ANY_CHAR} { - YYCURSOR += CG(heredoc_len) - 1; - yyleng = CG(heredoc_len); + zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack)); + + YYCURSOR += heredoc_label->length - 1; + yyleng = heredoc_label->length; + + heredoc_label_dtor(heredoc_label); + efree(heredoc_label); - Z_STRVAL_P(zendlval) = CG(heredoc); - Z_STRLEN_P(zendlval) = CG(heredoc_len); - CG(heredoc) = NULL; - CG(heredoc_len) = 0; BEGIN(ST_IN_SCRIPTING); return T_END_HEREDOC; } @@ -2276,6 +2278,8 @@ double_quotes_scan_done: {ANY_CHAR} { int newline = 0; + zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack)); + if (YYCURSOR > YYLIMIT) { return 0; } @@ -2291,8 +2295,8 @@ double_quotes_scan_done: /* fall through */ case '\n': /* Check for ending label on the next line */ - if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; @@ -2348,6 +2352,8 @@ heredoc_scan_done: {ANY_CHAR} { int newline = 0; + zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack)); + if (YYCURSOR > YYLIMIT) { return 0; } @@ -2363,8 +2369,8 @@ heredoc_scan_done: /* fall through */ case '\n': /* Check for ending label on the next line */ - if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) { - YYCTYPE *end = YYCURSOR + CG(heredoc_len); + if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { + YYCTYPE *end = YYCURSOR + heredoc_label->length; if (*end == ';') { end++; diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 015a903ded2..c764903f278 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Mar 1 21:27:30 2012 */ +/* Generated by re2c 0.13.5 on Sat Mar 31 21:29:29 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index cc062de872e..9f6fc13161a 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -111,6 +111,11 @@ static zend_always_inline void *zend_ptr_stack_pop(zend_ptr_stack *stack) return *(--stack->top_element); } +static inline void *zend_ptr_stack_top(zend_ptr_stack *stack) +{ + return stack->elements[stack->top - 1]; +} + #endif /* ZEND_PTR_STACK_H */ /* diff --git a/ext/tokenizer/tests/bug60097.phpt b/ext/tokenizer/tests/bug60097.phpt new file mode 100644 index 00000000000..620b4fda4cc --- /dev/null +++ b/ext/tokenizer/tests/bug60097.phpt @@ -0,0 +1,121 @@ +--TEST-- +Bug 60097: token_get_all fails to lex nested heredoc +--FILE-- + +--EXPECT-- +array(14) { + [0]=> + array(3) { + [0]=> + int(372) + [1]=> + string(6) " + int(1) + } + [1]=> + array(3) { + [0]=> + int(376) + [1]=> + string(8) "<< + int(2) + } + [2]=> + array(3) { + [0]=> + int(379) + [1]=> + string(1) "{" + [2]=> + int(3) + } + [3]=> + array(3) { + [0]=> + int(309) + [1]=> + string(2) "$s" + [2]=> + int(3) + } + [4]=> + string(1) "(" + [5]=> + array(3) { + [0]=> + int(376) + [1]=> + string(8) "<< + int(3) + } + [6]=> + array(3) { + [0]=> + int(377) + [1]=> + string(4) "DOC2" + [2]=> + int(4) + } + [7]=> + array(3) { + [0]=> + int(375) + [1]=> + string(1) " +" + [2]=> + int(4) + } + [8]=> + string(1) ")" + [9]=> + string(1) "}" + [10]=> + array(3) { + [0]=> + int(314) + [1]=> + string(1) " +" + [2]=> + int(5) + } + [11]=> + array(3) { + [0]=> + int(377) + [1]=> + string(4) "DOC1" + [2]=> + int(6) + } + [12]=> + string(1) ";" + [13]=> + array(3) { + [0]=> + int(375) + [1]=> + string(1) " +" + [2]=> + int(6) + } +} diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index c5cbf6c7d2f..d22fd712433 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -138,11 +138,8 @@ static void tokenize(zval *return_value TSRMLS_DC) token_line = ++CG(zend_lineno); CG(increment_lineno) = 0; } - add_next_index_stringl(keyword, Z_STRVAL(token), Z_STRLEN(token), 1); - efree(Z_STRVAL(token)); - } else { - add_next_index_stringl(keyword, (char *)zendtext, zendleng, 1); } + add_next_index_stringl(keyword, (char *)zendtext, zendleng, 1); add_next_index_long(keyword, token_line); add_next_index_zval(return_value, keyword); } else { From 9b101ac8b364610c20f710b8c6c631db5e6230a5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 15 May 2012 18:30:48 +0200 Subject: [PATCH 002/641] Add T_YIELD "yield" keyword --- Zend/zend_compile.c | 6 + Zend/zend_language_parser.y | 2 + Zend/zend_language_scanner.c | 6424 +++++++++++++++-------------- Zend/zend_language_scanner.l | 4 + Zend/zend_language_scanner_defs.h | 2 +- ext/standard/url_scanner_ex.c | 2 +- 6 files changed, 3244 insertions(+), 3196 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 602b6004100..2b2b58f9ac8 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2655,6 +2655,12 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ } /* }}} */ +void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ +{ + /* do nothing for now */ +} +/* }}} */ + static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ { int try_catch_offset = CG(active_op_array)->last_try_catch++; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 893e0133efe..61198cb10e8 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -158,6 +158,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_FUNCTION "function (T_FUNCTION)" %token T_CONST "const (T_CONST)" %token T_RETURN "return (T_RETURN)" +%token T_YIELD "yield (T_YIELD)" %token T_TRY "try (T_TRY)" %token T_CATCH "catch (T_CATCH)" %token T_THROW "throw (T_THROW)" @@ -297,6 +298,7 @@ unticked_statement: | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); } | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); } | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); } + | T_YIELD expr ';' { zend_do_yield(&$2 TSRMLS_CC); } | T_GLOBAL global_var_list ';' | T_STATIC static_var_list ';' | T_ECHO echo_expr_list ';' diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 0bfbac99750..a388e96a262 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Apr 30 15:56:25 2012 */ +/* Generated by re2c 0.13.5 on Tue May 15 13:07:23 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -1097,7 +1097,7 @@ yyc_INITIAL: yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1791 "Zend/zend_language_scanner.l" +#line 1795 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1175,7 +1175,7 @@ yy5: yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1779 "Zend/zend_language_scanner.l" +#line 1783 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1194,7 +1194,7 @@ yy7: if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1756 "Zend/zend_language_scanner.l" +#line 1760 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1392,7 +1392,7 @@ yy35: ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1716 "Zend/zend_language_scanner.l" +#line 1720 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1436,7 +1436,7 @@ yy43: ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1734 "Zend/zend_language_scanner.l" +#line 1738 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1454,7 +1454,7 @@ yy45: ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1747 "Zend/zend_language_scanner.l" +#line 1751 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1489,7 +1489,7 @@ yy50: yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1769 "Zend/zend_language_scanner.l" +#line 1773 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1569,7 +1569,7 @@ yyc_ST_BACKQUOTE: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2242 "Zend/zend_language_scanner.l" +#line 2246 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1621,7 +1621,7 @@ yy58: ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2186 "Zend/zend_language_scanner.l" +#line 2190 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; @@ -1636,7 +1636,7 @@ yy61: ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1659,7 +1659,7 @@ yy63: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1671,7 +1671,7 @@ yy66: ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -1690,7 +1690,7 @@ yy70: ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1716,7 +1716,7 @@ yy73: ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1792,7 +1792,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2192 "Zend/zend_language_scanner.l" +#line 2196 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1852,7 +1852,7 @@ yy80: ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2181 "Zend/zend_language_scanner.l" +#line 2185 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; @@ -1867,7 +1867,7 @@ yy83: ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1890,7 +1890,7 @@ yy85: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1902,7 +1902,7 @@ yy88: ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -1921,7 +1921,7 @@ yy92: ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1947,7 +1947,7 @@ yy95: ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1966,7 +1966,7 @@ yyc_ST_END_HEREDOC: ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2160 "Zend/zend_language_scanner.l" +#line 2164 "Zend/zend_language_scanner.l" { YYCURSOR += CG(heredoc_len) - 1; yyleng = CG(heredoc_len); @@ -2040,7 +2040,7 @@ yy103: yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2284 "Zend/zend_language_scanner.l" +#line 2288 "Zend/zend_language_scanner.l" { int newline = 0; @@ -2126,7 +2126,7 @@ yy107: ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -2149,7 +2149,7 @@ yy109: yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -2161,7 +2161,7 @@ yy112: ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -2180,7 +2180,7 @@ yy116: ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -2206,7 +2206,7 @@ yy119: ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -2286,32 +2286,32 @@ yyc_ST_IN_SCRIPTING: case 0x1C: case 0x1D: case 0x1E: - case 0x1F: goto yy183; + case 0x1F: goto yy184; case '\t': case '\n': case '\r': - case ' ': goto yy139; - case '!': goto yy152; - case '"': goto yy179; - case '#': goto yy175; - case '$': goto yy164; - case '%': goto yy158; - case '&': goto yy159; - case '\'': goto yy177; - case '(': goto yy146; + case ' ': goto yy140; + case '!': goto yy153; + case '"': goto yy180; + case '#': goto yy176; + case '$': goto yy165; + case '%': goto yy159; + case '&': goto yy160; + case '\'': goto yy178; + case '(': goto yy147; case ')': case ',': case ';': case '@': case '[': case ']': - case '~': goto yy165; - case '*': goto yy155; - case '+': goto yy151; - case '-': goto yy137; - case '.': goto yy157; - case '/': goto yy156; - case '0': goto yy171; + case '~': goto yy166; + case '*': goto yy156; + case '+': goto yy152; + case '-': goto yy138; + case '.': goto yy158; + case '/': goto yy157; + case '0': goto yy172; case '1': case '2': case '3': @@ -2320,16 +2320,16 @@ yyc_ST_IN_SCRIPTING: case '6': case '7': case '8': - case '9': goto yy173; - case ':': goto yy141; - case '<': goto yy153; - case '=': goto yy149; - case '>': goto yy154; - case '?': goto yy166; + case '9': goto yy174; + case ':': goto yy142; + case '<': goto yy154; + case '=': goto yy150; + case '>': goto yy155; + case '?': goto yy167; case 'A': - case 'a': goto yy132; + case 'a': goto yy133; case 'B': - case 'b': goto yy134; + case 'b': goto yy135; case 'C': case 'c': goto yy127; case 'D': @@ -2339,39 +2339,41 @@ yyc_ST_IN_SCRIPTING: case 'F': case 'f': goto yy126; case 'G': - case 'g': goto yy135; + case 'g': goto yy136; case 'I': - case 'i': goto yy130; + case 'i': goto yy131; case 'L': - case 'l': goto yy150; + case 'l': goto yy151; case 'N': - case 'n': goto yy144; + case 'n': goto yy145; case 'O': - case 'o': goto yy162; + case 'o': goto yy163; case 'P': - case 'p': goto yy136; + case 'p': goto yy137; case 'R': case 'r': goto yy128; case 'S': - case 's': goto yy133; + case 's': goto yy134; case 'T': - case 't': goto yy129; + case 't': goto yy130; case 'U': - case 'u': goto yy147; + case 'u': goto yy148; case 'V': - case 'v': goto yy145; + case 'v': goto yy146; case 'W': - case 'w': goto yy131; + case 'w': goto yy132; case 'X': - case 'x': goto yy163; - case '\\': goto yy142; - case '^': goto yy161; - case '_': goto yy148; - case '`': goto yy181; - case '{': goto yy167; - case '|': goto yy160; - case '}': goto yy169; - default: goto yy174; + case 'x': goto yy164; + case 'Y': + case 'y': goto yy129; + case '\\': goto yy143; + case '^': goto yy162; + case '_': goto yy149; + case '`': goto yy182; + case '{': goto yy168; + case '|': goto yy161; + case '}': goto yy170; + default: goto yy175; } yy123: YYDEBUG(123, *YYCURSOR); @@ -2379,49 +2381,49 @@ yy123: YYDEBUG(-1, yych); switch ((yych = *YYCURSOR)) { case 'C': - case 'c': goto yy726; + case 'c': goto yy732; case 'L': - case 'l': goto yy727; + case 'l': goto yy733; case 'M': - case 'm': goto yy728; + case 'm': goto yy734; case 'N': - case 'n': goto yy729; + case 'n': goto yy735; case 'V': - case 'v': goto yy730; + case 'v': goto yy736; case 'X': - case 'x': goto yy731; - default: goto yy186; + case 'x': goto yy737; + default: goto yy187; } yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1896 "Zend/zend_language_scanner.l" +#line 1900 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 2405 "Zend/zend_language_scanner.c" +#line 2407 "Zend/zend_language_scanner.c" yy125: YYDEBUG(125, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'H') { - if (yych == 'E') goto yy708; - goto yy186; + if (yych == 'E') goto yy714; + goto yy187; } else { - if (yych <= 'I') goto yy709; - if (yych <= 'N') goto yy186; - goto yy710; + if (yych <= 'I') goto yy715; + if (yych <= 'N') goto yy187; + goto yy716; } } else { if (yych <= 'h') { - if (yych == 'e') goto yy708; - goto yy186; + if (yych == 'e') goto yy714; + goto yy187; } else { - if (yych <= 'i') goto yy709; - if (yych == 'o') goto yy710; - goto yy186; + if (yych <= 'i') goto yy715; + if (yych == 'o') goto yy716; + goto yy187; } } yy126: @@ -2429,21 +2431,21 @@ yy126: yych = *++YYCURSOR; if (yych <= 'U') { if (yych <= 'N') { - if (yych == 'I') goto yy687; - goto yy186; + if (yych == 'I') goto yy693; + goto yy187; } else { - if (yych <= 'O') goto yy688; - if (yych <= 'T') goto yy186; - goto yy689; + if (yych <= 'O') goto yy694; + if (yych <= 'T') goto yy187; + goto yy695; } } else { if (yych <= 'n') { - if (yych == 'i') goto yy687; - goto yy186; + if (yych == 'i') goto yy693; + goto yy187; } else { - if (yych <= 'o') goto yy688; - if (yych == 'u') goto yy689; - goto yy186; + if (yych <= 'o') goto yy694; + if (yych == 'u') goto yy695; + goto yy187; } } yy127: @@ -2451,196 +2453,202 @@ yy127: yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'K') { - if (yych == 'A') goto yy652; - goto yy186; + if (yych == 'A') goto yy658; + goto yy187; } else { - if (yych <= 'L') goto yy653; - if (yych <= 'N') goto yy186; - goto yy654; + if (yych <= 'L') goto yy659; + if (yych <= 'N') goto yy187; + goto yy660; } } else { if (yych <= 'k') { - if (yych == 'a') goto yy652; - goto yy186; + if (yych == 'a') goto yy658; + goto yy187; } else { - if (yych <= 'l') goto yy653; - if (yych == 'o') goto yy654; - goto yy186; + if (yych <= 'l') goto yy659; + if (yych == 'o') goto yy660; + goto yy187; } } yy128: YYDEBUG(128, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy634; - if (yych == 'e') goto yy634; - goto yy186; + if (yych == 'E') goto yy640; + if (yych == 'e') goto yy640; + goto yy187; yy129: YYDEBUG(129, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'R') { - if (yych == 'H') goto yy622; - if (yych <= 'Q') goto yy186; - goto yy623; - } else { - if (yych <= 'h') { - if (yych <= 'g') goto yy186; - goto yy622; - } else { - if (yych == 'r') goto yy623; - goto yy186; - } - } + if (yych == 'I') goto yy635; + if (yych == 'i') goto yy635; + goto yy187; yy130: YYDEBUG(130, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'S') { - if (yych <= 'L') { - if (yych == 'F') goto yy569; - goto yy186; - } else { - if (yych <= 'M') goto yy571; - if (yych <= 'N') goto yy572; - if (yych <= 'R') goto yy186; - goto yy573; - } + if (yych <= 'R') { + if (yych == 'H') goto yy623; + if (yych <= 'Q') goto yy187; + goto yy624; } else { - if (yych <= 'm') { - if (yych == 'f') goto yy569; - if (yych <= 'l') goto yy186; - goto yy571; + if (yych <= 'h') { + if (yych <= 'g') goto yy187; + goto yy623; } else { - if (yych <= 'n') goto yy572; - if (yych == 's') goto yy573; - goto yy186; + if (yych == 'r') goto yy624; + goto yy187; } } yy131: YYDEBUG(131, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy564; - if (yych == 'h') goto yy564; - goto yy186; + if (yych <= 'S') { + if (yych <= 'L') { + if (yych == 'F') goto yy570; + goto yy187; + } else { + if (yych <= 'M') goto yy572; + if (yych <= 'N') goto yy573; + if (yych <= 'R') goto yy187; + goto yy574; + } + } else { + if (yych <= 'm') { + if (yych == 'f') goto yy570; + if (yych <= 'l') goto yy187; + goto yy572; + } else { + if (yych <= 'n') goto yy573; + if (yych == 's') goto yy574; + goto yy187; + } + } yy132: YYDEBUG(132, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'S') { - if (yych <= 'M') { - if (yych == 'B') goto yy546; - goto yy186; - } else { - if (yych <= 'N') goto yy547; - if (yych <= 'Q') goto yy186; - if (yych <= 'R') goto yy548; - goto yy549; - } - } else { - if (yych <= 'n') { - if (yych == 'b') goto yy546; - if (yych <= 'm') goto yy186; - goto yy547; - } else { - if (yych <= 'q') goto yy186; - if (yych <= 'r') goto yy548; - if (yych <= 's') goto yy549; - goto yy186; - } - } + if (yych == 'H') goto yy565; + if (yych == 'h') goto yy565; + goto yy187; yy133: YYDEBUG(133, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'W') { - if (yych == 'T') goto yy534; - if (yych <= 'V') goto yy186; - goto yy535; - } else { - if (yych <= 't') { - if (yych <= 's') goto yy186; - goto yy534; + if (yych <= 'S') { + if (yych <= 'M') { + if (yych == 'B') goto yy547; + goto yy187; } else { - if (yych == 'w') goto yy535; - goto yy186; + if (yych <= 'N') goto yy548; + if (yych <= 'Q') goto yy187; + if (yych <= 'R') goto yy549; + goto yy550; + } + } else { + if (yych <= 'n') { + if (yych == 'b') goto yy547; + if (yych <= 'm') goto yy187; + goto yy548; + } else { + if (yych <= 'q') goto yy187; + if (yych <= 'r') goto yy549; + if (yych <= 's') goto yy550; + goto yy187; } } yy134: YYDEBUG(134, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= ';') { - if (yych <= '"') { - if (yych <= '!') goto yy186; - goto yy526; - } else { - if (yych == '\'') goto yy527; - goto yy186; - } + yych = *++YYCURSOR; + if (yych <= 'W') { + if (yych == 'T') goto yy535; + if (yych <= 'V') goto yy187; + goto yy536; } else { - if (yych <= 'R') { - if (yych <= '<') goto yy525; - if (yych <= 'Q') goto yy186; - goto yy528; + if (yych <= 't') { + if (yych <= 's') goto yy187; + goto yy535; } else { - if (yych == 'r') goto yy528; - goto yy186; + if (yych == 'w') goto yy536; + goto yy187; } } yy135: YYDEBUG(135, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'O') { - if (yych == 'L') goto yy515; - if (yych <= 'N') goto yy186; - goto yy516; - } else { - if (yych <= 'l') { - if (yych <= 'k') goto yy186; - goto yy515; + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= ';') { + if (yych <= '"') { + if (yych <= '!') goto yy187; + goto yy527; } else { - if (yych == 'o') goto yy516; - goto yy186; + if (yych == '\'') goto yy528; + goto yy187; + } + } else { + if (yych <= 'R') { + if (yych <= '<') goto yy526; + if (yych <= 'Q') goto yy187; + goto yy529; + } else { + if (yych == 'r') goto yy529; + goto yy187; } } yy136: YYDEBUG(136, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'U') { - if (yych == 'R') goto yy491; - if (yych <= 'T') goto yy186; - goto yy492; + if (yych <= 'O') { + if (yych == 'L') goto yy516; + if (yych <= 'N') goto yy187; + goto yy517; } else { - if (yych <= 'r') { - if (yych <= 'q') goto yy186; - goto yy491; + if (yych <= 'l') { + if (yych <= 'k') goto yy187; + goto yy516; } else { - if (yych == 'u') goto yy492; - goto yy186; + if (yych == 'o') goto yy517; + goto yy187; } } yy137: YYDEBUG(137, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) <= '<') { - if (yych == '-') goto yy487; + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'R') goto yy492; + if (yych <= 'T') goto yy187; + goto yy493; } else { - if (yych <= '=') goto yy485; - if (yych <= '>') goto yy489; + if (yych <= 'r') { + if (yych <= 'q') goto yy187; + goto yy492; + } else { + if (yych == 'u') goto yy493; + goto yy187; + } } yy138: YYDEBUG(138, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '<') { + if (yych == '-') goto yy488; + } else { + if (yych <= '=') goto yy486; + if (yych <= '>') goto yy490; + } +yy139: + YYDEBUG(139, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1438 "Zend/zend_language_scanner.l" +#line 1442 "Zend/zend_language_scanner.l" { return yytext[0]; } -#line 2635 "Zend/zend_language_scanner.c" -yy139: - YYDEBUG(139, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy484; +#line 2643 "Zend/zend_language_scanner.c" yy140: YYDEBUG(140, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy485; +yy141: + YYDEBUG(141, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1169 "Zend/zend_language_scanner.l" +#line 1173 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -2648,261 +2656,261 @@ yy140: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 2652 "Zend/zend_language_scanner.c" -yy141: - YYDEBUG(141, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == ':') goto yy481; - goto yy138; +#line 2660 "Zend/zend_language_scanner.c" yy142: YYDEBUG(142, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych == ':') goto yy482; + goto yy139; +yy143: YYDEBUG(143, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(144, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1198 "Zend/zend_language_scanner.l" +#line 1202 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } -#line 2667 "Zend/zend_language_scanner.c" -yy144: - YYDEBUG(144, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'E') { - if (yych == 'A') goto yy469; - if (yych <= 'D') goto yy186; - goto yy470; - } else { - if (yych <= 'a') { - if (yych <= '`') goto yy186; - goto yy469; - } else { - if (yych == 'e') goto yy470; - goto yy186; - } - } +#line 2675 "Zend/zend_language_scanner.c" yy145: YYDEBUG(145, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy466; - if (yych == 'a') goto yy466; - goto yy186; + if (yych <= 'E') { + if (yych == 'A') goto yy470; + if (yych <= 'D') goto yy187; + goto yy471; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy187; + goto yy470; + } else { + if (yych == 'e') goto yy471; + goto yy187; + } + } yy146: YYDEBUG(146, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy467; + if (yych == 'a') goto yy467; + goto yy187; +yy147: + YYDEBUG(147, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'S') { if (yych <= 'D') { if (yych <= ' ') { - if (yych == '\t') goto yy391; - if (yych <= 0x1F) goto yy138; - goto yy391; + if (yych == '\t') goto yy392; + if (yych <= 0x1F) goto yy139; + goto yy392; } else { - if (yych <= '@') goto yy138; - if (yych == 'C') goto yy138; - goto yy391; + if (yych <= '@') goto yy139; + if (yych == 'C') goto yy139; + goto yy392; } } else { if (yych <= 'I') { - if (yych == 'F') goto yy391; - if (yych <= 'H') goto yy138; - goto yy391; + if (yych == 'F') goto yy392; + if (yych <= 'H') goto yy139; + goto yy392; } else { - if (yych == 'O') goto yy391; - if (yych <= 'Q') goto yy138; - goto yy391; + if (yych == 'O') goto yy392; + if (yych <= 'Q') goto yy139; + goto yy392; } } } else { if (yych <= 'f') { if (yych <= 'b') { - if (yych == 'U') goto yy391; - if (yych <= '`') goto yy138; - goto yy391; + if (yych == 'U') goto yy392; + if (yych <= '`') goto yy139; + goto yy392; } else { - if (yych == 'd') goto yy391; - if (yych <= 'e') goto yy138; - goto yy391; + if (yych == 'd') goto yy392; + if (yych <= 'e') goto yy139; + goto yy392; } } else { if (yych <= 'o') { - if (yych == 'i') goto yy391; - if (yych <= 'n') goto yy138; - goto yy391; + if (yych == 'i') goto yy392; + if (yych <= 'n') goto yy139; + goto yy392; } else { if (yych <= 's') { - if (yych <= 'q') goto yy138; - goto yy391; + if (yych <= 'q') goto yy139; + goto yy392; } else { - if (yych == 'u') goto yy391; - goto yy138; + if (yych == 'u') goto yy392; + goto yy139; } } } } -yy147: - YYDEBUG(147, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'S') { - if (yych == 'N') goto yy382; - if (yych <= 'R') goto yy186; - goto yy383; - } else { - if (yych <= 'n') { - if (yych <= 'm') goto yy186; - goto yy382; - } else { - if (yych == 's') goto yy383; - goto yy186; - } - } yy148: YYDEBUG(148, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '_') goto yy300; - goto yy186; + if (yych <= 'S') { + if (yych == 'N') goto yy383; + if (yych <= 'R') goto yy187; + goto yy384; + } else { + if (yych <= 'n') { + if (yych <= 'm') goto yy187; + goto yy383; + } else { + if (yych == 's') goto yy384; + goto yy187; + } + } yy149: YYDEBUG(149, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '<') goto yy138; - if (yych <= '=') goto yy294; - if (yych <= '>') goto yy296; - goto yy138; + if (yych == '_') goto yy301; + goto yy187; yy150: YYDEBUG(150, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy290; - if (yych == 'i') goto yy290; - goto yy186; + if (yych <= '<') goto yy139; + if (yych <= '=') goto yy295; + if (yych <= '>') goto yy297; + goto yy139; yy151: YYDEBUG(151, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '+') goto yy288; - if (yych == '=') goto yy286; - goto yy138; + if (yych == 'I') goto yy291; + if (yych == 'i') goto yy291; + goto yy187; yy152: YYDEBUG(152, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy283; - goto yy138; + if (yych == '+') goto yy289; + if (yych == '=') goto yy287; + goto yy139; yy153: YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '=') goto yy284; + goto yy139; +yy154: + YYDEBUG(154, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= ';') { - if (yych == '/') goto yy255; - goto yy138; + if (yych == '/') goto yy256; + goto yy139; } else { - if (yych <= '<') goto yy253; - if (yych <= '=') goto yy256; - if (yych <= '>') goto yy258; - goto yy138; + if (yych <= '<') goto yy254; + if (yych <= '=') goto yy257; + if (yych <= '>') goto yy259; + goto yy139; } -yy154: - YYDEBUG(154, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '<') goto yy138; - if (yych <= '=') goto yy249; - if (yych <= '>') goto yy247; - goto yy138; yy155: YYDEBUG(155, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy245; - goto yy138; + if (yych <= '<') goto yy139; + if (yych <= '=') goto yy250; + if (yych <= '>') goto yy248; + goto yy139; yy156: YYDEBUG(156, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '.') { - if (yych == '*') goto yy237; - goto yy138; - } else { - if (yych <= '/') goto yy239; - if (yych == '=') goto yy240; - goto yy138; - } + if (yych == '=') goto yy246; + goto yy139; yy157: YYDEBUG(157, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '/') goto yy138; - if (yych <= '9') goto yy233; - if (yych == '=') goto yy235; - goto yy138; + if (yych <= '.') { + if (yych == '*') goto yy238; + goto yy139; + } else { + if (yych <= '/') goto yy240; + if (yych == '=') goto yy241; + goto yy139; + } yy158: YYDEBUG(158, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '<') goto yy138; - if (yych <= '=') goto yy229; - if (yych <= '>') goto yy227; - goto yy138; + if (yych <= '/') goto yy139; + if (yych <= '9') goto yy234; + if (yych == '=') goto yy236; + goto yy139; yy159: YYDEBUG(159, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '&') goto yy223; - if (yych == '=') goto yy225; - goto yy138; + if (yych <= '<') goto yy139; + if (yych <= '=') goto yy230; + if (yych <= '>') goto yy228; + goto yy139; yy160: YYDEBUG(160, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy221; - if (yych == '|') goto yy219; - goto yy138; + if (yych == '&') goto yy224; + if (yych == '=') goto yy226; + goto yy139; yy161: YYDEBUG(161, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '=') goto yy217; - goto yy138; + if (yych == '=') goto yy222; + if (yych == '|') goto yy220; + goto yy139; yy162: YYDEBUG(162, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy215; - if (yych == 'r') goto yy215; - goto yy186; + if (yych == '=') goto yy218; + goto yy139; yy163: YYDEBUG(163, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy212; - if (yych == 'o') goto yy212; - goto yy186; + if (yych == 'R') goto yy216; + if (yych == 'r') goto yy216; + goto yy187; yy164: YYDEBUG(164, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= '_') { - if (yych <= '@') goto yy138; - if (yych <= 'Z') goto yy209; - if (yych <= '^') goto yy138; - goto yy209; - } else { - if (yych <= '`') goto yy138; - if (yych <= 'z') goto yy209; - if (yych <= '~') goto yy138; - goto yy209; - } + if (yych == 'O') goto yy213; + if (yych == 'o') goto yy213; + goto yy187; yy165: YYDEBUG(165, *YYCURSOR); yych = *++YYCURSOR; - goto yy138; + if (yych <= '_') { + if (yych <= '@') goto yy139; + if (yych <= 'Z') goto yy210; + if (yych <= '^') goto yy139; + goto yy210; + } else { + if (yych <= '`') goto yy139; + if (yych <= 'z') goto yy210; + if (yych <= '~') goto yy139; + goto yy210; + } yy166: YYDEBUG(166, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '>') goto yy205; - goto yy138; + goto yy139; yy167: YYDEBUG(167, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych == '>') goto yy206; + goto yy139; +yy168: YYDEBUG(168, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(169, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1443 "Zend/zend_language_scanner.l" +#line 1447 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; } -#line 2900 "Zend/zend_language_scanner.c" -yy169: - YYDEBUG(169, *YYCURSOR); - ++YYCURSOR; +#line 2908 "Zend/zend_language_scanner.c" +yy170: YYDEBUG(170, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(171, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1455 "Zend/zend_language_scanner.l" +#line 1459 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2910,35 +2918,35 @@ yy169: } return '}'; } -#line 2914 "Zend/zend_language_scanner.c" -yy171: - YYDEBUG(171, *YYCURSOR); +#line 2922 "Zend/zend_language_scanner.c" +yy172: + YYDEBUG(172, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'E') { if (yych <= '9') { - if (yych == '.') goto yy187; - if (yych >= '0') goto yy190; + if (yych == '.') goto yy188; + if (yych >= '0') goto yy191; } else { - if (yych == 'B') goto yy198; - if (yych >= 'E') goto yy192; + if (yych == 'B') goto yy199; + if (yych >= 'E') goto yy193; } } else { if (yych <= 'b') { - if (yych == 'X') goto yy197; - if (yych >= 'b') goto yy198; + if (yych == 'X') goto yy198; + if (yych >= 'b') goto yy199; } else { if (yych <= 'e') { - if (yych >= 'e') goto yy192; + if (yych >= 'e') goto yy193; } else { - if (yych == 'x') goto yy197; + if (yych == 'x') goto yy198; } } } -yy172: - YYDEBUG(172, *YYCURSOR); +yy173: + YYDEBUG(173, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1506 "Zend/zend_language_scanner.l" +#line 1510 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ zendlval->value.lval = strtol(yytext, NULL, 0); @@ -2959,35 +2967,35 @@ yy172: zendlval->type = IS_LONG; return T_LNUMBER; } -#line 2963 "Zend/zend_language_scanner.c" -yy173: - YYDEBUG(173, *YYCURSOR); +#line 2971 "Zend/zend_language_scanner.c" +yy174: + YYDEBUG(174, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '9') { - if (yych == '.') goto yy187; - if (yych <= '/') goto yy172; - goto yy190; + if (yych == '.') goto yy188; + if (yych <= '/') goto yy173; + goto yy191; } else { if (yych <= 'E') { - if (yych <= 'D') goto yy172; - goto yy192; + if (yych <= 'D') goto yy173; + goto yy193; } else { - if (yych == 'e') goto yy192; - goto yy172; + if (yych == 'e') goto yy193; + goto yy173; } } -yy174: - YYDEBUG(174, *YYCURSOR); - yych = *++YYCURSOR; - goto yy186; yy175: YYDEBUG(175, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + goto yy187; yy176: YYDEBUG(176, *YYCURSOR); + ++YYCURSOR; +yy177: + YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1903 "Zend/zend_language_scanner.l" +#line 1907 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3021,14 +3029,14 @@ yy176: return T_COMMENT; } -#line 3025 "Zend/zend_language_scanner.c" -yy177: - YYDEBUG(177, *YYCURSOR); - ++YYCURSOR; +#line 3033 "Zend/zend_language_scanner.c" yy178: YYDEBUG(178, *YYCURSOR); + ++YYCURSOR; +yy179: + YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1994 "Zend/zend_language_scanner.l" +#line 1998 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3096,14 +3104,14 @@ yy178: } return T_CONSTANT_ENCAPSED_STRING; } -#line 3100 "Zend/zend_language_scanner.c" -yy179: - YYDEBUG(179, *YYCURSOR); - ++YYCURSOR; +#line 3108 "Zend/zend_language_scanner.c" yy180: YYDEBUG(180, *YYCURSOR); + ++YYCURSOR; +yy181: + YYDEBUG(181, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2063 "Zend/zend_language_scanner.l" +#line 2067 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3144,24 +3152,24 @@ yy180: BEGIN(ST_DOUBLE_QUOTES); return '"'; } -#line 3148 "Zend/zend_language_scanner.c" -yy181: - YYDEBUG(181, *YYCURSOR); - ++YYCURSOR; +#line 3156 "Zend/zend_language_scanner.c" +yy182: YYDEBUG(182, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(183, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2154 "Zend/zend_language_scanner.l" +#line 2158 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; } -#line 3159 "Zend/zend_language_scanner.c" -yy183: - YYDEBUG(183, *YYCURSOR); - ++YYCURSOR; +#line 3167 "Zend/zend_language_scanner.c" +yy184: YYDEBUG(184, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2412 "Zend/zend_language_scanner.l" +#line 2416 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3170,132 +3178,132 @@ yy183: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 3174 "Zend/zend_language_scanner.c" -yy185: - YYDEBUG(185, *YYCURSOR); +#line 3182 "Zend/zend_language_scanner.c" +yy186: + YYDEBUG(186, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy186: - YYDEBUG(186, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy185; - } - goto yy124; yy187: YYDEBUG(187, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy186; + } + goto yy124; +yy188: + YYDEBUG(188, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; - YYDEBUG(188, *YYCURSOR); - if (yybm[0+yych] & 8) { - goto yy187; - } - if (yych == 'E') goto yy192; - if (yych == 'e') goto yy192; -yy189: YYDEBUG(189, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy188; + } + if (yych == 'E') goto yy193; + if (yych == 'e') goto yy193; +yy190: + YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1571 "Zend/zend_language_scanner.l" +#line 1575 "Zend/zend_language_scanner.l" { zendlval->value.dval = zend_strtod(yytext, NULL); zendlval->type = IS_DOUBLE; return T_DNUMBER; } -#line 3207 "Zend/zend_language_scanner.c" -yy190: - YYDEBUG(190, *YYCURSOR); +#line 3215 "Zend/zend_language_scanner.c" +yy191: + YYDEBUG(191, *YYCURSOR); yyaccept = 2; YYMARKER = ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; - YYDEBUG(191, *YYCURSOR); + YYDEBUG(192, *YYCURSOR); if (yych <= '9') { - if (yych == '.') goto yy187; - if (yych <= '/') goto yy172; - goto yy190; + if (yych == '.') goto yy188; + if (yych <= '/') goto yy173; + goto yy191; } else { if (yych <= 'E') { - if (yych <= 'D') goto yy172; + if (yych <= 'D') goto yy173; } else { - if (yych != 'e') goto yy172; + if (yych != 'e') goto yy173; } } -yy192: - YYDEBUG(192, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= ',') { - if (yych == '+') goto yy194; - } else { - if (yych <= '-') goto yy194; - if (yych <= '/') goto yy193; - if (yych <= '9') goto yy195; - } yy193: YYDEBUG(193, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy195; + } else { + if (yych <= '-') goto yy195; + if (yych <= '/') goto yy194; + if (yych <= '9') goto yy196; + } +yy194: + YYDEBUG(194, *YYCURSOR); YYCURSOR = YYMARKER; if (yyaccept <= 2) { if (yyaccept <= 1) { if (yyaccept <= 0) { goto yy124; } else { - goto yy138; + goto yy139; } } else { - goto yy172; + goto yy173; } } else { if (yyaccept <= 4) { if (yyaccept <= 3) { - goto yy189; + goto yy190; } else { - goto yy238; + goto yy239; } } else { - goto yy254; + goto yy255; } } -yy194: - YYDEBUG(194, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= '/') goto yy193; - if (yych >= ':') goto yy193; yy195: YYDEBUG(195, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= '/') goto yy194; + if (yych >= ':') goto yy194; +yy196: + YYDEBUG(196, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(196, *YYCURSOR); - if (yych <= '/') goto yy189; - if (yych <= '9') goto yy195; - goto yy189; -yy197: YYDEBUG(197, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 32) { - goto yy202; - } - goto yy193; + if (yych <= '/') goto yy190; + if (yych <= '9') goto yy196; + goto yy190; yy198: YYDEBUG(198, *YYCURSOR); yych = *++YYCURSOR; - if (yybm[0+yych] & 16) { - goto yy199; + if (yybm[0+yych] & 32) { + goto yy203; } - goto yy193; + goto yy194; yy199: YYDEBUG(199, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy200; + } + goto yy194; +yy200: + YYDEBUG(200, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(200, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy199; - } YYDEBUG(201, *YYCURSOR); + if (yybm[0+yych] & 16) { + goto yy200; + } + YYDEBUG(202, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1481 "Zend/zend_language_scanner.l" +#line 1485 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3320,19 +3328,19 @@ yy199: return T_DNUMBER; } } -#line 3324 "Zend/zend_language_scanner.c" -yy202: - YYDEBUG(202, *YYCURSOR); +#line 3332 "Zend/zend_language_scanner.c" +yy203: + YYDEBUG(203, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(203, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy202; - } YYDEBUG(204, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy203; + } + YYDEBUG(205, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1527 "Zend/zend_language_scanner.l" +#line 1531 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3357,16 +3365,16 @@ yy202: return T_DNUMBER; } } -#line 3361 "Zend/zend_language_scanner.c" -yy205: - YYDEBUG(205, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy207; - if (yych == '\r') goto yy208; +#line 3369 "Zend/zend_language_scanner.c" yy206: YYDEBUG(206, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy208; + if (yych == '\r') goto yy209; +yy207: + YYDEBUG(207, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1971 "Zend/zend_language_scanner.l" +#line 1975 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -3374,137 +3382,137 @@ yy206: BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } -#line 3378 "Zend/zend_language_scanner.c" -yy207: - YYDEBUG(207, *YYCURSOR); - yych = *++YYCURSOR; - goto yy206; +#line 3386 "Zend/zend_language_scanner.c" yy208: YYDEBUG(208, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy207; - goto yy206; + goto yy207; yy209: YYDEBUG(209, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy208; + goto yy207; +yy210: + YYDEBUG(210, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(210, *YYCURSOR); + YYDEBUG(211, *YYCURSOR); if (yych <= '^') { if (yych <= '9') { - if (yych >= '0') goto yy209; + if (yych >= '0') goto yy210; } else { - if (yych <= '@') goto yy211; - if (yych <= 'Z') goto yy209; + if (yych <= '@') goto yy212; + if (yych <= 'Z') goto yy210; } } else { if (yych <= '`') { - if (yych <= '_') goto yy209; + if (yych <= '_') goto yy210; } else { - if (yych <= 'z') goto yy209; - if (yych >= 0x7F) goto yy209; + if (yych <= 'z') goto yy210; + if (yych >= 0x7F) goto yy210; } } -yy211: - YYDEBUG(211, *YYCURSOR); +yy212: + YYDEBUG(212, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 3418 "Zend/zend_language_scanner.c" -yy212: - YYDEBUG(212, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy213; - if (yych != 'r') goto yy186; +#line 3426 "Zend/zend_language_scanner.c" yy213: YYDEBUG(213, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy214; + if (yych != 'r') goto yy187; +yy214: + YYDEBUG(214, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(214, *YYCURSOR); + YYDEBUG(215, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1426 "Zend/zend_language_scanner.l" +#line 1430 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } -#line 3436 "Zend/zend_language_scanner.c" -yy215: - YYDEBUG(215, *YYCURSOR); +#line 3444 "Zend/zend_language_scanner.c" +yy216: + YYDEBUG(216, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(216, *YYCURSOR); + YYDEBUG(217, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1418 "Zend/zend_language_scanner.l" +#line 1422 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } -#line 3449 "Zend/zend_language_scanner.c" -yy217: - YYDEBUG(217, *YYCURSOR); - ++YYCURSOR; +#line 3457 "Zend/zend_language_scanner.c" +yy218: YYDEBUG(218, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1406 "Zend/zend_language_scanner.l" - { - return T_XOR_EQUAL; -} -#line 3459 "Zend/zend_language_scanner.c" -yy219: - YYDEBUG(219, *YYCURSOR); ++YYCURSOR; - YYDEBUG(220, *YYCURSOR); + YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1410 "Zend/zend_language_scanner.l" { - return T_BOOLEAN_OR; + return T_XOR_EQUAL; } -#line 3469 "Zend/zend_language_scanner.c" -yy221: +#line 3467 "Zend/zend_language_scanner.c" +yy220: + YYDEBUG(220, *YYCURSOR); + ++YYCURSOR; YYDEBUG(221, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(222, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1402 "Zend/zend_language_scanner.l" - { - return T_OR_EQUAL; -} -#line 3479 "Zend/zend_language_scanner.c" -yy223: - YYDEBUG(223, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(224, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1414 "Zend/zend_language_scanner.l" { + return T_BOOLEAN_OR; +} +#line 3477 "Zend/zend_language_scanner.c" +yy222: + YYDEBUG(222, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(223, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1406 "Zend/zend_language_scanner.l" + { + return T_OR_EQUAL; +} +#line 3487 "Zend/zend_language_scanner.c" +yy224: + YYDEBUG(224, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(225, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1418 "Zend/zend_language_scanner.l" + { return T_BOOLEAN_AND; } -#line 3489 "Zend/zend_language_scanner.c" -yy225: - YYDEBUG(225, *YYCURSOR); - ++YYCURSOR; +#line 3497 "Zend/zend_language_scanner.c" +yy226: YYDEBUG(226, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(227, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1398 "Zend/zend_language_scanner.l" +#line 1402 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } -#line 3499 "Zend/zend_language_scanner.c" -yy227: - YYDEBUG(227, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy231; - if (yych == '\r') goto yy232; +#line 3507 "Zend/zend_language_scanner.c" yy228: YYDEBUG(228, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\n') goto yy232; + if (yych == '\r') goto yy233; +yy229: + YYDEBUG(229, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1980 "Zend/zend_language_scanner.l" +#line 1984 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); @@ -3517,61 +3525,61 @@ yy228: return yytext[0]; } } -#line 3521 "Zend/zend_language_scanner.c" -yy229: - YYDEBUG(229, *YYCURSOR); - ++YYCURSOR; +#line 3529 "Zend/zend_language_scanner.c" +yy230: YYDEBUG(230, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(231, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1386 "Zend/zend_language_scanner.l" +#line 1390 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } -#line 3531 "Zend/zend_language_scanner.c" -yy231: - YYDEBUG(231, *YYCURSOR); - yych = *++YYCURSOR; - goto yy228; +#line 3539 "Zend/zend_language_scanner.c" yy232: YYDEBUG(232, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy231; - goto yy228; + goto yy229; yy233: YYDEBUG(233, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy232; + goto yy229; +yy234: + YYDEBUG(234, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; - YYDEBUG(234, *YYCURSOR); - if (yych <= 'D') { - if (yych <= '/') goto yy189; - if (yych <= '9') goto yy233; - goto yy189; - } else { - if (yych <= 'E') goto yy192; - if (yych == 'e') goto yy192; - goto yy189; - } -yy235: YYDEBUG(235, *YYCURSOR); - ++YYCURSOR; + if (yych <= 'D') { + if (yych <= '/') goto yy190; + if (yych <= '9') goto yy234; + goto yy190; + } else { + if (yych <= 'E') goto yy193; + if (yych == 'e') goto yy193; + goto yy190; + } +yy236: YYDEBUG(236, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(237, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1382 "Zend/zend_language_scanner.l" +#line 1386 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } -#line 3566 "Zend/zend_language_scanner.c" -yy237: - YYDEBUG(237, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych == '*') goto yy242; +#line 3574 "Zend/zend_language_scanner.c" yy238: YYDEBUG(238, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '*') goto yy243; +yy239: + YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1937 "Zend/zend_language_scanner.l" +#line 1941 "Zend/zend_language_scanner.l" { int doc_com; @@ -3605,281 +3613,281 @@ yy238: return T_COMMENT; } -#line 3609 "Zend/zend_language_scanner.c" -yy239: - YYDEBUG(239, *YYCURSOR); - yych = *++YYCURSOR; - goto yy176; +#line 3617 "Zend/zend_language_scanner.c" yy240: YYDEBUG(240, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + goto yy177; +yy241: YYDEBUG(241, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(242, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1378 "Zend/zend_language_scanner.l" +#line 1382 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } -#line 3623 "Zend/zend_language_scanner.c" -yy242: - YYDEBUG(242, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 64) { - goto yy243; - } - goto yy193; +#line 3631 "Zend/zend_language_scanner.c" yy243: YYDEBUG(243, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy244; + } + goto yy194; +yy244: + YYDEBUG(244, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(244, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy243; - } - goto yy238; -yy245: YYDEBUG(245, *YYCURSOR); - ++YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy244; + } + goto yy239; +yy246: YYDEBUG(246, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1374 "Zend/zend_language_scanner.l" +#line 1378 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } -#line 3650 "Zend/zend_language_scanner.c" -yy247: - YYDEBUG(247, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '=') goto yy251; +#line 3658 "Zend/zend_language_scanner.c" +yy248: YYDEBUG(248, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy252; + YYDEBUG(249, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1434 "Zend/zend_language_scanner.l" +#line 1438 "Zend/zend_language_scanner.l" { return T_SR; } -#line 3661 "Zend/zend_language_scanner.c" -yy249: - YYDEBUG(249, *YYCURSOR); - ++YYCURSOR; +#line 3669 "Zend/zend_language_scanner.c" +yy250: YYDEBUG(250, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(251, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1362 "Zend/zend_language_scanner.l" +#line 1366 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } -#line 3671 "Zend/zend_language_scanner.c" -yy251: - YYDEBUG(251, *YYCURSOR); - ++YYCURSOR; +#line 3679 "Zend/zend_language_scanner.c" +yy252: YYDEBUG(252, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(253, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1394 "Zend/zend_language_scanner.l" +#line 1398 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } -#line 3681 "Zend/zend_language_scanner.c" -yy253: - YYDEBUG(253, *YYCURSOR); - yyaccept = 5; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= ';') goto yy254; - if (yych <= '<') goto yy269; - if (yych <= '=') goto yy267; +#line 3689 "Zend/zend_language_scanner.c" yy254: YYDEBUG(254, *YYCURSOR); + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= ';') goto yy255; + if (yych <= '<') goto yy270; + if (yych <= '=') goto yy268; +yy255: + YYDEBUG(255, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1430 "Zend/zend_language_scanner.l" +#line 1434 "Zend/zend_language_scanner.l" { return T_SL; } -#line 3696 "Zend/zend_language_scanner.c" -yy255: - YYDEBUG(255, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy260; - if (yych == 's') goto yy260; - goto yy193; +#line 3704 "Zend/zend_language_scanner.c" yy256: YYDEBUG(256, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych == 'S') goto yy261; + if (yych == 's') goto yy261; + goto yy194; +yy257: YYDEBUG(257, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(258, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1358 "Zend/zend_language_scanner.l" +#line 1362 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } -#line 3712 "Zend/zend_language_scanner.c" -yy258: - YYDEBUG(258, *YYCURSOR); - ++YYCURSOR; +#line 3720 "Zend/zend_language_scanner.c" yy259: YYDEBUG(259, *YYCURSOR); + ++YYCURSOR; +yy260: + YYDEBUG(260, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1354 "Zend/zend_language_scanner.l" +#line 1358 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } -#line 3723 "Zend/zend_language_scanner.c" -yy260: - YYDEBUG(260, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy261; - if (yych != 'c') goto yy193; +#line 3731 "Zend/zend_language_scanner.c" yy261: YYDEBUG(261, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy262; - if (yych != 'r') goto yy193; + if (yych == 'C') goto yy262; + if (yych != 'c') goto yy194; yy262: YYDEBUG(262, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy263; - if (yych != 'i') goto yy193; + if (yych == 'R') goto yy263; + if (yych != 'r') goto yy194; yy263: YYDEBUG(263, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy264; - if (yych != 'p') goto yy193; + if (yych == 'I') goto yy264; + if (yych != 'i') goto yy194; yy264: YYDEBUG(264, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy265; - if (yych != 't') goto yy193; + if (yych == 'P') goto yy265; + if (yych != 'p') goto yy194; yy265: YYDEBUG(265, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy266; + if (yych != 't') goto yy194; +yy266: + YYDEBUG(266, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; - YYDEBUG(266, *YYCURSOR); + YYDEBUG(267, *YYCURSOR); if (yych <= '\r') { - if (yych <= 0x08) goto yy193; - if (yych <= '\n') goto yy265; - if (yych <= '\f') goto yy193; - goto yy265; + if (yych <= 0x08) goto yy194; + if (yych <= '\n') goto yy266; + if (yych <= '\f') goto yy194; + goto yy266; } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy193; - goto yy265; + if (yych <= 0x1F) goto yy194; + goto yy266; } else { - if (yych == '>') goto yy205; - goto yy193; + if (yych == '>') goto yy206; + goto yy194; } } -yy267: - YYDEBUG(267, *YYCURSOR); - ++YYCURSOR; +yy268: YYDEBUG(268, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(269, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1390 "Zend/zend_language_scanner.l" +#line 1394 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } -#line 3778 "Zend/zend_language_scanner.c" -yy269: - YYDEBUG(269, *YYCURSOR); +#line 3786 "Zend/zend_language_scanner.c" +yy270: + YYDEBUG(270, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(270, *YYCURSOR); + YYDEBUG(271, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy269; + goto yy270; } if (yych <= 'Z') { if (yych <= '&') { - if (yych == '"') goto yy274; - goto yy193; + if (yych == '"') goto yy275; + goto yy194; } else { - if (yych <= '\'') goto yy273; - if (yych <= '@') goto yy193; + if (yych <= '\'') goto yy274; + if (yych <= '@') goto yy194; } } else { if (yych <= '`') { - if (yych != '_') goto yy193; + if (yych != '_') goto yy194; } else { - if (yych <= 'z') goto yy271; - if (yych <= '~') goto yy193; + if (yych <= 'z') goto yy272; + if (yych <= '~') goto yy194; } } -yy271: - YYDEBUG(271, *YYCURSOR); +yy272: + YYDEBUG(272, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(272, *YYCURSOR); + YYDEBUG(273, *YYCURSOR); if (yych <= '@') { if (yych <= '\f') { - if (yych == '\n') goto yy278; - goto yy193; + if (yych == '\n') goto yy279; + goto yy194; } else { - if (yych <= '\r') goto yy280; - if (yych <= '/') goto yy193; - if (yych <= '9') goto yy271; - goto yy193; + if (yych <= '\r') goto yy281; + if (yych <= '/') goto yy194; + if (yych <= '9') goto yy272; + goto yy194; } } else { if (yych <= '_') { - if (yych <= 'Z') goto yy271; - if (yych <= '^') goto yy193; - goto yy271; + if (yych <= 'Z') goto yy272; + if (yych <= '^') goto yy194; + goto yy272; } else { - if (yych <= '`') goto yy193; - if (yych <= 'z') goto yy271; - if (yych <= '~') goto yy193; - goto yy271; + if (yych <= '`') goto yy194; + if (yych <= 'z') goto yy272; + if (yych <= '~') goto yy194; + goto yy272; } } -yy273: - YYDEBUG(273, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\'') goto yy193; - if (yych <= '/') goto yy282; - if (yych <= '9') goto yy193; - goto yy282; yy274: YYDEBUG(274, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '"') goto yy193; - if (yych <= '/') goto yy276; - if (yych <= '9') goto yy193; - goto yy276; + if (yych == '\'') goto yy194; + if (yych <= '/') goto yy283; + if (yych <= '9') goto yy194; + goto yy283; yy275: YYDEBUG(275, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '"') goto yy194; + if (yych <= '/') goto yy277; + if (yych <= '9') goto yy194; + goto yy277; +yy276: + YYDEBUG(276, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; -yy276: - YYDEBUG(276, *YYCURSOR); +yy277: + YYDEBUG(277, *YYCURSOR); if (yych <= 'Z') { if (yych <= '/') { - if (yych != '"') goto yy193; + if (yych != '"') goto yy194; } else { - if (yych <= '9') goto yy275; - if (yych <= '@') goto yy193; - goto yy275; + if (yych <= '9') goto yy276; + if (yych <= '@') goto yy194; + goto yy276; } } else { if (yych <= '`') { - if (yych == '_') goto yy275; - goto yy193; + if (yych == '_') goto yy276; + goto yy194; } else { - if (yych <= 'z') goto yy275; - if (yych <= '~') goto yy193; - goto yy275; + if (yych <= 'z') goto yy276; + if (yych <= '~') goto yy194; + goto yy276; } } -yy277: - YYDEBUG(277, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy278; - if (yych == '\r') goto yy280; - goto yy193; yy278: YYDEBUG(278, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych == '\n') goto yy279; + if (yych == '\r') goto yy281; + goto yy194; yy279: YYDEBUG(279, *YYCURSOR); + ++YYCURSOR; +yy280: + YYDEBUG(280, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2105 "Zend/zend_language_scanner.l" +#line 2109 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -3927,255 +3935,255 @@ yy279: return T_START_HEREDOC; } -#line 3931 "Zend/zend_language_scanner.c" -yy280: - YYDEBUG(280, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy278; - goto yy279; +#line 3939 "Zend/zend_language_scanner.c" yy281: YYDEBUG(281, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy279; + goto yy280; +yy282: + YYDEBUG(282, *YYCURSOR); ++YYCURSOR; YYFILL(3); yych = *YYCURSOR; -yy282: - YYDEBUG(282, *YYCURSOR); +yy283: + YYDEBUG(283, *YYCURSOR); if (yych <= 'Z') { if (yych <= '/') { - if (yych == '\'') goto yy277; - goto yy193; + if (yych == '\'') goto yy278; + goto yy194; } else { - if (yych <= '9') goto yy281; - if (yych <= '@') goto yy193; - goto yy281; + if (yych <= '9') goto yy282; + if (yych <= '@') goto yy194; + goto yy282; } } else { if (yych <= '`') { - if (yych == '_') goto yy281; - goto yy193; + if (yych == '_') goto yy282; + goto yy194; } else { - if (yych <= 'z') goto yy281; - if (yych <= '~') goto yy193; - goto yy281; + if (yych <= 'z') goto yy282; + if (yych <= '~') goto yy194; + goto yy282; } } -yy283: - YYDEBUG(283, *YYCURSOR); - yych = *++YYCURSOR; - if (yych != '=') goto yy259; +yy284: YYDEBUG(284, *YYCURSOR); - ++YYCURSOR; + yych = *++YYCURSOR; + if (yych != '=') goto yy260; YYDEBUG(285, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1346 "Zend/zend_language_scanner.l" - { - return T_IS_NOT_IDENTICAL; -} -#line 3975 "Zend/zend_language_scanner.c" -yy286: + ++YYCURSOR; YYDEBUG(286, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(287, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1366 "Zend/zend_language_scanner.l" - { - return T_PLUS_EQUAL; -} -#line 3985 "Zend/zend_language_scanner.c" -yy288: - YYDEBUG(288, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(289, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1334 "Zend/zend_language_scanner.l" - { - return T_INC; -} -#line 3995 "Zend/zend_language_scanner.c" -yy290: - YYDEBUG(290, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy291; - if (yych != 's') goto yy186; -yy291: - YYDEBUG(291, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy292; - if (yych != 't') goto yy186; -yy292: - YYDEBUG(292, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(293, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1322 "Zend/zend_language_scanner.l" - { - return T_LIST; -} -#line 4018 "Zend/zend_language_scanner.c" -yy294: - YYDEBUG(294, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) == '=') goto yy298; - YYDEBUG(295, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1350 "Zend/zend_language_scanner.l" { + return T_IS_NOT_IDENTICAL; +} +#line 3983 "Zend/zend_language_scanner.c" +yy287: + YYDEBUG(287, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(288, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1370 "Zend/zend_language_scanner.l" + { + return T_PLUS_EQUAL; +} +#line 3993 "Zend/zend_language_scanner.c" +yy289: + YYDEBUG(289, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(290, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1338 "Zend/zend_language_scanner.l" + { + return T_INC; +} +#line 4003 "Zend/zend_language_scanner.c" +yy291: + YYDEBUG(291, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy292; + if (yych != 's') goto yy187; +yy292: + YYDEBUG(292, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy293; + if (yych != 't') goto yy187; +yy293: + YYDEBUG(293, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(294, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1326 "Zend/zend_language_scanner.l" + { + return T_LIST; +} +#line 4026 "Zend/zend_language_scanner.c" +yy295: + YYDEBUG(295, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy299; + YYDEBUG(296, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1354 "Zend/zend_language_scanner.l" + { return T_IS_EQUAL; } -#line 4029 "Zend/zend_language_scanner.c" -yy296: - YYDEBUG(296, *YYCURSOR); - ++YYCURSOR; +#line 4037 "Zend/zend_language_scanner.c" +yy297: YYDEBUG(297, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(298, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1318 "Zend/zend_language_scanner.l" +#line 1322 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } -#line 4039 "Zend/zend_language_scanner.c" -yy298: - YYDEBUG(298, *YYCURSOR); - ++YYCURSOR; +#line 4047 "Zend/zend_language_scanner.c" +yy299: YYDEBUG(299, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(300, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1342 "Zend/zend_language_scanner.l" +#line 1346 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } -#line 4049 "Zend/zend_language_scanner.c" -yy300: - YYDEBUG(300, *YYCURSOR); +#line 4057 "Zend/zend_language_scanner.c" +yy301: + YYDEBUG(301, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'C': - case 'c': goto yy302; + case 'c': goto yy303; case 'D': - case 'd': goto yy307; + case 'd': goto yy308; case 'F': - case 'f': goto yy304; + case 'f': goto yy305; case 'H': - case 'h': goto yy301; + case 'h': goto yy302; case 'L': - case 'l': goto yy306; + case 'l': goto yy307; case 'M': - case 'm': goto yy305; + case 'm': goto yy306; case 'N': - case 'n': goto yy308; + case 'n': goto yy309; case 'T': - case 't': goto yy303; - default: goto yy186; + case 't': goto yy304; + default: goto yy187; } -yy301: - YYDEBUG(301, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy369; - if (yych == 'a') goto yy369; - goto yy186; yy302: YYDEBUG(302, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy362; - if (yych == 'l') goto yy362; - goto yy186; + if (yych == 'A') goto yy370; + if (yych == 'a') goto yy370; + goto yy187; yy303: YYDEBUG(303, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy355; - if (yych == 'r') goto yy355; - goto yy186; + if (yych == 'L') goto yy363; + if (yych == 'l') goto yy363; + goto yy187; yy304: YYDEBUG(304, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'U') { - if (yych == 'I') goto yy339; - if (yych <= 'T') goto yy186; - goto yy340; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy186; - goto yy339; - } else { - if (yych == 'u') goto yy340; - goto yy186; - } - } + if (yych == 'R') goto yy356; + if (yych == 'r') goto yy356; + goto yy187; yy305: YYDEBUG(305, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy331; - if (yych == 'e') goto yy331; - goto yy186; + if (yych <= 'U') { + if (yych == 'I') goto yy340; + if (yych <= 'T') goto yy187; + goto yy341; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy187; + goto yy340; + } else { + if (yych == 'u') goto yy341; + goto yy187; + } + } yy306: YYDEBUG(306, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy325; - if (yych == 'i') goto yy325; - goto yy186; + if (yych == 'E') goto yy332; + if (yych == 'e') goto yy332; + goto yy187; yy307: YYDEBUG(307, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy320; - if (yych == 'i') goto yy320; - goto yy186; + if (yych == 'I') goto yy326; + if (yych == 'i') goto yy326; + goto yy187; yy308: YYDEBUG(308, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy309; - if (yych != 'a') goto yy186; + if (yych == 'I') goto yy321; + if (yych == 'i') goto yy321; + goto yy187; yy309: YYDEBUG(309, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy310; - if (yych != 'm') goto yy186; + if (yych == 'A') goto yy310; + if (yych != 'a') goto yy187; yy310: YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy311; - if (yych != 'e') goto yy186; + if (yych == 'M') goto yy311; + if (yych != 'm') goto yy187; yy311: YYDEBUG(311, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy312; - if (yych != 's') goto yy186; + if (yych == 'E') goto yy312; + if (yych != 'e') goto yy187; yy312: YYDEBUG(312, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy313; - if (yych != 'p') goto yy186; + if (yych == 'S') goto yy313; + if (yych != 's') goto yy187; yy313: YYDEBUG(313, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy314; - if (yych != 'a') goto yy186; + if (yych == 'P') goto yy314; + if (yych != 'p') goto yy187; yy314: YYDEBUG(314, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy315; - if (yych != 'c') goto yy186; + if (yych == 'A') goto yy315; + if (yych != 'a') goto yy187; yy315: YYDEBUG(315, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy316; - if (yych != 'e') goto yy186; + if (yych == 'C') goto yy316; + if (yych != 'c') goto yy187; yy316: YYDEBUG(316, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'E') goto yy317; + if (yych != 'e') goto yy187; +yy317: YYDEBUG(317, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(318, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(319, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(319, *YYCURSOR); + YYDEBUG(320, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1706 "Zend/zend_language_scanner.l" +#line 1710 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -4185,27 +4193,27 @@ yy316: } return T_NS_C; } -#line 4189 "Zend/zend_language_scanner.c" -yy320: - YYDEBUG(320, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy321; - if (yych != 'r') goto yy186; +#line 4197 "Zend/zend_language_scanner.c" yy321: YYDEBUG(321, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'R') goto yy322; + if (yych != 'r') goto yy187; +yy322: YYDEBUG(322, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(323, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(324, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(324, *YYCURSOR); + YYDEBUG(325, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1679 "Zend/zend_language_scanner.l" +#line 1683 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -4232,73 +4240,73 @@ yy321: zendlval->type = IS_STRING; return T_DIR; } -#line 4236 "Zend/zend_language_scanner.c" -yy325: - YYDEBUG(325, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy326; - if (yych != 'n') goto yy186; +#line 4244 "Zend/zend_language_scanner.c" yy326: YYDEBUG(326, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy327; - if (yych != 'e') goto yy186; + if (yych == 'N') goto yy327; + if (yych != 'n') goto yy187; yy327: YYDEBUG(327, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'E') goto yy328; + if (yych != 'e') goto yy187; +yy328: YYDEBUG(328, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(329, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(330, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(330, *YYCURSOR); + YYDEBUG(331, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1661 "Zend/zend_language_scanner.l" +#line 1665 "Zend/zend_language_scanner.l" { zendlval->value.lval = CG(zend_lineno); zendlval->type = IS_LONG; return T_LINE; } -#line 4267 "Zend/zend_language_scanner.c" -yy331: - YYDEBUG(331, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy332; - if (yych != 't') goto yy186; +#line 4275 "Zend/zend_language_scanner.c" yy332: YYDEBUG(332, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy333; - if (yych != 'h') goto yy186; + if (yych == 'T') goto yy333; + if (yych != 't') goto yy187; yy333: YYDEBUG(333, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy334; - if (yych != 'o') goto yy186; + if (yych == 'H') goto yy334; + if (yych != 'h') goto yy187; yy334: YYDEBUG(334, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy335; - if (yych != 'd') goto yy186; + if (yych == 'O') goto yy335; + if (yych != 'o') goto yy187; yy335: YYDEBUG(335, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'D') goto yy336; + if (yych != 'd') goto yy187; +yy336: YYDEBUG(336, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(337, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(338, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(338, *YYCURSOR); + YYDEBUG(339, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1640 "Zend/zend_language_scanner.l" +#line 1644 "Zend/zend_language_scanner.l" { const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; @@ -4319,58 +4327,58 @@ yy335: zendlval->type = IS_STRING; return T_METHOD_C; } -#line 4323 "Zend/zend_language_scanner.c" -yy339: - YYDEBUG(339, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy350; - if (yych == 'l') goto yy350; - goto yy186; +#line 4331 "Zend/zend_language_scanner.c" yy340: YYDEBUG(340, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy341; - if (yych != 'n') goto yy186; + if (yych == 'L') goto yy351; + if (yych == 'l') goto yy351; + goto yy187; yy341: YYDEBUG(341, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy342; - if (yych != 'c') goto yy186; + if (yych == 'N') goto yy342; + if (yych != 'n') goto yy187; yy342: YYDEBUG(342, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy343; - if (yych != 't') goto yy186; + if (yych == 'C') goto yy343; + if (yych != 'c') goto yy187; yy343: YYDEBUG(343, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy344; - if (yych != 'i') goto yy186; + if (yych == 'T') goto yy344; + if (yych != 't') goto yy187; yy344: YYDEBUG(344, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy345; - if (yych != 'o') goto yy186; + if (yych == 'I') goto yy345; + if (yych != 'i') goto yy187; yy345: YYDEBUG(345, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy346; - if (yych != 'n') goto yy186; + if (yych == 'O') goto yy346; + if (yych != 'o') goto yy187; yy346: YYDEBUG(346, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'N') goto yy347; + if (yych != 'n') goto yy187; +yy347: YYDEBUG(347, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(348, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(349, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(349, *YYCURSOR); + YYDEBUG(350, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1624 "Zend/zend_language_scanner.l" +#line 1628 "Zend/zend_language_scanner.l" { const char *func_name = NULL; @@ -4386,27 +4394,27 @@ yy346: zendlval->type = IS_STRING; return T_FUNC_C; } -#line 4390 "Zend/zend_language_scanner.c" -yy350: - YYDEBUG(350, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy351; - if (yych != 'e') goto yy186; +#line 4398 "Zend/zend_language_scanner.c" yy351: YYDEBUG(351, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'E') goto yy352; + if (yych != 'e') goto yy187; +yy352: YYDEBUG(352, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(353, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(354, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(354, *YYCURSOR); + YYDEBUG(355, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1667 "Zend/zend_language_scanner.l" +#line 1671 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); @@ -4418,37 +4426,37 @@ yy351: zendlval->type = IS_STRING; return T_FILE; } -#line 4422 "Zend/zend_language_scanner.c" -yy355: - YYDEBUG(355, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy356; - if (yych != 'a') goto yy186; +#line 4430 "Zend/zend_language_scanner.c" yy356: YYDEBUG(356, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy357; - if (yych != 'i') goto yy186; + if (yych == 'A') goto yy357; + if (yych != 'a') goto yy187; yy357: YYDEBUG(357, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy358; - if (yych != 't') goto yy186; + if (yych == 'I') goto yy358; + if (yych != 'i') goto yy187; yy358: YYDEBUG(358, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'T') goto yy359; + if (yych != 't') goto yy187; +yy359: YYDEBUG(359, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(360, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(361, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(361, *YYCURSOR); + YYDEBUG(362, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1604 "Zend/zend_language_scanner.l" +#line 1608 "Zend/zend_language_scanner.l" { const char *trait_name = NULL; @@ -4468,37 +4476,37 @@ yy358: return T_TRAIT_C; } -#line 4472 "Zend/zend_language_scanner.c" -yy362: - YYDEBUG(362, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy363; - if (yych != 'a') goto yy186; +#line 4480 "Zend/zend_language_scanner.c" yy363: YYDEBUG(363, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy364; - if (yych != 's') goto yy186; + if (yych == 'A') goto yy364; + if (yych != 'a') goto yy187; yy364: YYDEBUG(364, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'S') goto yy365; - if (yych != 's') goto yy186; + if (yych != 's') goto yy187; yy365: YYDEBUG(365, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'S') goto yy366; + if (yych != 's') goto yy187; +yy366: YYDEBUG(366, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych != '_') goto yy187; YYDEBUG(367, *YYCURSOR); + yych = *++YYCURSOR; + if (yych != '_') goto yy187; + YYDEBUG(368, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(368, *YYCURSOR); + YYDEBUG(369, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1577 "Zend/zend_language_scanner.l" +#line 1581 "Zend/zend_language_scanner.l" { const char *class_name = NULL; @@ -4525,2648 +4533,2676 @@ yy365: } return T_CLASS_C; } -#line 4529 "Zend/zend_language_scanner.c" -yy369: - YYDEBUG(369, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy370; - if (yych != 'l') goto yy186; +#line 4537 "Zend/zend_language_scanner.c" yy370: YYDEBUG(370, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy371; - if (yych != 't') goto yy186; + if (yych == 'L') goto yy371; + if (yych != 'l') goto yy187; yy371: YYDEBUG(371, *YYCURSOR); yych = *++YYCURSOR; - if (yych != '_') goto yy186; + if (yych == 'T') goto yy372; + if (yych != 't') goto yy187; +yy372: YYDEBUG(372, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy373; - if (yych != 'c') goto yy186; -yy373: + if (yych != '_') goto yy187; YYDEBUG(373, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy374; - if (yych != 'o') goto yy186; + if (yych == 'C') goto yy374; + if (yych != 'c') goto yy187; yy374: YYDEBUG(374, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy375; - if (yych != 'm') goto yy186; + if (yych == 'O') goto yy375; + if (yych != 'o') goto yy187; yy375: YYDEBUG(375, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy376; - if (yych != 'p') goto yy186; + if (yych == 'M') goto yy376; + if (yych != 'm') goto yy187; yy376: YYDEBUG(376, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy377; - if (yych != 'i') goto yy186; + if (yych == 'P') goto yy377; + if (yych != 'p') goto yy187; yy377: YYDEBUG(377, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy378; - if (yych != 'l') goto yy186; + if (yych == 'I') goto yy378; + if (yych != 'i') goto yy187; yy378: YYDEBUG(378, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy379; - if (yych != 'e') goto yy186; + if (yych == 'L') goto yy379; + if (yych != 'l') goto yy187; yy379: YYDEBUG(379, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy380; - if (yych != 'r') goto yy186; + if (yych == 'E') goto yy380; + if (yych != 'e') goto yy187; yy380: YYDEBUG(380, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy381; + if (yych != 'r') goto yy187; +yy381: + YYDEBUG(381, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(381, *YYCURSOR); + YYDEBUG(382, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1286 "Zend/zend_language_scanner.l" +#line 1290 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } -#line 4595 "Zend/zend_language_scanner.c" -yy382: - YYDEBUG(382, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy386; - if (yych == 's') goto yy386; - goto yy186; +#line 4603 "Zend/zend_language_scanner.c" yy383: YYDEBUG(383, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy384; - if (yych != 'e') goto yy186; + if (yych == 'S') goto yy387; + if (yych == 's') goto yy387; + goto yy187; yy384: YYDEBUG(384, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy385; + if (yych != 'e') goto yy187; +yy385: + YYDEBUG(385, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(385, *YYCURSOR); + YYDEBUG(386, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1266 "Zend/zend_language_scanner.l" +#line 1270 "Zend/zend_language_scanner.l" { return T_USE; } -#line 4619 "Zend/zend_language_scanner.c" -yy386: - YYDEBUG(386, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy387; - if (yych != 'e') goto yy186; +#line 4627 "Zend/zend_language_scanner.c" yy387: YYDEBUG(387, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy388; - if (yych != 't') goto yy186; + if (yych == 'E') goto yy388; + if (yych != 'e') goto yy187; yy388: YYDEBUG(388, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy389; + if (yych != 't') goto yy187; +yy389: + YYDEBUG(389, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(389, *YYCURSOR); + YYDEBUG(390, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1314 "Zend/zend_language_scanner.l" +#line 1318 "Zend/zend_language_scanner.l" { return T_UNSET; } -#line 4642 "Zend/zend_language_scanner.c" -yy390: - YYDEBUG(390, *YYCURSOR); +#line 4650 "Zend/zend_language_scanner.c" +yy391: + YYDEBUG(391, *YYCURSOR); ++YYCURSOR; YYFILL(7); yych = *YYCURSOR; -yy391: - YYDEBUG(391, *YYCURSOR); +yy392: + YYDEBUG(392, *YYCURSOR); if (yych <= 'S') { if (yych <= 'D') { if (yych <= ' ') { - if (yych == '\t') goto yy390; - if (yych <= 0x1F) goto yy193; - goto yy390; + if (yych == '\t') goto yy391; + if (yych <= 0x1F) goto yy194; + goto yy391; } else { if (yych <= 'A') { - if (yych <= '@') goto yy193; - goto yy395; + if (yych <= '@') goto yy194; + goto yy396; } else { - if (yych <= 'B') goto yy393; - if (yych <= 'C') goto yy193; - goto yy398; + if (yych <= 'B') goto yy394; + if (yych <= 'C') goto yy194; + goto yy399; } } } else { if (yych <= 'I') { - if (yych == 'F') goto yy399; - if (yych <= 'H') goto yy193; - goto yy400; + if (yych == 'F') goto yy400; + if (yych <= 'H') goto yy194; + goto yy401; } else { if (yych <= 'O') { - if (yych <= 'N') goto yy193; - goto yy394; + if (yych <= 'N') goto yy194; + goto yy395; } else { - if (yych <= 'Q') goto yy193; - if (yych <= 'R') goto yy397; - goto yy396; + if (yych <= 'Q') goto yy194; + if (yych <= 'R') goto yy398; + goto yy397; } } } } else { if (yych <= 'f') { if (yych <= 'a') { - if (yych == 'U') goto yy392; - if (yych <= '`') goto yy193; - goto yy395; + if (yych == 'U') goto yy393; + if (yych <= '`') goto yy194; + goto yy396; } else { if (yych <= 'c') { - if (yych <= 'b') goto yy393; - goto yy193; + if (yych <= 'b') goto yy394; + goto yy194; } else { - if (yych <= 'd') goto yy398; - if (yych <= 'e') goto yy193; - goto yy399; + if (yych <= 'd') goto yy399; + if (yych <= 'e') goto yy194; + goto yy400; } } } else { if (yych <= 'q') { if (yych <= 'i') { - if (yych <= 'h') goto yy193; - goto yy400; + if (yych <= 'h') goto yy194; + goto yy401; } else { - if (yych == 'o') goto yy394; - goto yy193; + if (yych == 'o') goto yy395; + goto yy194; } } else { if (yych <= 's') { - if (yych <= 'r') goto yy397; - goto yy396; + if (yych <= 'r') goto yy398; + goto yy397; } else { - if (yych != 'u') goto yy193; + if (yych != 'u') goto yy194; } } } } -yy392: - YYDEBUG(392, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy459; - if (yych == 'n') goto yy459; - goto yy193; yy393: YYDEBUG(393, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'O') { - if (yych == 'I') goto yy446; - if (yych <= 'N') goto yy193; - goto yy447; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy193; - goto yy446; - } else { - if (yych == 'o') goto yy447; - goto yy193; - } - } + if (yych == 'N') goto yy460; + if (yych == 'n') goto yy460; + goto yy194; yy394: YYDEBUG(394, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy438; - if (yych == 'b') goto yy438; - goto yy193; + if (yych <= 'O') { + if (yych == 'I') goto yy447; + if (yych <= 'N') goto yy194; + goto yy448; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy194; + goto yy447; + } else { + if (yych == 'o') goto yy448; + goto yy194; + } + } yy395: YYDEBUG(395, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy431; - if (yych == 'r') goto yy431; - goto yy193; + if (yych == 'B') goto yy439; + if (yych == 'b') goto yy439; + goto yy194; yy396: YYDEBUG(396, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy423; - if (yych == 't') goto yy423; - goto yy193; + if (yych == 'R') goto yy432; + if (yych == 'r') goto yy432; + goto yy194; yy397: YYDEBUG(397, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy421; - if (yych == 'e') goto yy421; - goto yy193; + if (yych == 'T') goto yy424; + if (yych == 't') goto yy424; + goto yy194; yy398: YYDEBUG(398, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy417; - if (yych == 'o') goto yy417; - goto yy193; + if (yych == 'E') goto yy422; + if (yych == 'e') goto yy422; + goto yy194; yy399: YYDEBUG(399, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy410; - if (yych == 'l') goto yy410; - goto yy193; + if (yych == 'O') goto yy418; + if (yych == 'o') goto yy418; + goto yy194; yy400: YYDEBUG(400, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy401; - if (yych != 'n') goto yy193; + if (yych == 'L') goto yy411; + if (yych == 'l') goto yy411; + goto yy194; yy401: YYDEBUG(401, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy402; - if (yych != 't') goto yy193; + if (yych == 'N') goto yy402; + if (yych != 'n') goto yy194; yy402: YYDEBUG(402, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy403; - if (yych != 'e') goto yy405; + if (yych == 'T') goto yy403; + if (yych != 't') goto yy194; yy403: YYDEBUG(403, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'G') goto yy408; - if (yych == 'g') goto yy408; - goto yy193; + if (yych == 'E') goto yy404; + if (yych != 'e') goto yy406; yy404: YYDEBUG(404, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; + yych = *++YYCURSOR; + if (yych == 'G') goto yy409; + if (yych == 'g') goto yy409; + goto yy194; yy405: YYDEBUG(405, *YYCURSOR); - if (yych <= 0x1F) { - if (yych == '\t') goto yy404; - goto yy193; - } else { - if (yych <= ' ') goto yy404; - if (yych != ')') goto yy193; - } - YYDEBUG(406, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(407, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1214 "Zend/zend_language_scanner.l" - { - return T_INT_CAST; -} -#line 4818 "Zend/zend_language_scanner.c" -yy408: - YYDEBUG(408, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy409; - if (yych != 'e') goto yy193; -yy409: - YYDEBUG(409, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy404; - if (yych == 'r') goto yy404; - goto yy193; -yy410: - YYDEBUG(410, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy411; - if (yych != 'o') goto yy193; -yy411: - YYDEBUG(411, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy412; - if (yych != 'a') goto yy193; -yy412: - YYDEBUG(412, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy413; - if (yych != 't') goto yy193; -yy413: - YYDEBUG(413, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(414, *YYCURSOR); +yy406: + YYDEBUG(406, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy413; - goto yy193; + if (yych == '\t') goto yy405; + goto yy194; } else { - if (yych <= ' ') goto yy413; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy405; + if (yych != ')') goto yy194; } - YYDEBUG(415, *YYCURSOR); + YYDEBUG(407, *YYCURSOR); ++YYCURSOR; - YYDEBUG(416, *YYCURSOR); + YYDEBUG(408, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1218 "Zend/zend_language_scanner.l" { - return T_DOUBLE_CAST; + return T_INT_CAST; } -#line 4866 "Zend/zend_language_scanner.c" -yy417: - YYDEBUG(417, *YYCURSOR); +#line 4826 "Zend/zend_language_scanner.c" +yy409: + YYDEBUG(409, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy418; - if (yych != 'u') goto yy193; -yy418: - YYDEBUG(418, *YYCURSOR); + if (yych == 'E') goto yy410; + if (yych != 'e') goto yy194; +yy410: + YYDEBUG(410, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy419; - if (yych != 'b') goto yy193; -yy419: - YYDEBUG(419, *YYCURSOR); + if (yych == 'R') goto yy405; + if (yych == 'r') goto yy405; + goto yy194; +yy411: + YYDEBUG(411, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy420; - if (yych != 'l') goto yy193; -yy420: - YYDEBUG(420, *YYCURSOR); + if (yych == 'O') goto yy412; + if (yych != 'o') goto yy194; +yy412: + YYDEBUG(412, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy413; - if (yych == 'e') goto yy413; - goto yy193; -yy421: - YYDEBUG(421, *YYCURSOR); + if (yych == 'A') goto yy413; + if (yych != 'a') goto yy194; +yy413: + YYDEBUG(413, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy422; - if (yych != 'a') goto yy193; -yy422: - YYDEBUG(422, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy413; - if (yych == 'l') goto yy413; - goto yy193; -yy423: - YYDEBUG(423, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy424; - if (yych != 'r') goto yy193; -yy424: - YYDEBUG(424, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy425; - if (yych != 'i') goto yy193; -yy425: - YYDEBUG(425, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy426; - if (yych != 'n') goto yy193; -yy426: - YYDEBUG(426, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'G') goto yy427; - if (yych != 'g') goto yy193; -yy427: - YYDEBUG(427, *YYCURSOR); + if (yych == 'T') goto yy414; + if (yych != 't') goto yy194; +yy414: + YYDEBUG(414, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(428, *YYCURSOR); + YYDEBUG(415, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy427; - goto yy193; + if (yych == '\t') goto yy414; + goto yy194; } else { - if (yych <= ' ') goto yy427; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy414; + if (yych != ')') goto yy194; } - YYDEBUG(429, *YYCURSOR); + YYDEBUG(416, *YYCURSOR); ++YYCURSOR; - YYDEBUG(430, *YYCURSOR); + YYDEBUG(417, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1222 "Zend/zend_language_scanner.l" { - return T_STRING_CAST; + return T_DOUBLE_CAST; } -#line 4940 "Zend/zend_language_scanner.c" -yy431: - YYDEBUG(431, *YYCURSOR); +#line 4874 "Zend/zend_language_scanner.c" +yy418: + YYDEBUG(418, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy432; - if (yych != 'r') goto yy193; -yy432: - YYDEBUG(432, *YYCURSOR); + if (yych == 'U') goto yy419; + if (yych != 'u') goto yy194; +yy419: + YYDEBUG(419, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy433; - if (yych != 'a') goto yy193; -yy433: - YYDEBUG(433, *YYCURSOR); + if (yych == 'B') goto yy420; + if (yych != 'b') goto yy194; +yy420: + YYDEBUG(420, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'Y') goto yy434; - if (yych != 'y') goto yy193; -yy434: - YYDEBUG(434, *YYCURSOR); + if (yych == 'L') goto yy421; + if (yych != 'l') goto yy194; +yy421: + YYDEBUG(421, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy414; + if (yych == 'e') goto yy414; + goto yy194; +yy422: + YYDEBUG(422, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy423; + if (yych != 'a') goto yy194; +yy423: + YYDEBUG(423, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy414; + if (yych == 'l') goto yy414; + goto yy194; +yy424: + YYDEBUG(424, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy425; + if (yych != 'r') goto yy194; +yy425: + YYDEBUG(425, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy426; + if (yych != 'i') goto yy194; +yy426: + YYDEBUG(426, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy427; + if (yych != 'n') goto yy194; +yy427: + YYDEBUG(427, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'G') goto yy428; + if (yych != 'g') goto yy194; +yy428: + YYDEBUG(428, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(435, *YYCURSOR); + YYDEBUG(429, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy434; - goto yy193; + if (yych == '\t') goto yy428; + goto yy194; } else { - if (yych <= ' ') goto yy434; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy428; + if (yych != ')') goto yy194; } - YYDEBUG(436, *YYCURSOR); + YYDEBUG(430, *YYCURSOR); ++YYCURSOR; - YYDEBUG(437, *YYCURSOR); + YYDEBUG(431, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1226 "Zend/zend_language_scanner.l" { - return T_ARRAY_CAST; + return T_STRING_CAST; } -#line 4977 "Zend/zend_language_scanner.c" -yy438: - YYDEBUG(438, *YYCURSOR); +#line 4948 "Zend/zend_language_scanner.c" +yy432: + YYDEBUG(432, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'J') goto yy439; - if (yych != 'j') goto yy193; -yy439: - YYDEBUG(439, *YYCURSOR); + if (yych == 'R') goto yy433; + if (yych != 'r') goto yy194; +yy433: + YYDEBUG(433, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy440; - if (yych != 'e') goto yy193; -yy440: - YYDEBUG(440, *YYCURSOR); + if (yych == 'A') goto yy434; + if (yych != 'a') goto yy194; +yy434: + YYDEBUG(434, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy441; - if (yych != 'c') goto yy193; -yy441: - YYDEBUG(441, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy442; - if (yych != 't') goto yy193; -yy442: - YYDEBUG(442, *YYCURSOR); + if (yych == 'Y') goto yy435; + if (yych != 'y') goto yy194; +yy435: + YYDEBUG(435, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(443, *YYCURSOR); + YYDEBUG(436, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy442; - goto yy193; + if (yych == '\t') goto yy435; + goto yy194; } else { - if (yych <= ' ') goto yy442; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy435; + if (yych != ')') goto yy194; } - YYDEBUG(444, *YYCURSOR); + YYDEBUG(437, *YYCURSOR); ++YYCURSOR; - YYDEBUG(445, *YYCURSOR); + YYDEBUG(438, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1230 "Zend/zend_language_scanner.l" { - return T_OBJECT_CAST; + return T_ARRAY_CAST; } -#line 5019 "Zend/zend_language_scanner.c" -yy446: - YYDEBUG(446, *YYCURSOR); +#line 4985 "Zend/zend_language_scanner.c" +yy439: + YYDEBUG(439, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy456; - if (yych == 'n') goto yy456; - goto yy193; -yy447: - YYDEBUG(447, *YYCURSOR); + if (yych == 'J') goto yy440; + if (yych != 'j') goto yy194; +yy440: + YYDEBUG(440, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy448; - if (yych != 'o') goto yy193; -yy448: - YYDEBUG(448, *YYCURSOR); + if (yych == 'E') goto yy441; + if (yych != 'e') goto yy194; +yy441: + YYDEBUG(441, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy449; - if (yych != 'l') goto yy193; -yy449: - YYDEBUG(449, *YYCURSOR); + if (yych == 'C') goto yy442; + if (yych != 'c') goto yy194; +yy442: + YYDEBUG(442, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy454; - if (yych == 'e') goto yy454; - goto yy451; -yy450: - YYDEBUG(450, *YYCURSOR); + if (yych == 'T') goto yy443; + if (yych != 't') goto yy194; +yy443: + YYDEBUG(443, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy451: - YYDEBUG(451, *YYCURSOR); + YYDEBUG(444, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy450; - goto yy193; + if (yych == '\t') goto yy443; + goto yy194; } else { - if (yych <= ' ') goto yy450; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy443; + if (yych != ')') goto yy194; } - YYDEBUG(452, *YYCURSOR); + YYDEBUG(445, *YYCURSOR); ++YYCURSOR; - YYDEBUG(453, *YYCURSOR); + YYDEBUG(446, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1234 "Zend/zend_language_scanner.l" { - return T_BOOL_CAST; + return T_OBJECT_CAST; } -#line 5064 "Zend/zend_language_scanner.c" -yy454: - YYDEBUG(454, *YYCURSOR); +#line 5027 "Zend/zend_language_scanner.c" +yy447: + YYDEBUG(447, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy455; - if (yych != 'a') goto yy193; -yy455: - YYDEBUG(455, *YYCURSOR); + if (yych == 'N') goto yy457; + if (yych == 'n') goto yy457; + goto yy194; +yy448: + YYDEBUG(448, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy450; - if (yych == 'n') goto yy450; - goto yy193; -yy456: - YYDEBUG(456, *YYCURSOR); + if (yych == 'O') goto yy449; + if (yych != 'o') goto yy194; +yy449: + YYDEBUG(449, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy457; - if (yych != 'a') goto yy193; -yy457: - YYDEBUG(457, *YYCURSOR); + if (yych == 'L') goto yy450; + if (yych != 'l') goto yy194; +yy450: + YYDEBUG(450, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy458; - if (yych != 'r') goto yy193; -yy458: - YYDEBUG(458, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'Y') goto yy427; - if (yych == 'y') goto yy427; - goto yy193; -yy459: - YYDEBUG(459, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy460; - if (yych != 's') goto yy193; -yy460: - YYDEBUG(460, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy461; - if (yych != 'e') goto yy193; -yy461: - YYDEBUG(461, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy462; - if (yych != 't') goto yy193; -yy462: - YYDEBUG(462, *YYCURSOR); + if (yych == 'E') goto yy455; + if (yych == 'e') goto yy455; + goto yy452; +yy451: + YYDEBUG(451, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(463, *YYCURSOR); +yy452: + YYDEBUG(452, *YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy462; - goto yy193; + if (yych == '\t') goto yy451; + goto yy194; } else { - if (yych <= ' ') goto yy462; - if (yych != ')') goto yy193; + if (yych <= ' ') goto yy451; + if (yych != ')') goto yy194; } - YYDEBUG(464, *YYCURSOR); + YYDEBUG(453, *YYCURSOR); ++YYCURSOR; - YYDEBUG(465, *YYCURSOR); + YYDEBUG(454, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1238 "Zend/zend_language_scanner.l" { - return T_UNSET_CAST; + return T_BOOL_CAST; } -#line 5128 "Zend/zend_language_scanner.c" -yy466: - YYDEBUG(466, *YYCURSOR); +#line 5072 "Zend/zend_language_scanner.c" +yy455: + YYDEBUG(455, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy467; - if (yych != 'r') goto yy186; -yy467: - YYDEBUG(467, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(468, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1210 "Zend/zend_language_scanner.l" - { - return T_VAR; -} -#line 5146 "Zend/zend_language_scanner.c" -yy469: - YYDEBUG(469, *YYCURSOR); + if (yych == 'A') goto yy456; + if (yych != 'a') goto yy194; +yy456: + YYDEBUG(456, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'M') goto yy473; - if (yych == 'm') goto yy473; - goto yy186; -yy470: - YYDEBUG(470, *YYCURSOR); + if (yych == 'N') goto yy451; + if (yych == 'n') goto yy451; + goto yy194; +yy457: + YYDEBUG(457, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy471; - if (yych != 'w') goto yy186; -yy471: - YYDEBUG(471, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(472, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1202 "Zend/zend_language_scanner.l" - { - return T_NEW; -} -#line 5170 "Zend/zend_language_scanner.c" -yy473: - YYDEBUG(473, *YYCURSOR); + if (yych == 'A') goto yy458; + if (yych != 'a') goto yy194; +yy458: + YYDEBUG(458, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy474; - if (yych != 'e') goto yy186; -yy474: - YYDEBUG(474, *YYCURSOR); + if (yych == 'R') goto yy459; + if (yych != 'r') goto yy194; +yy459: + YYDEBUG(459, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy475; - if (yych != 's') goto yy186; -yy475: - YYDEBUG(475, *YYCURSOR); + if (yych == 'Y') goto yy428; + if (yych == 'y') goto yy428; + goto yy194; +yy460: + YYDEBUG(460, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy476; - if (yych != 'p') goto yy186; -yy476: - YYDEBUG(476, *YYCURSOR); + if (yych == 'S') goto yy461; + if (yych != 's') goto yy194; +yy461: + YYDEBUG(461, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy477; - if (yych != 'a') goto yy186; -yy477: - YYDEBUG(477, *YYCURSOR); + if (yych == 'E') goto yy462; + if (yych != 'e') goto yy194; +yy462: + YYDEBUG(462, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy478; - if (yych != 'c') goto yy186; -yy478: - YYDEBUG(478, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy479; - if (yych != 'e') goto yy186; -yy479: - YYDEBUG(479, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(480, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1262 "Zend/zend_language_scanner.l" - { - return T_NAMESPACE; -} -#line 5213 "Zend/zend_language_scanner.c" -yy481: - YYDEBUG(481, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(482, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1194 "Zend/zend_language_scanner.l" - { - return T_PAAMAYIM_NEKUDOTAYIM; -} -#line 5223 "Zend/zend_language_scanner.c" -yy483: - YYDEBUG(483, *YYCURSOR); + if (yych == 'T') goto yy463; + if (yych != 't') goto yy194; +yy463: + YYDEBUG(463, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; + YYDEBUG(464, *YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy463; + goto yy194; + } else { + if (yych <= ' ') goto yy463; + if (yych != ')') goto yy194; + } + YYDEBUG(465, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(466, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1242 "Zend/zend_language_scanner.l" + { + return T_UNSET_CAST; +} +#line 5136 "Zend/zend_language_scanner.c" +yy467: + YYDEBUG(467, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy468; + if (yych != 'r') goto yy187; +yy468: + YYDEBUG(468, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(469, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1214 "Zend/zend_language_scanner.l" + { + return T_VAR; +} +#line 5154 "Zend/zend_language_scanner.c" +yy470: + YYDEBUG(470, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy474; + if (yych == 'm') goto yy474; + goto yy187; +yy471: + YYDEBUG(471, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'W') goto yy472; + if (yych != 'w') goto yy187; +yy472: + YYDEBUG(472, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(473, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1206 "Zend/zend_language_scanner.l" + { + return T_NEW; +} +#line 5178 "Zend/zend_language_scanner.c" +yy474: + YYDEBUG(474, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy475; + if (yych != 'e') goto yy187; +yy475: + YYDEBUG(475, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy476; + if (yych != 's') goto yy187; +yy476: + YYDEBUG(476, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy477; + if (yych != 'p') goto yy187; +yy477: + YYDEBUG(477, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy478; + if (yych != 'a') goto yy187; +yy478: + YYDEBUG(478, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy479; + if (yych != 'c') goto yy187; +yy479: + YYDEBUG(479, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy480; + if (yych != 'e') goto yy187; +yy480: + YYDEBUG(480, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(481, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1266 "Zend/zend_language_scanner.l" + { + return T_NAMESPACE; +} +#line 5221 "Zend/zend_language_scanner.c" +yy482: + YYDEBUG(482, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(483, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1198 "Zend/zend_language_scanner.l" + { + return T_PAAMAYIM_NEKUDOTAYIM; +} +#line 5231 "Zend/zend_language_scanner.c" yy484: YYDEBUG(484, *YYCURSOR); - if (yych <= '\f') { - if (yych <= 0x08) goto yy140; - if (yych <= '\n') goto yy483; - goto yy140; - } else { - if (yych <= '\r') goto yy483; - if (yych == ' ') goto yy483; - goto yy140; - } + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; yy485: YYDEBUG(485, *YYCURSOR); - ++YYCURSOR; + if (yych <= '\f') { + if (yych <= 0x08) goto yy141; + if (yych <= '\n') goto yy484; + goto yy141; + } else { + if (yych <= '\r') goto yy484; + if (yych == ' ') goto yy484; + goto yy141; + } +yy486: YYDEBUG(486, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(487, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1370 "Zend/zend_language_scanner.l" +#line 1374 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } -#line 5249 "Zend/zend_language_scanner.c" -yy487: - YYDEBUG(487, *YYCURSOR); - ++YYCURSOR; +#line 5257 "Zend/zend_language_scanner.c" +yy488: YYDEBUG(488, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(489, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1338 "Zend/zend_language_scanner.l" +#line 1342 "Zend/zend_language_scanner.l" { return T_DEC; } -#line 5259 "Zend/zend_language_scanner.c" -yy489: - YYDEBUG(489, *YYCURSOR); - ++YYCURSOR; +#line 5267 "Zend/zend_language_scanner.c" +yy490: YYDEBUG(490, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(491, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1164 "Zend/zend_language_scanner.l" +#line 1168 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } -#line 5270 "Zend/zend_language_scanner.c" -yy491: - YYDEBUG(491, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'O') { - if (yych == 'I') goto yy498; - if (yych <= 'N') goto yy186; - goto yy499; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy186; - goto yy498; - } else { - if (yych == 'o') goto yy499; - goto yy186; - } - } +#line 5278 "Zend/zend_language_scanner.c" yy492: YYDEBUG(492, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'B') goto yy493; - if (yych != 'b') goto yy186; + if (yych <= 'O') { + if (yych == 'I') goto yy499; + if (yych <= 'N') goto yy187; + goto yy500; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy187; + goto yy499; + } else { + if (yych == 'o') goto yy500; + goto yy187; + } + } yy493: YYDEBUG(493, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy494; - if (yych != 'l') goto yy186; + if (yych == 'B') goto yy494; + if (yych != 'b') goto yy187; yy494: YYDEBUG(494, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy495; - if (yych != 'i') goto yy186; + if (yych == 'L') goto yy495; + if (yych != 'l') goto yy187; yy495: YYDEBUG(495, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy496; - if (yych != 'c') goto yy186; + if (yych == 'I') goto yy496; + if (yych != 'i') goto yy187; yy496: YYDEBUG(496, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy497; + if (yych != 'c') goto yy187; +yy497: + YYDEBUG(497, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(497, *YYCURSOR); + YYDEBUG(498, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1310 "Zend/zend_language_scanner.l" +#line 1314 "Zend/zend_language_scanner.l" { return T_PUBLIC; } -#line 5319 "Zend/zend_language_scanner.c" -yy498: - YYDEBUG(498, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'V') { - if (yych == 'N') goto yy507; - if (yych <= 'U') goto yy186; - goto yy508; - } else { - if (yych <= 'n') { - if (yych <= 'm') goto yy186; - goto yy507; - } else { - if (yych == 'v') goto yy508; - goto yy186; - } - } +#line 5327 "Zend/zend_language_scanner.c" yy499: YYDEBUG(499, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy500; - if (yych != 't') goto yy186; + if (yych <= 'V') { + if (yych == 'N') goto yy508; + if (yych <= 'U') goto yy187; + goto yy509; + } else { + if (yych <= 'n') { + if (yych <= 'm') goto yy187; + goto yy508; + } else { + if (yych == 'v') goto yy509; + goto yy187; + } + } yy500: YYDEBUG(500, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy501; - if (yych != 'e') goto yy186; + if (yych == 'T') goto yy501; + if (yych != 't') goto yy187; yy501: YYDEBUG(501, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy502; - if (yych != 'c') goto yy186; + if (yych == 'E') goto yy502; + if (yych != 'e') goto yy187; yy502: YYDEBUG(502, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy503; - if (yych != 't') goto yy186; + if (yych == 'C') goto yy503; + if (yych != 'c') goto yy187; yy503: YYDEBUG(503, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy504; - if (yych != 'e') goto yy186; + if (yych == 'T') goto yy504; + if (yych != 't') goto yy187; yy504: YYDEBUG(504, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy505; - if (yych != 'd') goto yy186; + if (yych == 'E') goto yy505; + if (yych != 'e') goto yy187; yy505: YYDEBUG(505, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy506; + if (yych != 'd') goto yy187; +yy506: + YYDEBUG(506, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(506, *YYCURSOR); + YYDEBUG(507, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1306 "Zend/zend_language_scanner.l" +#line 1310 "Zend/zend_language_scanner.l" { return T_PROTECTED; } -#line 5378 "Zend/zend_language_scanner.c" -yy507: - YYDEBUG(507, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy513; - if (yych == 't') goto yy513; - goto yy186; +#line 5386 "Zend/zend_language_scanner.c" yy508: YYDEBUG(508, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy509; - if (yych != 'a') goto yy186; + if (yych == 'T') goto yy514; + if (yych == 't') goto yy514; + goto yy187; yy509: YYDEBUG(509, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy510; - if (yych != 't') goto yy186; + if (yych == 'A') goto yy510; + if (yych != 'a') goto yy187; yy510: YYDEBUG(510, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy511; - if (yych != 'e') goto yy186; + if (yych == 'T') goto yy511; + if (yych != 't') goto yy187; yy511: YYDEBUG(511, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy512; + if (yych != 'e') goto yy187; +yy512: + YYDEBUG(512, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(512, *YYCURSOR); + YYDEBUG(513, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1302 "Zend/zend_language_scanner.l" +#line 1306 "Zend/zend_language_scanner.l" { return T_PRIVATE; } -#line 5412 "Zend/zend_language_scanner.c" -yy513: - YYDEBUG(513, *YYCURSOR); +#line 5420 "Zend/zend_language_scanner.c" +yy514: + YYDEBUG(514, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(514, *YYCURSOR); + YYDEBUG(515, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1140 "Zend/zend_language_scanner.l" +#line 1144 "Zend/zend_language_scanner.l" { return T_PRINT; } -#line 5425 "Zend/zend_language_scanner.c" -yy515: - YYDEBUG(515, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy520; - if (yych == 'o') goto yy520; - goto yy186; +#line 5433 "Zend/zend_language_scanner.c" yy516: YYDEBUG(516, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy517; - if (yych != 't') goto yy186; + if (yych == 'O') goto yy521; + if (yych == 'o') goto yy521; + goto yy187; yy517: YYDEBUG(517, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy518; - if (yych != 'o') goto yy186; + if (yych == 'T') goto yy518; + if (yych != 't') goto yy187; yy518: YYDEBUG(518, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy519; + if (yych != 'o') goto yy187; +yy519: + YYDEBUG(519, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(519, *YYCURSOR); + YYDEBUG(520, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1132 "Zend/zend_language_scanner.l" +#line 1136 "Zend/zend_language_scanner.l" { return T_GOTO; } -#line 5454 "Zend/zend_language_scanner.c" -yy520: - YYDEBUG(520, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'B') goto yy521; - if (yych != 'b') goto yy186; +#line 5462 "Zend/zend_language_scanner.c" yy521: YYDEBUG(521, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy522; - if (yych != 'a') goto yy186; + if (yych == 'B') goto yy522; + if (yych != 'b') goto yy187; yy522: YYDEBUG(522, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy523; - if (yych != 'l') goto yy186; + if (yych == 'A') goto yy523; + if (yych != 'a') goto yy187; yy523: YYDEBUG(523, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'L') goto yy524; + if (yych != 'l') goto yy187; +yy524: YYDEBUG(524, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1274 "Zend/zend_language_scanner.l" - { - return T_GLOBAL; -} -#line 5482 "Zend/zend_language_scanner.c" -yy525: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(525, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '<') goto yy533; - goto yy193; -yy526: - YYDEBUG(526, *YYCURSOR); - yych = *++YYCURSOR; - goto yy180; -yy527: - YYDEBUG(527, *YYCURSOR); - yych = *++YYCURSOR; - goto yy178; -yy528: - YYDEBUG(528, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy529; - if (yych != 'e') goto yy186; -yy529: - YYDEBUG(529, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy530; - if (yych != 'a') goto yy186; -yy530: - YYDEBUG(530, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'K') goto yy531; - if (yych != 'k') goto yy186; -yy531: - YYDEBUG(531, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(532, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1124 "Zend/zend_language_scanner.l" - { - return T_BREAK; -} -#line 5523 "Zend/zend_language_scanner.c" -yy533: - YYDEBUG(533, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '<') goto yy269; - goto yy193; -yy534: - YYDEBUG(534, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy541; - if (yych == 'a') goto yy541; - goto yy186; -yy535: - YYDEBUG(535, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy536; - if (yych != 'i') goto yy186; -yy536: - YYDEBUG(536, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy537; - if (yych != 't') goto yy186; -yy537: - YYDEBUG(537, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy538; - if (yych != 'c') goto yy186; -yy538: - YYDEBUG(538, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy539; - if (yych != 'h') goto yy186; -yy539: - YYDEBUG(539, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(540, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1108 "Zend/zend_language_scanner.l" - { - return T_SWITCH; -} -#line 5567 "Zend/zend_language_scanner.c" -yy541: - YYDEBUG(541, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy542; - if (yych != 't') goto yy186; -yy542: - YYDEBUG(542, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy543; - if (yych != 'i') goto yy186; -yy543: - YYDEBUG(543, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy544; - if (yych != 'c') goto yy186; -yy544: - YYDEBUG(544, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(545, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1290 "Zend/zend_language_scanner.l" - { - return T_STATIC; -} -#line 5595 "Zend/zend_language_scanner.c" -yy546: - YYDEBUG(546, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy557; - if (yych == 's') goto yy557; - goto yy186; -yy547: - YYDEBUG(547, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'D') goto yy555; - if (yych == 'd') goto yy555; - goto yy186; -yy548: - YYDEBUG(548, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy551; - if (yych == 'r') goto yy551; - goto yy186; -yy549: - YYDEBUG(549, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(550, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1104 "Zend/zend_language_scanner.l" - { - return T_AS; -} -#line 5626 "Zend/zend_language_scanner.c" -yy551: - YYDEBUG(551, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy552; - if (yych != 'a') goto yy186; -yy552: - YYDEBUG(552, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'Y') goto yy553; - if (yych != 'y') goto yy186; -yy553: - YYDEBUG(553, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(554, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1326 "Zend/zend_language_scanner.l" - { - return T_ARRAY; -} -#line 5649 "Zend/zend_language_scanner.c" -yy555: - YYDEBUG(555, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(556, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1422 "Zend/zend_language_scanner.l" - { - return T_LOGICAL_AND; -} -#line 5662 "Zend/zend_language_scanner.c" -yy557: - YYDEBUG(557, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy558; - if (yych != 't') goto yy186; -yy558: - YYDEBUG(558, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy559; - if (yych != 'r') goto yy186; -yy559: - YYDEBUG(559, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy560; - if (yych != 'a') goto yy186; -yy560: - YYDEBUG(560, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy561; - if (yych != 'c') goto yy186; -yy561: - YYDEBUG(561, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy562; - if (yych != 't') goto yy186; -yy562: - YYDEBUG(562, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(563, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1294 "Zend/zend_language_scanner.l" - { - return T_ABSTRACT; -} -#line 5700 "Zend/zend_language_scanner.c" -yy564: - YYDEBUG(564, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy565; - if (yych != 'i') goto yy186; -yy565: - YYDEBUG(565, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy566; - if (yych != 'l') goto yy186; -yy566: - YYDEBUG(566, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy567; - if (yych != 'e') goto yy186; -yy567: - YYDEBUG(567, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(568, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1064 "Zend/zend_language_scanner.l" - { - return T_WHILE; -} -#line 5728 "Zend/zend_language_scanner.c" -yy569: - YYDEBUG(569, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(570, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1048 "Zend/zend_language_scanner.l" - { - return T_IF; -} -#line 5741 "Zend/zend_language_scanner.c" -yy571: - YYDEBUG(571, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'P') goto yy613; - if (yych == 'p') goto yy613; - goto yy186; -yy572: - YYDEBUG(572, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych <= 'C') { - if (yych <= 'B') goto yy186; - goto yy580; - } else { - if (yych <= 'R') goto yy186; - if (yych <= 'S') goto yy578; - goto yy579; - } - } else { - if (yych <= 'r') { - if (yych == 'c') goto yy580; - goto yy186; - } else { - if (yych <= 's') goto yy578; - if (yych <= 't') goto yy579; - goto yy186; - } - } -yy573: - YYDEBUG(573, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy574; - if (yych != 's') goto yy186; -yy574: - YYDEBUG(574, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy575; - if (yych != 'e') goto yy186; -yy575: - YYDEBUG(575, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy576; - if (yych != 't') goto yy186; -yy576: - YYDEBUG(576, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(577, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1278 "Zend/zend_language_scanner.l" { + return T_GLOBAL; +} +#line 5490 "Zend/zend_language_scanner.c" +yy526: + YYDEBUG(526, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '<') goto yy534; + goto yy194; +yy527: + YYDEBUG(527, *YYCURSOR); + yych = *++YYCURSOR; + goto yy181; +yy528: + YYDEBUG(528, *YYCURSOR); + yych = *++YYCURSOR; + goto yy179; +yy529: + YYDEBUG(529, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy530; + if (yych != 'e') goto yy187; +yy530: + YYDEBUG(530, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy531; + if (yych != 'a') goto yy187; +yy531: + YYDEBUG(531, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'K') goto yy532; + if (yych != 'k') goto yy187; +yy532: + YYDEBUG(532, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(533, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1128 "Zend/zend_language_scanner.l" + { + return T_BREAK; +} +#line 5531 "Zend/zend_language_scanner.c" +yy534: + YYDEBUG(534, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '<') goto yy270; + goto yy194; +yy535: + YYDEBUG(535, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy542; + if (yych == 'a') goto yy542; + goto yy187; +yy536: + YYDEBUG(536, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy537; + if (yych != 'i') goto yy187; +yy537: + YYDEBUG(537, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy538; + if (yych != 't') goto yy187; +yy538: + YYDEBUG(538, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy539; + if (yych != 'c') goto yy187; +yy539: + YYDEBUG(539, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy540; + if (yych != 'h') goto yy187; +yy540: + YYDEBUG(540, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(541, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1112 "Zend/zend_language_scanner.l" + { + return T_SWITCH; +} +#line 5575 "Zend/zend_language_scanner.c" +yy542: + YYDEBUG(542, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy543; + if (yych != 't') goto yy187; +yy543: + YYDEBUG(543, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy544; + if (yych != 'i') goto yy187; +yy544: + YYDEBUG(544, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy545; + if (yych != 'c') goto yy187; +yy545: + YYDEBUG(545, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(546, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1294 "Zend/zend_language_scanner.l" + { + return T_STATIC; +} +#line 5603 "Zend/zend_language_scanner.c" +yy547: + YYDEBUG(547, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy558; + if (yych == 's') goto yy558; + goto yy187; +yy548: + YYDEBUG(548, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy556; + if (yych == 'd') goto yy556; + goto yy187; +yy549: + YYDEBUG(549, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy552; + if (yych == 'r') goto yy552; + goto yy187; +yy550: + YYDEBUG(550, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(551, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1108 "Zend/zend_language_scanner.l" + { + return T_AS; +} +#line 5634 "Zend/zend_language_scanner.c" +yy552: + YYDEBUG(552, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy553; + if (yych != 'a') goto yy187; +yy553: + YYDEBUG(553, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'Y') goto yy554; + if (yych != 'y') goto yy187; +yy554: + YYDEBUG(554, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(555, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1330 "Zend/zend_language_scanner.l" + { + return T_ARRAY; +} +#line 5657 "Zend/zend_language_scanner.c" +yy556: + YYDEBUG(556, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(557, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1426 "Zend/zend_language_scanner.l" + { + return T_LOGICAL_AND; +} +#line 5670 "Zend/zend_language_scanner.c" +yy558: + YYDEBUG(558, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy559; + if (yych != 't') goto yy187; +yy559: + YYDEBUG(559, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy560; + if (yych != 'r') goto yy187; +yy560: + YYDEBUG(560, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy561; + if (yych != 'a') goto yy187; +yy561: + YYDEBUG(561, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy562; + if (yych != 'c') goto yy187; +yy562: + YYDEBUG(562, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy563; + if (yych != 't') goto yy187; +yy563: + YYDEBUG(563, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(564, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1298 "Zend/zend_language_scanner.l" + { + return T_ABSTRACT; +} +#line 5708 "Zend/zend_language_scanner.c" +yy565: + YYDEBUG(565, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy566; + if (yych != 'i') goto yy187; +yy566: + YYDEBUG(566, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy567; + if (yych != 'l') goto yy187; +yy567: + YYDEBUG(567, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy568; + if (yych != 'e') goto yy187; +yy568: + YYDEBUG(568, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(569, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1068 "Zend/zend_language_scanner.l" + { + return T_WHILE; +} +#line 5736 "Zend/zend_language_scanner.c" +yy570: + YYDEBUG(570, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(571, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1052 "Zend/zend_language_scanner.l" + { + return T_IF; +} +#line 5749 "Zend/zend_language_scanner.c" +yy572: + YYDEBUG(572, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'P') goto yy614; + if (yych == 'p') goto yy614; + goto yy187; +yy573: + YYDEBUG(573, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych <= 'C') { + if (yych <= 'B') goto yy187; + goto yy581; + } else { + if (yych <= 'R') goto yy187; + if (yych <= 'S') goto yy579; + goto yy580; + } + } else { + if (yych <= 'r') { + if (yych == 'c') goto yy581; + goto yy187; + } else { + if (yych <= 's') goto yy579; + if (yych <= 't') goto yy580; + goto yy187; + } + } +yy574: + YYDEBUG(574, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy575; + if (yych != 's') goto yy187; +yy575: + YYDEBUG(575, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy576; + if (yych != 'e') goto yy187; +yy576: + YYDEBUG(576, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy577; + if (yych != 't') goto yy187; +yy577: + YYDEBUG(577, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(578, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1282 "Zend/zend_language_scanner.l" + { return T_ISSET; } -#line 5797 "Zend/zend_language_scanner.c" -yy578: - YYDEBUG(578, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy599; - if (yych == 't') goto yy599; - goto yy186; +#line 5805 "Zend/zend_language_scanner.c" yy579: YYDEBUG(579, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy592; - if (yych == 'e') goto yy592; - goto yy186; + if (yych == 'T') goto yy600; + if (yych == 't') goto yy600; + goto yy187; yy580: YYDEBUG(580, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy581; - if (yych != 'l') goto yy186; + if (yych == 'E') goto yy593; + if (yych == 'e') goto yy593; + goto yy187; yy581: YYDEBUG(581, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy582; - if (yych != 'u') goto yy186; + if (yych == 'L') goto yy582; + if (yych != 'l') goto yy187; yy582: YYDEBUG(582, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy583; - if (yych != 'd') goto yy186; + if (yych == 'U') goto yy583; + if (yych != 'u') goto yy187; yy583: YYDEBUG(583, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy584; - if (yych != 'e') goto yy186; + if (yych == 'D') goto yy584; + if (yych != 'd') goto yy187; yy584: YYDEBUG(584, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy585; + if (yych != 'e') goto yy187; +yy585: + YYDEBUG(585, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '9') { - if (yych >= '0') goto yy185; + if (yych >= '0') goto yy186; } else { - if (yych <= '@') goto yy585; - if (yych <= 'Z') goto yy185; + if (yych <= '@') goto yy586; + if (yych <= 'Z') goto yy186; } } else { if (yych <= '`') { - if (yych <= '_') goto yy586; + if (yych <= '_') goto yy587; } else { - if (yych <= 'z') goto yy185; - if (yych >= 0x7F) goto yy185; + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; } } -yy585: - YYDEBUG(585, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1246 "Zend/zend_language_scanner.l" - { - return T_INCLUDE; -} -#line 5855 "Zend/zend_language_scanner.c" yy586: YYDEBUG(586, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy587; - if (yych != 'o') goto yy186; -yy587: - YYDEBUG(587, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy588; - if (yych != 'n') goto yy186; -yy588: - YYDEBUG(588, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy589; - if (yych != 'c') goto yy186; -yy589: - YYDEBUG(589, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy590; - if (yych != 'e') goto yy186; -yy590: - YYDEBUG(590, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(591, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1250 "Zend/zend_language_scanner.l" { - return T_INCLUDE_ONCE; + return T_INCLUDE; } -#line 5888 "Zend/zend_language_scanner.c" -yy592: +#line 5863 "Zend/zend_language_scanner.c" +yy587: + YYDEBUG(587, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy588; + if (yych != 'o') goto yy187; +yy588: + YYDEBUG(588, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy589; + if (yych != 'n') goto yy187; +yy589: + YYDEBUG(589, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy590; + if (yych != 'c') goto yy187; +yy590: + YYDEBUG(590, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy591; + if (yych != 'e') goto yy187; +yy591: + YYDEBUG(591, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(592, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy593; - if (yych != 'r') goto yy186; -yy593: - YYDEBUG(593, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy594; - if (yych != 'f') goto yy186; -yy594: - YYDEBUG(594, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy595; - if (yych != 'a') goto yy186; -yy595: - YYDEBUG(595, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy596; - if (yych != 'c') goto yy186; -yy596: - YYDEBUG(596, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy597; - if (yych != 'e') goto yy186; -yy597: - YYDEBUG(597, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(598, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1148 "Zend/zend_language_scanner.l" - { - return T_INTERFACE; -} -#line 5926 "Zend/zend_language_scanner.c" -yy599: - YYDEBUG(599, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'E') { - if (yych == 'A') goto yy600; - if (yych <= 'D') goto yy186; - goto yy601; - } else { - if (yych <= 'a') { - if (yych <= '`') goto yy186; - } else { - if (yych == 'e') goto yy601; - goto yy186; - } - } -yy600: - YYDEBUG(600, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy607; - if (yych == 'n') goto yy607; - goto yy186; -yy601: - YYDEBUG(601, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy602; - if (yych != 'a') goto yy186; -yy602: - YYDEBUG(602, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'D') goto yy603; - if (yych != 'd') goto yy186; -yy603: - YYDEBUG(603, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy604; - if (yych != 'o') goto yy186; -yy604: - YYDEBUG(604, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy605; - if (yych != 'f') goto yy186; -yy605: - YYDEBUG(605, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(606, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1270 "Zend/zend_language_scanner.l" - { - return T_INSTEADOF; -} -#line 5980 "Zend/zend_language_scanner.c" -yy607: - YYDEBUG(607, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy608; - if (yych != 'c') goto yy186; -yy608: - YYDEBUG(608, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy609; - if (yych != 'e') goto yy186; -yy609: - YYDEBUG(609, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy610; - if (yych != 'o') goto yy186; -yy610: - YYDEBUG(610, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy611; - if (yych != 'f') goto yy186; -yy611: - YYDEBUG(611, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(612, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1100 "Zend/zend_language_scanner.l" - { - return T_INSTANCEOF; -} -#line 6013 "Zend/zend_language_scanner.c" -yy613: - YYDEBUG(613, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy614; - if (yych != 'l') goto yy186; -yy614: - YYDEBUG(614, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy615; - if (yych != 'e') goto yy186; -yy615: - YYDEBUG(615, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'M') goto yy616; - if (yych != 'm') goto yy186; -yy616: - YYDEBUG(616, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy617; - if (yych != 'e') goto yy186; -yy617: - YYDEBUG(617, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy618; - if (yych != 'n') goto yy186; -yy618: - YYDEBUG(618, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy619; - if (yych != 't') goto yy186; -yy619: - YYDEBUG(619, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy620; - if (yych != 's') goto yy186; -yy620: - YYDEBUG(620, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(621, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1160 "Zend/zend_language_scanner.l" - { - return T_IMPLEMENTS; -} -#line 6061 "Zend/zend_language_scanner.c" -yy622: - YYDEBUG(622, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy630; - if (yych == 'r') goto yy630; - goto yy186; -yy623: - YYDEBUG(623, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'Y') { - if (yych == 'A') goto yy626; - if (yych <= 'X') goto yy186; - } else { - if (yych <= 'a') { - if (yych <= '`') goto yy186; - goto yy626; - } else { - if (yych != 'y') goto yy186; - } - } - YYDEBUG(624, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(625, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1036 "Zend/zend_language_scanner.l" - { - return T_TRY; -} -#line 6093 "Zend/zend_language_scanner.c" -yy626: - YYDEBUG(626, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy627; - if (yych != 'i') goto yy186; -yy627: - YYDEBUG(627, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy628; - if (yych != 't') goto yy186; -yy628: - YYDEBUG(628, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(629, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1152 "Zend/zend_language_scanner.l" - { - return T_TRAIT; -} -#line 6116 "Zend/zend_language_scanner.c" -yy630: - YYDEBUG(630, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy631; - if (yych != 'o') goto yy186; -yy631: - YYDEBUG(631, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'W') goto yy632; - if (yych != 'w') goto yy186; -yy632: - YYDEBUG(632, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(633, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1044 "Zend/zend_language_scanner.l" - { - return T_THROW; -} -#line 6139 "Zend/zend_language_scanner.c" -yy634: - YYDEBUG(634, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych == 'Q') goto yy636; - if (yych <= 'S') goto yy186; - } else { - if (yych <= 'q') { - if (yych <= 'p') goto yy186; - goto yy636; - } else { - if (yych != 't') goto yy186; - } - } - YYDEBUG(635, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'U') goto yy648; - if (yych == 'u') goto yy648; - goto yy186; -yy636: - YYDEBUG(636, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'U') goto yy637; - if (yych != 'u') goto yy186; -yy637: - YYDEBUG(637, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy638; - if (yych != 'i') goto yy186; -yy638: - YYDEBUG(638, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy639; - if (yych != 'r') goto yy186; -yy639: - YYDEBUG(639, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy640; - if (yych != 'e') goto yy186; -yy640: - YYDEBUG(640, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) <= '^') { - if (yych <= '9') { - if (yych >= '0') goto yy185; - } else { - if (yych <= '@') goto yy641; - if (yych <= 'Z') goto yy185; - } - } else { - if (yych <= '`') { - if (yych <= '_') goto yy642; - } else { - if (yych <= 'z') goto yy185; - if (yych >= 0x7F) goto yy185; - } - } -yy641: - YYDEBUG(641, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1254 "Zend/zend_language_scanner.l" { - return T_REQUIRE; + return T_INCLUDE_ONCE; } -#line 6204 "Zend/zend_language_scanner.c" +#line 5896 "Zend/zend_language_scanner.c" +yy593: + YYDEBUG(593, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy594; + if (yych != 'r') goto yy187; +yy594: + YYDEBUG(594, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy595; + if (yych != 'f') goto yy187; +yy595: + YYDEBUG(595, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy596; + if (yych != 'a') goto yy187; +yy596: + YYDEBUG(596, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy597; + if (yych != 'c') goto yy187; +yy597: + YYDEBUG(597, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy598; + if (yych != 'e') goto yy187; +yy598: + YYDEBUG(598, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(599, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1152 "Zend/zend_language_scanner.l" + { + return T_INTERFACE; +} +#line 5934 "Zend/zend_language_scanner.c" +yy600: + YYDEBUG(600, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'E') { + if (yych == 'A') goto yy601; + if (yych <= 'D') goto yy187; + goto yy602; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy187; + } else { + if (yych == 'e') goto yy602; + goto yy187; + } + } +yy601: + YYDEBUG(601, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy608; + if (yych == 'n') goto yy608; + goto yy187; +yy602: + YYDEBUG(602, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy603; + if (yych != 'a') goto yy187; +yy603: + YYDEBUG(603, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy604; + if (yych != 'd') goto yy187; +yy604: + YYDEBUG(604, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy605; + if (yych != 'o') goto yy187; +yy605: + YYDEBUG(605, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy606; + if (yych != 'f') goto yy187; +yy606: + YYDEBUG(606, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(607, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1274 "Zend/zend_language_scanner.l" + { + return T_INSTEADOF; +} +#line 5988 "Zend/zend_language_scanner.c" +yy608: + YYDEBUG(608, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy609; + if (yych != 'c') goto yy187; +yy609: + YYDEBUG(609, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy610; + if (yych != 'e') goto yy187; +yy610: + YYDEBUG(610, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy611; + if (yych != 'o') goto yy187; +yy611: + YYDEBUG(611, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy612; + if (yych != 'f') goto yy187; +yy612: + YYDEBUG(612, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(613, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1104 "Zend/zend_language_scanner.l" + { + return T_INSTANCEOF; +} +#line 6021 "Zend/zend_language_scanner.c" +yy614: + YYDEBUG(614, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy615; + if (yych != 'l') goto yy187; +yy615: + YYDEBUG(615, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy616; + if (yych != 'e') goto yy187; +yy616: + YYDEBUG(616, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'M') goto yy617; + if (yych != 'm') goto yy187; +yy617: + YYDEBUG(617, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy618; + if (yych != 'e') goto yy187; +yy618: + YYDEBUG(618, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy619; + if (yych != 'n') goto yy187; +yy619: + YYDEBUG(619, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy620; + if (yych != 't') goto yy187; +yy620: + YYDEBUG(620, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy621; + if (yych != 's') goto yy187; +yy621: + YYDEBUG(621, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(622, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1164 "Zend/zend_language_scanner.l" + { + return T_IMPLEMENTS; +} +#line 6069 "Zend/zend_language_scanner.c" +yy623: + YYDEBUG(623, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy631; + if (yych == 'r') goto yy631; + goto yy187; +yy624: + YYDEBUG(624, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'Y') { + if (yych == 'A') goto yy627; + if (yych <= 'X') goto yy187; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy187; + goto yy627; + } else { + if (yych != 'y') goto yy187; + } + } + YYDEBUG(625, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(626, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1040 "Zend/zend_language_scanner.l" + { + return T_TRY; +} +#line 6101 "Zend/zend_language_scanner.c" +yy627: + YYDEBUG(627, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy628; + if (yych != 'i') goto yy187; +yy628: + YYDEBUG(628, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy629; + if (yych != 't') goto yy187; +yy629: + YYDEBUG(629, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(630, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1156 "Zend/zend_language_scanner.l" + { + return T_TRAIT; +} +#line 6124 "Zend/zend_language_scanner.c" +yy631: + YYDEBUG(631, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy632; + if (yych != 'o') goto yy187; +yy632: + YYDEBUG(632, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'W') goto yy633; + if (yych != 'w') goto yy187; +yy633: + YYDEBUG(633, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(634, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1048 "Zend/zend_language_scanner.l" + { + return T_THROW; +} +#line 6147 "Zend/zend_language_scanner.c" +yy635: + YYDEBUG(635, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy636; + if (yych != 'e') goto yy187; +yy636: + YYDEBUG(636, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy637; + if (yych != 'l') goto yy187; +yy637: + YYDEBUG(637, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy638; + if (yych != 'd') goto yy187; +yy638: + YYDEBUG(638, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(639, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1036 "Zend/zend_language_scanner.l" + { + return T_YIELD; +} +#line 6175 "Zend/zend_language_scanner.c" +yy640: + YYDEBUG(640, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych == 'Q') goto yy642; + if (yych <= 'S') goto yy187; + } else { + if (yych <= 'q') { + if (yych <= 'p') goto yy187; + goto yy642; + } else { + if (yych != 't') goto yy187; + } + } + YYDEBUG(641, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy654; + if (yych == 'u') goto yy654; + goto yy187; yy642: YYDEBUG(642, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy643; - if (yych != 'o') goto yy186; + if (yych == 'U') goto yy643; + if (yych != 'u') goto yy187; yy643: YYDEBUG(643, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy644; - if (yych != 'n') goto yy186; + if (yych == 'I') goto yy644; + if (yych != 'i') goto yy187; yy644: YYDEBUG(644, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy645; - if (yych != 'c') goto yy186; + if (yych == 'R') goto yy645; + if (yych != 'r') goto yy187; yy645: YYDEBUG(645, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'E') goto yy646; - if (yych != 'e') goto yy186; + if (yych != 'e') goto yy187; yy646: YYDEBUG(646, *YYCURSOR); ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy186; + } else { + if (yych <= '@') goto yy647; + if (yych <= 'Z') goto yy186; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy648; + } else { + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; + } } +yy647: YYDEBUG(647, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1258 "Zend/zend_language_scanner.l" { - return T_REQUIRE_ONCE; + return T_REQUIRE; } -#line 6237 "Zend/zend_language_scanner.c" +#line 6240 "Zend/zend_language_scanner.c" yy648: YYDEBUG(648, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy649; - if (yych != 'r') goto yy186; + if (yych == 'O') goto yy649; + if (yych != 'o') goto yy187; yy649: YYDEBUG(649, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'N') goto yy650; - if (yych != 'n') goto yy186; + if (yych != 'n') goto yy187; yy650: YYDEBUG(650, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy651; + if (yych != 'c') goto yy187; +yy651: + YYDEBUG(651, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy652; + if (yych != 'e') goto yy187; +yy652: + YYDEBUG(652, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(651, *YYCURSOR); + YYDEBUG(653, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1262 "Zend/zend_language_scanner.l" + { + return T_REQUIRE_ONCE; +} +#line 6273 "Zend/zend_language_scanner.c" +yy654: + YYDEBUG(654, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy655; + if (yych != 'r') goto yy187; +yy655: + YYDEBUG(655, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy656; + if (yych != 'n') goto yy187; +yy656: + YYDEBUG(656, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(657, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1032 "Zend/zend_language_scanner.l" { return T_RETURN; } -#line 6260 "Zend/zend_language_scanner.c" -yy652: - YYDEBUG(652, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych <= 'L') { - if (yych <= 'K') goto yy186; - goto yy675; - } else { - if (yych <= 'R') goto yy186; - if (yych <= 'S') goto yy674; - goto yy673; - } - } else { - if (yych <= 'r') { - if (yych == 'l') goto yy675; - goto yy186; - } else { - if (yych <= 's') goto yy674; - if (yych <= 't') goto yy673; - goto yy186; - } - } -yy653: - YYDEBUG(653, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'O') { - if (yych == 'A') goto yy665; - if (yych <= 'N') goto yy186; - goto yy666; - } else { - if (yych <= 'a') { - if (yych <= '`') goto yy186; - goto yy665; - } else { - if (yych == 'o') goto yy666; - goto yy186; - } - } -yy654: - YYDEBUG(654, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy655; - if (yych != 'n') goto yy186; -yy655: - YYDEBUG(655, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych <= 'R') goto yy186; - if (yych >= 'T') goto yy657; - } else { - if (yych <= 'r') goto yy186; - if (yych <= 's') goto yy656; - if (yych <= 't') goto yy657; - goto yy186; - } -yy656: - YYDEBUG(656, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy663; - if (yych == 't') goto yy663; - goto yy186; -yy657: - YYDEBUG(657, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy658; - if (yych != 'i') goto yy186; +#line 6296 "Zend/zend_language_scanner.c" yy658: YYDEBUG(658, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy659; - if (yych != 'n') goto yy186; + if (yych <= 'T') { + if (yych <= 'L') { + if (yych <= 'K') goto yy187; + goto yy681; + } else { + if (yych <= 'R') goto yy187; + if (yych <= 'S') goto yy680; + goto yy679; + } + } else { + if (yych <= 'r') { + if (yych == 'l') goto yy681; + goto yy187; + } else { + if (yych <= 's') goto yy680; + if (yych <= 't') goto yy679; + goto yy187; + } + } yy659: YYDEBUG(659, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'U') goto yy660; - if (yych != 'u') goto yy186; + if (yych <= 'O') { + if (yych == 'A') goto yy671; + if (yych <= 'N') goto yy187; + goto yy672; + } else { + if (yych <= 'a') { + if (yych <= '`') goto yy187; + goto yy671; + } else { + if (yych == 'o') goto yy672; + goto yy187; + } + } yy660: YYDEBUG(660, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy661; - if (yych != 'e') goto yy186; + if (yych == 'N') goto yy661; + if (yych != 'n') goto yy187; yy661: YYDEBUG(661, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych <= 'R') goto yy187; + if (yych >= 'T') goto yy663; + } else { + if (yych <= 'r') goto yy187; + if (yych <= 's') goto yy662; + if (yych <= 't') goto yy663; + goto yy187; + } +yy662: + YYDEBUG(662, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy669; + if (yych == 't') goto yy669; + goto yy187; +yy663: + YYDEBUG(663, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy664; + if (yych != 'i') goto yy187; +yy664: + YYDEBUG(664, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy665; + if (yych != 'n') goto yy187; +yy665: + YYDEBUG(665, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'U') goto yy666; + if (yych != 'u') goto yy187; +yy666: + YYDEBUG(666, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy667; + if (yych != 'e') goto yy187; +yy667: + YYDEBUG(667, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(662, *YYCURSOR); + YYDEBUG(668, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1128 "Zend/zend_language_scanner.l" +#line 1132 "Zend/zend_language_scanner.l" { return T_CONTINUE; } -#line 6354 "Zend/zend_language_scanner.c" -yy663: - YYDEBUG(663, *YYCURSOR); +#line 6390 "Zend/zend_language_scanner.c" +yy669: + YYDEBUG(669, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(664, *YYCURSOR); + YYDEBUG(670, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1028 "Zend/zend_language_scanner.l" { return T_CONST; } -#line 6367 "Zend/zend_language_scanner.c" -yy665: - YYDEBUG(665, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy670; - if (yych == 's') goto yy670; - goto yy186; -yy666: - YYDEBUG(666, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy667; - if (yych != 'n') goto yy186; -yy667: - YYDEBUG(667, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy668; - if (yych != 'e') goto yy186; -yy668: - YYDEBUG(668, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(669, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1206 "Zend/zend_language_scanner.l" - { - return T_CLONE; -} -#line 6396 "Zend/zend_language_scanner.c" -yy670: - YYDEBUG(670, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy671; - if (yych != 's') goto yy186; +#line 6403 "Zend/zend_language_scanner.c" yy671: YYDEBUG(671, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'S') goto yy676; + if (yych == 's') goto yy676; + goto yy187; +yy672: YYDEBUG(672, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1144 "Zend/zend_language_scanner.l" - { - return T_CLASS; -} -#line 6414 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'N') goto yy673; + if (yych != 'n') goto yy187; yy673: YYDEBUG(673, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy684; - if (yych == 'c') goto yy684; - goto yy186; + if (yych == 'E') goto yy674; + if (yych != 'e') goto yy187; yy674: YYDEBUG(674, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy682; - if (yych == 'e') goto yy682; - goto yy186; -yy675: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(675, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy676; - if (yych != 'l') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1210 "Zend/zend_language_scanner.l" + { + return T_CLONE; +} +#line 6432 "Zend/zend_language_scanner.c" yy676: YYDEBUG(676, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy677; - if (yych != 'a') goto yy186; + if (yych == 'S') goto yy677; + if (yych != 's') goto yy187; yy677: YYDEBUG(677, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'B') goto yy678; - if (yych != 'b') goto yy186; -yy678: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(678, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy679; - if (yych != 'l') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1148 "Zend/zend_language_scanner.l" + { + return T_CLASS; +} +#line 6450 "Zend/zend_language_scanner.c" yy679: YYDEBUG(679, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy680; - if (yych != 'e') goto yy186; + if (yych == 'C') goto yy690; + if (yych == 'c') goto yy690; + goto yy187; yy680: YYDEBUG(680, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'E') goto yy688; + if (yych == 'e') goto yy688; + goto yy187; +yy681: YYDEBUG(681, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1330 "Zend/zend_language_scanner.l" - { - return T_CALLABLE; -} -#line 6464 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'L') goto yy682; + if (yych != 'l') goto yy187; yy682: YYDEBUG(682, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'A') goto yy683; + if (yych != 'a') goto yy187; +yy683: YYDEBUG(683, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1116 "Zend/zend_language_scanner.l" - { - return T_CASE; -} -#line 6477 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'B') goto yy684; + if (yych != 'b') goto yy187; yy684: YYDEBUG(684, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy685; - if (yych != 'h') goto yy186; + if (yych == 'L') goto yy685; + if (yych != 'l') goto yy187; yy685: YYDEBUG(685, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy686; + if (yych != 'e') goto yy187; +yy686: + YYDEBUG(686, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(686, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1040 "Zend/zend_language_scanner.l" - { - return T_CATCH; -} -#line 6495 "Zend/zend_language_scanner.c" -yy687: YYDEBUG(687, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy704; - if (yych == 'n') goto yy704; - goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1334 "Zend/zend_language_scanner.l" + { + return T_CALLABLE; +} +#line 6500 "Zend/zend_language_scanner.c" yy688: YYDEBUG(688, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy697; - if (yych == 'r') goto yy697; - goto yy186; -yy689: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(689, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'N') goto yy690; - if (yych != 'n') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1120 "Zend/zend_language_scanner.l" + { + return T_CASE; +} +#line 6513 "Zend/zend_language_scanner.c" yy690: YYDEBUG(690, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy691; - if (yych != 'c') goto yy186; + if (yych == 'H') goto yy691; + if (yych != 'h') goto yy187; yy691: YYDEBUG(691, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy692; - if (yych != 't') goto yy186; -yy692: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(692, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy693; - if (yych != 'i') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1044 "Zend/zend_language_scanner.l" + { + return T_CATCH; +} +#line 6531 "Zend/zend_language_scanner.c" yy693: YYDEBUG(693, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy694; - if (yych != 'o') goto yy186; + if (yych == 'N') goto yy710; + if (yych == 'n') goto yy710; + goto yy187; yy694: YYDEBUG(694, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy695; - if (yych != 'n') goto yy186; + if (yych == 'R') goto yy703; + if (yych == 'r') goto yy703; + goto yy187; yy695: YYDEBUG(695, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy696; + if (yych != 'n') goto yy187; +yy696: + YYDEBUG(696, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy697; + if (yych != 'c') goto yy187; +yy697: + YYDEBUG(697, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy698; + if (yych != 't') goto yy187; +yy698: + YYDEBUG(698, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'I') goto yy699; + if (yych != 'i') goto yy187; +yy699: + YYDEBUG(699, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy700; + if (yych != 'o') goto yy187; +yy700: + YYDEBUG(700, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy701; + if (yych != 'n') goto yy187; +yy701: + YYDEBUG(701, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(696, *YYCURSOR); + YYDEBUG(702, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1024 "Zend/zend_language_scanner.l" { return T_FUNCTION; } -#line 6550 "Zend/zend_language_scanner.c" -yy697: - YYDEBUG(697, *YYCURSOR); +#line 6586 "Zend/zend_language_scanner.c" +yy703: + YYDEBUG(703, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy698; - if (yych <= '9') goto yy185; + if (yych <= '/') goto yy704; + if (yych <= '9') goto yy186; } else { - if (yych == 'E') goto yy699; - if (yych <= 'Z') goto yy185; + if (yych == 'E') goto yy705; + if (yych <= 'Z') goto yy186; } } else { if (yych <= 'd') { - if (yych != '`') goto yy185; + if (yych != '`') goto yy186; } else { - if (yych <= 'e') goto yy699; - if (yych <= 'z') goto yy185; - if (yych >= 0x7F) goto yy185; + if (yych <= 'e') goto yy705; + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; } } -yy698: - YYDEBUG(698, *YYCURSOR); +yy704: + YYDEBUG(704, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1076 "Zend/zend_language_scanner.l" +#line 1080 "Zend/zend_language_scanner.l" { return T_FOR; } -#line 6578 "Zend/zend_language_scanner.c" -yy699: - YYDEBUG(699, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy700; - if (yych != 'a') goto yy186; -yy700: - YYDEBUG(700, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy701; - if (yych != 'c') goto yy186; -yy701: - YYDEBUG(701, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy702; - if (yych != 'h') goto yy186; -yy702: - YYDEBUG(702, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(703, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1084 "Zend/zend_language_scanner.l" - { - return T_FOREACH; -} -#line 6606 "Zend/zend_language_scanner.c" -yy704: - YYDEBUG(704, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy705; - if (yych != 'a') goto yy186; +#line 6614 "Zend/zend_language_scanner.c" yy705: YYDEBUG(705, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy706; - if (yych != 'l') goto yy186; + if (yych == 'A') goto yy706; + if (yych != 'a') goto yy187; yy706: YYDEBUG(706, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'C') goto yy707; + if (yych != 'c') goto yy187; +yy707: YYDEBUG(707, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1298 "Zend/zend_language_scanner.l" - { - return T_FINAL; -} -#line 6629 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'H') goto yy708; + if (yych != 'h') goto yy187; yy708: YYDEBUG(708, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'F') { - if (yych == 'C') goto yy714; - if (yych <= 'E') goto yy186; - goto yy715; - } else { - if (yych <= 'c') { - if (yych <= 'b') goto yy186; - goto yy714; - } else { - if (yych == 'f') goto yy715; - goto yy186; - } - } -yy709: - YYDEBUG(709, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy712; - if (yych == 'e') goto yy712; - goto yy186; -yy710: - YYDEBUG(710, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(711, *YYCURSOR); + YYDEBUG(709, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1072 "Zend/zend_language_scanner.l" +#line 1088 "Zend/zend_language_scanner.l" { - return T_DO; + return T_FOREACH; } -#line 6664 "Zend/zend_language_scanner.c" +#line 6642 "Zend/zend_language_scanner.c" +yy710: + YYDEBUG(710, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy711; + if (yych != 'a') goto yy187; +yy711: + YYDEBUG(711, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy712; + if (yych != 'l') goto yy187; yy712: YYDEBUG(712, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } YYDEBUG(713, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 1302 "Zend/zend_language_scanner.l" + { + return T_FINAL; +} +#line 6665 "Zend/zend_language_scanner.c" +yy714: + YYDEBUG(714, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'F') { + if (yych == 'C') goto yy720; + if (yych <= 'E') goto yy187; + goto yy721; + } else { + if (yych <= 'c') { + if (yych <= 'b') goto yy187; + goto yy720; + } else { + if (yych == 'f') goto yy721; + goto yy187; + } + } +yy715: + YYDEBUG(715, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy718; + if (yych == 'e') goto yy718; + goto yy187; +yy716: + YYDEBUG(716, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(717, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1076 "Zend/zend_language_scanner.l" + { + return T_DO; +} +#line 6700 "Zend/zend_language_scanner.c" +yy718: + YYDEBUG(718, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(719, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 1020 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6677 "Zend/zend_language_scanner.c" -yy714: - YYDEBUG(714, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy721; - if (yych == 'l') goto yy721; - goto yy186; -yy715: - YYDEBUG(715, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy716; - if (yych != 'a') goto yy186; -yy716: - YYDEBUG(716, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'U') goto yy717; - if (yych != 'u') goto yy186; -yy717: - YYDEBUG(717, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy718; - if (yych != 'l') goto yy186; -yy718: - YYDEBUG(718, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy719; - if (yych != 't') goto yy186; -yy719: - YYDEBUG(719, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } +#line 6713 "Zend/zend_language_scanner.c" +yy720: YYDEBUG(720, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1120 "Zend/zend_language_scanner.l" - { - return T_DEFAULT; -} -#line 6716 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'L') goto yy727; + if (yych == 'l') goto yy727; + goto yy187; yy721: YYDEBUG(721, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'A') goto yy722; - if (yych != 'a') goto yy186; + if (yych != 'a') goto yy187; yy722: YYDEBUG(722, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy723; - if (yych != 'r') goto yy186; + if (yych == 'U') goto yy723; + if (yych != 'u') goto yy187; yy723: YYDEBUG(723, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy724; - if (yych != 'e') goto yy186; + if (yych == 'L') goto yy724; + if (yych != 'l') goto yy187; yy724: YYDEBUG(724, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy725; + if (yych != 't') goto yy187; +yy725: + YYDEBUG(725, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(725, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1092 "Zend/zend_language_scanner.l" - { - return T_DECLARE; -} -#line 6744 "Zend/zend_language_scanner.c" -yy726: YYDEBUG(726, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy788; - if (yych == 'h') goto yy788; - goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1124 "Zend/zend_language_scanner.l" + { + return T_DEFAULT; +} +#line 6752 "Zend/zend_language_scanner.c" yy727: YYDEBUG(727, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy782; - if (yych == 's') goto yy782; - goto yy186; + if (yych == 'A') goto yy728; + if (yych != 'a') goto yy187; yy728: YYDEBUG(728, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'P') goto yy778; - if (yych == 'p') goto yy778; - goto yy186; + if (yych == 'R') goto yy729; + if (yych != 'r') goto yy187; yy729: YYDEBUG(729, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy744; - if (yych == 'd') goto yy744; - goto yy186; + if (yych == 'E') goto yy730; + if (yych != 'e') goto yy187; yy730: YYDEBUG(730, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy741; - if (yych == 'a') goto yy741; - goto yy186; -yy731: - YYDEBUG(731, *YYCURSOR); - yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych == 'I') goto yy732; - if (yych <= 'S') goto yy186; - goto yy733; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy186; - } else { - if (yych == 't') goto yy733; - goto yy186; - } + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; } + YYDEBUG(731, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1096 "Zend/zend_language_scanner.l" + { + return T_DECLARE; +} +#line 6780 "Zend/zend_language_scanner.c" yy732: YYDEBUG(732, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy739; - if (yych == 't') goto yy739; - goto yy186; + if (yych == 'H') goto yy794; + if (yych == 'h') goto yy794; + goto yy187; yy733: YYDEBUG(733, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy734; - if (yych != 'e') goto yy186; + if (yych == 'S') goto yy788; + if (yych == 's') goto yy788; + goto yy187; yy734: YYDEBUG(734, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy735; - if (yych != 'n') goto yy186; + if (yych == 'P') goto yy784; + if (yych == 'p') goto yy784; + goto yy187; yy735: YYDEBUG(735, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy736; - if (yych != 'd') goto yy186; + if (yych == 'D') goto yy750; + if (yych == 'd') goto yy750; + goto yy187; yy736: YYDEBUG(736, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy737; - if (yych != 's') goto yy186; + if (yych == 'A') goto yy747; + if (yych == 'a') goto yy747; + goto yy187; yy737: YYDEBUG(737, *YYCURSOR); + yych = *++YYCURSOR; + if (yych <= 'T') { + if (yych == 'I') goto yy738; + if (yych <= 'S') goto yy187; + goto yy739; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy187; + } else { + if (yych == 't') goto yy739; + goto yy187; + } + } +yy738: + YYDEBUG(738, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy745; + if (yych == 't') goto yy745; + goto yy187; +yy739: + YYDEBUG(739, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy740; + if (yych != 'e') goto yy187; +yy740: + YYDEBUG(740, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy741; + if (yych != 'n') goto yy187; +yy741: + YYDEBUG(741, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy742; + if (yych != 'd') goto yy187; +yy742: + YYDEBUG(742, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy743; + if (yych != 's') goto yy187; +yy743: + YYDEBUG(743, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(738, *YYCURSOR); + YYDEBUG(744, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1156 "Zend/zend_language_scanner.l" +#line 1160 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6828 "Zend/zend_language_scanner.c" -yy739: - YYDEBUG(739, *YYCURSOR); +#line 6864 "Zend/zend_language_scanner.c" +yy745: + YYDEBUG(745, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(740, *YYCURSOR); + YYDEBUG(746, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1016 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6841 "Zend/zend_language_scanner.c" -yy741: - YYDEBUG(741, *YYCURSOR); +#line 6877 "Zend/zend_language_scanner.c" +yy747: + YYDEBUG(747, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy742; - if (yych != 'l') goto yy186; -yy742: - YYDEBUG(742, *YYCURSOR); + if (yych == 'L') goto yy748; + if (yych != 'l') goto yy187; +yy748: + YYDEBUG(748, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } - YYDEBUG(743, *YYCURSOR); + YYDEBUG(749, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1242 "Zend/zend_language_scanner.l" +#line 1246 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6859 "Zend/zend_language_scanner.c" -yy744: - YYDEBUG(744, *YYCURSOR); +#line 6895 "Zend/zend_language_scanner.c" +yy750: + YYDEBUG(750, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'D': - case 'd': goto yy745; + case 'd': goto yy751; case 'F': - case 'f': goto yy746; + case 'f': goto yy752; case 'I': - case 'i': goto yy747; + case 'i': goto yy753; case 'S': - case 's': goto yy748; + case 's': goto yy754; case 'W': - case 'w': goto yy749; - default: goto yy186; + case 'w': goto yy755; + default: goto yy187; } -yy745: - YYDEBUG(745, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy771; - if (yych == 'e') goto yy771; - goto yy186; -yy746: - YYDEBUG(746, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy763; - if (yych == 'o') goto yy763; - goto yy186; -yy747: - YYDEBUG(747, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy761; - if (yych == 'f') goto yy761; - goto yy186; -yy748: - YYDEBUG(748, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'W') goto yy755; - if (yych == 'w') goto yy755; - goto yy186; -yy749: - YYDEBUG(749, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy750; - if (yych != 'h') goto yy186; -yy750: - YYDEBUG(750, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'I') goto yy751; - if (yych != 'i') goto yy186; yy751: YYDEBUG(751, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy752; - if (yych != 'l') goto yy186; + if (yych == 'E') goto yy777; + if (yych == 'e') goto yy777; + goto yy187; yy752: YYDEBUG(752, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy753; - if (yych != 'e') goto yy186; + if (yych == 'O') goto yy769; + if (yych == 'o') goto yy769; + goto yy187; yy753: YYDEBUG(753, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'F') goto yy767; + if (yych == 'f') goto yy767; + goto yy187; +yy754: YYDEBUG(754, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1068 "Zend/zend_language_scanner.l" - { - return T_ENDWHILE; -} -#line 6933 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'W') goto yy761; + if (yych == 'w') goto yy761; + goto yy187; yy755: YYDEBUG(755, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy756; - if (yych != 'i') goto yy186; + if (yych == 'H') goto yy756; + if (yych != 'h') goto yy187; yy756: YYDEBUG(756, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy757; - if (yych != 't') goto yy186; + if (yych == 'I') goto yy757; + if (yych != 'i') goto yy187; yy757: YYDEBUG(757, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy758; - if (yych != 'c') goto yy186; + if (yych == 'L') goto yy758; + if (yych != 'l') goto yy187; yy758: YYDEBUG(758, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy759; - if (yych != 'h') goto yy186; + if (yych == 'E') goto yy759; + if (yych != 'e') goto yy187; yy759: YYDEBUG(759, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } YYDEBUG(760, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1112 "Zend/zend_language_scanner.l" +#line 1072 "Zend/zend_language_scanner.l" { - return T_ENDSWITCH; + return T_ENDWHILE; } -#line 6966 "Zend/zend_language_scanner.c" +#line 6969 "Zend/zend_language_scanner.c" yy761: YYDEBUG(761, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'I') goto yy762; + if (yych != 'i') goto yy187; +yy762: YYDEBUG(762, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1056 "Zend/zend_language_scanner.l" - { - return T_ENDIF; -} -#line 6979 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'T') goto yy763; + if (yych != 't') goto yy187; yy763: YYDEBUG(763, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy764; - if (yych != 'r') goto yy186; + if (yych == 'C') goto yy764; + if (yych != 'c') goto yy187; yy764: YYDEBUG(764, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) <= '^') { - if (yych <= '@') { - if (yych <= '/') goto yy765; - if (yych <= '9') goto yy185; - } else { - if (yych == 'E') goto yy766; - if (yych <= 'Z') goto yy185; - } - } else { - if (yych <= 'd') { - if (yych != '`') goto yy185; - } else { - if (yych <= 'e') goto yy766; - if (yych <= 'z') goto yy185; - if (yych >= 0x7F) goto yy185; - } - } + yych = *++YYCURSOR; + if (yych == 'H') goto yy765; + if (yych != 'h') goto yy187; yy765: YYDEBUG(765, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1080 "Zend/zend_language_scanner.l" - { - return T_ENDFOR; -} -#line 7012 "Zend/zend_language_scanner.c" -yy766: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(766, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy767; - if (yych != 'a') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1116 "Zend/zend_language_scanner.l" + { + return T_ENDSWITCH; +} +#line 7002 "Zend/zend_language_scanner.c" yy767: YYDEBUG(767, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy768; - if (yych != 'c') goto yy186; -yy768: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } YYDEBUG(768, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy769; - if (yych != 'h') goto yy186; -yy769: - YYDEBUG(769, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(770, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1088 "Zend/zend_language_scanner.l" - { - return T_ENDFOREACH; -} -#line 7040 "Zend/zend_language_scanner.c" -yy771: - YYDEBUG(771, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy772; - if (yych != 'c') goto yy186; -yy772: - YYDEBUG(772, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy773; - if (yych != 'l') goto yy186; -yy773: - YYDEBUG(773, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy774; - if (yych != 'a') goto yy186; -yy774: - YYDEBUG(774, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy775; - if (yych != 'r') goto yy186; -yy775: - YYDEBUG(775, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy776; - if (yych != 'e') goto yy186; -yy776: - YYDEBUG(776, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(777, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1096 "Zend/zend_language_scanner.l" - { - return T_ENDDECLARE; -} -#line 7078 "Zend/zend_language_scanner.c" -yy778: - YYDEBUG(778, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy779; - if (yych != 't') goto yy186; -yy779: - YYDEBUG(779, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'Y') goto yy780; - if (yych != 'y') goto yy186; -yy780: - YYDEBUG(780, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(781, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1282 "Zend/zend_language_scanner.l" - { - return T_EMPTY; -} -#line 7101 "Zend/zend_language_scanner.c" -yy782: - YYDEBUG(782, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy783; - if (yych != 'e') goto yy186; -yy783: - YYDEBUG(783, *YYCURSOR); - ++YYCURSOR; - if ((yych = *YYCURSOR) <= '^') { - if (yych <= '@') { - if (yych <= '/') goto yy784; - if (yych <= '9') goto yy185; - } else { - if (yych == 'I') goto yy785; - if (yych <= 'Z') goto yy185; - } - } else { - if (yych <= 'h') { - if (yych != '`') goto yy185; - } else { - if (yych <= 'i') goto yy785; - if (yych <= 'z') goto yy185; - if (yych >= 0x7F) goto yy185; - } - } -yy784: - YYDEBUG(784, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1060 "Zend/zend_language_scanner.l" { - return T_ELSE; + return T_ENDIF; } -#line 7134 "Zend/zend_language_scanner.c" +#line 7015 "Zend/zend_language_scanner.c" +yy769: + YYDEBUG(769, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy770; + if (yych != 'r') goto yy187; +yy770: + YYDEBUG(770, *YYCURSOR); + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy771; + if (yych <= '9') goto yy186; + } else { + if (yych == 'E') goto yy772; + if (yych <= 'Z') goto yy186; + } + } else { + if (yych <= 'd') { + if (yych != '`') goto yy186; + } else { + if (yych <= 'e') goto yy772; + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; + } + } +yy771: + YYDEBUG(771, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1084 "Zend/zend_language_scanner.l" + { + return T_ENDFOR; +} +#line 7048 "Zend/zend_language_scanner.c" +yy772: + YYDEBUG(772, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy773; + if (yych != 'a') goto yy187; +yy773: + YYDEBUG(773, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy774; + if (yych != 'c') goto yy187; +yy774: + YYDEBUG(774, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy775; + if (yych != 'h') goto yy187; +yy775: + YYDEBUG(775, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(776, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1092 "Zend/zend_language_scanner.l" + { + return T_ENDFOREACH; +} +#line 7076 "Zend/zend_language_scanner.c" +yy777: + YYDEBUG(777, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy778; + if (yych != 'c') goto yy187; +yy778: + YYDEBUG(778, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy779; + if (yych != 'l') goto yy187; +yy779: + YYDEBUG(779, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy780; + if (yych != 'a') goto yy187; +yy780: + YYDEBUG(780, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy781; + if (yych != 'r') goto yy187; +yy781: + YYDEBUG(781, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy782; + if (yych != 'e') goto yy187; +yy782: + YYDEBUG(782, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(783, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1100 "Zend/zend_language_scanner.l" + { + return T_ENDDECLARE; +} +#line 7114 "Zend/zend_language_scanner.c" +yy784: + YYDEBUG(784, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy785; + if (yych != 't') goto yy187; yy785: YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'F') goto yy786; - if (yych != 'f') goto yy186; + if (yych == 'Y') goto yy786; + if (yych != 'y') goto yy187; yy786: YYDEBUG(786, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + goto yy186; } YYDEBUG(787, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1052 "Zend/zend_language_scanner.l" +#line 1286 "Zend/zend_language_scanner.l" { - return T_ELSEIF; + return T_EMPTY; } -#line 7152 "Zend/zend_language_scanner.c" +#line 7137 "Zend/zend_language_scanner.c" yy788: YYDEBUG(788, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy789; - if (yych != 'o') goto yy186; + if (yych == 'E') goto yy789; + if (yych != 'e') goto yy187; yy789: YYDEBUG(789, *YYCURSOR); ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy790; + if (yych <= '9') goto yy186; + } else { + if (yych == 'I') goto yy791; + if (yych <= 'Z') goto yy186; + } + } else { + if (yych <= 'h') { + if (yych != '`') goto yy186; + } else { + if (yych <= 'i') goto yy791; + if (yych <= 'z') goto yy186; + if (yych >= 0x7F) goto yy186; + } } +yy790: YYDEBUG(790, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1136 "Zend/zend_language_scanner.l" +#line 1064 "Zend/zend_language_scanner.l" + { + return T_ELSE; +} +#line 7170 "Zend/zend_language_scanner.c" +yy791: + YYDEBUG(791, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'F') goto yy792; + if (yych != 'f') goto yy187; +yy792: + YYDEBUG(792, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(793, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1056 "Zend/zend_language_scanner.l" + { + return T_ELSEIF; +} +#line 7188 "Zend/zend_language_scanner.c" +yy794: + YYDEBUG(794, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy795; + if (yych != 'o') goto yy187; +yy795: + YYDEBUG(795, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy186; + } + YYDEBUG(796, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1140 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7170 "Zend/zend_language_scanner.c" +#line 7206 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7205,41 +7241,41 @@ yyc_ST_LOOKING_FOR_PROPERTY: 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; - YYDEBUG(791, *YYCURSOR); + YYDEBUG(797, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '-') { if (yych <= '\r') { - if (yych <= 0x08) goto yy799; - if (yych <= '\n') goto yy793; - if (yych <= '\f') goto yy799; + if (yych <= 0x08) goto yy805; + if (yych <= '\n') goto yy799; + if (yych <= '\f') goto yy805; } else { - if (yych == ' ') goto yy793; - if (yych <= ',') goto yy799; - goto yy795; + if (yych == ' ') goto yy799; + if (yych <= ',') goto yy805; + goto yy801; } } else { if (yych <= '_') { - if (yych <= '@') goto yy799; - if (yych <= 'Z') goto yy797; - if (yych <= '^') goto yy799; - goto yy797; + if (yych <= '@') goto yy805; + if (yych <= 'Z') goto yy803; + if (yych <= '^') goto yy805; + goto yy803; } else { - if (yych <= '`') goto yy799; - if (yych <= 'z') goto yy797; - if (yych <= '~') goto yy799; - goto yy797; + if (yych <= '`') goto yy805; + if (yych <= 'z') goto yy803; + if (yych <= '~') goto yy805; + goto yy803; } } -yy793: - YYDEBUG(793, *YYCURSOR); +yy799: + YYDEBUG(799, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy805; -yy794: - YYDEBUG(794, *YYCURSOR); + goto yy811; +yy800: + YYDEBUG(800, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1169 "Zend/zend_language_scanner.l" +#line 1173 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -7247,73 +7283,73 @@ yy794: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7251 "Zend/zend_language_scanner.c" -yy795: - YYDEBUG(795, *YYCURSOR); +#line 7287 "Zend/zend_language_scanner.c" +yy801: + YYDEBUG(801, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy802; -yy796: - YYDEBUG(796, *YYCURSOR); + if ((yych = *YYCURSOR) == '>') goto yy808; +yy802: + YYDEBUG(802, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1188 "Zend/zend_language_scanner.l" +#line 1192 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7265 "Zend/zend_language_scanner.c" -yy797: - YYDEBUG(797, *YYCURSOR); +#line 7301 "Zend/zend_language_scanner.c" +yy803: + YYDEBUG(803, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy801; -yy798: - YYDEBUG(798, *YYCURSOR); + goto yy807; +yy804: + YYDEBUG(804, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1181 "Zend/zend_language_scanner.l" +#line 1185 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7281 "Zend/zend_language_scanner.c" -yy799: - YYDEBUG(799, *YYCURSOR); +#line 7317 "Zend/zend_language_scanner.c" +yy805: + YYDEBUG(805, *YYCURSOR); yych = *++YYCURSOR; - goto yy796; -yy800: - YYDEBUG(800, *YYCURSOR); + goto yy802; +yy806: + YYDEBUG(806, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy801: - YYDEBUG(801, *YYCURSOR); +yy807: + YYDEBUG(807, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy800; + goto yy806; } - goto yy798; -yy802: - YYDEBUG(802, *YYCURSOR); + goto yy804; +yy808: + YYDEBUG(808, *YYCURSOR); ++YYCURSOR; - YYDEBUG(803, *YYCURSOR); + YYDEBUG(809, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1177 "Zend/zend_language_scanner.l" +#line 1181 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7306 "Zend/zend_language_scanner.c" -yy804: - YYDEBUG(804, *YYCURSOR); +#line 7342 "Zend/zend_language_scanner.c" +yy810: + YYDEBUG(810, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy805: - YYDEBUG(805, *YYCURSOR); +yy811: + YYDEBUG(811, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy804; + goto yy810; } - goto yy794; + goto yy800; } /* *********************************** */ yyc_ST_LOOKING_FOR_VARNAME: @@ -7352,74 +7388,74 @@ yyc_ST_LOOKING_FOR_VARNAME: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(806, *YYCURSOR); + YYDEBUG(812, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '_') { - if (yych <= '@') goto yy810; - if (yych <= 'Z') goto yy808; - if (yych <= '^') goto yy810; + if (yych <= '@') goto yy816; + if (yych <= 'Z') goto yy814; + if (yych <= '^') goto yy816; } else { - if (yych <= '`') goto yy810; - if (yych <= 'z') goto yy808; - if (yych <= '~') goto yy810; + if (yych <= '`') goto yy816; + if (yych <= 'z') goto yy814; + if (yych <= '~') goto yy816; } -yy808: - YYDEBUG(808, *YYCURSOR); +yy814: + YYDEBUG(814, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '_') { if (yych <= '@') { - if (yych <= '/') goto yy809; - if (yych <= '9') goto yy812; + if (yych <= '/') goto yy815; + if (yych <= '9') goto yy818; } else { - if (yych <= '[') goto yy812; - if (yych >= '_') goto yy812; + if (yych <= '[') goto yy818; + if (yych >= '_') goto yy818; } } else { if (yych <= '|') { - if (yych <= '`') goto yy809; - if (yych <= 'z') goto yy812; + if (yych <= '`') goto yy815; + if (yych <= 'z') goto yy818; } else { - if (yych != '~') goto yy812; + if (yych != '~') goto yy818; } } -yy809: - YYDEBUG(809, *YYCURSOR); +yy815: + YYDEBUG(815, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1474 "Zend/zend_language_scanner.l" +#line 1478 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 7398 "Zend/zend_language_scanner.c" -yy810: - YYDEBUG(810, *YYCURSOR); +#line 7434 "Zend/zend_language_scanner.c" +yy816: + YYDEBUG(816, *YYCURSOR); yych = *++YYCURSOR; - goto yy809; -yy811: - YYDEBUG(811, *YYCURSOR); + goto yy815; +yy817: + YYDEBUG(817, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy812: - YYDEBUG(812, *YYCURSOR); +yy818: + YYDEBUG(818, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy811; + goto yy817; } - if (yych == '[') goto yy814; - if (yych == '}') goto yy814; - YYDEBUG(813, *YYCURSOR); + if (yych == '[') goto yy820; + if (yych == '}') goto yy820; + YYDEBUG(819, *YYCURSOR); YYCURSOR = YYMARKER; - goto yy809; -yy814: - YYDEBUG(814, *YYCURSOR); + goto yy815; +yy820: + YYDEBUG(820, *YYCURSOR); ++YYCURSOR; - YYDEBUG(815, *YYCURSOR); + YYDEBUG(821, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1464 "Zend/zend_language_scanner.l" +#line 1468 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); zend_copy_value(zendlval, yytext, yyleng); @@ -7428,18 +7464,18 @@ yy814: yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7432 "Zend/zend_language_scanner.c" +#line 7468 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_NOWDOC: - YYDEBUG(816, *YYCURSOR); + YYDEBUG(822, *YYCURSOR); YYFILL(1); yych = *YYCURSOR; - YYDEBUG(818, *YYCURSOR); + YYDEBUG(824, *YYCURSOR); ++YYCURSOR; - YYDEBUG(819, *YYCURSOR); + YYDEBUG(825, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2356 "Zend/zend_language_scanner.l" +#line 2360 "Zend/zend_language_scanner.l" { int newline = 0; @@ -7494,7 +7530,7 @@ nowdoc_scan_done: HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7498 "Zend/zend_language_scanner.c" +#line 7534 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7532,76 +7568,76 @@ yyc_ST_VAR_OFFSET: 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; - YYDEBUG(820, *YYCURSOR); + YYDEBUG(826, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '/') { if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy834; - if (yych <= '\n') goto yy830; - goto yy834; + if (yych <= 0x08) goto yy840; + if (yych <= '\n') goto yy836; + goto yy840; } else { - if (yych <= '\r') goto yy830; - if (yych <= 0x1F) goto yy834; - goto yy830; + if (yych <= '\r') goto yy836; + if (yych <= 0x1F) goto yy840; + goto yy836; } } else { if (yych <= '$') { - if (yych <= '"') goto yy829; - if (yych <= '#') goto yy830; - goto yy825; + if (yych <= '"') goto yy835; + if (yych <= '#') goto yy836; + goto yy831; } else { - if (yych == '\'') goto yy830; - goto yy829; + if (yych == '\'') goto yy836; + goto yy835; } } } else { if (yych <= '\\') { if (yych <= '@') { - if (yych <= '0') goto yy822; - if (yych <= '9') goto yy824; - goto yy829; + if (yych <= '0') goto yy828; + if (yych <= '9') goto yy830; + goto yy835; } else { - if (yych <= 'Z') goto yy832; - if (yych <= '[') goto yy829; - goto yy830; + if (yych <= 'Z') goto yy838; + if (yych <= '[') goto yy835; + goto yy836; } } else { if (yych <= '_') { - if (yych <= ']') goto yy827; - if (yych <= '^') goto yy829; - goto yy832; + if (yych <= ']') goto yy833; + if (yych <= '^') goto yy835; + goto yy838; } else { - if (yych <= '`') goto yy829; - if (yych <= 'z') goto yy832; - if (yych <= '~') goto yy829; - goto yy832; + if (yych <= '`') goto yy835; + if (yych <= 'z') goto yy838; + if (yych <= '~') goto yy835; + goto yy838; } } } -yy822: - YYDEBUG(822, *YYCURSOR); +yy828: + YYDEBUG(828, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'W') { if (yych <= '9') { - if (yych >= '0') goto yy846; + if (yych >= '0') goto yy852; } else { - if (yych == 'B') goto yy843; + if (yych == 'B') goto yy849; } } else { if (yych <= 'b') { - if (yych <= 'X') goto yy845; - if (yych >= 'b') goto yy843; + if (yych <= 'X') goto yy851; + if (yych >= 'b') goto yy849; } else { - if (yych == 'x') goto yy845; + if (yych == 'x') goto yy851; } } -yy823: - YYDEBUG(823, *YYCURSOR); +yy829: + YYDEBUG(829, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1552 "Zend/zend_language_scanner.l" +#line 1556 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { zendlval->value.lval = strtol(yytext, NULL, 10); @@ -7613,81 +7649,81 @@ yy823: } return T_NUM_STRING; } -#line 7617 "Zend/zend_language_scanner.c" -yy824: - YYDEBUG(824, *YYCURSOR); +#line 7653 "Zend/zend_language_scanner.c" +yy830: + YYDEBUG(830, *YYCURSOR); yych = *++YYCURSOR; - goto yy842; -yy825: - YYDEBUG(825, *YYCURSOR); + goto yy848; +yy831: + YYDEBUG(831, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '_') { - if (yych <= '@') goto yy826; - if (yych <= 'Z') goto yy838; - if (yych >= '_') goto yy838; + if (yych <= '@') goto yy832; + if (yych <= 'Z') goto yy844; + if (yych >= '_') goto yy844; } else { - if (yych <= '`') goto yy826; - if (yych <= 'z') goto yy838; - if (yych >= 0x7F) goto yy838; + if (yych <= '`') goto yy832; + if (yych <= 'z') goto yy844; + if (yych >= 0x7F) goto yy844; } -yy826: - YYDEBUG(826, *YYCURSOR); +yy832: + YYDEBUG(832, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1884 "Zend/zend_language_scanner.l" +#line 1888 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7642 "Zend/zend_language_scanner.c" -yy827: - YYDEBUG(827, *YYCURSOR); +#line 7678 "Zend/zend_language_scanner.c" +yy833: + YYDEBUG(833, *YYCURSOR); ++YYCURSOR; - YYDEBUG(828, *YYCURSOR); + YYDEBUG(834, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1879 "Zend/zend_language_scanner.l" +#line 1883 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 7653 "Zend/zend_language_scanner.c" -yy829: - YYDEBUG(829, *YYCURSOR); +#line 7689 "Zend/zend_language_scanner.c" +yy835: + YYDEBUG(835, *YYCURSOR); yych = *++YYCURSOR; - goto yy826; -yy830: - YYDEBUG(830, *YYCURSOR); + goto yy832; +yy836: + YYDEBUG(836, *YYCURSOR); ++YYCURSOR; - YYDEBUG(831, *YYCURSOR); + YYDEBUG(837, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1893 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); return T_ENCAPSED_AND_WHITESPACE; } -#line 7670 "Zend/zend_language_scanner.c" -yy832: - YYDEBUG(832, *YYCURSOR); +#line 7706 "Zend/zend_language_scanner.c" +yy838: + YYDEBUG(838, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy837; -yy833: - YYDEBUG(833, *YYCURSOR); + goto yy843; +yy839: + YYDEBUG(839, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1896 "Zend/zend_language_scanner.l" +#line 1900 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7685 "Zend/zend_language_scanner.c" -yy834: - YYDEBUG(834, *YYCURSOR); +#line 7721 "Zend/zend_language_scanner.c" +yy840: + YYDEBUG(840, *YYCURSOR); ++YYCURSOR; - YYDEBUG(835, *YYCURSOR); + YYDEBUG(841, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2412 "Zend/zend_language_scanner.l" +#line 2416 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7696,118 +7732,118 @@ yy834: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 7700 "Zend/zend_language_scanner.c" -yy836: - YYDEBUG(836, *YYCURSOR); +#line 7736 "Zend/zend_language_scanner.c" +yy842: + YYDEBUG(842, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy837: - YYDEBUG(837, *YYCURSOR); +yy843: + YYDEBUG(843, *YYCURSOR); if (yybm[0+yych] & 16) { - goto yy836; + goto yy842; } - goto yy833; -yy838: - YYDEBUG(838, *YYCURSOR); + goto yy839; +yy844: + YYDEBUG(844, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(839, *YYCURSOR); + YYDEBUG(845, *YYCURSOR); if (yych <= '^') { if (yych <= '9') { - if (yych >= '0') goto yy838; + if (yych >= '0') goto yy844; } else { - if (yych <= '@') goto yy840; - if (yych <= 'Z') goto yy838; + if (yych <= '@') goto yy846; + if (yych <= 'Z') goto yy844; } } else { if (yych <= '`') { - if (yych <= '_') goto yy838; + if (yych <= '_') goto yy844; } else { - if (yych <= 'z') goto yy838; - if (yych >= 0x7F) goto yy838; + if (yych <= 'z') goto yy844; + if (yych >= 0x7F) goto yy844; } } -yy840: - YYDEBUG(840, *YYCURSOR); +yy846: + YYDEBUG(846, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; return T_VARIABLE; } -#line 7742 "Zend/zend_language_scanner.c" -yy841: - YYDEBUG(841, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy842: - YYDEBUG(842, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy841; - } - goto yy823; -yy843: - YYDEBUG(843, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 128) { - goto yy851; - } -yy844: - YYDEBUG(844, *YYCURSOR); - YYCURSOR = YYMARKER; - goto yy823; -yy845: - YYDEBUG(845, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 64) { - goto yy849; - } - goto yy844; -yy846: - YYDEBUG(846, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; +#line 7778 "Zend/zend_language_scanner.c" +yy847: YYDEBUG(847, *YYCURSOR); - if (yych <= '/') goto yy848; - if (yych <= '9') goto yy846; + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; yy848: YYDEBUG(848, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy847; + } + goto yy829; +yy849: + YYDEBUG(849, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy857; + } +yy850: + YYDEBUG(850, *YYCURSOR); + YYCURSOR = YYMARKER; + goto yy829; +yy851: + YYDEBUG(851, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy855; + } + goto yy850; +yy852: + YYDEBUG(852, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(853, *YYCURSOR); + if (yych <= '/') goto yy854; + if (yych <= '9') goto yy852; +yy854: + YYDEBUG(854, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1564 "Zend/zend_language_scanner.l" +#line 1568 "Zend/zend_language_scanner.l" { /* Offset must be treated as a string */ zendlval->value.str.val = (char *)estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; zendlval->type = IS_STRING; return T_NUM_STRING; } -#line 7789 "Zend/zend_language_scanner.c" -yy849: - YYDEBUG(849, *YYCURSOR); +#line 7825 "Zend/zend_language_scanner.c" +yy855: + YYDEBUG(855, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(850, *YYCURSOR); + YYDEBUG(856, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy849; + goto yy855; } - goto yy848; -yy851: - YYDEBUG(851, *YYCURSOR); + goto yy854; +yy857: + YYDEBUG(857, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(852, *YYCURSOR); + YYDEBUG(858, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy851; + goto yy857; } - goto yy848; + goto yy854; } } -#line 2421 "Zend/zend_language_scanner.l" +#line 2425 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index c73f39aedb9..1b9d44c5871 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1033,6 +1033,10 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_RETURN; } +"yield" { + return T_YIELD; +} + "try" { return T_TRY; } diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 5ef78a9faf3..981c342e19c 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Apr 30 15:56:25 2012 */ +/* Generated by re2c 0.13.5 on Tue May 15 13:07:23 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index d106d95a36d..dc33b96b8fe 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sun Jan 1 10:36:29 2012 */ +/* Generated by re2c 0.13.5 on Tue May 15 13:07:17 2012 */ #line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ From 252f623464e7cf5cb794903ba07d652c9cea9a14 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 May 2012 14:18:20 +0200 Subject: [PATCH 003/641] Add flag for generator functions Generator functions have to specify the * (asterix) modifier after the function keyword. If they do so the ZEND_ACC_GENERATOR flag is added to the fn_flags. --- Zend/zend_compile.c | 9 ++++++--- Zend/zend_compile.h | 6 ++++-- Zend/zend_language_parser.y | 18 +++++++++++------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 2b2b58f9ac8..399a37cc0df 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1519,7 +1519,7 @@ int zend_do_verify_access_types(const znode *current_access_type, const znode *n } /* }}} */ -void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */ +void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int is_generator, int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */ { zend_op_array op_array; char *name = function_name->u.constant.value.str.val; @@ -1553,6 +1553,9 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n CG(interactive) = orig_interactive; op_array.function_name = name; + if (is_generator) { + op_array.fn_flags |= ZEND_ACC_GENERATOR; + } if (return_reference) { op_array.fn_flags |= ZEND_ACC_RETURN_REFERENCE; } @@ -1751,7 +1754,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n } /* }}} */ -void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC) /* {{{ */ +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int is_generator, int return_reference, int is_static TSRMLS_DC) /* {{{ */ { znode function_name; zend_op_array *current_op_array = CG(active_op_array); @@ -1761,7 +1764,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to function_name.op_type = IS_CONST; ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1, 1); - zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC); + zend_do_begin_function_declaration(function_token, &function_name, 0, is_generator, return_reference, NULL TSRMLS_CC); result->op_type = IS_TMP_VAR; result->u.op.var = get_temporary_variable(current_op_array); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 8a81a95362e..375f953d86c 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -194,6 +194,7 @@ typedef struct _zend_try_catch_element { #define ZEND_ACC_CLOSURE 0x100000 +#define ZEND_ACC_GENERATOR 0x800000 /* function flag for internal user call handlers __call, __callstatic */ #define ZEND_ACC_CALL_VIA_HANDLER 0x200000 @@ -477,7 +478,7 @@ void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC); void zend_do_add_variable(znode *result, const znode *op1, const znode *op2 TSRMLS_DC); int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier); -void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC); +void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int is_generator, int return_reference, znode *fn_flags_znode TSRMLS_DC); void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC); void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, const znode *initialization, znode *class_type, zend_bool pass_by_reference TSRMLS_DC); int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC); @@ -489,9 +490,10 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); +void zend_do_yield(znode *expr TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); -void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC); +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int is_generator, int return_reference, int is_static TSRMLS_DC); void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 61198cb10e8..2fcf6740c4a 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -359,6 +359,10 @@ class_declaration_statement: unticked_class_declaration_statement { DO_TICKS(); } ; +is_generator: + /* empty */ { $$.op_type = 0; } + | '*' { $$.op_type = 1; } +; is_reference: /* empty */ { $$.op_type = ZEND_RETURN_VAL; } @@ -367,7 +371,7 @@ is_reference: unticked_function_declaration_statement: - function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); } + function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $2.op_type, $3.op_type, NULL TSRMLS_CC); } '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } ; @@ -578,8 +582,8 @@ class_statement: variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';' | class_constant_declaration ';' | trait_use_statement - | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } '(' - parameter_list ')' method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } + | method_modifiers function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $3.op_type, $4.op_type, &$1 TSRMLS_CC); } + '(' parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } ; trait_use_statement: @@ -795,10 +799,10 @@ expr_without_variable: | combined_scalar { $$ = $1; } | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } - | function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); } - parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } - | T_STATIC function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); } - parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; } + | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } + '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } + | T_STATIC function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, $4.op_type, 1 TSRMLS_CC); } + '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; } ; combined_scalar_offset: From 9b51a3b96d89dc10d4ea65ceacaad22fa3420ea7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 May 2012 14:21:49 +0200 Subject: [PATCH 004/641] Minor code cleanup The block for the foreach separator was nested unnecessary. This commit simply removes that nesting. --- Zend/zend_compile.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 399a37cc0df..0d3ea109bff 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1725,7 +1725,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n } { - /* Push a seperator to the switch and foreach stacks */ + /* Push a seperator to the switch stack */ zend_switch_entry switch_entry; switch_entry.cond.op_type = IS_UNUSED; @@ -1733,16 +1733,16 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n switch_entry.control_var = 0; zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); + } - { - /* Foreach stack separator */ - zend_op dummy_opline; + { + /* Push a separator to the foreach stack */ + zend_op dummy_opline; - dummy_opline.result_type = IS_UNUSED; - dummy_opline.op1_type = IS_UNUSED; + dummy_opline.result_type = IS_UNUSED; + dummy_opline.op1_type = IS_UNUSED; - zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op)); - } + zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op)); } if (CG(doc_comment)) { From fd2a109f86d18b93d29153c2ddfa605651c7df05 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 May 2012 18:49:27 +0200 Subject: [PATCH 005/641] Add error if yield is used outside a generator The yield statement can only be used in generator functions, which are marked with an asterix. --- .../generators/yield_in_normal_function_error.phpt | 12 ++++++++++++ .../generators/yield_outside_function_error.phpt | 10 ++++++++++ Zend/zend_compile.c | 6 +++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/generators/yield_in_normal_function_error.phpt create mode 100644 Zend/tests/generators/yield_outside_function_error.phpt diff --git a/Zend/tests/generators/yield_in_normal_function_error.phpt b/Zend/tests/generators/yield_in_normal_function_error.phpt new file mode 100644 index 00000000000..802510d29cc --- /dev/null +++ b/Zend/tests/generators/yield_in_normal_function_error.phpt @@ -0,0 +1,12 @@ +--TEST-- +Yield cannot be used in normal (non-generator) functions +--FILE-- + +--EXPECTF-- +Fatal error: The "yield" statement can only be used inside a generator function in %s on line %d diff --git a/Zend/tests/generators/yield_outside_function_error.phpt b/Zend/tests/generators/yield_outside_function_error.phpt new file mode 100644 index 00000000000..fd7169d5f2e --- /dev/null +++ b/Zend/tests/generators/yield_outside_function_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +Yield cannot be used outside of functions +--FILE-- + +--EXPECTF-- +Fatal error: The "yield" statement can only be used inside a generator function in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0d3ea109bff..d2b3536788e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2660,7 +2660,11 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ { - /* do nothing for now */ + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { + zend_error(E_COMPILE_ERROR, "The \"yield\" statement can only be used inside a generator function"); + } + + /* do nothing for now */ } /* }}} */ From e14cfafcbfbe58e0fc3f7b814698a908b0dffca5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 May 2012 20:19:45 +0200 Subject: [PATCH 006/641] Add zend_do_suspend_if_generator calls The execution of generator functions will be suspended right after the arguments were RECVed. This will be done in zend_do_suspend_if_generator. --- Zend/zend_compile.c | 11 +++++++++++ Zend/zend_compile.h | 1 + Zend/zend_language_parser.y | 12 ++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d2b3536788e..831f9f9d3f0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2668,6 +2668,17 @@ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ } /* }}} */ +void zend_do_suspend_if_generator(TSRMLS_D) /* {{{ */ +{ + // we only suspend execution if the current function is a generator + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { + return; + } + + /* do nothing for now */ +} +/* }}} */ + static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ { int try_catch_offset = CG(active_op_array)->last_try_catch++; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 375f953d86c..5365f9693db 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -491,6 +491,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_yield(znode *expr TSRMLS_DC); +void zend_do_suspend_if_generator(TSRMLS_D); void zend_do_handle_exception(TSRMLS_D); void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int is_generator, int return_reference, int is_static TSRMLS_DC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 2fcf6740c4a..2045a5e4653 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -372,7 +372,8 @@ is_reference: unticked_function_declaration_statement: function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $2.op_type, $3.op_type, NULL TSRMLS_CC); } - '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } + '(' parameter_list ')' { zend_do_suspend_if_generator(TSRMLS_C); } + '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } ; unticked_class_declaration_statement: @@ -583,7 +584,8 @@ class_statement: | class_constant_declaration ';' | trait_use_statement | method_modifiers function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $3.op_type, $4.op_type, &$1 TSRMLS_CC); } - '(' parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } + '(' parameter_list ')' { zend_do_suspend_if_generator(TSRMLS_C); } + method_body { zend_do_abstract_method(&$5, &$1, &$11 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } ; trait_use_statement: @@ -800,9 +802,11 @@ expr_without_variable: | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } - '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } + '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } + '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } | T_STATIC function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, $4.op_type, 1 TSRMLS_CC); } - '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; } + '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } + '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; } ; combined_scalar_offset: From 1cec3f12cc719ccde286a3a55f6da1a5bf9ea2e4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 May 2012 23:11:18 +0200 Subject: [PATCH 007/641] Add ZEND_SUSPEND_AND_RETURN_GENERATOR opcode If the function is a generator this opcode will be invoked right after receiving the function arguments. The current implementation is just a dummy. --- Zend/zend_compile.c | 8 +++++++- Zend/zend_vm_def.h | 7 +++++++ Zend/zend_vm_execute.h | 32 ++++++++++++++++++++++++++++++++ Zend/zend_vm_opcodes.h | 1 + 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 831f9f9d3f0..f0802efd587 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2670,12 +2670,18 @@ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ void zend_do_suspend_if_generator(TSRMLS_D) /* {{{ */ { + zend_op *opline; + // we only suspend execution if the current function is a generator if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { return; } - /* do nothing for now */ + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_SUSPEND_AND_RETURN_GENERATOR; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7b13b440faa..9dc7e0842cf 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5195,4 +5195,11 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) +{ + /* do nothing for now */ + + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 2096c44e669..c6c3af65db6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1152,6 +1152,13 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } +static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + /* do nothing for now */ + + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -40782,6 +40789,31 @@ void zend_init_opcodes_handlers(void) ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 680778c2a28..9e24dee11d6 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -159,3 +159,4 @@ #define ZEND_SEPARATE 156 #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 +#define ZEND_SUSPEND_AND_RETURN_GENERATOR 159 From ca59e5464de78dae1f7c874a6bcc4f7ea2948b1d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 20 May 2012 00:03:27 +0200 Subject: [PATCH 008/641] Add empty Generator class --- Zend/Makefile.am | 3 ++- Zend/Zend.dsp | 4 ++++ Zend/ZendTS.dsp | 4 ++++ Zend/zend_default_classes.c | 2 ++ Zend/zend_generators.c | 47 +++++++++++++++++++++++++++++++++++++ Zend/zend_generators.h | 40 +++++++++++++++++++++++++++++++ configure.in | 2 +- win32/build/config.w32 | 2 +- 8 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 Zend/zend_generators.c create mode 100644 Zend/zend_generators.h diff --git a/Zend/Makefile.am b/Zend/Makefile.am index 5ec4590fefe..e5757fac56d 100644 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@ -17,7 +17,8 @@ libZend_la_SOURCES=\ zend_objects_API.c zend_ts_hash.c zend_stream.c \ zend_default_classes.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c \ - zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c + zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \ + zend_generators.c libZend_la_LDFLAGS = libZend_la_LIBADD = @ZEND_EXTRA_LIBS@ diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp index ebe01978c4e..23ebd4532b5 100644 --- a/Zend/Zend.dsp +++ b/Zend/Zend.dsp @@ -159,6 +159,10 @@ SOURCE=.\zend_float.c # End Source File # Begin Source File +SOURCE=.\zend_generators.c +# End Source File +# Begin Source File + SOURCE=.\zend_hash.c # End Source File # Begin Source File diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp index 3494cd4e17f..3be2c58bed6 100644 --- a/Zend/ZendTS.dsp +++ b/Zend/ZendTS.dsp @@ -185,6 +185,10 @@ SOURCE=.\zend_extensions.c # End Source File # Begin Source File +SOURCE=.\zend_generators.c +# End Source File +# Begin Source File + SOURCE=.\zend_hash.c # End Source File # Begin Source File diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index 73a765811e8..bcc43ea7db1 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -25,6 +25,7 @@ #include "zend_interfaces.h" #include "zend_exceptions.h" #include "zend_closures.h" +#include "zend_generators.h" ZEND_API void zend_register_default_classes(TSRMLS_D) @@ -33,6 +34,7 @@ ZEND_API void zend_register_default_classes(TSRMLS_D) zend_register_default_exception(TSRMLS_C); zend_register_iterator_wrapper(TSRMLS_C); zend_register_closure_ce(TSRMLS_C); + zend_register_generator_ce(TSRMLS_C); } /* diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c new file mode 100644 index 00000000000..6f98dcb2c1c --- /dev/null +++ b/Zend/zend_generators.c @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Nikita Popov | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#include "zend.h" +#include "zend_API.h" +#include "zend_generators.h" + +ZEND_API zend_class_entry *zend_ce_generator; + +static const zend_function_entry generator_functions[] = { + ZEND_FE_END +}; + +void zend_register_generator_ce(TSRMLS_D) /* {{{ */ +{ + zend_class_entry ce; + + INIT_CLASS_ENTRY(ce, "Generator", generator_functions); + zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); + zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h new file mode 100644 index 00000000000..60899072dff --- /dev/null +++ b/Zend/zend_generators.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Nikita Popov | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef ZEND_GENERATORS_H +#define ZEND_GENERATORS_H + +BEGIN_EXTERN_C() + +void zend_register_generator_ce(TSRMLS_D); + +extern ZEND_API zend_class_entry *zend_ce_generator; + +END_EXTERN_C() + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/configure.in b/configure.in index 96febdd9000..e9a0ef5069a 100644 --- a/configure.in +++ b/configure.in @@ -1472,7 +1472,7 @@ PHP_ADD_SOURCES(Zend, \ zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \ - zend_closures.c zend_float.c zend_string.c zend_signal.c) + zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c) if test -r "$abs_srcdir/Zend/zend_objects.c"; then PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c) diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 1a4b834be42..fae3cc66c30 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -359,7 +359,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \ zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \ zend_object_handlers.c zend_objects_API.c \ zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \ - zend_float.c zend_string.c"); + zend_float.c zend_string.c zend_generators.c"); if (VCVERS == 1200) { AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1); From 40b7533576b4f2ec4ba872d027179d92db71d844 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 20 May 2012 14:19:16 +0200 Subject: [PATCH 009/641] Add some boilerplate code for Generator class The Generator class now uses a zend_generator struct, so it'll be able to store additional info. This commit also ensures that Generator cannot be directly instantiated and extended. The error tests are now in a separate folder from the (yet-to-come) functional tests. --- .../errors/generator_extend_error.phpt | 10 ++++ .../errors/generator_instantiate_error.phpt | 10 ++++ .../yield_in_normal_function_error.phpt | 0 .../yield_outside_function_error.phpt | 0 Zend/zend_generators.c | 47 +++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 Zend/tests/generators/errors/generator_extend_error.phpt create mode 100644 Zend/tests/generators/errors/generator_instantiate_error.phpt rename Zend/tests/generators/{ => errors}/yield_in_normal_function_error.phpt (100%) rename Zend/tests/generators/{ => errors}/yield_outside_function_error.phpt (100%) diff --git a/Zend/tests/generators/errors/generator_extend_error.phpt b/Zend/tests/generators/errors/generator_extend_error.phpt new file mode 100644 index 00000000000..550f16ae03b --- /dev/null +++ b/Zend/tests/generators/errors/generator_extend_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +The Generator class cannot be extended +--FILE-- + +--EXPECTF-- +Fatal error: Class ExtendedGenerator may not inherit from final class (Generator) in %s on line %d diff --git a/Zend/tests/generators/errors/generator_instantiate_error.phpt b/Zend/tests/generators/errors/generator_instantiate_error.phpt new file mode 100644 index 00000000000..f8941c087af --- /dev/null +++ b/Zend/tests/generators/errors/generator_instantiate_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +It's not possible to directly instantiate the Generator class +--FILE-- + +--EXPECTF-- +Catchable fatal error: The "Generator" class is reserved for internal use and cannot be manually instantiated in %s on line %d diff --git a/Zend/tests/generators/yield_in_normal_function_error.phpt b/Zend/tests/generators/errors/yield_in_normal_function_error.phpt similarity index 100% rename from Zend/tests/generators/yield_in_normal_function_error.phpt rename to Zend/tests/generators/errors/yield_in_normal_function_error.phpt diff --git a/Zend/tests/generators/yield_outside_function_error.phpt b/Zend/tests/generators/errors/yield_outside_function_error.phpt similarity index 100% rename from Zend/tests/generators/yield_outside_function_error.phpt rename to Zend/tests/generators/errors/yield_outside_function_error.phpt diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 6f98dcb2c1c..21581db2c03 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -23,6 +23,49 @@ #include "zend_generators.h" ZEND_API zend_class_entry *zend_ce_generator; +static zend_object_handlers zend_generator_handlers; + +typedef struct _zend_generator { + zend_object std; + /* nothing more for now */ +} zend_generator; + +static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */ +{ + zend_object_std_dtor(&generator->std TSRMLS_CC); + + efree(generator); +} +/* }}} */ + +static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ +{ + zend_generator *generator; + zend_object_value object; + + generator = emalloc(sizeof(zend_generator)); + memset(generator, 0, sizeof(zend_generator)); + + zend_object_std_init(&generator->std, class_type TSRMLS_CC); + + object.handle = zend_objects_store_put(generator, NULL, + (zend_objects_free_object_storage_t) zend_generator_free_storage, + NULL /* no clone handler for now */ + TSRMLS_CC + ); + object.handlers = &zend_generator_handlers; + + return object; +} +/* }}} */ + +static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* {{{ */ +{ + zend_error(E_RECOVERABLE_ERROR, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated"); + + return NULL; +} +/* }}} */ static const zend_function_entry generator_functions[] = { ZEND_FE_END @@ -35,6 +78,10 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Generator", generator_functions); zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_generator->create_object = zend_generator_create; + + memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_generator_handlers.get_constructor = zend_generator_get_constructor; } /* }}} */ From 46fa26ab853b766c9222e49dbe7555de360b42f4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 20 May 2012 14:45:01 +0200 Subject: [PATCH 010/641] Make generator functions return a Generator object Right now generator functions simply immediately return a new Generator object (no suspension yet). --- .../generators/generator_returns_generator.phpt | 16 ++++++++++++++++ Zend/zend_execute.c | 1 + Zend/zend_vm_def.h | 12 ++++++++++-- Zend/zend_vm_execute.h | 12 ++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Zend/tests/generators/generator_returns_generator.phpt diff --git a/Zend/tests/generators/generator_returns_generator.phpt b/Zend/tests/generators/generator_returns_generator.phpt new file mode 100644 index 00000000000..a3e2b29468f --- /dev/null +++ b/Zend/tests/generators/generator_returns_generator.phpt @@ -0,0 +1,16 @@ +--TEST-- +A generator function returns a Generator object +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index d72fc7369af..d82abfc6138 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -35,6 +35,7 @@ #include "zend_exceptions.h" #include "zend_interfaces.h" #include "zend_closures.h" +#include "zend_generators.h" #include "zend_vm.h" #include "zend_dtrace.h" diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 9dc7e0842cf..13ae824c48b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5197,9 +5197,17 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) { - /* do nothing for now */ + if (EG(return_value_ptr_ptr)) { + zval *return_value; - ZEND_VM_NEXT_OPCODE(); + ALLOC_INIT_ZVAL(return_value); + object_init_ex(return_value, zend_ce_generator); + + *EG(return_value_ptr_ptr) = return_value; + } + + /* for now we just do a normal return without suspension */ + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c6c3af65db6..12338117f56 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1154,9 +1154,17 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - /* do nothing for now */ + if (EG(return_value_ptr_ptr)) { + zval *return_value; - ZEND_VM_NEXT_OPCODE(); + ALLOC_INIT_ZVAL(return_value); + object_init_ex(return_value, zend_ce_generator); + + *EG(return_value_ptr_ptr) = return_value; + } + + /* for now we just do a normal return without suspension */ + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From 5e763d9420cbccbd8ee4f14a263b2439e6c5ae88 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 22 May 2012 23:14:36 +0200 Subject: [PATCH 011/641] Allocate execute_data using malloc for generators Generators need to switch the execute_data very often. If the execute_data is allocated on the VM stack this operation would require to always copy the structure (which is quite large). That's why the execution context is allocated on the heap instead (only for generators obviously). --- Zend/zend_vm_def.h | 8 +++++++- Zend/zend_vm_execute.h | 44 +++++++++++++++++++++++++++++++++++----- Zend/zend_vm_execute.skl | 36 ++++++++++++++++++++++++++++---- 3 files changed, 78 insertions(+), 10 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 13ae824c48b..20b5633b8ae 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2530,7 +2530,13 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) nested = EX(nested); - zend_vm_stack_free(execute_data TSRMLS_CC); + /* For generators the execute_data is stored on the heap, for everything + * else it is stored on the VM stack. */ + if (op_array->fn_flags & ZEND_ACC_GENERATOR) { + efree(execute_data); + } else { + zend_vm_stack_free(execute_data TSRMLS_CC); + } if (nested) { execute_data = EG(current_execute_data); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 12338117f56..d351067cb76 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -342,11 +342,15 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) { DCL_OPLINE + zend_execute_data *execute_data; + size_t execute_data_size; + zend_bool nested = 0; zend_bool original_in_execution = EG(in_execution); + if (EG(exception)) { return; } @@ -354,11 +358,35 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) EG(in_execution) = 1; zend_vm_enter: - /* Initialize execute_data */ - execute_data = (zend_execute_data *)zend_vm_stack_alloc( + /* + * When allocating the execute_data, memory for compiled variables and + * temporary variables is also allocated after the actual zend_execute_data + * struct. op_array->last_var specifies the number of compiled variables and + * op_array->T is the number of temporary variables. If there is no symbol + * table, then twice as much memory is allocated for compiled variables. + * In that case the first half contains zval**s and the second half the + * actual zval*s (which would otherwise be in the symbol table). + */ + execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + - ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + - ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T TSRMLS_CC); + ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + + ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T + ; + + /* + * Normally the execute_data is allocated on the VM stack (because it does + * not actually do any allocation and thus is faster). For generators + * though this behavior would be suboptimal, because the (rather large) + * structure would have to be copied back and forth every time execution is + * suspended or resumed. That's why for generators the execution context + * is allocated using emalloc, thus allowing to save and restore it simply + * by replacing a pointer. + */ + if (op_array->fn_flags & ZEND_ACC_GENERATOR) { + execute_data = emalloc(execute_data_size); + } else { + execute_data = zend_vm_stack_alloc(execute_data_size TSRMLS_CC); + } EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data))); memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); @@ -477,7 +505,13 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) nested = EX(nested); - zend_vm_stack_free(execute_data TSRMLS_CC); + /* For generators the execute_data is stored on the heap, for everything + * else it is stored on the VM stack. */ + if (op_array->fn_flags & ZEND_ACC_GENERATOR) { + efree(execute_data); + } else { + zend_vm_stack_free(execute_data TSRMLS_CC); + } if (nested) { execute_data = EG(current_execute_data); diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 426f689795f..359e0520089 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -3,9 +3,13 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) { DCL_OPLINE + zend_execute_data *execute_data; + size_t execute_data_size; + zend_bool nested = 0; zend_bool original_in_execution = EG(in_execution); + {%HELPER_VARS%} {%INTERNAL_LABELS%} @@ -17,11 +21,35 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) EG(in_execution) = 1; zend_vm_enter: - /* Initialize execute_data */ - execute_data = (zend_execute_data *)zend_vm_stack_alloc( + /* + * When allocating the execute_data, memory for compiled variables and + * temporary variables is also allocated after the actual zend_execute_data + * struct. op_array->last_var specifies the number of compiled variables and + * op_array->T is the number of temporary variables. If there is no symbol + * table, then twice as much memory is allocated for compiled variables. + * In that case the first half contains zval**s and the second half the + * actual zval*s (which would otherwise be in the symbol table). + */ + execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + - ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + - ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T TSRMLS_CC); + ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + + ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T + ; + + /* + * Normally the execute_data is allocated on the VM stack (because it does + * not actually do any allocation and thus is faster). For generators + * though this behavior would be suboptimal, because the (rather large) + * structure would have to be copied back and forth every time execution is + * suspended or resumed. That's why for generators the execution context + * is allocated using emalloc, thus allowing to save and restore it simply + * by replacing a pointer. + */ + if (op_array->fn_flags & ZEND_ACC_GENERATOR) { + execute_data = emalloc(execute_data_size); + } else { + execute_data = zend_vm_stack_alloc(execute_data_size TSRMLS_CC); + } EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data))); memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); From 9ce9a7e639bbb6c1c4bb34d542d2ac4e42e9457e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 23 May 2012 14:20:25 +0200 Subject: [PATCH 012/641] Add initial code for suspending execution This is just some initial code, which is still quite broken (and needs to be moved so it can be reused.) --- Zend/zend_generators.c | 28 ++++++++++++++++++++++----- Zend/zend_generators.h | 7 +++++++ Zend/zend_vm_def.h | 43 ++++++++++++++++++++++++++++++++++++++++-- Zend/zend_vm_execute.h | 43 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 112 insertions(+), 9 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 21581db2c03..d9ddd75ffbe 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -25,15 +25,33 @@ ZEND_API zend_class_entry *zend_ce_generator; static zend_object_handlers zend_generator_handlers; -typedef struct _zend_generator { - zend_object std; - /* nothing more for now */ -} zend_generator; - static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */ { zend_object_std_dtor(&generator->std TSRMLS_CC); + if (generator->execute_data) { + zend_execute_data *execute_data = generator->execute_data; + + if (!execute_data->symbol_table) { + int i; + for (i = 0; i < execute_data->op_array->last_var; ++i) { + if (execute_data->CVs[i]) { + zval_ptr_dtor(execute_data->CVs[i]); + } + } + } else { + if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) { + zend_hash_destroy(execute_data->symbol_table); + FREE_HASHTABLE(execute_data->symbol_table); + } else { + zend_hash_clean(execute_data->symbol_table); + *(++EG(symtable_cache_ptr)) = execute_data->symbol_table; + } + } + + efree(execute_data); + } + efree(generator); } /* }}} */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 60899072dff..c3b8f455f65 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -27,6 +27,13 @@ void zend_register_generator_ce(TSRMLS_D); extern ZEND_API zend_class_entry *zend_ce_generator; +typedef struct _zend_generator { + zend_object std; + + /* The suspended execution context. */ + zend_execute_data *execute_data; +} zend_generator; + END_EXTERN_C() #endif diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 20b5633b8ae..f4d16be7f97 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5203,17 +5203,56 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) { + zend_bool nested; + if (EG(return_value_ptr_ptr)) { zval *return_value; + zend_generator *generator; ALLOC_INIT_ZVAL(return_value); object_init_ex(return_value, zend_ce_generator); *EG(return_value_ptr_ptr) = return_value; + + /* back up the execution context */ + generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); + generator->execute_data = execute_data; } - /* for now we just do a normal return without suspension */ - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + /* restore the previous execution context */ + EG(current_execute_data) = EX(prev_execute_data); + nested = EX(nested); + + /* if there is no return value pointer we are responsible for freeing the + * execution data */ + if (!EG(return_value_ptr_ptr)) { + /* something has to be done in here, not sure yet what exactly */ + } + + EG(opline_ptr) = NULL; + if (nested) { + /* so we can use EX() again */ + execute_data = EG(current_execute_data); + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + EG(active_symbol_table) = EX(symbol_table); + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + } + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d351067cb76..8316a0afb15 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1188,17 +1188,56 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zend_bool nested; + if (EG(return_value_ptr_ptr)) { zval *return_value; + zend_generator *generator; ALLOC_INIT_ZVAL(return_value); object_init_ex(return_value, zend_ce_generator); *EG(return_value_ptr_ptr) = return_value; + + /* back up the execution context */ + generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); + generator->execute_data = execute_data; } - /* for now we just do a normal return without suspension */ - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + /* restore the previous execution context */ + EG(current_execute_data) = EX(prev_execute_data); + nested = EX(nested); + + /* if there is no return value pointer we are responsible for freeing the + * execution data */ + if (!EG(return_value_ptr_ptr)) { + /* something has to be done in here, not sure yet what exactly */ + } + + EG(opline_ptr) = NULL; + if (nested) { + /* so we can use EX() again */ + execute_data = EG(current_execute_data); + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + EG(active_symbol_table) = EX(symbol_table); + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + } + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From 2c5ecb4fea3580dfe7e89be7b236b1cacbaf80de Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 23 May 2012 16:07:15 +0200 Subject: [PATCH 013/641] Add dummy Iterator implementation This simply adds dummy rewind/valid/current/key/next methods to Generator. --- Zend/zend_generators.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index d9ddd75ffbe..00af65538aa 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -20,6 +20,7 @@ #include "zend.h" #include "zend_API.h" +#include "zend_interfaces.h" #include "zend_generators.h" ZEND_API zend_class_entry *zend_ce_generator; @@ -85,7 +86,65 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* } /* }}} */ +/* {{{ proto void Generator::rewind() + * Rewind the generator */ +ZEND_METHOD(Generator, rewind) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +} +/* }}} */ + +/* {{{ proto bool Generator::valid() + * Check whether the generator is valid */ +ZEND_METHOD(Generator, valid) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +} +/* }}} */ + +/* {{{ proto mixed Generator::current() + * Get the current value */ +ZEND_METHOD(Generator, current) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +} +/* }}} */ + +/* {{{ proto mixed Generator::key() + * Get the current key */ +ZEND_METHOD(Generator, key) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +} +/* }}} */ + +/* {{{ proto void Generator::next() + * Advances the generator */ +ZEND_METHOD(Generator, next) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +} +/* }}} */ + +ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0) +ZEND_END_ARG_INFO() + static const zend_function_entry generator_functions[] = { + ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -98,6 +157,8 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_generator->create_object = zend_generator_create; + zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator); + memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zend_generator_handlers.get_constructor = zend_generator_get_constructor; } From ececcbce0e37a306afc1a039f52188b6c243fecc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 23 May 2012 20:34:17 +0200 Subject: [PATCH 014/641] Allow calling zend_vm_gen from everywhere Before one could only call it with cwd=Zend. --- Zend/zend_vm_gen.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 3163000e472..a6314edd0c4 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1182,7 +1182,7 @@ function gen_vm($def, $skel) { // Generate opcode #defines (zend_vm_opcodes.h) $code_len = strlen((string)$max_opcode); - $f = fopen("zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"); + $f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"); // Insert header out($f, $GLOBALS['header_text']); @@ -1196,8 +1196,8 @@ function gen_vm($def, $skel) { echo "zend_vm_opcodes.h generated successfully.\n"; // Generate zend_vm_execute.h - $f = fopen("zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"); - $executor_file = realpath("zend_vm_execute.h"); + $f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"); + $executor_file = realpath(__DIR__ . "/zend_vm_execute.h"); // Insert header out($f, $GLOBALS['header_text']); @@ -1440,6 +1440,6 @@ if (!defined("ZEND_VM_LINES")) { define("ZEND_VM_LINES", 0); } -gen_vm("zend_vm_def.h", "zend_vm_execute.skl"); +gen_vm(__DIR__ . "/zend_vm_def.h", __DIR__ . "/zend_vm_execute.skl"); ?> From 1d2f61904987133d542c68cd349cf313d0bef1c8 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Fri, 25 May 2012 18:55:34 +0800 Subject: [PATCH 015/641] Fixed bug #61964 (finfo_open with directory cause invalid free) --- ext/fileinfo/libmagic/apprentice.c | 27 +++++++++--- ext/fileinfo/tests/bug61964.phpt | 69 ++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 ext/fileinfo/tests/bug61964.phpt diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 4a54849e070..98bde27a2d7 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -753,7 +753,7 @@ private int apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { - int errs = 0; + int errs = 0, mflen = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; size_t files = 0, maxfiles = 0; @@ -782,7 +782,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } while ((d = readdir(dir)) != NULL) { - if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { + if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -804,14 +804,14 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } } - filearr[files++] = mfn; + filearr[files++] = estrndup(mfn, mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); for (i = 0; i < files; i++) { load_1(ms, action, filearr[i], &errs, &marray, &marraycount); - free(filearr[i]); + efree(filearr[i]); } free(filearr); } else @@ -886,9 +886,14 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, mentrycount += marray[i].cont_count; } out: - for (i = 0; i < marraycount; i++) - efree(marray[i].mp); - efree(marray); + for (i = 0; i < marraycount; i++) { + if (marray[i].mp) { + efree(marray[i].mp); + } + } + if (marray) { + efree(marray); + } if (errs) { *magicp = NULL; *nmagicp = 0; @@ -1165,6 +1170,9 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, return -1; } me = &(*mentryp)[*nmentryp - 1]; + if (me->mp == NULL) { + return -1; + } if (me->cont_count == me->max_count) { struct magic *nm; size_t cnt = me->max_count + ALLOC_CHUNK; @@ -1329,6 +1337,10 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp, if (m->type == FILE_INVALID) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "type `%s' invalid", l); + if (me->mp) { + efree(me->mp); + me->mp = NULL; + } return -1; } @@ -2219,6 +2231,7 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, mm = emalloc((size_t)st.sb.st_size); if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != (size_t)st.sb.st_size) { file_badread(ms); + ret = 1; goto error1; } ret = 1; diff --git a/ext/fileinfo/tests/bug61964.phpt b/ext/fileinfo/tests/bug61964.phpt new file mode 100644 index 00000000000..99c8fd2ae3e --- /dev/null +++ b/ext/fileinfo/tests/bug61964.phpt @@ -0,0 +1,69 @@ +--TEST-- +Bug #61964 (finfo_open with directory cause invalid free) +--SKIPIF-- + +--FILE-- + Core\n> Me"); +file_put_contents($dir . "/test2.txt", "a\nb\n"); +@mkdir($dir . "/test-inner-folder"); + +finfo_open(FILEINFO_NONE, $dir); +echo "DONE: testing dir with files\n"; + +rmdir($dir . "/test-inner-folder"); +unlink($dir . "/test1.txt"); +unlink($dir . "/test2.txt"); + +unlink($magic_file_copy); +unlink($magic_file_copy2); +rmdir($dir); +?> +===DONE=== +--EXPECTF-- +bool(false) +resource(%d) of type (file_info) +resource(%d) of type (file_info) +bool(false) + +Notice: finfo_open(): Warning: offset `string' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset ` Core' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `Core' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset `a' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `a' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964.php on line %d + +Notice: finfo_open(): Warning: type `b' invalid in %sbug61964.php on line %d + +Warning: finfo_open(): Failed to load magic database at '%stest-folder'. in %sbug61964.php on line %d +DONE: testing dir with files +===DONE=== From f627be52540738e124da7cb1566d7f60a2b6a48b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 May 2012 17:53:13 +0200 Subject: [PATCH 016/641] Add support for executing a zend_execute_data This adds another function execute_ex(), which accepts a zend_execute_data struct to run (contrary to execute(), which accepts a zend_op_array from which it initialized the execute_data). This needs a bit more cleanup. --- Zend/zend_execute.h | 1 + Zend/zend_generators.c | 45 ++++++++++++++++++++++++ Zend/zend_generators.h | 2 ++ Zend/zend_vm_execute.h | 74 +++++++++++++++++++++------------------ Zend/zend_vm_execute.skl | 75 ++++++++++++++++++++++------------------ Zend/zend_vm_gen.php | 3 +- 6 files changed, 132 insertions(+), 68 deletions(-) diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 7d427388bda..75a7eaa8a1a 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -56,6 +56,7 @@ void init_executor(TSRMLS_D); void shutdown_executor(TSRMLS_D); void shutdown_destructors(TSRMLS_D); ZEND_API void execute(zend_op_array *op_array TSRMLS_DC); +ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC); ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC); ZEND_API int zend_is_true(zval *op); #define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 00af65538aa..de1271fdf15 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -86,13 +86,34 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* } /* }}} */ +static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ +{ + generator->execute_data->opline++; + execute_ex(generator->execute_data TSRMLS_CC); +} +/* }}} */ + +static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */ +{ + if (!generator->value) { + zend_generator_resume(generator TSRMLS_CC); + } +} +/* }}} */ + /* {{{ proto void Generator::rewind() * Rewind the generator */ ZEND_METHOD(Generator, rewind) { + zend_generator *generator; + if (zend_parse_parameters_none() == FAILURE) { return; } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_ensure_initialized(generator TSRMLS_CC); } /* }}} */ @@ -100,9 +121,15 @@ ZEND_METHOD(Generator, rewind) * Check whether the generator is valid */ ZEND_METHOD(Generator, valid) { + zend_generator *generator; + if (zend_parse_parameters_none() == FAILURE) { return; } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_ensure_initialized(generator TSRMLS_CC); } /* }}} */ @@ -110,9 +137,15 @@ ZEND_METHOD(Generator, valid) * Get the current value */ ZEND_METHOD(Generator, current) { + zend_generator *generator; + if (zend_parse_parameters_none() == FAILURE) { return; } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_ensure_initialized(generator TSRMLS_CC); } /* }}} */ @@ -120,9 +153,15 @@ ZEND_METHOD(Generator, current) * Get the current key */ ZEND_METHOD(Generator, key) { + zend_generator *generator; + if (zend_parse_parameters_none() == FAILURE) { return; } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_ensure_initialized(generator TSRMLS_CC); } /* }}} */ @@ -130,9 +169,15 @@ ZEND_METHOD(Generator, key) * Advances the generator */ ZEND_METHOD(Generator, next) { + zend_generator *generator; + if (zend_parse_parameters_none() == FAILURE) { return; } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_ensure_initialized(generator TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index c3b8f455f65..1422b71896e 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -32,6 +32,8 @@ typedef struct _zend_generator { /* The suspended execution context. */ zend_execute_data *execute_data; + /* Current value */ + zval *value; } zend_generator; END_EXTERN_C() diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 8316a0afb15..c83a4dbb38c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -339,25 +339,9 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o #define EX_Ts() EX(Ts) -ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) -{ - DCL_OPLINE - +static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { zend_execute_data *execute_data; - size_t execute_data_size; - zend_bool nested = 0; - zend_bool original_in_execution = EG(in_execution); - - - - if (EG(exception)) { - return; - } - - EG(in_execution) = 1; - -zend_vm_enter: /* * When allocating the execute_data, memory for compiled variables and * temporary variables is also allocated after the actual zend_execute_data @@ -367,11 +351,10 @@ zend_vm_enter: * In that case the first half contains zval**s and the second half the * actual zval*s (which would otherwise be in the symbol table). */ - execute_data_size = - ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + - ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + - ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T - ; + size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)); + size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)); + size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T; + size_t total_size = execute_data_size + CVs_size + Ts_size; /* * Normally the execute_data is allocated on the VM stack (because it does @@ -383,14 +366,16 @@ zend_vm_enter: * by replacing a pointer. */ if (op_array->fn_flags & ZEND_ACC_GENERATOR) { - execute_data = emalloc(execute_data_size); + execute_data = emalloc(total_size); } else { - execute_data = zend_vm_stack_alloc(execute_data_size TSRMLS_CC); + execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC); } - EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data))); - memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); - EX(Ts) = (temp_variable *)(((char*)EX(CVs)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2))); + EX(CVs) = (zval ***) ((char *) execute_data + execute_data_size); + memset(EX(CVs), 0, sizeof(zval **) * op_array->last_var); + + EX(Ts) = (temp_variable *) ((char *) EX(CVs) + CVs_size); + EX(fbc) = NULL; EX(called_scope) = NULL; EX(object) = NULL; @@ -400,9 +385,6 @@ zend_vm_enter: EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; - nested = 1; - - LOAD_REGS(); if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); @@ -422,11 +404,31 @@ zend_vm_enter: EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes; EG(opline_ptr) = &EX(opline); - LOAD_OPLINE(); EX(function_state).function = (zend_function *) op_array; EX(function_state).arguments = NULL; + return execute_data; +} + +ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC) +{ + DCL_OPLINE + + zend_bool original_in_execution = EG(in_execution); + + + + if (EG(exception)) { + return; + } + + EG(in_execution) = 1; + +zend_vm_enter: + LOAD_REGS(); + LOAD_OPLINE(); + while (1) { int ret; #ifdef ZEND_WIN32 @@ -441,8 +443,7 @@ zend_vm_enter: EG(in_execution) = original_in_execution; return; case 2: - op_array = EG(active_op_array); - goto zend_vm_enter; + execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); case 3: execute_data = EG(current_execute_data); default: @@ -454,6 +455,13 @@ zend_vm_enter: zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen"); } +ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) +{ + zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC); + + execute_ex(execute_data TSRMLS_CC); +} + static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 359e0520089..d251e55344e 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -1,26 +1,8 @@ {%DEFINES%} -ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) -{ - DCL_OPLINE - +static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { zend_execute_data *execute_data; - size_t execute_data_size; - zend_bool nested = 0; - zend_bool original_in_execution = EG(in_execution); - - {%HELPER_VARS%} - - {%INTERNAL_LABELS%} - - if (EG(exception)) { - return; - } - - EG(in_execution) = 1; - -zend_vm_enter: /* * When allocating the execute_data, memory for compiled variables and * temporary variables is also allocated after the actual zend_execute_data @@ -30,11 +12,10 @@ zend_vm_enter: * In that case the first half contains zval**s and the second half the * actual zval*s (which would otherwise be in the symbol table). */ - execute_data_size = - ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + - ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) + - ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T - ; + size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)); + size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)); + size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T; + size_t total_size = execute_data_size + CVs_size + Ts_size; /* * Normally the execute_data is allocated on the VM stack (because it does @@ -46,14 +27,16 @@ zend_vm_enter: * by replacing a pointer. */ if (op_array->fn_flags & ZEND_ACC_GENERATOR) { - execute_data = emalloc(execute_data_size); + execute_data = emalloc(total_size); } else { - execute_data = zend_vm_stack_alloc(execute_data_size TSRMLS_CC); + execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC); } - EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data))); - memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var); - EX(Ts) = (temp_variable *)(((char*)EX(CVs)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2))); + EX(CVs) = (zval ***) ((char *) execute_data + execute_data_size); + memset(EX(CVs), 0, sizeof(zval **) * op_array->last_var); + + EX(Ts) = (temp_variable *) ((char *) EX(CVs) + CVs_size); + EX(fbc) = NULL; EX(called_scope) = NULL; EX(object) = NULL; @@ -63,9 +46,6 @@ zend_vm_enter: EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; - nested = 1; - - LOAD_REGS(); if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); @@ -85,11 +65,33 @@ zend_vm_enter: EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes; EG(opline_ptr) = &EX(opline); - LOAD_OPLINE(); EX(function_state).function = (zend_function *) op_array; EX(function_state).arguments = NULL; + return execute_data; +} + +ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC) +{ + DCL_OPLINE + + zend_bool original_in_execution = EG(in_execution); + + {%HELPER_VARS%} + + {%INTERNAL_LABELS%} + + if (EG(exception)) { + return; + } + + EG(in_execution) = 1; + +zend_vm_enter: + LOAD_REGS(); + LOAD_OPLINE(); + while (1) { {%ZEND_VM_CONTINUE_LABEL%} #ifdef ZEND_WIN32 @@ -106,6 +108,13 @@ zend_vm_enter: zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen"); } +ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) +{ + zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC); + + {%EXECUTOR_NAME%}_ex(execute_data TSRMLS_CC); +} + {%EXTERNAL_EXECUTOR%} void {%INITIALIZER_NAME%}(void) diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index a6314edd0c4..b7fd874264f 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -976,8 +976,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, $m[1]."\t\tEG(in_execution) = original_in_execution;\n". $m[1]."\t\treturn;\n". $m[1]."\tcase 2:\n" . - $m[1]."\t\top_array = EG(active_op_array);\n". - $m[1]."\t\tgoto zend_vm_enter;\n". + $m[1]."\t\texecute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC);\n". $m[1]."\tcase 3:\n" . $m[1]."\t\texecute_data = EG(current_execute_data);\n". $m[1]."\tdefault:\n". From 1a99d1c8874936f7e232840a580d7bc588d63a6c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 May 2012 19:40:29 +0200 Subject: [PATCH 017/641] Add way to pass generator object to opcode handlers The generator zval is put into the return_value_ptr_ptr. --- Zend/zend_generators.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index de1271fdf15..1ea910b0eba 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -86,17 +86,23 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* } /* }}} */ -static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ +static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ { + /* Go to next opcode (we don't want to run the last one again) */ generator->execute_data->opline++; + + /* We (mis) use the return_value_ptr_ptr to provide the generator object + * to the executor. This way YIELD will be able to set the yielded value */ + EG(return_value_ptr_ptr) = &object; + execute_ex(generator->execute_data TSRMLS_CC); } /* }}} */ -static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */ +static void zend_generator_ensure_initialized(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ { if (!generator->value) { - zend_generator_resume(generator TSRMLS_CC); + zend_generator_resume(object, generator TSRMLS_CC); } } /* }}} */ @@ -105,15 +111,17 @@ static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_D * Rewind the generator */ ZEND_METHOD(Generator, rewind) { + zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + object = getThis(); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); + zend_generator_ensure_initialized(object, generator TSRMLS_CC); } /* }}} */ @@ -121,15 +129,17 @@ ZEND_METHOD(Generator, rewind) * Check whether the generator is valid */ ZEND_METHOD(Generator, valid) { + zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + object = getThis(); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); + zend_generator_ensure_initialized(object, generator TSRMLS_CC); } /* }}} */ @@ -137,15 +147,17 @@ ZEND_METHOD(Generator, valid) * Get the current value */ ZEND_METHOD(Generator, current) { + zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + object = getThis(); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); + zend_generator_ensure_initialized(object, generator TSRMLS_CC); } /* }}} */ @@ -153,15 +165,17 @@ ZEND_METHOD(Generator, current) * Get the current key */ ZEND_METHOD(Generator, key) { + zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + object = getThis(); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); + zend_generator_ensure_initialized(object, generator TSRMLS_CC); } /* }}} */ @@ -169,15 +183,16 @@ ZEND_METHOD(Generator, key) * Advances the generator */ ZEND_METHOD(Generator, next) { + zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); + zend_generator_ensure_initialized(object, generator TSRMLS_CC); } /* }}} */ From fafce58683e74a397023cc1077aae210109b40b6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 May 2012 22:44:53 +0200 Subject: [PATCH 018/641] Add YIELD opcode implementation --- Zend/zend_compile.c | 8 +- Zend/zend_generators.c | 23 ++++- Zend/zend_vm_def.h | 41 +++++++++ Zend/zend_vm_execute.h | 186 +++++++++++++++++++++++++++++++++++++++++ Zend/zend_vm_opcodes.h | 1 + 5 files changed, 256 insertions(+), 3 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f0802efd587..b0e6ee20660 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2660,11 +2660,17 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ { + zend_op *opline; + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { zend_error(E_COMPILE_ERROR, "The \"yield\" statement can only be used inside a generator function"); } - /* do nothing for now */ + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_YIELD; + SET_NODE(opline->op1, expr); + SET_UNUSED(opline->op2); } /* }}} */ diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 1ea910b0eba..8161fc79351 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -53,6 +53,10 @@ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* efree(execute_data); } + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + efree(generator); } /* }}} */ @@ -88,14 +92,28 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ { - /* Go to next opcode (we don't want to run the last one again) */ - generator->execute_data->opline++; + /* Backup executor globals */ + zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); + zend_op **original_opline_ptr = EG(opline_ptr); + zend_op_array *original_active_op_array = EG(active_op_array); /* We (mis) use the return_value_ptr_ptr to provide the generator object * to the executor. This way YIELD will be able to set the yielded value */ EG(return_value_ptr_ptr) = &object; + EG(opline_ptr) = &generator->execute_data->opline; + EG(active_op_array) = generator->execute_data->op_array; + + /* Go to next opcode (we don't want to run the last one again) */ + generator->execute_data->opline++; + + /* Resume execution */ execute_ex(generator->execute_data TSRMLS_CC); + + /* Restore executor globals */ + EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; + EG(opline_ptr) = original_opline_ptr; + EG(active_op_array) = original_active_op_array; } /* }}} */ @@ -190,6 +208,7 @@ ZEND_METHOD(Generator, next) return; } + object = getThis(); generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f4d16be7f97..b2fc0517e5f 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5255,4 +5255,45 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_LEAVE(); } +ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) +{ + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + { + USE_OPLINE + zend_free_op free_op1; + zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); + + /* Consts, temporary variables and references need copying */ + if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!IS_OP1_TMP_FREE()) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + generator->value = value; + Z_ADDREF_P(value); + } + + FREE_OP1_IF_VAR(); + } + + ZEND_VM_RETURN(); +} + ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c83a4dbb38c..775b0ec0645 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3030,6 +3030,46 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + { + USE_OPLINE + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + generator->value = value; + Z_ADDREF_P(value); + } + + } + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -7616,6 +7656,46 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + { + USE_OPLINE + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + generator->value = value; + Z_ADDREF_P(value); + } + + } + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -12279,6 +12359,47 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + { + USE_OPLINE + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + generator->value = value; + Z_ADDREF_P(value); + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -28113,6 +28234,46 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + { + USE_OPLINE + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + generator->value = value; + Z_ADDREF_P(value); + } + + } + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -40903,6 +41064,31 @@ void zend_init_opcodes_handlers(void) ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, + ZEND_YIELD_SPEC_CONST_HANDLER, + ZEND_YIELD_SPEC_CONST_HANDLER, + ZEND_YIELD_SPEC_CONST_HANDLER, + ZEND_YIELD_SPEC_CONST_HANDLER, + ZEND_YIELD_SPEC_CONST_HANDLER, + ZEND_YIELD_SPEC_TMP_HANDLER, + ZEND_YIELD_SPEC_TMP_HANDLER, + ZEND_YIELD_SPEC_TMP_HANDLER, + ZEND_YIELD_SPEC_TMP_HANDLER, + ZEND_YIELD_SPEC_TMP_HANDLER, + ZEND_YIELD_SPEC_VAR_HANDLER, + ZEND_YIELD_SPEC_VAR_HANDLER, + ZEND_YIELD_SPEC_VAR_HANDLER, + ZEND_YIELD_SPEC_VAR_HANDLER, + ZEND_YIELD_SPEC_VAR_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_YIELD_SPEC_CV_HANDLER, + ZEND_YIELD_SPEC_CV_HANDLER, + ZEND_YIELD_SPEC_CV_HANDLER, + ZEND_YIELD_SPEC_CV_HANDLER, + ZEND_YIELD_SPEC_CV_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 9e24dee11d6..53e00a1743c 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -160,3 +160,4 @@ #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 #define ZEND_SUSPEND_AND_RETURN_GENERATOR 159 +#define ZEND_YIELD 160 From 5bb3a995c2ad1a41c22a88e17dc46fef22ab1849 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 May 2012 23:07:05 +0200 Subject: [PATCH 019/641] Implement return for generators For generators ZEND_RETURN directly calls ZEND_VM_RETURN(), thus passing execution back to the caller (zend_generator_resume). This commit also adds a check that only return; is used in generators and not return $value;. --- .../errors/generator_cannot_return_error.phpt | 12 +++++++++++ Zend/zend_compile.c | 4 ++++ Zend/zend_generators.c | 11 ++++++++++ Zend/zend_vm_def.h | 5 +++++ Zend/zend_vm_execute.h | 20 +++++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 Zend/tests/generators/errors/generator_cannot_return_error.phpt diff --git a/Zend/tests/generators/errors/generator_cannot_return_error.phpt b/Zend/tests/generators/errors/generator_cannot_return_error.phpt new file mode 100644 index 00000000000..070e3d5d5c0 --- /dev/null +++ b/Zend/tests/generators/errors/generator_cannot_return_error.phpt @@ -0,0 +1,12 @@ +--TEST-- +Generators cannot return values +--FILE-- + +--EXPECTF-- +Fatal error: Generators cannot return values using "return" in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b0e6ee20660..30fecf1e2e1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2615,6 +2615,10 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ zend_op *opline; int start_op_number, end_op_number; + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) && expr != NULL) { + zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); + } + if (do_end_vparse) { if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(expr)) { zend_do_end_variable_parse(expr, BP_VAR_W, 0 TSRMLS_CC); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 8161fc79351..78cd0c29883 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -140,6 +140,9 @@ ZEND_METHOD(Generator, rewind) generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + /* Generators aren't rewindable, so rewind() only has to make sure that + * the generator is initialized, nothing more */ } /* }}} */ @@ -158,6 +161,8 @@ ZEND_METHOD(Generator, valid) generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + RETURN_BOOL(generator->value != NULL); } /* }}} */ @@ -176,6 +181,10 @@ ZEND_METHOD(Generator, current) generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + if (generator->value) { + RETURN_ZVAL(generator->value, 1, 1); + } } /* }}} */ @@ -212,6 +221,8 @@ ZEND_METHOD(Generator, next) generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + zend_generator_resume(object, generator TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b2fc0517e5f..b944be0241b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2840,6 +2840,11 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) zval *retval_ptr; zend_free_op free_op1; + /* For generators return means to simply stop executing */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + ZEND_VM_RETURN(); + } + SAVE_OPLINE(); retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 775b0ec0645..d3fa75c2e76 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2321,6 +2321,11 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zval *retval_ptr; + /* For generators return means to simply stop executing */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + ZEND_VM_RETURN(); + } + SAVE_OPLINE(); retval_ptr = opline->op1.zv; @@ -6894,6 +6899,11 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; + /* For generators return means to simply stop executing */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + ZEND_VM_RETURN(); + } + SAVE_OPLINE(); retval_ptr = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -11372,6 +11382,11 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; + /* For generators return means to simply stop executing */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + ZEND_VM_RETURN(); + } + SAVE_OPLINE(); retval_ptr = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -27406,6 +27421,11 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; + /* For generators return means to simply stop executing */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + ZEND_VM_RETURN(); + } + SAVE_OPLINE(); retval_ptr = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); From d49d3971e630121a3cc11196b88f7afa2b1e2f26 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 May 2012 23:59:22 +0200 Subject: [PATCH 020/641] Close generator on return --- Zend/zend_generators.c | 19 ++++++++++++++++--- Zend/zend_generators.h | 9 +++++---- Zend/zend_vm_def.h | 8 +++++++- Zend/zend_vm_execute.h | 32 ++++++++++++++++++++++++++++---- 4 files changed, 56 insertions(+), 12 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 78cd0c29883..a6b16527742 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -26,10 +26,8 @@ ZEND_API zend_class_entry *zend_ce_generator; static zend_object_handlers zend_generator_handlers; -static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */ +void zend_generator_close(zend_generator *generator TSRMLS_DC) /* {{{ */ { - zend_object_std_dtor(&generator->std TSRMLS_CC); - if (generator->execute_data) { zend_execute_data *execute_data = generator->execute_data; @@ -51,12 +49,22 @@ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* } efree(execute_data); + generator->execute_data = NULL; } if (generator->value) { zval_ptr_dtor(&generator->value); + generator->value = NULL; } +} +/* }}} */ + +static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */ +{ + zend_generator_close(generator TSRMLS_CC); + + zend_object_std_dtor(&generator->std TSRMLS_CC); efree(generator); } /* }}} */ @@ -92,6 +100,11 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ { + /* The generator is already closed, thus can't resume */ + if (!generator->execute_data) { + return; + } + /* Backup executor globals */ zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); zend_op **original_opline_ptr = EG(opline_ptr); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 1422b71896e..4becddf17c9 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -23,10 +23,6 @@ BEGIN_EXTERN_C() -void zend_register_generator_ce(TSRMLS_D); - -extern ZEND_API zend_class_entry *zend_ce_generator; - typedef struct _zend_generator { zend_object std; @@ -36,6 +32,11 @@ typedef struct _zend_generator { zval *value; } zend_generator; +extern ZEND_API zend_class_entry *zend_ce_generator; + +void zend_register_generator_ce(TSRMLS_D); +void zend_generator_close(zend_generator *generator TSRMLS_DC); + END_EXTERN_C() #endif diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b944be0241b..781bd9fdd1c 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2840,8 +2840,14 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) zval *retval_ptr; zend_free_op free_op1; - /* For generators return means to simply stop executing */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources. */ + zend_generator_close(generator TSRMLS_CC); + + /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d3fa75c2e76..1eac10512d7 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2321,8 +2321,14 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zval *retval_ptr; - /* For generators return means to simply stop executing */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources. */ + zend_generator_close(generator TSRMLS_CC); + + /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); } @@ -6899,8 +6905,14 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; - /* For generators return means to simply stop executing */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources. */ + zend_generator_close(generator TSRMLS_CC); + + /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); } @@ -11382,8 +11394,14 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; - /* For generators return means to simply stop executing */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources. */ + zend_generator_close(generator TSRMLS_CC); + + /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); } @@ -27421,8 +27439,14 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; - /* For generators return means to simply stop executing */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources. */ + zend_generator_close(generator TSRMLS_CC); + + /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); } From cbfa96cad59d679502eca002a1e920065f11f871 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 27 May 2012 00:25:12 +0200 Subject: [PATCH 021/641] Remove wrong dtor call --- Zend/zend_generators.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index a6b16527742..36a9727722d 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -196,7 +196,7 @@ ZEND_METHOD(Generator, current) zend_generator_ensure_initialized(object, generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 1); + RETURN_ZVAL(generator->value, 1, 0); } } /* }}} */ From 39d3d5ec138119acf614fb285e92c3bcda7a2555 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 27 May 2012 00:50:27 +0200 Subject: [PATCH 022/641] Add first real generator test The test implements an xrange() function (the generator version of range()). --- Zend/tests/generators/xrange.phpt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Zend/tests/generators/xrange.phpt diff --git a/Zend/tests/generators/xrange.phpt b/Zend/tests/generators/xrange.phpt new file mode 100644 index 00000000000..685c6b3b570 --- /dev/null +++ b/Zend/tests/generators/xrange.phpt @@ -0,0 +1,23 @@ +--TEST-- +Simple generator xrange() test +--FILE-- + +--EXPECT-- +int(10) +int(12) +int(14) +int(16) +int(18) +int(20) From 247bb737d552508829c5de7770ed0b15c3d8f7fd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 27 May 2012 03:50:31 +0200 Subject: [PATCH 023/641] Add support for generator methods --- Zend/zend_generators.c | 53 ++++++++++++++++++++++++++++-------------- Zend/zend_vm_def.h | 5 ++++ Zend/zend_vm_execute.h | 5 ++++ 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 36a9727722d..ae706f19a57 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -48,6 +48,10 @@ void zend_generator_close(zend_generator *generator TSRMLS_DC) /* {{{ */ } } + if (execute_data->current_this) { + zval_ptr_dtor(&execute_data->current_this); + } + efree(execute_data); generator->execute_data = NULL; } @@ -105,28 +109,43 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS return; } - /* Backup executor globals */ - zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); - zend_op **original_opline_ptr = EG(opline_ptr); - zend_op_array *original_active_op_array = EG(active_op_array); + { + /* Backup executor globals */ + zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); + zend_op **original_opline_ptr = EG(opline_ptr); + zend_op_array *original_active_op_array = EG(active_op_array); + HashTable *original_active_symbol_table = EG(active_symbol_table); + zval *original_This = EG(This); + zend_class_entry *original_scope = EG(scope); + zend_class_entry *original_called_scope = EG(called_scope); - /* We (mis) use the return_value_ptr_ptr to provide the generator object - * to the executor. This way YIELD will be able to set the yielded value */ - EG(return_value_ptr_ptr) = &object; + /* We (mis)use the return_value_ptr_ptr to provide the generator object + * to the executor, so YIELD will be able to set the yielded value */ + EG(return_value_ptr_ptr) = &object; - EG(opline_ptr) = &generator->execute_data->opline; - EG(active_op_array) = generator->execute_data->op_array; + /* Set executor globals */ + EG(opline_ptr) = &generator->execute_data->opline; + EG(active_op_array) = generator->execute_data->op_array; + EG(active_symbol_table) = generator->execute_data->symbol_table; + EG(This) = generator->execute_data->current_this; + EG(scope) = generator->execute_data->current_scope; + EG(called_scope) = generator->execute_data->current_called_scope; - /* Go to next opcode (we don't want to run the last one again) */ - generator->execute_data->opline++; + /* Go to next opcode (we don't want to run the last one again) */ + generator->execute_data->opline++; - /* Resume execution */ - execute_ex(generator->execute_data TSRMLS_CC); + /* Resume execution */ + execute_ex(generator->execute_data TSRMLS_CC); - /* Restore executor globals */ - EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; - EG(opline_ptr) = original_opline_ptr; - EG(active_op_array) = original_active_op_array; + /* Restore executor globals */ + EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; + EG(opline_ptr) = original_opline_ptr; + EG(active_op_array) = original_active_op_array; + EG(active_symbol_table) = original_active_symbol_table; + EG(This) = original_This; + EG(scope) = original_scope; + EG(called_scope) = original_called_scope; + } } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 781bd9fdd1c..42397ed278d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5225,6 +5225,11 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) *EG(return_value_ptr_ptr) = return_value; + /* back up some executor globals */ + EX(current_this) = EG(This); + EX(current_scope) = EG(scope); + EX(current_called_scope) = EG(called_scope); + /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 1eac10512d7..fa802c652b6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1207,6 +1207,11 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP *EG(return_value_ptr_ptr) = return_value; + /* back up some executor globals */ + EX(current_this) = EG(This); + EX(current_scope) = EG(scope); + EX(current_called_scope) = EG(called_scope); + /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; From 64a643a4e3c1b45d3a9b2ad24537f7aab6296f7d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 27 May 2012 17:14:20 +0200 Subject: [PATCH 024/641] Free loop variables If the generator is closed before it has finished running, it may happen that some FREE or SWITCH_FREE opcodes haven't been executed and memory is leaked. This fixes it by walking the brk_cont_array and manually freeing the variables. --- .../generators/no_foreach_var_leaks.phpt | 19 +++++++++ Zend/zend_generators.c | 40 ++++++++++++++++++- Zend/zend_generators.h | 2 +- Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 8 ++-- 5 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 Zend/tests/generators/no_foreach_var_leaks.phpt diff --git a/Zend/tests/generators/no_foreach_var_leaks.phpt b/Zend/tests/generators/no_foreach_var_leaks.phpt new file mode 100644 index 00000000000..36ab91bb15a --- /dev/null +++ b/Zend/tests/generators/no_foreach_var_leaks.phpt @@ -0,0 +1,19 @@ +--TEST-- +foreach() (and other) variables aren't leaked on premature close +--FILE-- +current()); + +// generator is closed here, without running SWITCH_FREE + +?> +--EXPECT-- +string(3) "Foo" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index ae706f19a57..12116a0f109 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -26,7 +26,7 @@ ZEND_API zend_class_entry *zend_ce_generator; static zend_object_handlers zend_generator_handlers; -void zend_generator_close(zend_generator *generator TSRMLS_DC) /* {{{ */ +void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC) /* {{{ */ { if (generator->execute_data) { zend_execute_data *execute_data = generator->execute_data; @@ -52,6 +52,42 @@ void zend_generator_close(zend_generator *generator TSRMLS_DC) /* {{{ */ zval_ptr_dtor(&execute_data->current_this); } + /* If the generator is closed before it can finish execution (reach + * a return statement) we have to free loop variables manually, as + * we don't know whether the SWITCH_FREE / FREE opcodes have run */ + if (!finished_execution) { + zend_op_array *op_array = execute_data->op_array; + zend_uint op_num = execute_data->opline - op_array->opcodes; + + int i; + for (i = 0; i < op_array->last_brk_cont; ++i) { + zend_brk_cont_element *brk_cont = op_array->brk_cont_array + i; + + if (brk_cont->start < 0) { + continue; + } else if (brk_cont->start > op_num) { + break; + } else if (brk_cont->brk > op_num) { + zend_op *brk_opline = op_array->opcodes + brk_cont->brk; + + switch (brk_opline->opcode) { + case ZEND_SWITCH_FREE: + { + temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var); + zval_ptr_dtor(&var->var.ptr); + } + break; + case ZEND_FREE: + { + temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var); + zval_dtor(&var->tmp_var); + } + break; + } + } + } + } + efree(execute_data); generator->execute_data = NULL; } @@ -66,7 +102,7 @@ void zend_generator_close(zend_generator *generator TSRMLS_DC) /* {{{ */ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */ { - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 0 TSRMLS_CC); zend_object_std_dtor(&generator->std TSRMLS_CC); efree(generator); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 4becddf17c9..192e9e75c95 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -35,7 +35,7 @@ typedef struct _zend_generator { extern ZEND_API zend_class_entry *zend_ce_generator; void zend_register_generator_ce(TSRMLS_D); -void zend_generator_close(zend_generator *generator TSRMLS_DC); +void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC); END_EXTERN_C() diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 42397ed278d..440b36d04a4 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2845,7 +2845,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); /* Close the generator to free up resources. */ - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 1 TSRMLS_CC); /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index fa802c652b6..8f06afa9e14 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2331,7 +2331,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); /* Close the generator to free up resources. */ - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 1 TSRMLS_CC); /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); @@ -6915,7 +6915,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); /* Close the generator to free up resources. */ - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 1 TSRMLS_CC); /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); @@ -11404,7 +11404,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); /* Close the generator to free up resources. */ - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 1 TSRMLS_CC); /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); @@ -27449,7 +27449,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); /* Close the generator to free up resources. */ - zend_generator_close(generator TSRMLS_CC); + zend_generator_close(generator, 1 TSRMLS_CC); /* Pass execution back to generator handling code */ ZEND_VM_RETURN(); From 9f52c5c22647f0648dbb350c551417b1ad070359 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 27 May 2012 22:48:21 +0200 Subject: [PATCH 025/641] Fix generator creation when execute_data is not nested This happens primarily when the generator is invoked from some internal place like a dynamic function call. --- Zend/tests/generators/dynamic_call.phpt | 19 +++++++++++++++++++ Zend/zend_vm_def.h | 6 ++++-- Zend/zend_vm_execute.h | 6 ++++-- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 Zend/tests/generators/dynamic_call.phpt diff --git a/Zend/tests/generators/dynamic_call.phpt b/Zend/tests/generators/dynamic_call.phpt new file mode 100644 index 00000000000..7b4b0c3e59a --- /dev/null +++ b/Zend/tests/generators/dynamic_call.phpt @@ -0,0 +1,19 @@ +--TEST-- +It's possible to invoke a generator dynamically +--FILE-- + +--EXPECT-- +string(3) "bar" +string(3) "foo" diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 440b36d04a4..0b06c9217c3 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5265,10 +5265,12 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) EX(called_scope) = DECODE_CTOR(EX(called_scope)); zend_vm_stack_clear_multiple(TSRMLS_C); + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); + ZEND_VM_RETURN(); } ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 8f06afa9e14..6879d9dcbb0 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1247,10 +1247,12 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP EX(called_scope) = DECODE_CTOR(EX(called_scope)); zend_vm_stack_clear_multiple(TSRMLS_C); + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); + ZEND_VM_RETURN(); } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From bcc7d976f31a572160a52c15f415deea3497ab68 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 May 2012 00:24:58 +0200 Subject: [PATCH 026/641] Set EG(current_execute_data) This fixes several issues. In particular it makes method generators work properly and also allows generators using a symbol table. --- Zend/tests/generators/generator_method.phpt | 29 +++++++++++++++++++++ Zend/zend_generators.c | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 Zend/tests/generators/generator_method.phpt diff --git a/Zend/tests/generators/generator_method.phpt b/Zend/tests/generators/generator_method.phpt new file mode 100644 index 00000000000..b64476dc897 --- /dev/null +++ b/Zend/tests/generators/generator_method.phpt @@ -0,0 +1,29 @@ +--TEST-- +Methods can be generators +--FILE-- +data = $data; + } + + public function *getIterator() { + foreach ($this->data as $value) { + yield $value; + } + } +} + +$test = new Test(['foo', 'bar', 'baz']); +foreach ($test as $value) { + var_dump($value); +} + +?> +--EXPECT-- +string(3) "foo" +string(3) "bar" +string(3) "baz" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 12116a0f109..00d637ca6d8 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -148,6 +148,7 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS { /* Backup executor globals */ zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); + zend_execute_data *original_execute_data = EG(current_execute_data); zend_op **original_opline_ptr = EG(opline_ptr); zend_op_array *original_active_op_array = EG(active_op_array); HashTable *original_active_symbol_table = EG(active_symbol_table); @@ -160,6 +161,7 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS EG(return_value_ptr_ptr) = &object; /* Set executor globals */ + EG(current_execute_data) = generator->execute_data; EG(opline_ptr) = &generator->execute_data->opline; EG(active_op_array) = generator->execute_data->op_array; EG(active_symbol_table) = generator->execute_data->symbol_table; @@ -175,6 +177,7 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS /* Restore executor globals */ EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; + EG(current_execute_data) = original_execute_data; EG(opline_ptr) = original_opline_ptr; EG(active_op_array) = original_active_op_array; EG(active_symbol_table) = original_active_symbol_table; From 4aab08b64c2318775be6d8e629747ac66a108485 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 May 2012 06:43:18 +0200 Subject: [PATCH 027/641] Properly free resources when generator return value not used To keep things clean two new functions are introduced: zend_clean_and_cache_symbol_table(HashTable *symbol_table) zend_free_compiled_variables(zval ***CVs, int num) --- .../tests/generators/unused_return_value.phpt | 13 +++++++ Zend/zend_execute.c | 25 +++++++++++++ Zend/zend_execute.h | 3 ++ Zend/zend_generators.c | 7 +--- Zend/zend_vm_def.h | 36 +++++-------------- Zend/zend_vm_execute.h | 36 +++++-------------- 6 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 Zend/tests/generators/unused_return_value.phpt diff --git a/Zend/tests/generators/unused_return_value.phpt b/Zend/tests/generators/unused_return_value.phpt new file mode 100644 index 00000000000..8d6deefb95b --- /dev/null +++ b/Zend/tests/generators/unused_return_value.phpt @@ -0,0 +1,13 @@ +--TEST-- +There shouldn't be any leaks when the genertor's return value isn't used +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index d82abfc6138..9031fb5557c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1538,6 +1538,31 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t return get_zval_ptr_ptr(op_type, node, Ts, should_free, type); } +void zend_clean_and_cache_symbol_table(HashTable *symbol_table) /* {{{ */ +{ + if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) { + zend_hash_destroy(symbol_table); + FREE_HASHTABLE(symbol_table); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(symbol_table); + *(++EG(symtable_cache_ptr)) = symbol_table; + } +} +/* }}} */ + +void zend_free_compiled_variables(zval ***CVs, int num) /* {{{ */ +{ + int i; + for (i = 0; i < num; ++i) { + if (CVs[i]) { + zval_ptr_dtor(CVs[i]); + } + } +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 75a7eaa8a1a..6dfd607d1bb 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -432,6 +432,9 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); +void zend_clean_and_cache_symbol_table(HashTable *symbol_table); +void zend_free_compiled_variables(zval ***CVs, int num); + #define CACHED_PTR(num) \ EG(active_op_array)->run_time_cache[(num)] diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 00d637ca6d8..e4b070498b5 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -32,12 +32,7 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio zend_execute_data *execute_data = generator->execute_data; if (!execute_data->symbol_table) { - int i; - for (i = 0; i < execute_data->op_array->last_var; ++i) { - if (execute_data->CVs[i]) { - zval_ptr_dtor(execute_data->CVs[i]); - } - } + zend_free_compiled_variables(execute_data->CVs, execute_data->op_array->last_var); } else { if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) { zend_hash_destroy(execute_data->symbol_table); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 0b06c9217c3..04b65950dc9 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2514,14 +2514,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { - zval ***cv = EX_CVs(); - zval ***end = cv + op_array->last_var; - while (cv != end) { - if (*cv) { - zval_ptr_dtor(*cv); - } - cv++; - } + zend_free_compiled_variables(EX_CVs(), op_array->last_var); } if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { @@ -2579,15 +2572,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); } EG(active_symbol_table) = EX(symbol_table); @@ -2732,15 +2717,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ @@ -5242,7 +5219,12 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) /* if there is no return value pointer we are responsible for freeing the * execution data */ if (!EG(return_value_ptr_ptr)) { - /* something has to be done in here, not sure yet what exactly */ + if (!EG(active_symbol_table)) { + zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); + } else { + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + } + efree(execute_data); } EG(opline_ptr) = NULL; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6879d9dcbb0..c195148c976 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -497,14 +497,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { - zval ***cv = EX_CVs(); - zval ***end = cv + op_array->last_var; - while (cv != end) { - if (*cv) { - zval_ptr_dtor(*cv); - } - cv++; - } + zend_free_compiled_variables(EX_CVs(), op_array->last_var); } if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { @@ -562,15 +555,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); } EG(active_symbol_table) = EX(symbol_table); @@ -715,15 +700,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ @@ -1224,7 +1201,12 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP /* if there is no return value pointer we are responsible for freeing the * execution data */ if (!EG(return_value_ptr_ptr)) { - /* something has to be done in here, not sure yet what exactly */ + if (!EG(active_symbol_table)) { + zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); + } else { + zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + } + efree(execute_data); } EG(opline_ptr) = NULL; From 3966df7fc83093766e5e6862b18b8ef03ef58e09 Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Thu, 26 Apr 2012 07:48:49 -0400 Subject: [PATCH 028/641] Add support for Travis CI --- .travis.yml | 11 +++++++++++ run-tests.php | 15 +++++++++------ travis/compile.sh | 4 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100755 travis/compile.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..feff37ecc45 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: php +# We only specify one version so we only get one worker +php: + - 5.4 +# Compile PHP +before_script: + - ./travis/compile.sh +# Return 1 with failed testso +env: REPORT_EXIT_STATUS=1 +# Run PHP's make test +script: make test diff --git a/run-tests.php b/run-tests.php index 2b37ec4f4af..4af9a4f3a63 100755 --- a/run-tests.php +++ b/run-tests.php @@ -311,6 +311,7 @@ VALGRIND : " . ($leak_check ? $valgrind_header : 'Not used') . " define('PHP_QA_EMAIL', 'qa-reports@lists.php.net'); define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); define('QA_REPORTS_PAGE', 'http://qa.php.net/reports'); +define('TRAVIS_CI' , !!getenv('TRAVIS_PHP_VERSION')); function save_or_mail_results() { @@ -318,7 +319,7 @@ function save_or_mail_results() $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression; /* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */ - if (!getenv('NO_INTERACTION')) { + if (!getenv('NO_INTERACTION') && !TRAVIS_CI) { $fp = fopen("php://stdin", "r+"); if ($sum_results['FAILED'] || $sum_results['BORKED'] || $sum_results['WARNED'] || $sum_results['LEAKED'] || $sum_results['XFAILED']) { echo "\nYou may have found a problem in PHP."; @@ -335,8 +336,8 @@ function save_or_mail_results() $just_save_results = (strtolower($user_input[0]) == 's'); } - if ($just_save_results || !getenv('NO_INTERACTION')) { - if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { + if ($just_save_results || !getenv('NO_INTERACTION') || TRAVIS_CI) { + if ($just_save_results || TRAVIS_CI || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { /* * Collect information about the host system for our report * Fetch phpinfo() output so that we can see the PHP enviroment @@ -348,7 +349,9 @@ function save_or_mail_results() } /* Ask the user to provide an email address, so that QA team can contact the user */ - if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { + if (TRAVIS_CI) { + $user_email = 'travis at php dot net'; + } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): "; flush(); $user_email = trim(fgets($fp, 1024)); @@ -424,7 +427,7 @@ function save_or_mail_results() $failed_tests_data .= $sep . "PHPINFO" . $sep; $failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null'); - if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) { + if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status) && !TRAVIS_CI) { file_put_contents($output_file, $failed_tests_data); if (!$just_save_results) { @@ -432,7 +435,7 @@ function save_or_mail_results() } echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n"; - } else { + } elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) { fwrite($fp, "\nThank you for helping to make PHP better.\n"); fclose($fp); } diff --git a/travis/compile.sh b/travis/compile.sh new file mode 100755 index 00000000000..f80cc6bd0b6 --- /dev/null +++ b/travis/compile.sh @@ -0,0 +1,4 @@ +#!/bin/bash +./buildconf +./configure --with-pdo-mysql --with-mysql --with-sqlite --with-pdo-sqlite +make From f15beda158a8fbb16823baf3801409356b79cb4f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 10:36:33 -0400 Subject: [PATCH 029/641] Reformat, setup MySQL DB, call run-tests directly --- .travis.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index feff37ecc45..9bc335b0586 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,17 @@ language: php -# We only specify one version so we only get one worker + php: + # We only specify one version so we only get one worker - 5.4 -# Compile PHP + +env: + - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php DB=mysql + before_script: + # Compile PHP - ./travis/compile.sh -# Return 1 with failed testso -env: REPORT_EXIT_STATUS=1 -# Run PHP's make test -script: make test + # Create the MySQL test DB + - mysql -u root -e "CREATE DATABASE test" + +# Run PHPs run-tests.php +script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" From 0fe8b495add557251519050bb94b5dd451d9f7cb Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 21:27:29 -0400 Subject: [PATCH 030/641] Add extension configs, compile more extensions --- .travis.yml | 10 ++++++--- travis/compile.sh | 39 +++++++++++++++++++++++++++++++++-- travis/ext/mysql/setup.sh | 2 ++ travis/ext/mysqli/setup.sh | 2 ++ travis/ext/pdo_mysql/setup.sh | 2 ++ travis/ext/pdo_pgsql/setup.sh | 2 ++ travis/ext/pgsql/setup.sh | 4 ++++ 7 files changed, 56 insertions(+), 5 deletions(-) create mode 100755 travis/ext/mysql/setup.sh create mode 100755 travis/ext/mysqli/setup.sh create mode 100755 travis/ext/pdo_mysql/setup.sh create mode 100755 travis/ext/pdo_pgsql/setup.sh create mode 100755 travis/ext/pgsql/setup.sh diff --git a/.travis.yml b/.travis.yml index 9bc335b0586..8f61d7fb136 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,17 @@ php: - 5.4 env: - - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php DB=mysql + - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php before_script: # Compile PHP - ./travis/compile.sh - # Create the MySQL test DB - - mysql -u root -e "CREATE DATABASE test" + # Setup Extensions + - ./travis/ext/mysql/setup.sh + - ./travis/ext/mysqli/setup.sh + - ./travis/ext/pdo_mysql/setup.sh + - ./travis/ext/pgsql/setup.sh + - ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" diff --git a/travis/compile.sh b/travis/compile.sh index f80cc6bd0b6..a0fc167a15b 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,4 +1,39 @@ #!/bin/bash ./buildconf -./configure --with-pdo-mysql --with-mysql --with-sqlite --with-pdo-sqlite -make +./configure \ +--with-pdo-mysql \ +--with-mysql \ +--with-mysqli \ +--with-pgsql \ +--with-pdo-pgsql \ +--with-pdo-sqlite \ +--enable-intl \ +--without-pear \ +--with-gd \ +--with-jpeg-dir=/usr \ +--with-png-dir=/usr \ +--enable-exif \ +--enable-zip \ +--with-zlib \ +--with-zlib-dir=/usr \ +--with-mcrypt=/usr \ +--enable-soap \ +--enable-xmlreader \ +--with-xsl \ +--with-curl=/usr \ +--with-tidy \ +--with-xmlrpc \ +--enable-sysvsem \ +--enable-sysvshm \ +--enable-shmop \ +--enable-pcntl \ +--with-readline \ +--enable-mbstring \ +--with-curl \ +--with-gettext \ +--enable-sockets \ +--with-bz2 \ +--enable-bcmath \ +--enable-fastcgi \ +--with-mime-magic +make \ No newline at end of file diff --git a/travis/ext/mysql/setup.sh b/travis/ext/mysql/setup.sh new file mode 100755 index 00000000000..994fad13766 --- /dev/null +++ b/travis/ext/mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/mysqli/setup.sh b/travis/ext/mysqli/setup.sh new file mode 100755 index 00000000000..994fad13766 --- /dev/null +++ b/travis/ext/mysqli/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_mysql/setup.sh b/travis/ext/pdo_mysql/setup.sh new file mode 100755 index 00000000000..994fad13766 --- /dev/null +++ b/travis/ext/pdo_mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_pgsql/setup.sh b/travis/ext/pdo_pgsql/setup.sh new file mode 100755 index 00000000000..6f16f72cc25 --- /dev/null +++ b/travis/ext/pdo_pgsql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password=' \ No newline at end of file diff --git a/travis/ext/pgsql/setup.sh b/travis/ext/pgsql/setup.sh new file mode 100755 index 00000000000..32b39a40443 --- /dev/null +++ b/travis/ext/pgsql/setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo ' +' >> "./ext/pgsql/tests/config.inc" +psql -c 'create database test;' -U postgres \ No newline at end of file From 3db6d59a63b3ad4c76cb489a228e8ea40387996f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 23:53:24 -0400 Subject: [PATCH 031/641] Source all extension scripts for ENV vars --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f61d7fb136..c51a332f40a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,11 @@ before_script: # Compile PHP - ./travis/compile.sh # Setup Extensions - - ./travis/ext/mysql/setup.sh - - ./travis/ext/mysqli/setup.sh - - ./travis/ext/pdo_mysql/setup.sh - - ./travis/ext/pgsql/setup.sh - - ./travis/ext/pdo_pgsql/setup.sh + - . ./travis/ext/mysql/setup.sh + - . ./travis/ext/mysqli/setup.sh + - . ./travis/ext/pdo_mysql/setup.sh + - . ./travis/ext/pgsql/setup.sh + - . ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" From e2ebe6ce4ed9b149143949008f930007dfcb855f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 23:53:53 -0400 Subject: [PATCH 032/641] Add curl extension config, uses cli-server to test --- travis/ext/curl/setup.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 travis/ext/curl/setup.sh diff --git a/travis/ext/curl/setup.sh b/travis/ext/curl/setup.sh new file mode 100755 index 00000000000..74dad16eb35 --- /dev/null +++ b/travis/ext/curl/setup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +export PHP_CURL_HTTP_REMOTE_SERVER="http://localhost" +cd ./ext/curl/tests/responder +sudo php -S localhost:80 & +cd - \ No newline at end of file From 5ef46fe43c25996a8fd6eb8c513e4114569d79b6 Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Mon, 28 May 2012 06:18:44 -0400 Subject: [PATCH 033/641] Fix boolean casting and whitespace (@dsp / #68) --- run-tests.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run-tests.php b/run-tests.php index 4af9a4f3a63..753e1ddc023 100755 --- a/run-tests.php +++ b/run-tests.php @@ -311,7 +311,7 @@ VALGRIND : " . ($leak_check ? $valgrind_header : 'Not used') . " define('PHP_QA_EMAIL', 'qa-reports@lists.php.net'); define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); define('QA_REPORTS_PAGE', 'http://qa.php.net/reports'); -define('TRAVIS_CI' , !!getenv('TRAVIS_PHP_VERSION')); +define('TRAVIS_CI' , (bool) getenv('TRAVIS_PHP_VERSION')); function save_or_mail_results() { @@ -349,9 +349,9 @@ function save_or_mail_results() } /* Ask the user to provide an email address, so that QA team can contact the user */ - if (TRAVIS_CI) { - $user_email = 'travis at php dot net'; - } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { + if (TRAVIS_CI) { + $user_email = 'travis at php dot net'; + } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): "; flush(); $user_email = trim(fgets($fp, 1024)); From b770b221e0b3036708deb9e22dacf296402787f0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 May 2012 02:31:56 +0200 Subject: [PATCH 034/641] Make the GOTO and SWITCH VMs work again --- Zend/zend_vm_def.h | 7 +++++++ Zend/zend_vm_execute.h | 28 ++++++++++++++++++++++++---- Zend/zend_vm_execute.skl | 7 +++---- Zend/zend_vm_gen.php | 12 +++++++----- 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 04b65950dc9..47d5ec40988 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5203,6 +5203,7 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) *EG(return_value_ptr_ptr) = return_value; /* back up some executor globals */ + SAVE_OPLINE(); EX(current_this) = EG(This); EX(current_scope) = EG(scope); EX(current_called_scope) = EG(called_scope); @@ -5248,6 +5249,8 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) zend_vm_stack_clear_multiple(TSRMLS_C); + LOAD_REGS(); + LOAD_OPLINE(); ZEND_VM_INC_OPCODE(); ZEND_VM_LEAVE(); } @@ -5293,6 +5296,10 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); } + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + ZEND_VM_RETURN(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c195148c976..bd22768a3a2 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -393,10 +393,10 @@ static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array * if (op_array->this_var != -1 && EG(This)) { Z_ADDREF_P(EG(This)); /* For $this pointer */ if (!EG(active_symbol_table)) { - EX_CV(op_array->this_var) = (zval**)EX_CVs() + (op_array->last_var + op_array->this_var); - *EX_CV(op_array->this_var) = EG(This); + EX(CVs)[op_array->this_var] = (zval **) EX(CVs) + op_array->last_var + op_array->this_var; + *EX(CVs)[op_array->this_var] = EG(This); } else { - if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX_CV(op_array->this_var))==FAILURE) { + if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) &EX(CVs)[op_array->this_var])==FAILURE) { Z_DELREF_P(EG(This)); } } @@ -425,7 +425,6 @@ ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC) EG(in_execution) = 1; -zend_vm_enter: LOAD_REGS(); LOAD_OPLINE(); @@ -444,8 +443,10 @@ zend_vm_enter: return; case 2: execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); + break; case 3: execute_data = EG(current_execute_data); + break; default: break; } @@ -1185,6 +1186,7 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP *EG(return_value_ptr_ptr) = return_value; /* back up some executor globals */ + SAVE_OPLINE(); EX(current_this) = EG(This); EX(current_scope) = EG(scope); EX(current_called_scope) = EG(called_scope); @@ -1230,6 +1232,8 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP zend_vm_stack_clear_multiple(TSRMLS_C); + LOAD_REGS(); + LOAD_OPLINE(); ZEND_VM_INC_OPCODE(); ZEND_VM_LEAVE(); } @@ -3067,6 +3071,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + ZEND_VM_RETURN(); } @@ -7704,6 +7712,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + ZEND_VM_RETURN(); } @@ -12419,6 +12431,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + ZEND_VM_RETURN(); } @@ -28304,6 +28320,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + ZEND_VM_RETURN(); } diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index d251e55344e..e77c7cb3c63 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -54,10 +54,10 @@ static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array * if (op_array->this_var != -1 && EG(This)) { Z_ADDREF_P(EG(This)); /* For $this pointer */ if (!EG(active_symbol_table)) { - EX_CV(op_array->this_var) = (zval**)EX_CVs() + (op_array->last_var + op_array->this_var); - *EX_CV(op_array->this_var) = EG(This); + EX(CVs)[op_array->this_var] = (zval **) EX(CVs) + op_array->last_var + op_array->this_var; + *EX(CVs)[op_array->this_var] = EG(This); } else { - if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX_CV(op_array->this_var))==FAILURE) { + if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) &EX(CVs)[op_array->this_var])==FAILURE) { Z_DELREF_P(EG(This)); } } @@ -88,7 +88,6 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC) EG(in_execution) = 1; -zend_vm_enter: LOAD_REGS(); LOAD_OPLINE(); diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index b7fd874264f..ee2b0b2f2da 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -856,7 +856,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, out($f,"#define LOAD_REGS() do {Ts = EX(Ts); CVs = EX(CVs);} while (0)\n"); out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n"); out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n"); - out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n"); + out($f,"#define ZEND_VM_ENTER() execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n"); out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n"); @@ -892,7 +892,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, out($f,"#define LOAD_REGS() do {Ts = EX(Ts); CVs = EX(CVs);} while (0)\n"); out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n"); out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n"); - out($f,"#define ZEND_VM_ENTER() op_array = EG(active_op_array); goto zend_vm_enter\n"); + out($f,"#define ZEND_VM_ENTER() execute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC); LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n"); out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n"); @@ -932,7 +932,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, // Emit array of labels of opcode handlers and code for // zend_opcode_handlers initialization $prolog = $m[1]; - out($f,$prolog."if (op_array == NULL) {\n"); + out($f,$prolog."if (execute_data == NULL) {\n"); out($f,$prolog."\tstatic const opcode_handler_t labels[] = {\n"); gen_labels($f, $spec, $kind, $prolog."\t\t"); out($f,$prolog."\t};\n"); @@ -977,8 +977,10 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, $m[1]."\t\treturn;\n". $m[1]."\tcase 2:\n" . $m[1]."\t\texecute_data = zend_create_execute_data_from_op_array(EG(active_op_array), 1 TSRMLS_CC);\n". + $m[1]."\t\tbreak;\n" . $m[1]."\tcase 3:\n" . $m[1]."\t\texecute_data = EG(current_execute_data);\n". + $m[1]."\t\tbreak;\n" . $m[1]."\tdefault:\n". $m[1]."\t\tbreak;\n". $m[1]."}".$m[3]."\n"); @@ -1005,9 +1007,9 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, $prolog = $m[1]; if ($kind == ZEND_VM_KIND_GOTO) { // Labels are defined in the executor itself, so we call it - // with op_array NULL and it sets zend_opcode_handlers array + // with execute_data NULL and it sets zend_opcode_handlers array out($f,$prolog."TSRMLS_FETCH();\n"); - out($f,$prolog."zend_execute(NULL TSRMLS_CC);\n"); + out($f,$prolog.$executor_name."_ex(NULL TSRMLS_CC);\n"); } else { if ($old) { // Reserving space for user-defined opcodes From 3600914ced52eb4f6db10410ba887c8e2a2acfe1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 May 2012 17:34:33 +0200 Subject: [PATCH 035/641] Add support for $generator->send() Yield now is an expression and the return value is the value passed to $generator->send(). By default (i.e. if ->next() is called) the value is NULL. Unlike in Python ->send() can be run without priming the generator with a ->next() call first. --- Zend/tests/generators/generator_send.phpt | 22 ++++++++++++ Zend/zend_compile.c | 6 +++- Zend/zend_compile.h | 2 +- Zend/zend_generators.c | 32 +++++++++++++++++ Zend/zend_generators.h | 2 ++ Zend/zend_language_parser.y | 5 +-- Zend/zend_vm_def.h | 11 +++++- Zend/zend_vm_execute.h | 44 ++++++++++++++++++++--- 8 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 Zend/tests/generators/generator_send.phpt diff --git a/Zend/tests/generators/generator_send.phpt b/Zend/tests/generators/generator_send.phpt new file mode 100644 index 00000000000..11ac37f846e --- /dev/null +++ b/Zend/tests/generators/generator_send.phpt @@ -0,0 +1,22 @@ +--TEST-- +Values can be sent back to the generator +--FILE-- +current()); +$gen->send("send bar"); +var_dump($gen->current()); +$gen->send("send foo"); + +?> +--EXPECT-- +string(9) "yield foo" +string(8) "send bar" +string(9) "yield bar" +string(8) "send foo" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 30fecf1e2e1..37e49014ec6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2662,7 +2662,7 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ +void zend_do_yield(znode *result, const znode *expr TSRMLS_DC) /* {{{ */ { zend_op *opline; @@ -2675,6 +2675,10 @@ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ opline->opcode = ZEND_YIELD; SET_NODE(opline->op1, expr); SET_UNUSED(opline->op2); + + opline->result_type = IS_VAR; + opline->result.var = get_temporary_variable(CG(active_op_array)); + GET_NODE(result, opline->result); } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5365f9693db..953a9f1df02 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -490,7 +490,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); -void zend_do_yield(znode *expr TSRMLS_DC); +void zend_do_yield(znode *result, const znode *expr TSRMLS_DC); void zend_do_suspend_if_generator(TSRMLS_D); void zend_do_handle_exception(TSRMLS_D); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index e4b070498b5..01c9aa31981 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -292,15 +292,47 @@ ZEND_METHOD(Generator, next) } /* }}} */ +/* {{{ proto void Generator::send() + * Sends a value to the generator */ +ZEND_METHOD(Generator, send) +{ + zval *object, *value; + zend_generator *generator; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) { + return; + } + + object = getThis(); + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + + zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + /* The sent value was initialized to NULL, so dtor that */ + zval_ptr_dtor(generator->send_target->var.ptr_ptr); + + /* Set new sent value */ + Z_ADDREF_P(value); + generator->send_target->var.ptr = value; + generator->send_target->var.ptr_ptr = &value; + + zend_generator_resume(object, generator TSRMLS_CC); +} + ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + static const zend_function_entry generator_functions[] = { ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC) ZEND_FE_END }; diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 192e9e75c95..c9b43b31b65 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -30,6 +30,8 @@ typedef struct _zend_generator { zend_execute_data *execute_data; /* Current value */ zval *value; + /* Variable to put sent value into */ + temp_variable *send_target; } zend_generator; extern ZEND_API zend_class_entry *zend_ce_generator; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 2045a5e4653..ea8ac41795a 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -68,6 +68,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_LOGICAL_AND "and (T_LOGICAL_AND)" %right T_PRINT %token T_PRINT "print (T_PRINT)" +%right T_YIELD +%token T_YIELD "yield (T_YIELD)" %left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL %token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)" %token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)" @@ -158,7 +160,6 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_FUNCTION "function (T_FUNCTION)" %token T_CONST "const (T_CONST)" %token T_RETURN "return (T_RETURN)" -%token T_YIELD "yield (T_YIELD)" %token T_TRY "try (T_TRY)" %token T_CATCH "catch (T_CATCH)" %token T_THROW "throw (T_THROW)" @@ -298,7 +299,6 @@ unticked_statement: | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); } | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); } | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); } - | T_YIELD expr ';' { zend_do_yield(&$2 TSRMLS_CC); } | T_GLOBAL global_var_list ';' | T_STATIC static_var_list ';' | T_ECHO echo_expr_list ';' @@ -801,6 +801,7 @@ expr_without_variable: | combined_scalar { $$ = $1; } | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } + | T_YIELD expr { zend_do_yield(&$$, &$2 TSRMLS_CC); } | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 47d5ec40988..8c810cdee81 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5260,6 +5260,8 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) { + USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); @@ -5268,8 +5270,8 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) zval_ptr_dtor(&generator->value); } + /* Set the new yielded value */ { - USE_OPLINE zend_free_op free_op1; zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -5296,6 +5298,13 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); } + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index bd22768a3a2..fa077332061 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3036,6 +3036,8 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); @@ -3044,8 +3046,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zval_ptr_dtor(&generator->value); } + /* Set the new yielded value */ { - USE_OPLINE zval *value = opline->op1.zv; @@ -3071,6 +3073,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -7677,6 +7686,8 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); @@ -7685,8 +7696,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&generator->value); } + /* Set the new yielded value */ { - USE_OPLINE zend_free_op free_op1; zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -7712,6 +7723,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -12395,6 +12413,8 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); @@ -12403,8 +12423,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&generator->value); } + /* Set the new yielded value */ { - USE_OPLINE zend_free_op free_op1; zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -12431,6 +12451,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -28285,6 +28312,8 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); @@ -28293,8 +28322,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_ptr_dtor(&generator->value); } + /* Set the new yielded value */ { - USE_OPLINE zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); @@ -28320,6 +28349,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); From ad525c288ad83df497ed1a0668915cad61d72e26 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 May 2012 17:53:11 +0200 Subject: [PATCH 036/641] Allow to use yield without value If the generator is used as a coroutine it often doesn't make sense to yield anything. In this case one can simply receive values using $value = yield; The yield here will simply yield NULL. --- .../tests/generators/yield_without_value.phpt | 27 +++++ Zend/zend_compile.c | 8 +- Zend/zend_language_parser.y | 1 + Zend/zend_vm_def.h | 10 +- Zend/zend_vm_execute.h | 99 ++++++++++++++++--- 5 files changed, 127 insertions(+), 18 deletions(-) create mode 100644 Zend/tests/generators/yield_without_value.phpt diff --git a/Zend/tests/generators/yield_without_value.phpt b/Zend/tests/generators/yield_without_value.phpt new file mode 100644 index 00000000000..dc467a83bd1 --- /dev/null +++ b/Zend/tests/generators/yield_without_value.phpt @@ -0,0 +1,27 @@ +--TEST-- +yield can be used without a value +--FILE-- +current()); +$reciever->send(1); +var_dump($reciever->current()); +$reciever->send(2); +var_dump($reciever->current()); +$reciever->send(3); + +?> +--EXPECT-- +NULL +int(1) +NULL +int(2) +NULL +int(3) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 37e49014ec6..89549bb6edd 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2673,8 +2673,12 @@ void zend_do_yield(znode *result, const znode *expr TSRMLS_DC) /* {{{ */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_YIELD; - SET_NODE(opline->op1, expr); - SET_UNUSED(opline->op2); + + if (expr) { + SET_NODE(opline->op1, expr); + } else { + SET_UNUSED(opline->op2); + } opline->result_type = IS_VAR; opline->result.var = get_temporary_variable(CG(active_op_array)); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index ea8ac41795a..ac22e7f7332 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -801,6 +801,7 @@ expr_without_variable: | combined_scalar { $$ = $1; } | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } + | T_YIELD { zend_do_yield(&$$, NULL TSRMLS_CC); } | T_YIELD expr { zend_do_yield(&$$, &$2 TSRMLS_CC); } | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8c810cdee81..67610309a54 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5258,7 +5258,7 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_RETURN(); } -ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) +ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, ANY) { USE_OPLINE @@ -5271,7 +5271,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) } /* Set the new yielded value */ - { + if (OP1_TYPE != IS_UNUSED) { zend_free_op free_op1; zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -5291,11 +5291,15 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV, ANY) generator->value = copy; } else { - generator->value = value; Z_ADDREF_P(value); + generator->value = value; } FREE_OP1_IF_VAR(); + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); } /* If a value is sent it should go into the result var */ diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index fa077332061..efe0812ca90 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3047,7 +3047,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } /* Set the new yielded value */ - { + if (IS_CONST != IS_UNUSED) { zval *value = opline->op1.zv; @@ -3067,10 +3067,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS generator->value = copy; } else { - generator->value = value; Z_ADDREF_P(value); + generator->value = value; } + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); } /* If a value is sent it should go into the result var */ @@ -7697,7 +7701,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } /* Set the new yielded value */ - { + if (IS_TMP_VAR != IS_UNUSED) { zend_free_op free_op1; zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -7717,10 +7721,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) generator->value = copy; } else { - generator->value = value; Z_ADDREF_P(value); + generator->value = value; } + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); } /* If a value is sent it should go into the result var */ @@ -12424,7 +12432,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } /* Set the new yielded value */ - { + if (IS_VAR != IS_UNUSED) { zend_free_op free_op1; zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -12444,11 +12452,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) generator->value = copy; } else { - generator->value = value; Z_ADDREF_P(value); + generator->value = value; } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); } /* If a value is sent it should go into the result var */ @@ -22080,6 +22092,63 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); /* Never reached */ } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -28323,7 +28392,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } /* Set the new yielded value */ - { + if (IS_CV != IS_UNUSED) { zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); @@ -28343,10 +28412,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) generator->value = copy; } else { - generator->value = value; Z_ADDREF_P(value); + generator->value = value; } + } else { + /* If no value way specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); } /* If a value is sent it should go into the result var */ @@ -41168,11 +41241,11 @@ void zend_init_opcodes_handlers(void) ZEND_YIELD_SPEC_VAR_HANDLER, ZEND_YIELD_SPEC_VAR_HANDLER, ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_YIELD_SPEC_UNUSED_HANDLER, + ZEND_YIELD_SPEC_UNUSED_HANDLER, + ZEND_YIELD_SPEC_UNUSED_HANDLER, + ZEND_YIELD_SPEC_UNUSED_HANDLER, + ZEND_YIELD_SPEC_UNUSED_HANDLER, ZEND_YIELD_SPEC_CV_HANDLER, ZEND_YIELD_SPEC_CV_HANDLER, ZEND_YIELD_SPEC_CV_HANDLER, From 12e928314fb270db31adc361ac4993b4f0fe000a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 May 2012 18:01:08 +0200 Subject: [PATCH 037/641] Fix segfault when send()ing to a closed generator --- Zend/tests/generators/send_after_close.phpt | 14 ++++++++++++++ Zend/zend_generators.c | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 Zend/tests/generators/send_after_close.phpt diff --git a/Zend/tests/generators/send_after_close.phpt b/Zend/tests/generators/send_after_close.phpt new file mode 100644 index 00000000000..6a251b24816 --- /dev/null +++ b/Zend/tests/generators/send_after_close.phpt @@ -0,0 +1,14 @@ +--TEST-- +Calls to send() after close should do nothing +--FILE-- +send("Test"); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 01c9aa31981..0cf600a922a 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -308,6 +308,11 @@ ZEND_METHOD(Generator, send) zend_generator_ensure_initialized(object, generator TSRMLS_CC); + /* The generator is already closed, thus can't send anything */ + if (!generator->execute_data) { + return; + } + /* The sent value was initialized to NULL, so dtor that */ zval_ptr_dtor(generator->send_target->var.ptr_ptr); From 72a91d08e7d70d5524feb6cc7c8e32b3bd68f1df Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 May 2012 18:11:18 +0200 Subject: [PATCH 038/641] Add $generator->close() method Calling $generator->close() is equivalent to executing a return statement at the current position in the generator. --- Zend/tests/generators/generator_close.phpt | 32 ++++++++++++++++++++++ Zend/zend_generators.c | 17 ++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Zend/tests/generators/generator_close.phpt diff --git a/Zend/tests/generators/generator_close.phpt b/Zend/tests/generators/generator_close.phpt new file mode 100644 index 00000000000..003eef094dc --- /dev/null +++ b/Zend/tests/generators/generator_close.phpt @@ -0,0 +1,32 @@ +--TEST-- +Generator can be closed by calling ->close() +--FILE-- +close(); + } +} + +?> +--EXPECT-- +int(0) +int(1) +int(2) +int(3) +int(4) +int(5) +int(6) +int(7) +int(8) +int(9) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 0cf600a922a..b2fe8af8546 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -324,6 +324,22 @@ ZEND_METHOD(Generator, send) zend_generator_resume(object, generator TSRMLS_CC); } +/* {{{ proto void Generator::close() + * Closes the generator */ +ZEND_METHOD(Generator, close) +{ + zend_generator *generator; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + + zend_generator_close(generator, 0); +} +/* }}} */ + ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0) ZEND_END_ARG_INFO() @@ -338,6 +354,7 @@ static const zend_function_entry generator_functions[] = { ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, close, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_FE_END }; From bc08c2cf9485e20fea0eef7ab149cefdf9a3662e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 May 2012 02:44:06 +0200 Subject: [PATCH 039/641] Add support for yielding keys Keys are yielded using the yield $key => $value syntax. Currently this is implemented as a statement only and not as an expression, because conflicts arise considering nesting and use in arrays: yield yield $a => $b; // could be either yield (yield $a) => $b; // or yield (yield $a => $b); Once I find some way to resolve these conflicts this should be available as an expression too. Also the key yielding code is rather copy-and-past-y for the value yielding code, so that should be factored out. --- .../tests/generators/generator_with_keys.phpt | 26 + Zend/zend_compile.c | 12 +- Zend/zend_compile.h | 2 +- Zend/zend_generators.c | 8 + Zend/zend_generators.h | 2 + Zend/zend_language_parser.y | 5 +- Zend/zend_vm_def.h | 41 +- Zend/zend_vm_execute.h | 2671 +++++++++++++++-- 8 files changed, 2448 insertions(+), 319 deletions(-) create mode 100644 Zend/tests/generators/generator_with_keys.phpt diff --git a/Zend/tests/generators/generator_with_keys.phpt b/Zend/tests/generators/generator_with_keys.phpt new file mode 100644 index 00000000000..43e3e5ecf7a --- /dev/null +++ b/Zend/tests/generators/generator_with_keys.phpt @@ -0,0 +1,26 @@ +--TEST-- +Generators can also yield keys +--FILE-- + current($array); + prev($array); + } +} + +$array = [ + 'foo' => 'bar', + 'bar' => 'foo', +]; + +foreach (reverse($array) as $key => $value) { + echo $key, ' => ', $value, "\n"; +} + +?> +--EXPECT-- +bar => foo +foo => bar diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 89549bb6edd..da61b766622 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2662,7 +2662,7 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_do_yield(znode *result, const znode *expr TSRMLS_DC) /* {{{ */ +void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC) /* {{{ */ { zend_op *opline; @@ -2674,8 +2674,14 @@ void zend_do_yield(znode *result, const znode *expr TSRMLS_DC) /* {{{ */ opline->opcode = ZEND_YIELD; - if (expr) { - SET_NODE(opline->op1, expr); + if (value) { + SET_NODE(opline->op1, value); + } else { + SET_UNUSED(opline->op1); + } + + if (key) { + SET_NODE(opline->op2, key); } else { SET_UNUSED(opline->op2); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 953a9f1df02..ec86ed86de0 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -490,7 +490,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); -void zend_do_yield(znode *result, const znode *expr TSRMLS_DC); +void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC); void zend_do_suspend_if_generator(TSRMLS_D); void zend_do_handle_exception(TSRMLS_D); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index b2fe8af8546..d3d4b3f7a81 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -92,6 +92,10 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio generator->value = NULL; } + if (generator->key) { + zval_ptr_dtor(&generator->key); + generator->key = NULL; + } } /* }}} */ @@ -269,6 +273,10 @@ ZEND_METHOD(Generator, key) generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + if (generator->key) { + RETURN_ZVAL(generator->key, 1, 0); + } } /* }}} */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index c9b43b31b65..2fd2c93b636 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -30,6 +30,8 @@ typedef struct _zend_generator { zend_execute_data *execute_data; /* Current value */ zval *value; + /* Current key */ + zval *key; /* Variable to put sent value into */ temp_variable *send_target; } zend_generator; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index ac22e7f7332..16c0ea2b2c3 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -299,6 +299,7 @@ unticked_statement: | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); } | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); } | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); } + | T_YIELD expr T_DOUBLE_ARROW expr ';' { zend_do_yield(&$$, &$4, &$2 TSRMLS_CC); } | T_GLOBAL global_var_list ';' | T_STATIC static_var_list ';' | T_ECHO echo_expr_list ';' @@ -801,8 +802,8 @@ expr_without_variable: | combined_scalar { $$ = $1; } | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } - | T_YIELD { zend_do_yield(&$$, NULL TSRMLS_CC); } - | T_YIELD expr { zend_do_yield(&$$, &$2 TSRMLS_CC); } + | T_YIELD { zend_do_yield(&$$, NULL, NULL TSRMLS_CC); } + | T_YIELD expr { zend_do_yield(&$$, &$2, NULL TSRMLS_CC); } | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 67610309a54..36b9c93c525 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5258,7 +5258,7 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_RETURN(); } -ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, ANY) +ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) { USE_OPLINE @@ -5270,6 +5270,11 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, ANY) zval_ptr_dtor(&generator->value); } + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + /* Set the new yielded value */ if (OP1_TYPE != IS_UNUSED) { zend_free_op free_op1; @@ -5297,11 +5302,43 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, ANY) FREE_OP1_IF_VAR(); } else { - /* If no value way specified yield null */ + /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); generator->value = &EG(uninitialized_zval); } + /* Set the new yielded key */ + if (OP2_TYPE != IS_UNUSED) { + zend_free_op free_op2; + zval *key = GET_OP2_ZVAL_PTR(BP_VAR_R); + + /* Consts, temporary variables and references need copying */ + if (OP2_TYPE == IS_CONST || OP2_TYPE == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!IS_OP1_TMP_FREE()) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + FREE_OP2_IF_VAR(); + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + /* If a value is sent it should go into the result var */ generator->send_target = &EX_T(opline->result.var); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index efe0812ca90..ac7ff7ff585 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3034,63 +3034,6 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - - /* Destroy the previously yielded value */ - if (generator->value) { - zval_ptr_dtor(&generator->value); - } - - /* Set the new yielded value */ - if (IS_CONST != IS_UNUSED) { - - zval *value = opline->op1.zv; - - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; - - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); - - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); - } - - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; - } - - } else { - /* If no value way specified yield null */ - Z_ADDREF(EG(uninitialized_zval)); - generator->value = &EG(uninitialized_zval); - } - - /* If a value is sent it should go into the result var */ - generator->send_target = &EX_T(opline->result.var); - - /* Initialize the sent value to NULL */ - Z_ADDREF(EG(uninitialized_zval)); - AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - - /* The GOTO VM uses a local opline variable. We need to set the opline - * variable in execute_data so we don't resume at an old position. */ - SAVE_OPLINE(); - - ZEND_VM_RETURN(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -4111,6 +4054,99 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CONST != IS_UNUSED) { + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CONST != IS_UNUSED) { + + zval *key = opline->op2.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -4651,6 +4687,99 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN } } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CONST != IS_UNUSED) { + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -5516,6 +5645,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CONST != IS_UNUSED) { + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -6075,6 +6298,99 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CONST != IS_UNUSED) { + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_UNUSED != IS_UNUSED) { + + zval *key = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -6674,6 +6990,99 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND } } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CONST != IS_UNUSED) { + + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CV != IS_UNUSED) { + + zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -7688,63 +8097,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - - /* Destroy the previously yielded value */ - if (generator->value) { - zval_ptr_dtor(&generator->value); - } - - /* Set the new yielded value */ - if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; - - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); - - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); - } - - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; - } - - } else { - /* If no value way specified yield null */ - Z_ADDREF(EG(uninitialized_zval)); - generator->value = &EG(uninitialized_zval); - } - - /* If a value is sent it should go into the result var */ - generator->send_target = &EX_T(opline->result.var); - - /* Initialize the sent value to NULL */ - Z_ADDREF(EG(uninitialized_zval)); - AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - - /* The GOTO VM uses a local opline variable. We need to set the opline - * variable in execute_data so we don't resume at an old position. */ - SAVE_OPLINE(); - - ZEND_VM_RETURN(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -8633,6 +8985,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CONST != IS_UNUSED) { + + zval *key = opline->op2.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -9173,6 +9618,99 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL } } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -10038,6 +10576,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -10463,6 +11095,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_UNUSED != IS_UNUSED) { + + zval *key = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -11000,6 +11725,99 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE } } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CV != IS_UNUSED) { + + zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -12419,64 +13237,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - - /* Destroy the previously yielded value */ - if (generator->value) { - zval_ptr_dtor(&generator->value); - } - - /* Set the new yielded value */ - if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; - - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); - - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); - } - - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; - } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } else { - /* If no value way specified yield null */ - Z_ADDREF(EG(uninitialized_zval)); - generator->value = &EG(uninitialized_zval); - } - - /* If a value is sent it should go into the result var */ - generator->send_target = &EX_T(opline->result.var); - - /* Initialize the sent value to NULL */ - Z_ADDREF(EG(uninitialized_zval)); - AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - - /* The GOTO VM uses a local opline variable. We need to set the opline - * variable in execute_data so we don't resume at an old position. */ - SAVE_OPLINE(); - - ZEND_VM_RETURN(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -14816,6 +15576,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CONST != IS_UNUSED) { + + zval *key = opline->op2.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -16742,6 +17596,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_ return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -19048,6 +19996,101 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_ return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -20032,6 +21075,100 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_UNUSED != IS_UNUSED) { + + zval *key = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -22007,6 +23144,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O return zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CV != IS_UNUSED) { + + zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -22092,63 +23323,6 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZEND_VM_NEXT_OPCODE(); /* Never reached */ } -static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - - /* Destroy the previously yielded value */ - if (generator->value) { - zval_ptr_dtor(&generator->value); - } - - /* Set the new yielded value */ - if (IS_UNUSED != IS_UNUSED) { - - zval *value = NULL; - - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; - - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); - - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); - } - - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; - } - - } else { - /* If no value way specified yield null */ - Z_ADDREF(EG(uninitialized_zval)); - generator->value = &EG(uninitialized_zval); - } - - /* If a value is sent it should go into the result var */ - generator->send_target = &EX_T(opline->result.var); - - /* Initialize the sent value to NULL */ - Z_ADDREF(EG(uninitialized_zval)); - AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - - /* The GOTO VM uses a local opline variable. We need to set the opline - * variable in execute_data so we don't resume at an old position. */ - SAVE_OPLINE(); - - ZEND_VM_RETURN(); -} - static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -23398,6 +24572,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER( return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CONST != IS_UNUSED) { + + zval *key = opline->op2.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -24556,6 +25823,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZE return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -25714,6 +27074,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZE return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -25983,6 +27437,99 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE } } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_UNUSED != IS_UNUSED) { + + zval *key = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -27138,6 +28685,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEN return zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_UNUSED != IS_UNUSED) { + + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CV != IS_UNUSED) { + + zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -28379,63 +30019,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - - /* Destroy the previously yielded value */ - if (generator->value) { - zval_ptr_dtor(&generator->value); - } - - /* Set the new yielded value */ - if (IS_CV != IS_UNUSED) { - - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; - - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); - - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); - } - - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; - } - - } else { - /* If no value way specified yield null */ - Z_ADDREF(EG(uninitialized_zval)); - generator->value = &EG(uninitialized_zval); - } - - /* If a value is sent it should go into the result var */ - generator->send_target = &EX_T(opline->result.var); - - /* Initialize the sent value to NULL */ - Z_ADDREF(EG(uninitialized_zval)); - AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); - - /* The GOTO VM uses a local opline variable. We need to set the opline - * variable in execute_data so we don't resume at an old position. */ - SAVE_OPLINE(); - - ZEND_VM_RETURN(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -30554,6 +32137,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CV != IS_UNUSED) { + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CONST != IS_UNUSED) { + + zval *key = opline->op2.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -32351,6 +34027,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_O return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CV != IS_UNUSED) { + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -34527,6 +36296,100 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_O return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CV != IS_UNUSED) { + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_VAR != IS_UNUSED) { + zend_free_op free_op2; + zval *key = _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -35372,6 +37235,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CV != IS_UNUSED) { + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_UNUSED != IS_UNUSED) { + + zval *key = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -37217,6 +39173,99 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OP return zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Destroy the previously yielded value */ + if (generator->value) { + zval_ptr_dtor(&generator->value); + } + + /* Destroy the previously yielded key */ + if (generator->key) { + zval_ptr_dtor(&generator->key); + } + + /* Set the new yielded value */ + if (IS_CV != IS_UNUSED) { + + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; + } + + } else { + /* If no value was specified yield null */ + Z_ADDREF(EG(uninitialized_zval)); + generator->value = &EG(uninitialized_zval); + } + + /* Set the new yielded key */ + if (IS_CV != IS_UNUSED) { + + zval *key = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, key); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->key = copy; + } else { + Z_ADDREF_P(key); + generator->key = key; + } + + } else { + /* Setting the key to NULL signals that the auto-increment key + * generation should be used */ + generator->key = NULL; + } + + /* If a value is sent it should go into the result var */ + generator->send_target = &EX_T(opline->result.var); + + /* Initialize the sent value to NULL */ + Z_ADDREF(EG(uninitialized_zval)); + AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + + /* The GOTO VM uses a local opline variable. We need to set the opline + * variable in execute_data so we don't resume at an old position. */ + SAVE_OPLINE(); + + ZEND_VM_RETURN(); +} + static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_error_noreturn(E_ERROR, "Invalid opcode %d/%d/%d.", OPLINE->opcode, OPLINE->op1_type, OPLINE->op2_type); @@ -41226,31 +43275,31 @@ void zend_init_opcodes_handlers(void) ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_YIELD_SPEC_CONST_HANDLER, - ZEND_YIELD_SPEC_CONST_HANDLER, - ZEND_YIELD_SPEC_CONST_HANDLER, - ZEND_YIELD_SPEC_CONST_HANDLER, - ZEND_YIELD_SPEC_CONST_HANDLER, - ZEND_YIELD_SPEC_TMP_HANDLER, - ZEND_YIELD_SPEC_TMP_HANDLER, - ZEND_YIELD_SPEC_TMP_HANDLER, - ZEND_YIELD_SPEC_TMP_HANDLER, - ZEND_YIELD_SPEC_TMP_HANDLER, - ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_YIELD_SPEC_VAR_HANDLER, - ZEND_YIELD_SPEC_UNUSED_HANDLER, - ZEND_YIELD_SPEC_UNUSED_HANDLER, - ZEND_YIELD_SPEC_UNUSED_HANDLER, - ZEND_YIELD_SPEC_UNUSED_HANDLER, - ZEND_YIELD_SPEC_UNUSED_HANDLER, - ZEND_YIELD_SPEC_CV_HANDLER, - ZEND_YIELD_SPEC_CV_HANDLER, - ZEND_YIELD_SPEC_CV_HANDLER, - ZEND_YIELD_SPEC_CV_HANDLER, - ZEND_YIELD_SPEC_CV_HANDLER, + ZEND_YIELD_SPEC_CONST_CONST_HANDLER, + ZEND_YIELD_SPEC_CONST_TMP_HANDLER, + ZEND_YIELD_SPEC_CONST_VAR_HANDLER, + ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER, + ZEND_YIELD_SPEC_CONST_CV_HANDLER, + ZEND_YIELD_SPEC_TMP_CONST_HANDLER, + ZEND_YIELD_SPEC_TMP_TMP_HANDLER, + ZEND_YIELD_SPEC_TMP_VAR_HANDLER, + ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER, + ZEND_YIELD_SPEC_TMP_CV_HANDLER, + ZEND_YIELD_SPEC_VAR_CONST_HANDLER, + ZEND_YIELD_SPEC_VAR_TMP_HANDLER, + ZEND_YIELD_SPEC_VAR_VAR_HANDLER, + ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER, + ZEND_YIELD_SPEC_VAR_CV_HANDLER, + ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER, + ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER, + ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER, + ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER, + ZEND_YIELD_SPEC_UNUSED_CV_HANDLER, + ZEND_YIELD_SPEC_CV_CONST_HANDLER, + ZEND_YIELD_SPEC_CV_TMP_HANDLER, + ZEND_YIELD_SPEC_CV_VAR_HANDLER, + ZEND_YIELD_SPEC_CV_UNUSED_HANDLER, + ZEND_YIELD_SPEC_CV_CV_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; From 879016023566ce162be1d81e973bde9db76dd519 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 May 2012 05:05:49 +0200 Subject: [PATCH 040/641] Add auto-increment keys When no key is explicitely yielded PHP will used auto-incrementing keys as a fallback. They behave the same as with arrays, i.e. the key is the successor of the largest previously used integer key. --- .../generators/auto_incrementing_keys.phpt | 22 ++ Zend/zend_generators.c | 3 + Zend/zend_generators.h | 2 + Zend/zend_vm_def.h | 14 +- Zend/zend_vm_execute.h | 350 ++++++++++++++---- 5 files changed, 313 insertions(+), 78 deletions(-) create mode 100644 Zend/tests/generators/auto_incrementing_keys.phpt diff --git a/Zend/tests/generators/auto_incrementing_keys.phpt b/Zend/tests/generators/auto_incrementing_keys.phpt new file mode 100644 index 00000000000..623f2d813d4 --- /dev/null +++ b/Zend/tests/generators/auto_incrementing_keys.phpt @@ -0,0 +1,22 @@ +--TEST-- +Generator keys are auto-incrementing by default +--FILE-- + 'rab'; + yield 'oof'; +} + +foreach (gen() as $k => $v) { + echo $k, ' => ', $v, "\n"; +} + +?> +--EXPECT-- +0 => foo +1 => bar +5 => rab +6 => oof diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index d3d4b3f7a81..5c211b0e8b8 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -116,6 +116,9 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM generator = emalloc(sizeof(zend_generator)); memset(generator, 0, sizeof(zend_generator)); + /* The key will be incremented on first use, so it'll start at 0 */ + generator->largest_used_integer_key = -1; + zend_object_std_init(&generator->std, class_type TSRMLS_CC); object.handle = zend_objects_store_put(generator, NULL, diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 2fd2c93b636..b73557c7154 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -34,6 +34,8 @@ typedef struct _zend_generator { zval *key; /* Variable to put sent value into */ temp_variable *send_target; + /* Largest used integer key for auto-incrementing keys */ + long largest_used_integer_key; } zend_generator; extern ZEND_API zend_class_entry *zend_ce_generator; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 36b9c93c525..f1fd64cf814 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5332,11 +5332,19 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + FREE_OP2_IF_VAR(); } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index ac7ff7ff585..09c3461b7a3 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4127,10 +4127,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -4760,10 +4768,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -5718,11 +5734,19 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -6371,10 +6395,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -7063,10 +7095,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -9058,10 +9098,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -9691,10 +9739,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -10649,11 +10705,19 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -11168,10 +11232,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -11798,10 +11870,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -15650,10 +15730,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -17670,10 +17758,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -20070,11 +20166,19 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -21149,10 +21253,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -23218,10 +23330,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -24645,10 +24765,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -25896,10 +26024,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -27147,11 +27283,19 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -27510,10 +27654,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -28758,10 +28910,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -32210,10 +32370,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -34100,10 +34268,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -36369,11 +36545,19 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -37308,10 +37492,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ @@ -39246,10 +39438,18 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS generator->key = key; } + if (Z_TYPE_P(generator->key) == IS_LONG + && Z_LVAL_P(generator->key) > generator->largest_used_integer_key + ) { + generator->largest_used_integer_key = Z_LVAL_P(generator->key); + } + } else { - /* Setting the key to NULL signals that the auto-increment key - * generation should be used */ - generator->key = NULL; + /* If no key was specified we use auto-increment keys */ + generator->largest_used_integer_key++; + + ALLOC_INIT_ZVAL(generator->key); + ZVAL_LONG(generator->key, generator->largest_used_integer_key); } /* If a value is sent it should go into the result var */ From 0033a525213e68e6ae74b3c3d75fd6ea4beea5d6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 May 2012 16:28:33 +0200 Subject: [PATCH 041/641] Allow throwing exceptions from generators The missing piece is how one can find the next stack frame, which is required for dtor'ing arguments pushed to the stack. As the generator execute_data does not live on the stack one can't use it to figure out the start of the next stack frame. So there must be some other method. --- .../generator_throwing_exception.phpt | 28 +++++++++++ Zend/zend_vm_def.h | 38 ++++++++++++-- Zend/zend_vm_execute.h | 50 +++++++++++++++---- 3 files changed, 100 insertions(+), 16 deletions(-) create mode 100644 Zend/tests/generators/generator_throwing_exception.phpt diff --git a/Zend/tests/generators/generator_throwing_exception.phpt b/Zend/tests/generators/generator_throwing_exception.phpt new file mode 100644 index 00000000000..5df4a811328 --- /dev/null +++ b/Zend/tests/generators/generator_throwing_exception.phpt @@ -0,0 +1,28 @@ +--TEST-- +Generators can throw exceptions +--FILE-- +current()); + +try { + $gen->next(); +} catch (Exception $e) { + echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; +} + +var_dump($gen->current()); + +?> +--EXPECT-- +string(3) "foo" +Caught exception with message "test" +NULL diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f1fd64cf814..cbdf701adcb 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2821,10 +2821,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - /* Close the generator to free up resources. */ + /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); - /* Pass execution back to generator handling code */ + /* Pass execution back to handling code */ ZEND_VM_RETURN(); } @@ -4992,11 +4992,25 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) int i; zend_uint catch_op_num = 0; int catched = 0; - zval restored_error_reporting; + void **stack_frame; - void **stack_frame = (void**)(((char*)EX_Ts()) + - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T)); + /* Figure out where the next stack frame (which maybe contains pushed + * arguments that have to be dtor'ed) starts */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* For generators the execution context is not stored on the stack so + * I don't know yet how to figure out where the next stack frame + * starts. For now I'll just use the stack top to ignore argument + * dtor'ing altogether. */ + stack_frame = zend_vm_stack_top(TSRMLS_C); + } else { + /* In all other cases the next stack frame starts after the temporary + * variables section of the current execution context */ + stack_frame = (void **) ((char *) EX_Ts() + + ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T); + } + /* If the exception was thrown during a function call there might be + * arguments pushed to the stack that have to be dtor'ed. */ while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C); zval_ptr_dtor(&stack_zval_p); @@ -5058,6 +5072,8 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) /* restore previous error_reporting value */ if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) { + zval restored_error_reporting; + Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); @@ -5067,6 +5083,18 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) EX(old_error_reporting) = NULL; if (!catched) { + /* For generators skip the leave handler return directly */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources */ + zend_generator_close(generator, 1 TSRMLS_CC); + + /* Pass execution back to handling code */ + ZEND_VM_RETURN(); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } else { ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 09c3461b7a3..039504be451 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1055,11 +1055,25 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER int i; zend_uint catch_op_num = 0; int catched = 0; - zval restored_error_reporting; + void **stack_frame; - void **stack_frame = (void**)(((char*)EX_Ts()) + - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T)); + /* Figure out where the next stack frame (which maybe contains pushed + * arguments that have to be dtor'ed) starts */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* For generators the execution context is not stored on the stack so + * I don't know yet how to figure out where the next stack frame + * starts. For now I'll just use the stack top to ignore argument + * dtor'ing altogether. */ + stack_frame = zend_vm_stack_top(TSRMLS_C); + } else { + /* In all other cases the next stack frame starts after the temporary + * variables section of the current execution context */ + stack_frame = (void **) ((char *) EX_Ts() + + ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T); + } + /* If the exception was thrown during a function call there might be + * arguments pushed to the stack that have to be dtor'ed. */ while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C); zval_ptr_dtor(&stack_zval_p); @@ -1121,6 +1135,8 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER /* restore previous error_reporting value */ if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) { + zval restored_error_reporting; + Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); @@ -1130,6 +1146,18 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER EX(old_error_reporting) = NULL; if (!catched) { + /* For generators skip the leave handler return directly */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* Close the generator to free up resources */ + zend_generator_close(generator, 1 TSRMLS_CC); + + /* Pass execution back to handling code */ + ZEND_VM_RETURN(); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); @@ -2318,10 +2346,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - /* Close the generator to free up resources. */ + /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); - /* Pass execution back to generator handling code */ + /* Pass execution back to handling code */ ZEND_VM_RETURN(); } @@ -7368,10 +7396,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - /* Close the generator to free up resources. */ + /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); - /* Pass execution back to generator handling code */ + /* Pass execution back to handling code */ ZEND_VM_RETURN(); } @@ -12323,10 +12351,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - /* Close the generator to free up resources. */ + /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); - /* Pass execution back to generator handling code */ + /* Pass execution back to handling code */ ZEND_VM_RETURN(); } @@ -29344,10 +29372,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); - /* Close the generator to free up resources. */ + /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); - /* Pass execution back to generator handling code */ + /* Pass execution back to handling code */ ZEND_VM_RETURN(); } From ee89e228f6f684555dd219d8a46d173cfed3230a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 31 May 2012 00:00:30 +0200 Subject: [PATCH 042/641] Allow yielding during function calls During function calls arguments are pushed onto the stack. Now these are backed up on yield and restored on resume. This requires memcpy'ing them, but there doesn't seem to be any better way to do it. Also this fixes the issue with exceptions thrown during function calls. --- ...nerator_throwing_during_function_call.phpt | 32 ++++++++++++++++++ .../yield_during_function_call.phpt | 15 +++++++++ Zend/zend_generators.c | 33 +++++++++++++++++++ Zend/zend_generators.h | 10 ++++++ Zend/zend_vm_def.h | 11 ++++--- Zend/zend_vm_execute.h | 11 ++++--- 6 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 Zend/tests/generators/generator_throwing_during_function_call.phpt create mode 100644 Zend/tests/generators/yield_during_function_call.phpt diff --git a/Zend/tests/generators/generator_throwing_during_function_call.phpt b/Zend/tests/generators/generator_throwing_during_function_call.phpt new file mode 100644 index 00000000000..5e40ef94837 --- /dev/null +++ b/Zend/tests/generators/generator_throwing_during_function_call.phpt @@ -0,0 +1,32 @@ +--TEST-- +Stack is cleaned up properly when an exception is thrown during a function call +--FILE-- +current()); + +try { + $gen->next(); +} catch (Exception $e) { + echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; +} + +var_dump($gen->current()); + +?> +--EXPECT-- +string(3) "foo" +Caught exception with message "test" +NULL diff --git a/Zend/tests/generators/yield_during_function_call.phpt b/Zend/tests/generators/yield_during_function_call.phpt new file mode 100644 index 00000000000..9727b8fd33e --- /dev/null +++ b/Zend/tests/generators/yield_during_function_call.phpt @@ -0,0 +1,15 @@ +--TEST-- +"yield" can occur during a function call +--FILE-- +send(10); + +?> +--EXPECT-- +string(10) "xxxxxxxxxx" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 5c211b0e8b8..4754d7595d9 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -83,6 +83,19 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio } } + /* Clear any backed up stack arguments */ + if (generator->backed_up_stack) { + zval **zvals = (zval **) generator->backed_up_stack; + size_t zval_num = generator->backed_up_stack_size / sizeof(zval *); + int i; + + for (i = 0; i < zval_num; i++) { + zval_ptr_dtor(&zvals[i]); + } + + efree(generator->backed_up_stack); + } + efree(execute_data); generator->execute_data = NULL; } @@ -158,6 +171,17 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS zend_class_entry *original_scope = EG(scope); zend_class_entry *original_called_scope = EG(called_scope); + /* Remember the current stack position so we can back up pushed args */ + generator->original_stack_top = zend_vm_stack_top(TSRMLS_C); + + /* If there is a backed up stack copy it to the VM stack */ + if (generator->backed_up_stack) { + void *stack = zend_vm_stack_alloc(generator->backed_up_stack_size TSRMLS_CC); + memcpy(stack, generator->backed_up_stack, generator->backed_up_stack_size); + efree(generator->backed_up_stack); + generator->backed_up_stack = NULL; + } + /* We (mis)use the return_value_ptr_ptr to provide the generator object * to the executor, so YIELD will be able to set the yielded value */ EG(return_value_ptr_ptr) = &object; @@ -186,6 +210,15 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS EG(This) = original_This; EG(scope) = original_scope; EG(called_scope) = original_called_scope; + + /* The stack top before and after the execution differ, i.e. there are + * arguments pushed to the stack. */ + if (generator->original_stack_top != zend_vm_stack_top(TSRMLS_C)) { + generator->backed_up_stack_size = (zend_vm_stack_top(TSRMLS_C) - generator->original_stack_top) * sizeof(void *); + generator->backed_up_stack = emalloc(generator->backed_up_stack_size); + memcpy(generator->backed_up_stack, generator->original_stack_top, generator->backed_up_stack_size); + zend_vm_stack_free(generator->original_stack_top TSRMLS_CC); + } } } /* }}} */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index b73557c7154..89193bbe6e4 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -28,6 +28,16 @@ typedef struct _zend_generator { /* The suspended execution context. */ zend_execute_data *execute_data; + + /* If the execution is suspended during a function call there may be + * arguments pushed to the stack, so it has to be backed up. */ + void *backed_up_stack; + size_t backed_up_stack_size; + + /* The original stack top before resuming the generator. This is required + * for proper cleanup during exception handling. */ + void **original_stack_top; + /* Current value */ zval *value; /* Current key */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index cbdf701adcb..de63d8b5e22 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4997,11 +4997,12 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) /* Figure out where the next stack frame (which maybe contains pushed * arguments that have to be dtor'ed) starts */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* For generators the execution context is not stored on the stack so - * I don't know yet how to figure out where the next stack frame - * starts. For now I'll just use the stack top to ignore argument - * dtor'ing altogether. */ - stack_frame = zend_vm_stack_top(TSRMLS_C); + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* For generators the next stack frame is conveniently stored in the + * generator object. */ + stack_frame = generator->original_stack_top; } else { /* In all other cases the next stack frame starts after the temporary * variables section of the current execution context */ diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 039504be451..98d849bbd68 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1060,11 +1060,12 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER /* Figure out where the next stack frame (which maybe contains pushed * arguments that have to be dtor'ed) starts */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* For generators the execution context is not stored on the stack so - * I don't know yet how to figure out where the next stack frame - * starts. For now I'll just use the stack top to ignore argument - * dtor'ing altogether. */ - stack_frame = zend_vm_stack_top(TSRMLS_C); + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + + /* For generators the next stack frame is conveniently stored in the + * generator object. */ + stack_frame = generator->original_stack_top; } else { /* In all other cases the next stack frame starts after the temporary * variables section of the current execution context */ From 13a9555342a4156a6150818234639b49a596ccd6 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Thu, 31 May 2012 23:31:00 +0800 Subject: [PATCH 043/641] Implemented FR #61602 Allow access to name of constant used as default value This is an improved commit for FR #61602, this fixed the previous commit 054f3e3's C99 compiler compatibility issue --- ext/reflection/php_reflection.c | 115 ++++++++++++++++-- ...Parameter_DefaultValueConstant_basic1.phpt | 52 ++++++++ ...Parameter_DefaultValueConstant_basic2.phpt | 30 +++++ ...nParameter_DefaultValueConstant_error.phpt | 25 ++++ 4 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt create mode 100644 ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt create mode 100644 ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 1cf65cee164..ac997fcfa49 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1457,6 +1457,54 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c } /* }}} */ +/* {{{ _reflection_param_get_default_param */ +static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTION_PARAMETERS) +{ + reflection_object *intern; + parameter_reference *param; + + intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC); + if (intern == NULL || intern->ptr == NULL) { + if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { + return NULL; + } + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the reflection object"); + } + + param = intern->ptr; + if (param->fptr->type != ZEND_USER_FUNCTION) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + return NULL; + } + + if (param->offset < param->required) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); + return NULL; + } + + return param; +} +/* }}} */ + +/* {{{ _reflection_param_get_default_precv */ +static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS, parameter_reference *param) +{ + zend_op *precv; + + if (param == NULL) { + return NULL; + } + + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); + if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + return NULL; + } + + return precv; +} +/* }}} */ + /* {{{ Preventing __clone from being called */ ZEND_METHOD(reflection, __clone) { @@ -2535,27 +2583,20 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) Returns the default value of this parameter or throws an exception */ ZEND_METHOD(reflection_parameter, getDefaultValue) { - reflection_object *intern; parameter_reference *param; zend_op *precv; if (zend_parse_parameters_none() == FAILURE) { return; } - GET_REFLECTION_OBJECT_PTR(param); - if (param->fptr->type != ZEND_USER_FUNCTION) - { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { return; } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); - return; - } - precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); - if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (!precv) { return; } @@ -2568,6 +2609,54 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) } /* }}} */ +/* {{{ proto public bool ReflectionParameter::isDefaultValueConstant() + Returns whether the default value of this parameter is constant */ +ZEND_METHOD(reflection_parameter, isDefaultValueConstant) +{ + zend_op *precv; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { + RETURN_FALSE; + } + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + RETURN_TRUE; + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto public mixed ReflectionParameter::getDefaultValueConstantName() + Returns the default value's constant name if default value is constant or null */ +ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) +{ + zend_op *precv; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU); + if (!param) { + return; + } + + precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); + if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRLEN_P(precv->op2.zv), 1); + } +} +/* }}} */ + /* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) @@ -5903,6 +5992,8 @@ static const zend_function_entry reflection_parameter_functions[] = { ZEND_ME(reflection_parameter, isOptional, arginfo_reflection__void, 0) ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_reflection__void, 0) ZEND_ME(reflection_parameter, getDefaultValue, arginfo_reflection__void, 0) + ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_reflection__void, 0) + ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_reflection__void, 0) PHP_FE_END }; diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt new file mode 100644 index 00000000000..cdd00d26248 --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt @@ -0,0 +1,52 @@ +--TEST-- +ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() +--FILE-- +getParameters() as $param) { + if($param->getName() == 'test1') { + var_dump($param->isDefaultValueConstant()); + } + if($param->getName() == 'test2') { + var_dump($param->isDefaultValueConstant()); + } + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + var_dump($param->getDefaultValueConstantName()); + } +} + +class Foo2 { + const bar = 'Foo2::bar'; +} + +class Foo { + const bar = 'Foo::bar'; + + public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) { + } +} + +$method = new ReflectionMethod('Foo', 'baz'); +$params = $method->getParameters(); + +foreach ($params as $param) { + if ($param->isDefaultValueConstant()) { + var_dump($param->getDefaultValueConstantName()); + } +} +?> +==DONE== +--EXPECT-- +bool(false) +bool(true) +string(12) "CONST_TEST_1" +string(9) "self::bar" +string(9) "Foo2::bar" +string(12) "CONST_TEST_1" +==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt new file mode 100644 index 00000000000..1ee9e93735a --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt @@ -0,0 +1,30 @@ +--TEST-- +ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() for namespace +--FILE-- +getParameters() as $param) { + if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) { + echo $param->getDefaultValueConstantName() . "\n"; + } + } + echo "==DONE=="; +} +?> +--EXPECT-- +ReflectionTestNamespace\TestClass::TEST_CONST_2 +ReflectionTestNamespace\CONST_TEST_1 +==DONE== diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt new file mode 100644 index 00000000000..984b06efe22 --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt @@ -0,0 +1,25 @@ +--TEST-- +ReflectionParameter::getDefaultValueConstant() should raise exception on non optional parameter +--FILE-- +getParameters() as $param) { + try { + echo $param->getDefaultValueConstantName() . "\n"; + } + catch(ReflectionException $e) { + echo $e->getMessage() . "\n"; + } +} +?> +==DONE== +--EXPECT-- +Parameter is not optional +CONST_TEST_1 +==DONE== From 1477be9aa88689f7e547a24258dc4d63637fd5b0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 31 May 2012 20:03:18 +0200 Subject: [PATCH 044/641] Make $generator->send() return the current value This makes the API easier to use (and is consistent with Python and JS). --- .../generators/send_returns_current.phpt | 20 +++++++++++++++++++ Zend/zend_generators.c | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/generators/send_returns_current.phpt diff --git a/Zend/tests/generators/send_returns_current.phpt b/Zend/tests/generators/send_returns_current.phpt new file mode 100644 index 00000000000..d3a4afd53a3 --- /dev/null +++ b/Zend/tests/generators/send_returns_current.phpt @@ -0,0 +1,20 @@ +--TEST-- +$generator->send() returns the yielded value +--FILE-- +send('foo')); +var_dump($gen->send('bar')); + +?> +--EXPECT-- +string(3) "oof" +string(3) "rab" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 4754d7595d9..5b58e217604 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -336,7 +336,7 @@ ZEND_METHOD(Generator, next) } /* }}} */ -/* {{{ proto void Generator::send() +/* {{{ proto mixed Generator::send() * Sends a value to the generator */ ZEND_METHOD(Generator, send) { @@ -366,6 +366,10 @@ ZEND_METHOD(Generator, send) generator->send_target->var.ptr_ptr = &value; zend_generator_resume(object, generator TSRMLS_CC); + + if (generator->value) { + RETURN_ZVAL(generator->value, 1, 0); + } } /* {{{ proto void Generator::close() From 59e0930d37e2a559317e2c08ecfee5a84bde925d Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:16:00 +0200 Subject: [PATCH 045/641] - Comment unused function to avoid warnings --- sapi/fpm/fpm/fpm_conf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 1f3258f35fd..dfe6792c058 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -242,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -257,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { From 35abf3f20c36109b4afdcbd62db9a1846575ac3d Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:16:53 +0200 Subject: [PATCH 046/641] - fix missing include for unix sockets --- sapi/fpm/fpm/fpm_sockets.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 5b9c698c2ad..499ba6baf89 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -7,6 +7,7 @@ #include #include +#include #include #include From 38ca8cb7a12548b44b942ddd4fb2628b70bc6612 Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:18:48 +0200 Subject: [PATCH 047/641] - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) --- NEWS | 1 + sapi/fpm/fpm/fpm_php.c | 38 ++++++++++++++++++++++++++++++++++++++ sapi/fpm/fpm/fpm_php.h | 1 + sapi/fpm/fpm/fpm_status.c | 9 +++++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index d031c3c0d46..42eb5b464ea 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ PHP NEWS . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests). (fat) + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec73efb..cd4d3aef3a3 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(&EG(symbol_table), table, strlen(table) + 1, (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed318a0..d6054737d67 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index e64a645b2d0..3b09d3b8959 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include "zlog.h" #include "fpm_atomic.h" #include "fpm_conf.h" +#include "fpm_php.h" #include static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri && strstr(SG(request_info).query_string, "full"); + full = (fpm_php_get_string_from_table("_GET", "full" TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string && strstr(SG(request_info).query_string, "html")) { + if (fpm_php_get_string_from_table("_GET", "html" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/html"), 1, 1 TSRMLS_CC); time_format = "%d/%b/%Y:%H:%M:%S %z"; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "xml")) { + } else if (fpm_php_get_string_from_table("_GET", "xml" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/xml"), 1, 1 TSRMLS_CC); time_format = "%s"; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* JSON */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "json")) { + } else if (fpm_php_get_string_from_table("_GET", "json" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: application/json"), 1, 1 TSRMLS_CC); time_format = "%s"; From 43ec7088829338decce93ea4aada34f0bb6f069b Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:22:02 +0200 Subject: [PATCH 048/641] - Comment unused function to avoid warnings --- sapi/fpm/fpm/fpm_conf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 1f3258f35fd..dfe6792c058 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -242,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -257,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { From ec4a1d576b07f05e65a649842ed701def21adadd Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:22:18 +0200 Subject: [PATCH 049/641] - fix missing include for unix sockets --- sapi/fpm/fpm/fpm_sockets.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 5b9c698c2ad..499ba6baf89 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -7,6 +7,7 @@ #include #include +#include #include #include From 238caeb63c4f4faf67b9f8de62a753eb3e954dbe Mon Sep 17 00:00:00 2001 From: Jerome Loyet Date: Fri, 1 Jun 2012 11:23:01 +0200 Subject: [PATCH 050/641] - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) --- NEWS | 1 + sapi/fpm/fpm/fpm_php.c | 38 ++++++++++++++++++++++++++++++++++++++ sapi/fpm/fpm/fpm_php.h | 1 + sapi/fpm/fpm/fpm_status.c | 9 +++++---- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index eed55f1e1a5..363a8b7f252 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ PHP NEWS . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests). (fat) + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec73efb..cd4d3aef3a3 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(&EG(symbol_table), table, strlen(table) + 1, (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed318a0..d6054737d67 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 83de76d5abd..5f2c852c7d7 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include "zlog.h" #include "fpm_atomic.h" #include "fpm_conf.h" +#include "fpm_php.h" #include static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri && strstr(SG(request_info).query_string, "full"); + full = (fpm_php_get_string_from_table("_GET", "full" TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string && strstr(SG(request_info).query_string, "html")) { + if (fpm_php_get_string_from_table("_GET", "html" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/html"), 1, 1 TSRMLS_CC); time_format = "%d/%b/%Y:%H:%M:%S %z"; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "xml")) { + } else if (fpm_php_get_string_from_table("_GET", "xml" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: text/xml"), 1, 1 TSRMLS_CC); time_format = "%s"; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* JSON */ - } else if (SG(request_info).request_uri && strstr(SG(request_info).query_string, "json")) { + } else if (fpm_php_get_string_from_table("_GET", "json" TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL("Content-Type: application/json"), 1, 1 TSRMLS_CC); time_format = "%s"; From 2c230fb574fb2b3e17a74b6678ab36b6572a3c7a Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 1 Jun 2012 22:12:08 +0300 Subject: [PATCH 051/641] close the underlying stream as early as possible and so notify the NET layer --- ext/mysqlnd/mysqlnd.c | 13 ++++++------- ext/mysqlnd/mysqlnd_net.c | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 705dac3d450..cc3a3917a18 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -1849,8 +1849,9 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR DBG_INF("Connection clean, sending COM_QUIT"); if (net_stream) { ret = conn->m->simple_command(conn, COM_QUIT, NULL, 0, PROT_LAST, TRUE, TRUE TSRMLS_CC); + net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); } - /* Do nothing */ + CONN_SET_STATE(conn, CONN_QUIT_SENT); break; case CONN_SENDING_LOAD_DATA: /* @@ -1866,6 +1867,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR Do nothing, the connection will be brutally closed and the server will catch it and free close from its side. */ + /* Fall-through */ case CONN_ALLOCED: /* Allocated but not connected or there was failure when trying @@ -1873,16 +1875,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR Fall-through */ + CONN_SET_STATE(conn, CONN_QUIT_SENT); + net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); + /* Fall-through */ case CONN_QUIT_SENT: /* The user has killed its own connection */ break; } - /* - We hold one reference, and every other object which needs the - connection does increase it by 1. - */ - CONN_SET_STATE(conn, CONN_QUIT_SENT); - net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); DBG_RETURN(ret); } diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index a641a41d2f9..7458f76528d 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -239,17 +239,19 @@ MYSQLND_METHOD(mysqlnd_net, post_connect_set_opt)(MYSQLND_NET * const net, { php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); DBG_ENTER("mysqlnd_net::post_connect_set_opt"); - if (net->data->options.timeout_read) { - struct timeval tv; - DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); - tv.tv_sec = net->data->options.timeout_read; - tv.tv_usec = 0; - php_stream_set_option(net_stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv); - } + if (net_stream) { + if (net->data->options.timeout_read) { + struct timeval tv; + DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); + tv.tv_sec = net->data->options.timeout_read; + tv.tv_usec = 0; + php_stream_set_option(net_stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &tv); + } - if (!memcmp(scheme, "tcp://", sizeof("tcp://") - 1)) { - /* TCP -> Set TCP_NODELAY */ - mysqlnd_set_sock_no_delay(net_stream TSRMLS_CC); + if (!memcmp(scheme, "tcp://", sizeof("tcp://") - 1)) { + /* TCP -> Set TCP_NODELAY */ + mysqlnd_set_sock_no_delay(net_stream TSRMLS_CC); + } } DBG_VOID_RETURN; @@ -1051,6 +1053,7 @@ static php_stream * MYSQLND_METHOD(mysqlnd_net, get_stream)(const MYSQLND_NET * const net TSRMLS_DC) { DBG_ENTER("mysqlnd_net::get_stream"); + DBG_INF_FMT("%p", net? net->data->stream:NULL); DBG_RETURN(net? net->data->stream:NULL); } /* }}} */ From 6117f4c7c0abe3721c2371600a97641003de21a7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 2 Jun 2012 20:40:58 +0200 Subject: [PATCH 052/641] Add cloning support for generators Generators can now be cloned. I'm pretty sure that my current code does not yet cover all the edge cases of cloning the execution context, so there are probably a few bugs in there :) --- Zend/tests/generators/clone.phpt | 32 ++++ Zend/tests/generators/clone_with_foreach.phpt | 33 ++++ Zend/tests/generators/clone_with_stack.phpt | 18 +++ .../generators/clone_with_symbol_table.phpt | 27 ++++ Zend/zend_generators.c | 142 ++++++++++++++++-- 5 files changed, 243 insertions(+), 9 deletions(-) create mode 100644 Zend/tests/generators/clone.phpt create mode 100644 Zend/tests/generators/clone_with_foreach.phpt create mode 100644 Zend/tests/generators/clone_with_stack.phpt create mode 100644 Zend/tests/generators/clone_with_symbol_table.phpt diff --git a/Zend/tests/generators/clone.phpt b/Zend/tests/generators/clone.phpt new file mode 100644 index 00000000000..94c4c6364e7 --- /dev/null +++ b/Zend/tests/generators/clone.phpt @@ -0,0 +1,32 @@ +--TEST-- +Generators can be cloned +--FILE-- +current()); +$g1->next(); + +$g2 = clone $g1; +var_dump($g2->current()); +$g2->next(); + +var_dump($g2->current()); +var_dump($g1->current()); + +$g1->next(); +var_dump($g1->current()); + +?> +--EXPECT-- +int(0) +int(1) +int(2) +int(1) +int(2) diff --git a/Zend/tests/generators/clone_with_foreach.phpt b/Zend/tests/generators/clone_with_foreach.phpt new file mode 100644 index 00000000000..42cf3348ea2 --- /dev/null +++ b/Zend/tests/generators/clone_with_foreach.phpt @@ -0,0 +1,33 @@ +--TEST-- +Cloning a generator with a foreach loop properly adds a ref for the loop var +--FILE-- +current()); + +$g2 = clone $g1; +var_dump($g2->current()); + +$g1->next(); +$g2->next(); +var_dump($g1->current()); +var_dump($g2->current()); + +$g1->close(); +$g2->next(); +var_dump($g2->current()); + +?> +--EXPECT-- +int(1) +int(1) +int(2) +int(2) +int(3) diff --git a/Zend/tests/generators/clone_with_stack.phpt b/Zend/tests/generators/clone_with_stack.phpt new file mode 100644 index 00000000000..79bca31bb62 --- /dev/null +++ b/Zend/tests/generators/clone_with_stack.phpt @@ -0,0 +1,18 @@ +--TEST-- +A generator with an active stack can be cloned +--FILE-- +rewind(); +$g2 = clone $g1; +$g1->close(); +$g2->send(10); + +?> +--EXPECT-- +string(10) "xxxxxxxxxx" diff --git a/Zend/tests/generators/clone_with_symbol_table.phpt b/Zend/tests/generators/clone_with_symbol_table.phpt new file mode 100644 index 00000000000..2a4cf10aaba --- /dev/null +++ b/Zend/tests/generators/clone_with_symbol_table.phpt @@ -0,0 +1,27 @@ +--TEST-- +A generator using a symbol table can be cloned +--FILE-- + 'bar']); + + // interrupt + yield; + + var_dump($foo); +} + +$g1 = gen(); +$g1->rewind(); +$g2 = clone $g1; +$g1->close(); +$g2->next(); + +?> +--EXPECT-- +string(3) "bar" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 5b58e217604..01b93ef7fc0 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -34,13 +34,7 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio if (!execute_data->symbol_table) { zend_free_compiled_variables(execute_data->CVs, execute_data->op_array->last_var); } else { - if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) { - zend_hash_destroy(execute_data->symbol_table); - FREE_HASHTABLE(execute_data->symbol_table); - } else { - zend_hash_clean(execute_data->symbol_table); - *(++EG(symtable_cache_ptr)) = execute_data->symbol_table; - } + zend_clean_and_cache_symbol_table(execute_data->symbol_table); } if (execute_data->current_this) { @@ -121,6 +115,134 @@ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* } /* }}} */ +static void zend_generator_clone_storage(zend_generator *orig, zend_generator **clone_ptr) /* {{{ */ +{ + zend_generator *clone = emalloc(sizeof(zend_generator)); + memcpy(clone, orig, sizeof(zend_generator)); + + if (orig->execute_data) { + /* Create a few shorter aliases to the old execution data */ + zend_execute_data *execute_data = orig->execute_data; + zend_op_array *op_array = execute_data->op_array; + HashTable *symbol_table = execute_data->symbol_table; + + /* Alloc separate execution context, as well as separate sections for + * compiled variables and temporary variables */ + size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)); + size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (symbol_table ? 1 : 2)); + size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T; + size_t total_size = execute_data_size + CVs_size + Ts_size; + + clone->execute_data = emalloc(total_size); + + /* Copy the zend_execute_data struct */ + memcpy(clone->execute_data, execute_data, execute_data_size); + + /* Set the pointers to the memory segments for the compiled and + * temporary variables (which are located after the execute_data) */ + clone->execute_data->CVs = (zval ***) ((char *) clone->execute_data + execute_data_size); + clone->execute_data->Ts = (temp_variable *) ((char *) clone->execute_data->CVs + CVs_size); + + /* Zero out the compiled variables section */ + memset(clone->execute_data->CVs, 0, sizeof(zval **) * op_array->last_var); + + if (!symbol_table) { + int i; + + /* Copy compiled variables */ + for (i = 0; i < op_array->last_var; i++) { + if (execute_data->CVs[i]) { + clone->execute_data->CVs[i] = (zval **) clone->execute_data->CVs + op_array->last_var + i; + *clone->execute_data->CVs[i] = (zval *) orig->execute_data->CVs[op_array->last_var + i]; + Z_ADDREF_PP(clone->execute_data->CVs[i]); + } + } + } else { + /* Copy symbol table */ + ALLOC_HASHTABLE(clone->execute_data->symbol_table); + zend_hash_init(clone->execute_data->symbol_table, zend_hash_num_elements(symbol_table), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(clone->execute_data->symbol_table, symbol_table, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); + + /* Update zval** pointers for compiled variables */ + { + int i; + for (i = 0; i < op_array->last_var; i++) { + if (zend_hash_quick_find(clone->execute_data->symbol_table, op_array->vars[i].name, op_array->vars[i].name_len + 1, op_array->vars[i].hash_value, (void **) &clone->execute_data->CVs[i]) == FAILURE) { + clone->execute_data->CVs[i] = NULL; + } + } + } + } + + /* Copy the temporary variables */ + memcpy(clone->execute_data->Ts, orig->execute_data->Ts, Ts_size); + + /* Add references to loop variables */ + { + zend_uint op_num = execute_data->opline - op_array->opcodes; + + int i; + for (i = 0; i < op_array->last_brk_cont; ++i) { + zend_brk_cont_element *brk_cont = op_array->brk_cont_array + i; + + if (brk_cont->start < 0) { + continue; + } else if (brk_cont->start > op_num) { + break; + } else if (brk_cont->brk > op_num) { + zend_op *brk_opline = op_array->opcodes + brk_cont->brk; + + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + temp_variable *var = (temp_variable *) ((char *) execute_data->Ts + brk_opline->op1.var); + + Z_ADDREF_P(var->var.ptr); + } + } + } + } + + if (orig->backed_up_stack) { + /* Copy backed up stack */ + clone->backed_up_stack = emalloc(orig->backed_up_stack_size); + memcpy(clone->backed_up_stack, orig->backed_up_stack, orig->backed_up_stack_size); + + /* Add refs to stack variables */ + { + zval **zvals = (zval **) orig->backed_up_stack; + size_t zval_num = orig->backed_up_stack_size / sizeof(zval *); + int i; + + for (i = 0; i < zval_num; i++) { + Z_ADDREF_P(zvals[i]); + } + } + } + + /* Update the send_target to use the temporary variable with the same + * offset as the original generator, but in out temporary variable + * memory segment. */ + if (orig->send_target) { + size_t offset = (char *) orig->send_target - (char *) execute_data->Ts; + clone->send_target = (temp_variable *) ( + (char *) clone->execute_data->Ts + offset + ); + Z_ADDREF_P(clone->send_target->var.ptr); + } + } + + /* The value and key are known not to be references, so simply add refs */ + if (orig->value) { + Z_ADDREF_P(orig->value); + } + + if (orig->key) { + Z_ADDREF_P(orig->key); + } + + *clone_ptr = clone; +} +/* }}} */ + static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { zend_generator *generator; @@ -136,7 +258,7 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM object.handle = zend_objects_store_put(generator, NULL, (zend_objects_free_object_storage_t) zend_generator_free_storage, - NULL /* no clone handler for now */ + (zend_objects_store_clone_t) zend_generator_clone_storage TSRMLS_CC ); object.handlers = &zend_generator_handlers; @@ -358,7 +480,8 @@ ZEND_METHOD(Generator, send) } /* The sent value was initialized to NULL, so dtor that */ - zval_ptr_dtor(generator->send_target->var.ptr_ptr); + zval_ptr_dtor(&generator->send_target->var.ptr); + /* Set new sent value */ Z_ADDREF_P(value); @@ -419,6 +542,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zend_generator_handlers.get_constructor = zend_generator_get_constructor; + zend_generator_handlers.clone_obj = zend_objects_store_clone_obj; } /* }}} */ From 7b3bfa5784cf36647f21a72ceb9741e40927a5b6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 3 Jun 2012 02:00:11 +0200 Subject: [PATCH 053/641] Improve backtraces from generators The current situation is still not perfect, as the generator function itself does not appear in the stack trace. This makes sense in some way, but it would probably be more helpful if it would show up (with the bound arguments) after the $generator->xyz() call. This could be misleading too though as the function is not *really* called there. --- Zend/tests/generators/backtrace.phpt | 25 +++++++++++++++++++++++++ Zend/zend_generators.c | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 Zend/tests/generators/backtrace.phpt diff --git a/Zend/tests/generators/backtrace.phpt b/Zend/tests/generators/backtrace.phpt new file mode 100644 index 00000000000..cbf8de1114e --- /dev/null +++ b/Zend/tests/generators/backtrace.phpt @@ -0,0 +1,25 @@ +--TEST-- +Printing the stack trace in a generator +--FILE-- +rewind(); // trigger run +} + +$gen = f2(); +f3($gen); + +?> +--EXPECTF-- +#0 f1() called at [%s:%d] +#1 Generator->rewind() called at [%s:%d] +#2 f3(Generator Object ()) called at [%s:%d] diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 01b93ef7fc0..df204fa4137 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -317,6 +317,10 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS EG(scope) = generator->execute_data->current_scope; EG(called_scope) = generator->execute_data->current_called_scope; + /* Set prev_execute_data to the current execute_data to get halfways + * reasonable backtraces */ + generator->execute_data->prev_execute_data = original_execute_data; + /* Go to next opcode (we don't want to run the last one again) */ generator->execute_data->opline++; From bf82f46ea9028faa3830525d2462effe7d08600d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 3 Jun 2012 02:16:29 +0200 Subject: [PATCH 054/641] Properly handle yield during method calls --- .../generators/yield_during_method_call.phpt | 35 +++++++++++++++++++ Zend/zend_generators.c | 8 +++++ 2 files changed, 43 insertions(+) create mode 100644 Zend/tests/generators/yield_during_method_call.phpt diff --git a/Zend/tests/generators/yield_during_method_call.phpt b/Zend/tests/generators/yield_during_method_call.phpt new file mode 100644 index 00000000000..da987ab5b73 --- /dev/null +++ b/Zend/tests/generators/yield_during_method_call.phpt @@ -0,0 +1,35 @@ +--TEST-- +Yield can be used during a method call +--FILE-- +b(yield); +} + +$gen = gen(); +$gen->send('foo'); + +// test resource cleanup +$gen = gen(); +$gen->rewind(); +$gen->close(); + +// test cloning +$g1 = gen(); +$g1->rewind(); +$g2 = clone $g1; +$g1->close(); +$g2->send('bar'); + +?> +--EXPECT-- +foo +bar diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index df204fa4137..a3277e6eebd 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -41,6 +41,10 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio zval_ptr_dtor(&execute_data->current_this); } + if (execute_data->object) { + zval_ptr_dtor(&execute_data->object); + } + /* If the generator is closed before it can finish execution (reach * a return statement) we have to free loop variables manually, as * we don't know whether the SWITCH_FREE / FREE opcodes have run */ @@ -228,6 +232,10 @@ static void zend_generator_clone_storage(zend_generator *orig, zend_generator ** ); Z_ADDREF_P(clone->send_target->var.ptr); } + + if (execute_data->object) { + Z_ADDREF_P(execute_data->object); + } } /* The value and key are known not to be references, so simply add refs */ From 54d85308ebd53b580f42e476dd869929acd8777a Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 3 Jun 2012 18:49:47 +0200 Subject: [PATCH 055/641] Add preliminary README.md for github Github uses a special markdown syntax and display the content of the README formatted on the front page of the repo. This readme contains information for github users. --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000000..51973854db8 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +The PHP Interpreter +=================== + +This is the github mirror of the official PHP repository located at +http://git.php.net. + +[![Build Status](https://secure.travis-ci.org/php/php-src.png?branch=master)](http://travis-ci.org/php/php-src) + +Pull Requests +============= +PHP accepts pull requests via github. Discussions are done on github, but +depending on the topic can also be relayed to the official PHP developer +mailinglist internals@lists.php.net. + +New features require an RFC and must be accepted by the developers. +See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more +information on the process. + +Bug fixes **do not** require an RFC, but require a bugtracker ticket. Always +open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN. + + Fix #55371: get_magic_quotes_gpc() throws deprecation warning + + After removing magic quotes, the get_magic_quotes_gpc function caused + a deprecate warning. get_magic_quotes_gpc can be used to detected + the magic_quotes behavior and therefore should not raise a warning at any + time. The patch removes this warning + +We do not merge pull requests directly on github. All PRs will be +pulled and pushed through http://git.php.net. From 1fc6b3c4d9f364aab0353cce979f582908eab61b Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 3 Jun 2012 19:11:10 +0200 Subject: [PATCH 056/641] Send mails to php-qa@lists.php.net whenever a build is failing --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index c51a332f40a..c1f72e4f660 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,13 @@ php: # We only specify one version so we only get one worker - 5.4 +notifications: +email: + recipients: + - php-qa@lists.php.net + on_success: change # [always|never|change] default: change + on_failure: always # [always|never|change] default: always + env: - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php From 160b5b564cde00c6243381e225445fdce83a0997 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 3 Jun 2012 19:20:17 +0200 Subject: [PATCH 057/641] Fix indention --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1f72e4f660..cfb40093653 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ php: - 5.4 notifications: -email: - recipients: - - php-qa@lists.php.net - on_success: change # [always|never|change] default: change - on_failure: always # [always|never|change] default: always + email: + recipients: + - php-qa@lists.php.net + on_success: change # [always|never|change] default: change + on_failure: always # [always|never|change] default: always env: - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php From e59b6dc0ae803d49c3f620818285f98dfb61fd57 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 3 Jun 2012 15:23:07 -0300 Subject: [PATCH 058/641] - Fixed information leak in ext exif (discovered by Martin Noga, Matthew "j00ru" Jurczyk, Gynvael Coldwind) --- ext/exif/exif.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 9468c2380b2..604010b0390 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3278,7 +3278,7 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC); if (length > 2+l1+1) { - l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1); + l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1); exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC); } } @@ -3428,6 +3428,10 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC) case M_SOF13: case M_SOF14: case M_SOF15: + if ((itemlen - 2) < 6) { + return FALSE; + } + exif_process_SOFn(Data, marker, &sof_info); ImageInfo->Width = sof_info.width; ImageInfo->Height = sof_info.height; From d57b278ad1f490094b0c3331cf02312b785a8a78 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 3 Jun 2012 18:16:57 -0300 Subject: [PATCH 059/641] - Optimize comparison between same HashTable pointer --- Zend/zend_operators.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index da11a6c7ae5..e6fe67e7649 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1575,7 +1575,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); break; case IS_ARRAY: - Z_LVAL_P(result) = zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0; + Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || + zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0); break; case IS_OBJECT: if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { @@ -2029,13 +2030,13 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { - return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); + return ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); } /* }}} */ ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { - ZVAL_LONG(result, zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); + ZVAL_LONG(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); } /* }}} */ From f3802db7a087d056ae1a0804ea0f7b503dd9c9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 1 Jun 2012 15:13:59 +0200 Subject: [PATCH 060/641] Fixed write in constant memory. clang did not forgive. --- ext/intl/timezone/timezone_class.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 4034838f97a..850da4a7481 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -62,7 +62,7 @@ U_CFUNC TimeZone *timezone_convert_datetimezone(int type, intl_error *outside_error, const char *func TSRMLS_DC) { - const char *id = NULL, + char *id = NULL, offset_id[] = "GMT+00:00"; int id_len = 0; char *message; @@ -93,7 +93,7 @@ U_CFUNC TimeZone *timezone_convert_datetimezone(int type, } id = offset_id; - id_len = slprintf((char*)id, sizeof(offset_id), "GMT%+03d:%02d", + id_len = slprintf(id, sizeof(offset_id), "GMT%+03d:%02d", hours, minutes); break; } From 72beff0d414ef45c06f118f7f60d5cd194c6a013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 1 Jun 2012 17:17:35 +0200 Subject: [PATCH 061/641] Added private constructor to IntlTimeZone. --- ext/intl/timezone/timezone_class.cpp | 1 + ext/intl/timezone/timezone_methods.cpp | 7 +++++++ ext/intl/timezone/timezone_methods.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 850da4a7481..c976eb143ac 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -524,6 +524,7 @@ ZEND_END_ARG_INFO() * Every 'IntlTimeZone' class method has an entry in this table */ static zend_function_entry TimeZone_class_functions[] = { + PHP_ME(IntlTimeZone, __construct, ainfo_tz_void, ZEND_ACC_PRIVATE) PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index e596cc5174a..b7f31c3f3b4 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -34,6 +34,13 @@ extern "C" { } #include "common/common_enum.h" +U_CFUNC PHP_METHOD(IntlTimeZone, __construct) +{ + zend_throw_exception( NULL, + "An object of this type cannot be created with the new operator", + 0 TSRMLS_CC ); +} + U_CFUNC PHP_FUNCTION(intltz_create_time_zone) { char *str_id; diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h index 824f72a0d21..e153418ea72 100644 --- a/ext/intl/timezone/timezone_methods.h +++ b/ext/intl/timezone/timezone_methods.h @@ -19,6 +19,8 @@ #include +PHP_METHOD(IntlTimeZone, __construct) + PHP_FUNCTION(intltz_create_time_zone); PHP_FUNCTION(intltz_from_date_time_zone); From eb346ef0f419b90739aadfb6cc7b7436c5b521d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 00:01:48 +0200 Subject: [PATCH 062/641] DateFormat plays nice with Calendar, TimeZone The following changes were made: * The IntlDateFormatter constructor now accepts the usual values for its $timezone argument. This includes timezone identifiers, IntlTimeZone objects, DateTimeZone objects and NULL. An empty string is not accepted. An invalid time zone is no longer accepted (it used to use UTC in this case). * When NULL is passed to IntlDateFormatter, the time zone specified in date.timezone is used instead of the ICU default. * The IntlDateFormatter $calendar argument now accepts also an IntlCalendar. In this case, IntlDateFormatter::getCalendar() will return false. * The time zone passed to the IntlDateFormatter is ignored if it is NULL and if the calendar passed is an IntlCalendar object -- in this case, the IntlCalendar time zone will be used instead. Otherwise, the time zone specified in the $timezone argument is used instead. * Added IntlDateFormatter::getCalendarObject(), which always returns the IntlCalendar object that backs the DateFormat, even if a constant was passed to the constructor, i.e., if an IntlCalendar was not passed to the constructor. * Added IntlDateFormatter::setTimeZone(). It accepts the usual values for time zone arguments. If NULL is passed, the time zone of the IntlDateFormatter WILL be overridden with the default time zone, even if an IntlCalendar object was passed to the constructor. * Added IntlDateFormatter::getTimeZone(), which returns the time zone that's associated with the DateFormat. * Depreacated IntlDateFormatter::setTimeZoneId() and made it an alias for IntlDateFormatter::setTimeZone(), as the new ::setTimeZone() also accepts plain identifiers, besides other types. IntlDateFormatter::getTimeZoneId() is not deprecated however. * IntlDateFormatter::setCalendar() with a constant passed should now work correctly. This requires saving the requested locale to the constructor. * Centralized the hacks required to avoid compilation disasters on Windows due to some headers being included inside and outside of extern "C" blocks. --- ext/intl/calendar/calendar_class.cpp | 10 + ext/intl/calendar/calendar_class.h | 2 + ext/intl/calendar/calendar_methods.cpp | 3 +- .../calendar/gregoriancalendar_methods.cpp | 4 +- ext/intl/common/common_enum.cpp | 2 + ext/intl/config.m4 | 13 +- ext/intl/config.w32 | 3 + ext/intl/dateformat/dateformat.c | 154 ----------- ext/intl/dateformat/dateformat_attr.c | 164 ----------- ext/intl/dateformat/dateformat_attr.h | 4 - ext/intl/dateformat/dateformat_attrcpp.cpp | 261 ++++++++++++++++++ ext/intl/dateformat/dateformat_attrcpp.h | 35 +++ ext/intl/dateformat/dateformat_class.c | 20 +- ext/intl/dateformat/dateformat_class.h | 12 +- ext/intl/dateformat/dateformat_create.cpp | 193 +++++++++++++ ext/intl/dateformat/dateformat_create.h | 25 ++ ext/intl/dateformat/dateformat_format.c | 4 +- ext/intl/dateformat/dateformat_helpers.cpp | 106 +++++++ ext/intl/dateformat/dateformat_helpers.h | 39 +++ ext/intl/grapheme/grapheme.h | 1 - ext/intl/intl_convertcpp.cpp | 3 +- ext/intl/intl_cppshims.h | 34 +++ ext/intl/msgformat/msgformat_helpers.cpp | 4 +- ext/intl/php_intl.c | 13 +- ext/intl/php_intl.h | 7 +- ext/intl/timezone/timezone_class.cpp | 4 +- ext/intl/timezone/timezone_methods.cpp | 4 +- ext/intl/timezone/timezone_methods.h | 2 +- 28 files changed, 768 insertions(+), 358 deletions(-) create mode 100644 ext/intl/dateformat/dateformat_attrcpp.cpp create mode 100644 ext/intl/dateformat/dateformat_attrcpp.h create mode 100644 ext/intl/dateformat/dateformat_create.cpp create mode 100644 ext/intl/dateformat/dateformat_create.h create mode 100644 ext/intl/dateformat/dateformat_helpers.cpp create mode 100644 ext/intl/dateformat/dateformat_helpers.h create mode 100644 ext/intl/intl_cppshims.h diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 130c6b59f32..beb65f718f4 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include @@ -55,6 +57,14 @@ U_CFUNC void calendar_object_create(zval *object, calendar_object_construct(object, calendar TSRMLS_CC); } +U_CFUNC Calendar *calendar_fetch_native_calendar(zval *object TSRMLS_DC) +{ + Calendar_object *co = (Calendar_object*) + zend_object_store_get_object(object TSRMLS_CC); + + return co->ucal; +} + U_CFUNC void calendar_object_construct(zval *object, Calendar *calendar TSRMLS_DC) { diff --git a/ext/intl/calendar/calendar_class.h b/ext/intl/calendar/calendar_class.h index abf9555292d..140389b6393 100644 --- a/ext/intl/calendar/calendar_class.h +++ b/ext/intl/calendar/calendar_class.h @@ -56,6 +56,8 @@ typedef struct { void calendar_object_create(zval *object, Calendar *calendar TSRMLS_DC); +Calendar *calendar_fetch_native_calendar(zval *object TSRMLS_DC); + void calendar_object_construct(zval *object, Calendar *calendar TSRMLS_DC); void calendar_register_IntlCalendar_class(TSRMLS_D); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 1e8c9e7fefd..8562a2d69ea 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include @@ -31,7 +33,6 @@ extern "C" { #include "../locale/locale.h" #include #include -#define _MSC_STDINT_H_ /* avoid redefinitions */ #include } #include "../common/common_enum.h" diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 4f26cc59457..47e84633a2d 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include @@ -27,8 +29,6 @@ extern "C" { #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" #include "../locale/locale.h" -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 #include } diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index 14265d45971..a0e346061a7 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + // Fix build on Windows/old versions of ICU #include diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index b1845d8febd..431deeb7d29 100755 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -52,6 +52,9 @@ if test "$PHP_INTL" != "no"; then dateformat/dateformat_data.c \ dateformat/dateformat_format.c \ dateformat/dateformat_parse.c \ + dateformat/dateformat_create.cpp \ + dateformat/dateformat_attrcpp.cpp \ + dateformat/dateformat_helpers.cpp \ msgformat/msgformat.c \ msgformat/msgformat_attr.c \ msgformat/msgformat_class.c \ @@ -67,11 +70,11 @@ if test "$PHP_INTL" != "no"; then transliterator/transliterator.c \ transliterator/transliterator_class.c \ transliterator/transliterator_methods.c \ - timezone/timezone_class.cpp \ - timezone/timezone_methods.cpp \ - calendar/calendar_class.cpp \ - calendar/calendar_methods.cpp \ - calendar/gregoriancalendar_methods.cpp \ + timezone/timezone_class.cpp \ + timezone/timezone_methods.cpp \ + calendar/calendar_class.cpp \ + calendar/calendar_methods.cpp \ + calendar/gregoriancalendar_methods.cpp \ idn/idn.c \ $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) PHP_ADD_BUILD_DIR($ext_builddir/collator) diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 index ce12d9d3420..735749ab438 100755 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -63,6 +63,9 @@ if (PHP_INTL != "no") { dateformat_format.c \ dateformat_parse.c \ dateformat_data.c \ + dateformat_attrcpp.cpp \ + dateformat_helpers.cpp \ + dateformat_create.cpp \ ", "intl"); ADD_SOURCES(configure_module_dirname + "/idn", "\ idn.c", diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index b399a39fcb5..fb83eeef05b 100755 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -17,12 +17,9 @@ #include "config.h" #endif -#include #include -#include #include "php_intl.h" -#include "intl_convert.h" #include "dateformat_class.h" #include "dateformat.h" @@ -67,157 +64,6 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) } /* }}} */ -/* {{{ */ -static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) -{ - char* locale; - int locale_len = 0; - zval* object; - long date_type = 0; - long time_type = 0; - long calendar = UCAL_GREGORIAN; - char* timezone_str = NULL; - int timezone_str_len = 0; - char* pattern_str = NULL; - int pattern_str_len = 0; - UChar* svalue = NULL; /* UTF-16 pattern_str */ - int slength = 0; - UChar* timezone_utf16 = NULL; /* UTF-16 timezone_str */ - int timezone_utf16_len = 0; - UCalendar ucal_obj = NULL; - IntlDateFormatter_object* dfo; - - intl_error_reset( NULL TSRMLS_CC ); - object = return_value; - /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sll|sls", - &locale, &locale_len, &date_type, &time_type, &timezone_str, &timezone_str_len, &calendar,&pattern_str, &pattern_str_len ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: unable to parse input parameters", 0 TSRMLS_CC ); - zval_dtor(return_value); - RETURN_NULL(); - } - - INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - - if (calendar != UCAL_TRADITIONAL && calendar != UCAL_GREGORIAN) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " - "invalid value for calendar type; it must be one of " - "IntlDateFormatter::TRADITIONAL (locale's default calendar) " - "or IntlDateFormatter::GREGORIAN", 0 TSRMLS_CC); - goto error; - } - - DATE_FORMAT_METHOD_FETCH_OBJECT; - - if (DATE_FORMAT_OBJECT(dfo) != NULL) { - intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_create: cannot call constructor twice", 0 TSRMLS_CC); - return; - } - - /* Convert pattern (if specified) to UTF-16. */ - if( pattern_str && pattern_str_len>0 ){ - intl_convert_utf8_to_utf16(&svalue, &slength, - pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo)); - if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { - /* object construction -> only set global error */ - intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: " - "error converting pattern to UTF-16", 0 TSRMLS_CC); - goto error; - } - } - - /* resources allocated from now on */ - - /* Convert pattern (if specified) to UTF-16. */ - if( timezone_str && timezone_str_len >0 ){ - intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, - timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(dfo)); - if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { - intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: " - "error converting timezone_str to UTF-16", 0 TSRMLS_CC); - goto error; - } - } - - if(locale_len == 0) { - locale = INTL_G(default_locale); - } - - if( pattern_str && pattern_str_len>0 ){ - DATE_FORMAT_OBJECT(dfo) = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, timezone_utf16, timezone_utf16_len, svalue, slength, &INTL_DATA_ERROR_CODE(dfo)); - } else { - DATE_FORMAT_OBJECT(dfo) = udat_open(time_type, date_type, locale, timezone_utf16, timezone_utf16_len, svalue, slength, &INTL_DATA_ERROR_CODE(dfo)); - } - - if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { - if (calendar != UCAL_TRADITIONAL) { - ucal_obj = ucal_open(timezone_utf16, timezone_utf16_len, locale, - calendar, &INTL_DATA_ERROR_CODE(dfo)); - if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { - udat_setCalendar(DATE_FORMAT_OBJECT(dfo), ucal_obj); - ucal_close(ucal_obj); - } else { - intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create" - ": error opening calendar", 0 TSRMLS_CC); - goto error; - } - } - } else { - intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: date " - "formatter creation failed", 0 TSRMLS_CC); - goto error; - } - - /* Set the class variables */ - dfo->date_type = date_type; - dfo->time_type = time_type; - dfo->calendar = calendar; - if( timezone_str && timezone_str_len > 0){ - dfo->timezone_id = estrndup( timezone_str, timezone_str_len); - } - -error: - if (svalue) { - efree(svalue); - } - if (timezone_utf16) { - efree(timezone_utf16); - } - if (U_FAILURE(intl_error_get_code(NULL TSRMLS_CC))) { - /* free_object handles partially constructed instances fine */ - zval_dtor(return_value); - RETVAL_NULL(); - } -} -/* }}} */ - -/* {{{ proto IntlDateFormatter IntlDateFormatter::create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) - * Create formatter. }}} */ -/* {{{ proto IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) - - * Create formatter. - */ -PHP_FUNCTION( datefmt_create ) -{ - object_init_ex( return_value, IntlDateFormatter_ce_ptr ); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} -/* }}} */ - -/* {{{ proto void IntlDateFormatter::__construct(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern]) - * IntlDateFormatter object constructor. - */ -PHP_METHOD( IntlDateFormatter, __construct ) -{ - /* return_value param is being changed, therefore we will always return - * NULL here */ - return_value = getThis(); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} -/* }}} */ - /* {{{ proto int IntlDateFormatter::getErrorCode() * Get formatter's last error code. }}} */ /* {{{ proto int datefmt_get_error_code( IntlDateFormatter $nf ) diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 6131cedc956..a32a4860c93 100755 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -24,39 +24,6 @@ #include #include -#include - -static void internal_set_calendar(IntlDateFormatter_object *dfo, char* timezone_id, int timezone_id_len, int calendar, zval* return_value TSRMLS_DC){ - int timezone_utf16_len = 0; - UChar* timezone_utf16 = NULL; /* timezone_id in UTF-16 */ - char* locale = NULL; - - UCalendar* ucal_obj = NULL; - - /* check for the validity of value of calendar passed */ - intl_error_reset( NULL TSRMLS_CC ); - if( calendar > 1){ - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: calendar value specified is out of valid range", 0 TSRMLS_CC); - RETURN_FALSE; - } - - /* Convert timezone to UTF-16. */ - intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_id, timezone_id_len, &INTL_DATA_ERROR_CODE(dfo)); - INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" ); - - /* Get the locale for the dateformatter */ - locale = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(dfo)); - - /* Set the calendar if passed */ - ucal_obj = ucal_open(timezone_utf16, timezone_utf16_len, locale, calendar, &INTL_DATA_ERROR_CODE(dfo) ); - udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj ); - INTL_METHOD_CHECK_STATUS(dfo, "Error setting the calendar."); - - if( timezone_utf16){ - efree(timezone_utf16); - } -} /* {{{ proto unicode IntlDateFormatter::getDateType( ) * Get formatter datetype. }}} */ @@ -110,97 +77,6 @@ PHP_FUNCTION( datefmt_get_timetype ) } /* }}} */ - -/* {{{ proto unicode IntlDateFormatter::getCalendar( ) - * Get formatter calendar. }}} */ -/* {{{ proto string datefmt_get_calendar( IntlDateFormatter $mf ) - * Get formatter calendar. - */ -PHP_FUNCTION( datefmt_get_calendar ) -{ - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_calendar: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter calendar." ); - - RETURN_LONG(dfo->calendar); -} -/* }}} */ - -/* {{{ proto unicode IntlDateFormatter::getTimeZoneId( ) - * Get formatter timezone_id. }}} */ -/* {{{ proto string datefmt_get_timezone_id( IntlDateFormatter $mf ) - * Get formatter timezone_id. - */ -PHP_FUNCTION( datefmt_get_timezone_id ) -{ - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_timezone_id: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timezone_id." ); - - if( dfo->timezone_id ){ - RETURN_STRING((char*)dfo->timezone_id, TRUE ); - }else{ - RETURN_NULL(); - } -} - -/* {{{ proto boolean IntlDateFormatter::setTimeZoneId( $timezone_id) - * Set formatter timezone_id. }}} */ -/* {{{ proto boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id) - * Set formatter timezone_id. - */ -PHP_FUNCTION( datefmt_set_timezone_id ) -{ - char* timezone_id = NULL; - int timezone_id_len = 0; - - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, IntlDateFormatter_ce_ptr,&timezone_id, &timezone_id_len) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_timezone_id: unable to parse input params", 0 TSRMLS_CC ); - RETURN_FALSE; - } - - /* Fetch the object. */ - DATE_FORMAT_METHOD_FETCH_OBJECT; - - /* set the timezone for the calendar */ - internal_set_calendar( dfo, timezone_id, timezone_id_len, dfo->calendar, return_value TSRMLS_CC ); - - /* Set the IntlDateFormatter variable */ - if( dfo->timezone_id ){ - efree(dfo->timezone_id); - } - dfo->timezone_id = estrndup(timezone_id, timezone_id_len); - - RETURN_TRUE; -} - /* {{{ proto string IntlDateFormatter::getPattern( ) * Get formatter pattern. }}} */ /* {{{ proto string datefmt_get_pattern( IntlDateFormatter $mf ) @@ -369,43 +245,3 @@ PHP_FUNCTION( datefmt_set_lenient ) udat_setLenient(DATE_FORMAT_OBJECT(dfo), (UBool)isLenient ); } /* }}} */ - -/* {{{ proto bool IntlDateFormatter::setPattern( int $calendar ) - * Set formatter calendar. }}} */ -/* {{{ proto bool datefmt_set_calendar( IntlDateFormatter $mf, int $calendar ) - * Set formatter calendar. - */ -PHP_FUNCTION( datefmt_set_calendar ) -{ - long calendar = 0; - - DATE_FORMAT_METHOD_INIT_VARS; - - /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", - &object, IntlDateFormatter_ce_ptr, &calendar ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: unable to parse input params", 0 TSRMLS_CC); - RETURN_FALSE; - } - - /* check for the validity of value of calendar passed */ - intl_error_reset( NULL TSRMLS_CC ); - if (calendar > 1) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: calendar value specified is out of valid range", 0 TSRMLS_CC); - RETURN_FALSE; - } - - DATE_FORMAT_METHOD_FETCH_OBJECT; - - internal_set_calendar( dfo, dfo->timezone_id, strlen(dfo->timezone_id), calendar, return_value TSRMLS_CC ); - - /* Set the calendar value in the IntlDateFormatter object */ - dfo->calendar = calendar; - - RETURN_TRUE; -} -/* }}} */ - - diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h index bf28824d636..6fe82a6e00c 100755 --- a/ext/intl/dateformat/dateformat_attr.h +++ b/ext/intl/dateformat/dateformat_attr.h @@ -21,11 +21,7 @@ //PHP_FUNCTION( datefmt_get_timezone ); PHP_FUNCTION( datefmt_get_datetype ); PHP_FUNCTION( datefmt_get_timetype ); -PHP_FUNCTION( datefmt_get_calendar ); -PHP_FUNCTION( datefmt_set_calendar ); PHP_FUNCTION( datefmt_get_locale ); -PHP_FUNCTION( datefmt_get_timezone_id ); -PHP_FUNCTION( datefmt_set_timezone_id ); PHP_FUNCTION( datefmt_get_pattern ); PHP_FUNCTION( datefmt_set_pattern ); PHP_FUNCTION( datefmt_is_lenient ); diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp new file mode 100644 index 00000000000..b68abec6591 --- /dev/null +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -0,0 +1,261 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include + +extern "C" { +#include "../php_intl.h" +#include "dateformat_class.h" +#include "dateformat_attrcpp.h" +#define USE_TIMEZONE_POINTER 1 +#include "../timezone/timezone_class.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +} + +#include "../intl_convertcpp.h" +#include "dateformat_helpers.h" + +static inline DateFormat *fetch_datefmt(IntlDateFormatter_object *dfo) { + return (DateFormat *)dfo->datef_data.udatf; +} + +/* {{{ proto string IntlDateFormatter::getTimeZoneId() + * Get formatter timezone_id. }}} */ +/* {{{ proto string datefmt_get_timezone_id(IntlDateFormatter $mf) + * Get formatter timezone_id. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_" + "id: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + UnicodeString res = UnicodeString(); + fetch_datefmt(dfo)->getTimeZone().getID(res); + intl_charFromString(res, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), &INTL_DATA_ERROR_CODE(dfo)); + INTL_METHOD_CHECK_STATUS(dfo, "Could not convert time zone id to UTF-8"); + + Z_TYPE_P(return_value) = IS_STRING; +} + +/* {{{ proto IntlTimeZone IntlDateFormatter::getTimeZone() + * Get formatter timezone. }}} */ +/* {{{ proto IntlTimeZone datefmt_get_timezone(IntlDateFormatter $mf) + * Get formatter timezone. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_timezone) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_timezone: unable to parse input params", 0 TSRMLS_CC ); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + const TimeZone& tz = fetch_datefmt(dfo)->getTimeZone(); + TimeZone *tz_clone = tz.clone(); + if (tz_clone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_get_timezone: Out of memory when cloning time zone", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + object_init_ex(return_value, TimeZone_ce_ptr); + timezone_object_construct(tz_clone, return_value, 1 TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(datefmt_set_timezone_id) +{ + php_error_docref0(NULL TSRMLS_CC, E_DEPRECATED, + "Use datefmt_set_timezone() instead, which also accepts a plain " + "time zone identifier and for which this function is now an " + "alias"); + PHP_FN(datefmt_set_timezone)(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +/* {{{ proto boolean IntlDateFormatter::setTimeZone(mixed $timezone) + * Set formatter's timezone. }}} */ +/* {{{ proto boolean datefmt_set_timezone_id(IntlDateFormatter $mf, $timezone_id) + * Set formatter timezone_id. + */ +U_CFUNC PHP_FUNCTION(datefmt_set_timezone) +{ + zval **timezone_zv; + TimeZone *timezone; + + DATE_FORMAT_METHOD_INIT_VARS; + + if ( zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "OZ", &object, IntlDateFormatter_ce_ptr, &timezone_zv) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_timezone: " + "unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + timezone = timezone_process_timezone_argument(timezone_zv, + INTL_DATA_ERROR_P(dfo), "datefmt_set_timezone" TSRMLS_CC); + if (timezone == NULL) { + RETURN_FALSE; + } + + fetch_datefmt(dfo)->adoptTimeZone(timezone); +} + +/* {{{ proto int IntlDateFormatter::getCalendar( ) + * Get formatter calendar type. }}} */ +/* {{{ proto int datefmt_get_calendar(IntlDateFormatter $mf) + * Get formatter calendar type. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_calendar) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_calendar: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + if (dfo->calendar == -1) { + /* an IntlCalendar was provided to the constructor */ + RETURN_FALSE; + } + + RETURN_LONG(dfo->calendar); +} +/* }}} */ + +/* {{{ proto IntlCalendar IntlDateFormatter::getCalendarObject() + * Get formatter calendar. }}} */ +/* {{{ proto IntlCalendar datefmt_get_calendar_object(IntlDateFormatter $mf) + * Get formatter calendar. + */ +U_CFUNC PHP_FUNCTION(datefmt_get_calendar_object) +{ + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, IntlDateFormatter_ce_ptr ) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_get_calendar_object: unable to parse input params", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + const Calendar *cal = fetch_datefmt(dfo)->getCalendar(); + if (cal == NULL) { + RETURN_NULL(); + } + + Calendar *cal_clone = cal->clone(); + if (cal_clone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_get_calendar_object: Out of memory when cloning " + "calendar", 0 TSRMLS_CC); + RETURN_FALSE; + } + + calendar_object_create(return_value, cal_clone TSRMLS_CC); +} +/* }}} */ + +/* {{{ proto bool IntlDateFormatter::setCalendar(mixed $calendar) + * Set formatter's calendar. }}} */ +/* {{{ proto bool datefmt_set_calendar(IntlDateFormatter $mf, mixed $calendar) + * Set formatter's calendar. + */ +U_CFUNC PHP_FUNCTION(datefmt_set_calendar) +{ + zval *calendar_zv; + DATE_FORMAT_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", + &object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_set_calendar: unable to parse input params", 0 TSRMLS_CC); + RETURN_FALSE; + } + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + Calendar *cal; + long cal_type; + bool cal_owned; + Locale locale = Locale::createFromName(dfo->requested_locale); + // getting the actual locale from the DateFormat is not enough + // because we would have lost modifiers such as @calendar. We + // must store the requested locale on object creation + + if (datefmt_process_calendar_arg(calendar_zv, locale, + "datefmt_set_calendar", INTL_DATA_ERROR_P(dfo), cal, cal_type, + cal_owned TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + + if (cal_owned) { + /* a non IntlCalendar was specified, we want to keep the timezone */ + TimeZone *old_timezone = fetch_datefmt(dfo)->getTimeZone().clone(); + if (old_timezone == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_set_calendar: Out of memory when cloning calendar", + 0 TSRMLS_CC); + delete cal; + RETURN_FALSE; + } + cal->adoptTimeZone(old_timezone); + } else { + cal = cal->clone(); + if (cal == NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, + "datefmt_set_calendar: Out of memory when cloning calendar", + 0 TSRMLS_CC); + RETURN_FALSE; + } + } + + fetch_datefmt(dfo)->adoptCalendar(cal); + + dfo->calendar = cal_type; + + RETURN_TRUE; +} +/* }}} */ + diff --git a/ext/intl/dateformat/dateformat_attrcpp.h b/ext/intl/dateformat/dateformat_attrcpp.h new file mode 100644 index 00000000000..408232f9400 --- /dev/null +++ b/ext/intl/dateformat/dateformat_attrcpp.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef DATEFORMAT_ATTRCPP_H +#define DATEFORMAT_ATTRCPP_H + +PHP_FUNCTION(datefmt_get_timezone_id); + +PHP_FUNCTION(datefmt_set_timezone_id); + +PHP_FUNCTION(datefmt_get_timezone); + +PHP_FUNCTION(datefmt_set_timezone); + +PHP_FUNCTION(datefmt_get_calendar); + +PHP_FUNCTION(datefmt_set_calendar); + +PHP_FUNCTION(datefmt_get_calendar_object); + +#endif /* DATEFORMAT_ATTRCPP_H */ + diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index c66610f23b9..fda67f1b700 100755 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -22,6 +22,7 @@ #include "dateformat_parse.h" #include "dateformat.h" #include "dateformat_attr.h" +#include "dateformat_attrcpp.h" zend_class_entry *IntlDateFormatter_ce_ptr = NULL; static zend_object_handlers IntlDateFormatter_handlers; @@ -44,12 +45,12 @@ void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC ) zend_object_std_dtor( &dfo->zo TSRMLS_CC ); - dateformat_data_free( &dfo->datef_data TSRMLS_CC ); - - if( dfo->timezone_id ){ - efree(dfo->timezone_id); + if (dfo->requested_locale) { + efree( dfo->requested_locale ); } + dateformat_data_free( &dfo->datef_data TSRMLS_CC ); + efree( dfo ); } /* }}} */ @@ -63,10 +64,10 @@ zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC intern = ecalloc( 1, sizeof(IntlDateFormatter_object) ); dateformat_data_init( &intern->datef_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); - intern->date_type = 0; - intern->time_type = 0; - intern->calendar = 1; /* Gregorian calendar */ - intern->timezone_id = NULL; + intern->date_type = 0; + intern->time_type = 0; + intern->calendar = -1; + intern->requested_locale = NULL; retval.handle = zend_objects_store_put( intern, @@ -157,9 +158,12 @@ static zend_function_entry IntlDateFormatter_class_functions[] = { PHP_NAMED_FE( getDateType, ZEND_FN( datefmt_get_datetype ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getTimeType, ZEND_FN( datefmt_get_timetype ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getCalendar, ZEND_FN( datefmt_get_calendar ), arginfo_intldateformatter_getdatetype ) + PHP_NAMED_FE( getCalendarObject, ZEND_FN( datefmt_get_calendar_object ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( setCalendar, ZEND_FN( datefmt_set_calendar ), arginfo_intldateformatter_setcalendar ) PHP_NAMED_FE( getTimeZoneId, ZEND_FN( datefmt_get_timezone_id ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( setTimeZoneId, ZEND_FN( datefmt_set_timezone_id ), arginfo_intldateformatter_settimezoneid ) + PHP_NAMED_FE( getTimeZone, ZEND_FN( datefmt_get_timezone ), arginfo_intldateformatter_getdatetype ) + PHP_NAMED_FE( setTimeZone, ZEND_FN( datefmt_set_timezone ), arginfo_intldateformatter_settimezoneid ) PHP_NAMED_FE( setPattern, ZEND_FN( datefmt_set_pattern ), arginfo_intldateformatter_setpattern ) PHP_NAMED_FE( getPattern, ZEND_FN( datefmt_get_pattern ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( getLocale, ZEND_FN( datefmt_get_locale ), arginfo_intldateformatter_getdatetype ) diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h index 9ad83ee3d63..de5cf4a1813 100755 --- a/ext/intl/dateformat/dateformat_class.h +++ b/ext/intl/dateformat/dateformat_class.h @@ -24,12 +24,12 @@ #include "dateformat_data.h" typedef struct { - zend_object zo; - dateformat_data datef_data; - int date_type ; - int time_type ; - int calendar ; - char* timezone_id; + zend_object zo; + dateformat_data datef_data; + int date_type; + int time_type; + int calendar; + char *requested_locale; } IntlDateFormatter_object; void dateformat_register_IntlDateFormatter_class( TSRMLS_D ); diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp new file mode 100644 index 00000000000..fef93e93d95 --- /dev/null +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -0,0 +1,193 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Kirti Velankar | + | Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include + +extern "C" { +#include +#include + +#include "php_intl.h" +#include "dateformat_create.h" +#include "dateformat_class.h" +#define USE_TIMEZONE_POINTER 1 +#include "../timezone/timezone_class.h" +#include "../intl_convert.h" +} + +#include "dateformat_helpers.h" + +/* {{{ */ +static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +{ + zval *object; + + char *locale_str; + int locale_len = 0; + Locale locale; + long date_type = 0; + long time_type = 0; + zval *calendar_zv = NULL; + Calendar *calendar = NULL; + long calendar_type; + bool calendar_owned; + zval **timezone_zv = NULL; + TimeZone *timezone = NULL; + bool explicit_tz; + char* pattern_str = NULL; + int pattern_str_len = 0; + UChar* svalue = NULL; /* UTF-16 pattern_str */ + int slength = 0; + IntlDateFormatter_object* dfo; + + intl_error_reset(NULL TSRMLS_CC); + object = return_value; + /* Parse parameters. */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|Zzs", + &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, + &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " + "unable to parse input parameters", 0 TSRMLS_CC); + zval_dtor(return_value); + RETURN_NULL(); + } + + INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); + if (locale_len == 0) { + locale_str = INTL_G(default_locale); + } + locale = Locale::createFromName(locale_str); + + DATE_FORMAT_METHOD_FETCH_OBJECT; + + if (DATE_FORMAT_OBJECT(dfo) != NULL) { + intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_create: cannot call constructor twice", 0 TSRMLS_CC); + return; + } + + /* process calendar */ + if (datefmt_process_calendar_arg(calendar_zv, locale, "datefmt_create", + INTL_DATA_ERROR_P(dfo), calendar, calendar_type, + calendar_owned TSRMLS_CC) + == FAILURE) { + goto error; + } + + /* process timezone */ + explicit_tz = timezone_zv != NULL && Z_TYPE_PP(timezone_zv) != IS_NULL; + + if (explicit_tz || calendar_owned ) { + //we have an explicit time zone or a non-object calendar + timezone = timezone_process_timezone_argument(timezone_zv, + INTL_DATA_ERROR_P(dfo), "datefmt_create" TSRMLS_CC); + if (timezone == NULL) { + goto error; + } + } + + /* Convert pattern (if specified) to UTF-16. */ + if (pattern_str && pattern_str_len > 0) { + intl_convert_utf8_to_utf16(&svalue, &slength, + pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + /* object construction -> only set global error */ + intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: " + "error converting pattern to UTF-16", 0 TSRMLS_CC); + goto error; + } + } + + if (pattern_str && pattern_str_len > 0) { + DATE_FORMAT_OBJECT(dfo) = udat_open(UDAT_IGNORE, UDAT_IGNORE, + locale_str, NULL, 0, svalue, slength, + &INTL_DATA_ERROR_CODE(dfo)); + } else { + DATE_FORMAT_OBJECT(dfo) = udat_open((UDateFormatStyle)time_type, + (UDateFormatStyle)date_type, locale_str, NULL, 0, svalue, + slength, &INTL_DATA_ERROR_CODE(dfo)); + } + + if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + DateFormat *df = (DateFormat*)DATE_FORMAT_OBJECT(dfo); + if (calendar_owned) { + df->adoptCalendar(calendar); + calendar_owned = false; + } else { + df->setCalendar(*calendar); + } + + if (timezone != NULL) { + df->adoptTimeZone(timezone); + } + } else { + intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: date " + "formatter creation failed", 0 TSRMLS_CC); + goto error; + } + + /* Set the class variables */ + dfo->date_type = date_type; + dfo->time_type = time_type; + dfo->calendar = calendar_type; + dfo->requested_locale = estrdup(locale_str); + +error: + if (svalue) { + efree(svalue); + } + if (timezone != NULL && DATE_FORMAT_OBJECT(dfo) == NULL) { + delete timezone; + } + if (calendar != NULL && calendar_owned) { + delete calendar; + } + if (U_FAILURE(intl_error_get_code(NULL TSRMLS_CC))) { + /* free_object handles partially constructed instances fine */ + zval_dtor(return_value); + RETVAL_NULL(); + } +} +/* }}} */ + +/* {{{ proto IntlDateFormatter IntlDateFormatter::create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] ) + * Create formatter. }}} */ +/* {{{ proto IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern) + * Create formatter. + */ +U_CFUNC PHP_FUNCTION( datefmt_create ) +{ + object_init_ex( return_value, IntlDateFormatter_ce_ptr ); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ + +/* {{{ proto void IntlDateFormatter::__construct(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern]) + * IntlDateFormatter object constructor. + */ +U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) +{ + /* return_value param is being changed, therefore we will always return + * NULL here */ + return_value = getThis(); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} +/* }}} */ diff --git a/ext/intl/dateformat/dateformat_create.h b/ext/intl/dateformat/dateformat_create.h new file mode 100644 index 00000000000..47e67c2f45a --- /dev/null +++ b/ext/intl/dateformat/dateformat_create.h @@ -0,0 +1,25 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ +#ifndef DATE_FORMATTER_H +#define DATE_FORMATTER_H + +#include + +PHP_FUNCTION( datefmt_create ); +PHP_METHOD( IntlDateFormatter, __construct ); +void dateformat_register_constants( INIT_FUNC_ARGS ); + +#endif // DATE_FORMATTER_H diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 4d03d924c85..82f825f1403 100755 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -27,6 +27,8 @@ #include "dateformat_class.h" #include "dateformat_format.h" #include "dateformat_data.h" +/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ +#define _MSC_STDINT_H_ 1 #include "ext/date/php_date.h" /* {{{ @@ -91,7 +93,7 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, HashTable* ha long yday =0; long mday =0; UBool isInDST = FALSE; - UCalendar *pcal; + const UCalendar *pcal; /* Fetch values from the incoming array */ year = internal_get_arr_ele( dfo, hash_arr, CALENDAR_YEAR TSRMLS_CC) + 1900; /* tm_year is years since 1900 */ diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp new file mode 100644 index 00000000000..74758bbec92 --- /dev/null +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -0,0 +1,106 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include + +#include "dateformat_helpers.h" + +extern "C" { +#include "../php_intl.h" +#include +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +} + +int datefmt_process_calendar_arg(zval* calendar_zv, + Locale const& locale, + const char *func_name, + intl_error *err, + Calendar*& cal, + long& cal_int_type, + bool& calendar_owned TSRMLS_DC) +{ + char *msg; + UErrorCode status = UErrorCode(); + + if (calendar_zv == NULL || Z_TYPE_P(calendar_zv) == IS_NULL) { + + // default requested + cal = new GregorianCalendar(locale, status); + calendar_owned = true; + + cal_int_type = UCAL_GREGORIAN; + + } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { + + long v = Z_LVAL_P(calendar_zv); + if (v != (long)UCAL_TRADITIONAL && v != (long)UCAL_GREGORIAN) { + spprintf(&msg, 0, "%s: invalid value for calendar type; it must be " + "one of IntlDateFormatter::TRADITIONAL (locale's default " + "calendar) or IntlDateFormatter::GREGORIAN. " + "Alternatively, it can be an IntlCalendar object", + func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } else if (v == (long)UCAL_TRADITIONAL) { + cal = Calendar::createInstance(locale, status); + } else { //UCAL_GREGORIAN + cal = new GregorianCalendar(locale, status); + } + calendar_owned = true; + + cal_int_type = Z_LVAL_P(calendar_zv); + + } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && + instanceof_function_ex(Z_OBJCE_P(calendar_zv), + Calendar_ce_ptr, 0 TSRMLS_CC)) { + + cal = calendar_fetch_native_calendar(calendar_zv TSRMLS_CC); + if (cal == NULL) { + spprintf(&msg, 0, "%s: Found unconstructed IntlCalendar object", + func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + calendar_owned = false; + + cal_int_type = -1; + + } else { + spprintf(&msg, 0, "%s: Invalid calendar argument; should be an integer " + "or an IntlCalendar instance", func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + + if (cal == NULL && !U_FAILURE(status)) { + status = U_MEMORY_ALLOCATION_ERROR; + } + if (U_FAILURE(status)) { + spprintf(&msg, 0, "%s: Failure instantiating calendar", func_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + return FAILURE; + } + + return SUCCESS; +} diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h new file mode 100644 index 00000000000..bded0b7d781 --- /dev/null +++ b/ext/intl/dateformat/dateformat_helpers.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef DATEFORMAT_HELPERS_H +#define DATEFORMAT_HELPERS_H + +#ifndef __cplusplus +#error For C++ only +#endif + +#include + +extern "C" { +#include "../php_intl.h" +} + +int datefmt_process_calendar_arg(zval* calendar_zv, + Locale const& locale, + const char *func_name, + intl_error *err, + Calendar*& cal, + long& cal_int_type, + bool& calendar_owned TSRMLS_DC); + +#endif /* DATEFORMAT_HELPERS_H */ + diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h index c0e697ac1e5..756ce9173e8 100755 --- a/ext/intl/grapheme/grapheme.h +++ b/ext/intl/grapheme/grapheme.h @@ -19,7 +19,6 @@ #include #include -#include PHP_FUNCTION(grapheme_strlen); PHP_FUNCTION(grapheme_strpos); diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp index 503402871cd..f699a3c61c9 100644 --- a/ext/intl/intl_convertcpp.cpp +++ b/ext/intl/intl_convertcpp.cpp @@ -16,8 +16,7 @@ /* $Id$ */ -//Fixes the build on old versions of ICU with Windows -#include +#include "intl_cppshims.h" #include "intl_convertcpp.h" #include diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h new file mode 100644 index 00000000000..2fb70edfd0e --- /dev/null +++ b/ext/intl/intl_cppshims.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef INTL_CPPSHIMS_H +#define INTL_CPPSHIMS_H + +#ifndef __cplusplus +#error For inclusion form C++ files only +#endif + +#ifdef _MSC_VER +//This is only required for old versions of ICU only +#include + +#include + +/* avoid redefinition of int8_t, also defined in unicode/pwin32.h */ +#define _MSC_STDINT_H_ 1 +#endif + +#endif \ No newline at end of file diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 6f4615e1697..fd8df1a39c3 100755 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -18,10 +18,8 @@ #include "config.h" #endif -// Fix build on Windows / old versions of ICU -#include +#include "../intl_cppshims.h" -#include #include #include #include diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index db8e00392cf..59272db7127 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -41,6 +41,8 @@ #include "formatter/formatter_main.h" #include "formatter/formatter_parse.h" +#include "grapheme/grapheme.h" + #include "msgformat/msgformat.h" #include "msgformat/msgformat_class.h" #include "msgformat/msgformat_attr.h" @@ -58,6 +60,7 @@ #include "dateformat/dateformat.h" #include "dateformat/dateformat_class.h" #include "dateformat/dateformat_attr.h" +#include "dateformat/dateformat_attrcpp.h" #include "dateformat/dateformat_format.h" #include "dateformat/dateformat_parse.h" #include "dateformat/dateformat_data.h" @@ -321,6 +324,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2) ZEND_ARG_INFO(0, pattern) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_timezone, 0, 0, 2) + ZEND_ARG_INFO(0, mf) + ZEND_ARG_INFO(0, timezone) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2) ZEND_ARG_INFO(0, mf) ZEND_ARG_INFO(0, calendar) @@ -675,10 +683,13 @@ zend_function_entry intl_functions[] = { PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_get_calendar_object, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar ) PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale ) - PHP_FE( datefmt_set_timezone_id, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_set_timezone_id, arginfo_datefmt_set_timezone ) + PHP_FE( datefmt_get_timezone, arginfo_msgfmt_get_locale ) + PHP_FE( datefmt_set_timezone, arginfo_datefmt_set_timezone ) PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern ) PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale ) diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index 38f61ad8ac4..c3d5c60f078 100755 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -22,8 +22,13 @@ #include +/* Even if we're included from C++, don't introduce C++ definitions + * because we were included with extern "C". The effect would be that + * when the headers defined any method, they would do so with C linkage */ +#undef U_SHOW_CPLUSPLUS_API +#define U_SHOW_CPLUSPLUS_API 0 #include "collator/collator_sort.h" -#include "grapheme/grapheme.h" +#include #include "intl_error.h" extern zend_module_entry intl_module_entry; diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index c976eb143ac..6e62c34f6d3 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -19,6 +19,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include "../intl_convertcpp.h" @@ -30,8 +32,6 @@ extern "C" { #include "timezone_methods.h" #include #include -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 #include } diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index b7f31c3f3b4..1435679fe74 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "../intl_cppshims.h" + #include #include #include @@ -28,8 +30,6 @@ extern "C" { #include "intl_convert.h" #include "../locale/locale.h" #include -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 #include } #include "common/common_enum.h" diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h index e153418ea72..28c39f4fd70 100644 --- a/ext/intl/timezone/timezone_methods.h +++ b/ext/intl/timezone/timezone_methods.h @@ -19,7 +19,7 @@ #include -PHP_METHOD(IntlTimeZone, __construct) +PHP_METHOD(IntlTimeZone, __construct); PHP_FUNCTION(intltz_create_time_zone); From 758f0686d41cd39176f5055c50f0b094580cbbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 00:02:35 +0200 Subject: [PATCH 063/641] Added and fixed tests given eb346ef --- ext/intl/tests/bug50590.phpt | 2 + ext/intl/tests/bug62017.phpt | 2 +- ext/intl/tests/bug62081.phpt | 6 +- .../dateformat___construct_bad_tz_cal.phpt | 28 ++++++ ext/intl/tests/dateformat_calendars.phpt | 2 +- ext/intl/tests/dateformat_create_cal_arg.phpt | 49 ++++++++++ ext/intl/tests/dateformat_format.phpt | 4 +- ext/intl/tests/dateformat_format_parse.phpt | 2 +- .../dateformat_getCalendarObject_error.phpt | 39 ++++++++ .../tests/dateformat_getTimeZone_error.phpt | 39 ++++++++ .../tests/dateformat_get_set_calendar.phpt | 91 +++++++++---------- .../tests/dateformat_get_set_timezone.phpt | 58 ++++++++++++ .../tests/dateformat_get_timezone_id.phpt | 15 +-- .../dateformat_setTimeZoneID_deprecation.phpt | 18 ++++ .../tests/dateformat_setTimeZone_error.phpt | 49 ++++++++++ .../tests/dateformat_set_timezone_id2.phpt | 22 +++-- .../dateformat_timezone_arg_variations.phpt | 41 +++++++++ 17 files changed, 399 insertions(+), 68 deletions(-) create mode 100644 ext/intl/tests/dateformat___construct_bad_tz_cal.phpt create mode 100644 ext/intl/tests/dateformat_create_cal_arg.phpt create mode 100644 ext/intl/tests/dateformat_getCalendarObject_error.phpt create mode 100644 ext/intl/tests/dateformat_getTimeZone_error.phpt create mode 100644 ext/intl/tests/dateformat_get_set_timezone.phpt create mode 100644 ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt create mode 100644 ext/intl/tests/dateformat_setTimeZone_error.phpt create mode 100644 ext/intl/tests/dateformat_timezone_arg_variations.phpt diff --git a/ext/intl/tests/bug50590.phpt b/ext/intl/tests/bug50590.phpt index c39c333b23a..4784d378773 100644 --- a/ext/intl/tests/bug50590.phpt +++ b/ext/intl/tests/bug50590.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #50590 (IntlDateFormatter::parse result is limited to the integer range) +--INI-- +date.timezone=Atlantic/Azores --SKIPIF-- --FILE-- diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt index 13c4fe5df0b..50aeae48061 100644 --- a/ext/intl/tests/bug62017.phpt +++ b/ext/intl/tests/bug62017.phpt @@ -14,7 +14,7 @@ var_dump( new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", IntlDateFormatter::GREGORIAN, "\x80")); --EXPECTF-- -Warning: datefmt_create(): datefmt_create: error converting timezone_str to UTF-16 in %s on line %d +Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d NULL Warning: IntlDateFormatter::__construct(): datefmt_create: error converting pattern to UTF-16 in %s on line %d diff --git a/ext/intl/tests/bug62081.phpt b/ext/intl/tests/bug62081.phpt index 7d9e2cec47f..44ad4beec7f 100644 --- a/ext/intl/tests/bug62081.phpt +++ b/ext/intl/tests/bug62081.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #62081: IntlDateFormatter leaks memory if called twice +--INI-- +date.timezone=Atlantic/Azores --SKIPIF-- __construct(1,1,1,1,1)); +$x = new IntlDateFormatter('en', 1, 1); +var_dump($x->__construct('en', 1, 1)); --EXPECTF-- Warning: IntlDateFormatter::__construct(): datefmt_create: cannot call constructor twice in %s on line %d NULL diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt new file mode 100644 index 00000000000..1f682ddb4a0 --- /dev/null +++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt @@ -0,0 +1,28 @@ +--TEST-- +IntlDateFormatter::__construct(): bad timezone or calendar +--FILE-- + +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::__construct(): datefmt_create: no such time zone: 'bad timezone' in %s on line %d +NULL + +Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %s on line %d +NULL + +Warning: IntlDateFormatter::__construct(): datefmt_create: Invalid calendar argument; should be an integer or an IntlCalendar instance in %s on line %d +NULL +==DONE== diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt index 27f380c7184..6af02e51c14 100644 --- a/ext/intl/tests/dateformat_calendars.phpt +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -41,5 +41,5 @@ string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12" string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12" -Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN in %s on line %d +Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %s on line %d ==DONE== diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt new file mode 100644 index 00000000000..8e5f942a6be --- /dev/null +++ b/ext/intl/tests/dateformat_create_cal_arg.phpt @@ -0,0 +1,49 @@ +--TEST-- +IntlDateFormatter: several forms of the calendar arg +--FILE-- +format($ts), "\n"; + +$cal = IntlCalendar::createInstance('UTC', 'en@calendar=islamic'); +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, $cal); +echo $df->format($ts), "\n"; + +//override calendar's timezone +$cal = new IntlGregorianCalendar('UTC', NULL); +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Madrid', $cal); +echo $df->format($ts), "\n"; + +//default calendar is gregorian +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0); +echo $df->format($ts), "\n"; + +//try now with traditional +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, NULL, IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +//the timezone can be overridden when not specifying a calendar +$df = new IntlDateFormatter('es_ES@calendar=islamic', 0, 0, 'UTC', IntlDateFormatter::TRADITIONAL); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0); +echo $df->format($ts), "\n"; + +?> +==DONE== +--EXPECT-- +domingo, 1 de enero de 2012 00:00:00 GMT +domingo, 8 de Safar de 1433 00:00:00 GMT +domingo, 1 de enero de 2012 01:00:00 Hora estándar de Europa Central +sábado, 31 de diciembre de 2011 d.C. 23:00:00 Hora estándar de las Azores +sábado, 7 de Safar de 1433 AH 23:00:00 Hora estándar de las Azores +domingo, 8 de Safar de 1433 AH 00:00:00 GMT +domingo, 1 de enero de 2012 00:00:00 GMT +==DONE== diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index e5548196d10..98f9d34c03a 100755 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -5,6 +5,8 @@ datefmt_format_code() --FILE-- getCalendarObject(9)); +var_dump(datefmt_get_calendar_object($df, 9)); +var_dump(datefmt_get_calendar_object($df, 9)); +var_dump(datefmt_get_calendar_object(new stdclass)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_calendar_object() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt new file mode 100644 index 00000000000..c9d49fde436 --- /dev/null +++ b/ext/intl/tests/dateformat_getTimeZone_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +IntlDateFormatter::getTimeZone(): bad args +--FILE-- +getTimeZone(9)); +var_dump(datefmt_get_timezone($df, 9)); +var_dump(datefmt_get_timezone($df, 9)); +var_dump(datefmt_get_timezone(new stdclass)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt index bfd4e578e1c..e792ea37993 100755 --- a/ext/intl/tests/dateformat_get_set_calendar.phpt +++ b/ext/intl/tests/dateformat_get_set_calendar.phpt @@ -1,60 +1,51 @@ --TEST-- -datefmt_get_calendar_code() datefmt_set_calendar_code() ---SKIPIF-- - +IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() --FILE-- format($ts), "\n"; +var_dump($df->getCalendar(), +$df->getCalendarObject()->getType(), +$df->getCalendarObject()->getTimeZone()->getId()); +echo "\n"; } -include_once( 'ut_common.inc' ); +$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk'); +d($df); + + +//changing the calendar with a cal type should not change tz +$df->setCalendar(IntlDateFormatter::TRADITIONAL); +d($df); + +//but changing with an actual calendar should +$cal = IntlCalendar::createInstance("UTC"); +$df->setCalendar($cal); +d($df); -// Run the test -ut_run(); ?> +==DONE== --EXPECT-- -Creating IntlDateFormatter with calendar = 1 -After call to get_calendar : calendar= 1 -------------------- -Setting IntlDateFormatter with calendar = 1 -After call to get_calendar : calendar= 1 -------------------- -Setting IntlDateFormatter with calendar = 0 -After call to get_calendar : calendar= 0 -------------------- -Setting IntlDateFormatter with calendar = 3 -After call to get_calendar : calendar= 0 -------------------- \ No newline at end of file +dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00 +int(1) +string(9) "gregorian" +string(12) "Europe/Minsk" + +dimanche 8 Safar 1433 AH 03:00:00 UTC+03:00 +int(0) +string(7) "islamic" +string(12) "Europe/Minsk" + +dimanche 1 janvier 2012 ap. J.-C. 00:00:00 UTC +bool(false) +string(9) "gregorian" +string(3) "UTC" + +==DONE== diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt new file mode 100644 index 00000000000..50b036e36ec --- /dev/null +++ b/ext/intl/tests/dateformat_get_set_timezone.phpt @@ -0,0 +1,58 @@ +--TEST-- +IntlDateFormatter: get/setTimeZone() +--FILE-- +format($ts), "\n"; +var_dump( +$df->getTimeZoneID(), +$df->getTimeZone()->getID()); +echo "\n"; +} + +$df = new IntlDateFormatter('pt_PT', 0, 0, 'Europe/Minsk'); +d($df); + +$df->setTimeZone(NULL); +d($df); + +$df->setTimeZone('Europe/Madrid'); +d($df); + +$df->setTimeZone(IntlTimeZone::createTimeZone('Europe/Paris')); +d($df); + +$df->setTimeZone(new DateTimeZone('Europe/Amsterdam')); +d($df); + +?> +==DONE== +--EXPECT-- +Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00 +string(12) "Europe/Minsk" +string(12) "Europe/Minsk" + +Sábado, 31 de Dezembro de 2011 23:00:00 Hora Padrão dos Açores +string(15) "Atlantic/Azores" +string(15) "Atlantic/Azores" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(13) "Europe/Madrid" +string(13) "Europe/Madrid" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(12) "Europe/Paris" +string(12) "Europe/Paris" + +Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +string(16) "Europe/Amsterdam" +string(16) "Europe/Amsterdam" + +==DONE== diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt index 80cbdbbf0fc..a9701c38687 100755 --- a/ext/intl/tests/dateformat_get_timezone_id.phpt +++ b/ext/intl/tests/dateformat_get_timezone_id.phpt @@ -1,5 +1,8 @@ --TEST-- datefmt_get_timezone_id_code() +--INI-- +date.timezone=Atlantic/Azores +intl.error_level=E_WARNING --SKIPIF-- --FILE-- @@ -14,8 +17,8 @@ function ut_main() { $timezone_id_arr = array ( 'America/New_York', - 'America/Los_Angeles', - 'America/Dallas' + 'US/Pacific', + 'US/Central' ); $res_str = ''; @@ -42,8 +45,8 @@ ut_run(); Creating IntlDateFormatter with timezone_id = America/New_York After call to get_timezone_id : timezone_id= America/New_York -Creating IntlDateFormatter with timezone_id = America/Los_Angeles -After call to get_timezone_id : timezone_id= America/Los_Angeles +Creating IntlDateFormatter with timezone_id = US/Pacific +After call to get_timezone_id : timezone_id= US/Pacific -Creating IntlDateFormatter with timezone_id = America/Dallas -After call to get_timezone_id : timezone_id= America/Dallas +Creating IntlDateFormatter with timezone_id = US/Central +After call to get_timezone_id : timezone_id= US/Central diff --git a/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt new file mode 100644 index 00000000000..ccc477d0750 --- /dev/null +++ b/ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt @@ -0,0 +1,18 @@ +--TEST-- +IntlDateFormatter: setTimeZoneID() deprecation +--FILE-- +setTimeZoneId('Europe/Madrid'); + +?> +==DONE== +--EXPECTF-- + +Deprecated: IntlDateFormatter::setTimeZoneId(): Use datefmt_set_timezone() instead, which also accepts a plain time zone identifier and for which this function is now an alias in %s on line %d +==DONE== diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt new file mode 100644 index 00000000000..8200197948d --- /dev/null +++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +IntlDateFormatter::setTimeZone() bad args +--FILE-- +setTimeZone()); +var_dump(datefmt_set_timezone()); +var_dump($df->setTimeZone(array())); +var_dump($df->setTimeZone(1, 2)); +var_dump($df->setTimeZone('non existing timezone')); +var_dump(datefmt_set_timezone(new stdclass, 'UTC')); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on line %d + +Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Notice: Array to string conversion in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'Array' in %s on line %d +bool(false) + +Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) + +Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'non existing timezone' in %s on line %d +bool(false) + +Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d + +Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 23aacda90ae..ce9b89d1fdb 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -1,11 +1,16 @@ --TEST-- datefmt_set_timezone_id_code() icu >= 4.8 +--INI-- +date.timezone=Atlantic/Azores --SKIPIF-- --FILE-- ---EXPECT-- -After creation of the dateformatter : timezone_id= America/San_Francisco +--EXPECTF-- + +Warning: IntlDateFormatter::setTimeZoneId(): datefmt_set_timezone: no such time zone: 'CN' in %s on line %d + +Warning: datefmt_set_timezone_id(): datefmt_set_timezone: no such time zone: 'CN' in %s on line %d + +After creation of the dateformatter : timezone_id= US/Pacific ----------- Trying to set timezone_id= America/New_York After call to set_timezone_id : timezone_id= America/New_York @@ -71,6 +81,6 @@ Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM Cent Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM Central Standard Time ----------- Trying to set timezone_id= CN -After call to set_timezone_id : timezone_id= CN -Formatting timestamp=0 resulted in Thursday, January 1, 1970 12:00:00 AM GMT -Formatting timestamp=3600 resulted in Thursday, January 1, 1970 1:00:00 AM GMT +After call to set_timezone_id : timezone_id= America/Chicago +Formatting timestamp=0 resulted in Wednesday, December 31, 1969 6:00:00 PM Central Standard Time +Formatting timestamp=3600 resulted in Wednesday, December 31, 1969 7:00:00 PM Central Standard Time diff --git a/ext/intl/tests/dateformat_timezone_arg_variations.phpt b/ext/intl/tests/dateformat_timezone_arg_variations.phpt new file mode 100644 index 00000000000..df3ebd853d6 --- /dev/null +++ b/ext/intl/tests/dateformat_timezone_arg_variations.phpt @@ -0,0 +1,41 @@ +--TEST-- +IntlDateFormatter: several forms of the timezone arg +--FILE-- +format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam'); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, new DateTimeZone('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, IntlTimeZone::createTimeZone('America/New_York')); +echo $df->format($ts), "\n"; + +//time zone has priority +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +//calendar has priority +$df = new IntlDateFormatter('es_ES', 0, 0, NULL, new IntlGregorianCalendar('Europe/Lisbon')); +echo $df->format($ts), "\n"; + +$df = new IntlDateFormatter('es_ES', 0, 0, 'Europe/Amsterdam', 0); +echo $df->format($ts), "\n"; + +--EXPECTF-- +sábado%S 31 de diciembre de 2011 23:00:00 Hora%S de las Azores +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central +domingo%S 1 de enero de 2012 00:00:00 Hora%S de Europa Occidental +sábado%S 31 de diciembre de 2011 19:00:00 Hora estándar oriental +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central +domingo%S 1 de enero de 2012 00:00:00 Hora%S de Europa Occidental +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central From 9b233b7e5ec236774c84dc83b4020b1258762c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 10:18:24 +0200 Subject: [PATCH 064/641] Changed XFAILed collator_get_sort_key.phpt Ressurected and limited to ICU 4.8 in the hope that the sort keys will remain stable in more recent ICU versions. I have only tested with ICU 4.8 so far. --- ext/intl/tests/collator_get_sort_key.phpt | 71 +++++++++++------------ 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index 0fedde0fff2..a9c4d713481 100755 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -2,8 +2,7 @@ collator_get_sort_key() --SKIPIF-- ---XFAIL-- -Sort keys are not fixed, comparing them to fixed strings doesn't work. += 4.8 only'; ?> --FILE-- --EXPECT-- source: abc -key: %29%2B-%01%07%01%07%00 +key: 27292b01070107 source: abd -key: %29%2B%2F%01%07%01%07%00 +key: 27292d01070107 source: aaa -key: %29%29%29%01%07%01%07%00 -source: %D0%B0%D0%B0 -key: _++%01%06%01%06%00 -source: %D0%B0 -key: _+%01%05%01%05%00 +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 source: z -key: %5B%01%05%01%05%00 -source: -key: %01%01%00 -source: -key: %01%01%00 +key: 5901050105 +source: +key: 0101 +source: +key: 0101 source: 3 -key: %26%80%01%05%01%05%00 +key: 1801050105 source: y -key: Y%01%05%01%05%00 +key: 5701050105 source: i -key: 9%01%05%01%05%00 +key: 3701050105 source: k -key: %3D%01%05%01%05%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 \ No newline at end of file +key: 3b01050105 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: ÑÑŽÑ +key: 5d3b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: ÑÑŽÑ +key: 5d3b3f4501070107 \ No newline at end of file From c22a29b57639178581210ec377ea4e9909f828c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 18:21:39 +0100 Subject: [PATCH 065/641] Updated UPGRADING for the changes in eb346ef --- UPGRADING | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/UPGRADING b/UPGRADING index 73cf10641fc..0787087531a 100755 --- a/UPGRADING +++ b/UPGRADING @@ -63,12 +63,42 @@ PHP X.Y UPGRADE NOTES - MessageFormatter::parse() and MessageFormat::format() (and their static equivalents) now don't throw away better than second precision in the arguments. +- IntlDateFormatter::__construct and datefmt_create() now accept for the + $timezone argument time zone identifiers, IntlTimeZone objects, DateTimeZone + objects and NULL. It used to accept only time zone identifiers and NULL. + Invalid time zone identifiers are no longer accepted. Emptry strings are + no longer accepted. +- The default time zone used in IntlDateFormatter::__construct and + datefmt_create() (when the corresponding argument is not passed or NULL is + passed) is now the one given by date_default_timezone_get(), not the + default ICU time zone. +- The time zone passed to the IntlDateFormatter is ignored if it is NULL and if + the calendar passed is an IntlCalendar object -- in this case, the + IntlCalendar's time zone will be used instead. Otherwise, the time zone + specified in the $timezone argument is used instead. This does not affect + old code, as IntlCalendar was introduced in this version. +- IntlDateFormatter::__construct and datefmt_create() now accept for the + $calendar argument also IntlCalendar objects. +- IntlDateFormatter::getCalendar() and datefmt_get_calendar() return false + if the IntlDateFormatter was set up with an IntlCalendar instead of the + constants IntlDateFormatter::GREGORIAN/TRADITIONAL. IntlCalendar did not + exist before this version. +- IntlDateFormatter::setCalendar() and datefmt_set_calendar() now also accept + an IntlCalendar object, in which case its time zone is taken. Passing a + constant is still allowed, and still keeps the time zone. +- IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are + deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone() + instead. ======================================== 5. New Functions ======================================== - Intl: + - datefmt_get_calendar_object() + - datefmt_get_timezone() + - datefmt_set_timezone() + - datefmt_get_calendar_object() - intlcal_create_instance() - intlcal_get_keyword_values_for_locale() - intlcal_get_now() @@ -140,6 +170,10 @@ PHP X.Y UPGRADE NOTES - intltz_get_error_code() - intltz_get_error_message() + - IntlDateFormatter::getCalendarObject() + - IntlDateFormatter::getTimeZone() + - IntlDateFormatter::setTimeZone() + - SPL: - SplFixedArray::__wakeup() From f5b421621d89c3e87c498ee228c421e67719fbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 31 May 2012 12:11:44 +0200 Subject: [PATCH 066/641] BreakIterator and RuleBasedBreakiterator added This commit adds wrappers for the classes BreakIterator and RuleBasedbreakIterator. The C++ ICU classes are described here: Additionally, a tutorial is available at: This implementation wraps UTF-8 text in a UText. The text is iterated without any copying or conversion to UTF-16. There is also no validation that the input is actually UTF-8; where there are malformed sequences, the UText will simply U+FFFD. The class BreakIterator cannot be instantiated directly (has a private constructor). It provides the interface exposed by the ICU abstract class with the same name. The PHP class is not abstract because we may use it to wrap native subclasses of BreakIterator that we don't know how to wrap. This class includes methods to move the iterator position to the beginning (first()), to the end (last()), forward (next()), backwards (previous()), to the boundary preceding a certain position (preceding()) and following a certain position (following()) and to obtain the current position (current()). next() can also be used to advance or recede an arbitrary number of positions. BreakIterator also exposes other native methods: getAvailableLocales(), getLocale() and factory methods to build several predefined types of BreakIterators: createWordInstance() for word boundaries, createCharacterInstance() for locale dependent notions of "characters", createSentenceInstance() for sentences, createLineInstance() and createTitleInstance() -- for title casing breaks. These factories currently return RuleBasedbreakIterators where the names of the rule sets are found in the ICU data, observing the passed locale (although the locale is taken into considering there are very few exceptions to the root rules). The clone and compare_object PHP object handlers are also implemented, though the comparison does not yield meaningful results when used with >, <, >= and <=. Note that BreakIterator is an iterator only in the sense of the first 'Iterator' in 'IteratorIterator', i.e., it does not implement the Iterator interface. The reason is that there is no sensible implementation for Iterator::key(). Using it for an ordinal of the current boundary is not feasible because we are allowed to move to any boundary at any time. It we were to determine the current ordinal when last() is called we'd have to traverse the whole input text to find out how many breaks there were before. Therefore, BreakIterator implements only Traversable. It can be wrapped in an IteratorIterator, but the usual warnings apply. Finally, I added a convenience method to BreakIterator: getPartsIterator(). This provides an IntlIterator, backed by the BreakIterator PHP object (i.e. moving the pointer or changing the text in BreakIterator affects the iterator and also moving the iterator affects the backing BreakIterator), which allows traversing the text between each boundary. This iterator uses the original text to retrieve the text between two positions, not the code points returned by the wrapping UText. Therefore, if the text includes invalid code unit sequences, these invalid sequences will be in the output of this iterator, not U+FFFD code points. The class RuleBasedIterator exposes a constructor that allows building an iterator from arbitrary compiled or non-compiled rules. The form of these rules in described in the tutorial linked above. The rest of the methods allow retrieving the rules -- getRules() and getCompiledRules() --, a hash code of the rule set (hashCode()) and the rules statuses (getRuleStatus() and getRuleStatusVec()). Because the RuleBasedBreakIterator constructor may return parse errors, I reuse the UParseError to text function that was in the transliterator files. Therefore, I move that function to intl_error.c. common_enum.cpp was also changed, mainly to expose previously static functions. This avoided code duplication when implementing the BreakIterator iterator and the IntlIterator returned by BreakIterator::getPartsIterator(). --- .../breakiterator/breakiterator_class.cpp | 342 ++++++++++++++ ext/intl/breakiterator/breakiterator_class.h | 71 +++ .../breakiterator/breakiterator_iterators.cpp | 218 +++++++++ .../breakiterator/breakiterator_iterators.h | 39 ++ .../breakiterator/breakiterator_methods.cpp | 442 ++++++++++++++++++ .../breakiterator/breakiterator_methods.h | 64 +++ .../rulebasedbreakiterator_methods.cpp | 227 +++++++++ .../rulebasedbreakiterator_methods.h | 34 ++ ext/intl/common/common_enum.cpp | 49 +- ext/intl/common/common_enum.h | 38 ++ ext/intl/config.m4 | 4 + ext/intl/config.w32 | 7 + ext/intl/intl_error.c | 78 +++- ext/intl/intl_error.h | 5 + ext/intl/php_intl.c | 5 + ext/intl/transliterator/transliterator.c | 79 ---- .../transliterator/transliterator_methods.c | 2 +- 17 files changed, 1583 insertions(+), 121 deletions(-) create mode 100644 ext/intl/breakiterator/breakiterator_class.cpp create mode 100644 ext/intl/breakiterator/breakiterator_class.h create mode 100644 ext/intl/breakiterator/breakiterator_iterators.cpp create mode 100644 ext/intl/breakiterator/breakiterator_iterators.h create mode 100644 ext/intl/breakiterator/breakiterator_methods.cpp create mode 100644 ext/intl/breakiterator/breakiterator_methods.h create mode 100644 ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp create mode 100644 ext/intl/breakiterator/rulebasedbreakiterator_methods.h diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp new file mode 100644 index 00000000000..47e5fb52df1 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -0,0 +1,342 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "breakiterator_iterators.h" + +#include + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include "breakiterator_methods.h" +#include "rulebasedbreakiterator_methods.h" +#include +#include +#include +} + +/* {{{ Global variables */ +zend_class_entry *BreakIterator_ce_ptr; +zend_class_entry *RuleBasedBreakIterator_ce_ptr; +zend_object_handlers BreakIterator_handlers; +/* }}} */ + +U_CFUNC void breakiterator_object_create(zval *object, + BreakIterator *biter TSRMLS_DC) +{ + UClassID classId = biter->getDynamicClassID(); + zend_class_entry *ce; + + if (classId == RuleBasedBreakIterator::getStaticClassID()) { + ce = RuleBasedBreakIterator_ce_ptr; + } else { + ce = BreakIterator_ce_ptr; + } + + object_init_ex(object, ce); + breakiterator_object_construct(object, biter TSRMLS_CC); +} + +U_CFUNC void breakiterator_object_construct(zval *object, + BreakIterator *biter TSRMLS_DC) +{ + BreakIterator_object *bio; + + BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; //populate to from object + assert(bio->biter == NULL); + bio->biter = biter; +} + +/* {{{ compare handler for BreakIterator */ +static int BreakIterator_compare_objects(zval *object1, + zval *object2 TSRMLS_DC) +{ + BreakIterator_object *bio1, + *bio2; + + bio1 = (BreakIterator_object*)zend_object_store_get_object(object1 TSRMLS_CC); + bio2 = (BreakIterator_object*)zend_object_store_get_object(object2 TSRMLS_CC); + + if (bio1->biter == NULL || bio2->biter == NULL) { + return bio1->biter == bio2->biter ? 0 : 1; + } + + return *bio1->biter == *bio2->biter ? 0 : 1; +} +/* }}} */ + +/* {{{ clone handler for BreakIterator */ +static zend_object_value BreakIterator_clone_obj(zval *object TSRMLS_DC) +{ + BreakIterator_object *bio_orig, + *bio_new; + zend_object_value ret_val; + + bio_orig = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + intl_errors_reset(INTL_DATA_ERROR_P(bio_orig) TSRMLS_CC); + + ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); + bio_new = (BreakIterator_object*)zend_object_store_get_object_by_handle( + ret_val.handle TSRMLS_CC); + + zend_objects_clone_members(&bio_new->zo, ret_val, + &bio_orig->zo, Z_OBJ_HANDLE_P(object) TSRMLS_CC); + + if (bio_orig->biter != NULL) { + BreakIterator *new_biter; + + new_biter = bio_orig->biter->clone(); + if (!new_biter) { + char *err_msg; + intl_errors_set_code(BREAKITER_ERROR_P(bio_orig), + U_MEMORY_ALLOCATION_ERROR TSRMLS_CC); + intl_errors_set_custom_msg(BREAKITER_ERROR_P(bio_orig), + "Could not clone BreakIterator", 0 TSRMLS_CC); + err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig) TSRMLS_CC); + zend_throw_exception(NULL, err_msg, 0 TSRMLS_CC); + efree(err_msg); + } else { + bio_new->biter = new_biter; + bio_new->text = bio_orig->text; + if (bio_new->text) { + zval_add_ref(&bio_new->text); + } + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed BreakIterator", 0 TSRMLS_CC); + } + + return ret_val; +} +/* }}} */ + +/* {{{ get_debug_info handler for BreakIterator */ +static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS_DC) +{ + zval zv = zval_used_for_init; + BreakIterator_object *bio; + const BreakIterator *biter; + + *is_temp = 1; + + array_init_size(&zv, 8); + + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + biter = bio->biter; + + if (biter == NULL) { + add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 0); + return Z_ARRVAL(zv); + } + add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1); + + if (bio->text == NULL) { + add_assoc_null_ex(&zv, "text", sizeof("text")); + } else { + zval_add_ref(&bio->text); + add_assoc_zval_ex(&zv, "text", sizeof("text"), bio->text); + } + + add_assoc_string_ex(&zv, "type", sizeof("type"), + const_cast(typeid(*biter).name()), 1); + + return Z_ARRVAL(zv); +} +/* }}} */ + +/* {{{ void breakiterator_object_init(BreakIterator_object* to) + * Initialize internals of BreakIterator_object not specific to zend standard objects. + */ +static void breakiterator_object_init(BreakIterator_object *bio TSRMLS_DC) +{ + intl_error_init(BREAKITER_ERROR_P(bio) TSRMLS_CC); + bio->biter = NULL; + bio->text = NULL; +} +/* }}} */ + +/* {{{ BreakIterator_objects_dtor */ +static void BreakIterator_objects_dtor(void *object, + zend_object_handle handle TSRMLS_DC) +{ + zend_objects_destroy_object((zend_object*)object, handle TSRMLS_CC); +} +/* }}} */ + +/* {{{ BreakIterator_objects_free */ +static void BreakIterator_objects_free(zend_object *object TSRMLS_DC) +{ + BreakIterator_object* bio = (BreakIterator_object*) object; + + if (bio->text) { + zval_ptr_dtor(&bio->text); + } + if (bio->biter) { + delete bio->biter; + bio->biter = NULL; + } + intl_error_reset(BREAKITER_ERROR_P(bio) TSRMLS_CC); + + zend_object_std_dtor(&bio->zo TSRMLS_CC); + + efree(bio); +} +/* }}} */ + +/* {{{ BreakIterator_object_create */ +static zend_object_value BreakIterator_object_create(zend_class_entry *ce TSRMLS_DC) +{ + zend_object_value retval; + BreakIterator_object* intern; + + intern = (BreakIterator_object*)ecalloc(1, sizeof(BreakIterator_object)); + + zend_object_std_init(&intern->zo, ce TSRMLS_CC); +#if PHP_VERSION_ID < 50399 + zend_hash_copy(intern->zo.properties, &(ce->default_properties), + (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*)); +#else + object_properties_init((zend_object*) intern, ce); +#endif + breakiterator_object_init(intern TSRMLS_CC); + + retval.handle = zend_objects_store_put( + intern, + BreakIterator_objects_dtor, + (zend_objects_free_object_storage_t) BreakIterator_objects_free, + NULL TSRMLS_CC); + + retval.handlers = &BreakIterator_handlers; + + return retval; +} +/* }}} */ + +/* {{{ BreakIterator/RuleBasedBreakIterator methods arguments info */ + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_void, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_locale, 0, 0, 0) + ZEND_ARG_INFO(0, "locale") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_setText, 0, 0, 1) + ZEND_ARG_INFO(0, "text") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_next, 0, 0, 0) + ZEND_ARG_INFO(0, "offset") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_offset, 0, 0, 1) + ZEND_ARG_INFO(0, "offset") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_get_locale, 0, 0, 1) + ZEND_ARG_INFO(0, "locale_type") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(ainfo_rbbi___construct, 0, 0, 1) + ZEND_ARG_INFO(0, "rules") + ZEND_ARG_INFO(0, "areCompiled") +ZEND_END_ARG_INFO() + +/* }}} */ + +/* {{{ BreakIterator_class_functions + * Every 'BreakIterator' class method has an entry in this table + */ +static const zend_function_entry BreakIterator_class_functions[] = { + PHP_ME(BreakIterator, __construct, ainfo_biter_void, ZEND_ACC_PRIVATE) + PHP_ME_MAPPING(createWordInstance, breakiter_create_word_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createLineInstance, breakiter_create_line_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createCharacterInstance, breakiter_create_character_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createSentenceInstance, breakiter_create_sentence_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createTitleInstance, breakiter_create_title_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getAvailableLocales, breakiter_get_available_locales, ainfo_biter_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getText, breakiter_get_text, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(setText, breakiter_set_text, ainfo_biter_setText, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(first, breakiter_first, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(last, breakiter_last, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(previous, breakiter_previous, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(next, breakiter_next, ainfo_biter_next, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(current, breakiter_current, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(following, breakiter_following, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(preceding, breakiter_preceding, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(isBoundary, breakiter_is_boundary, ainfo_biter_offset, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getLocale, breakiter_get_locale, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getPartsIterator, breakiter_get_parts_iterator, ainfo_biter_void, ZEND_ACC_PUBLIC) + + PHP_ME_MAPPING(getErrorCode, breakiter_get_error_code, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getErrorMessage, breakiter_get_error_message, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; +/* }}} */ + +/* {{{ RuleBasedBreakIterator_class_functions + */ +static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { + PHP_ME(RuleBasedBreakIterator, __construct, ainfo_rbbi___construct, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(hashCode, rbbi_hash_code, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRules, rbbi_get_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRuleStatus, rbbi_get_rule_status, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getRuleStatusVec, rbbi_get_rule_status_vec, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getBinaryRules, rbbi_get_binary_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; +/* }}} */ + + +/* {{{ breakiterator_register_BreakIterator_class + * Initialize 'BreakIterator' class + */ +void breakiterator_register_BreakIterator_class(TSRMLS_D) +{ + zend_class_entry ce; + + /* Create and register 'BreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "BreakIterator", BreakIterator_class_functions); + ce.create_object = BreakIterator_object_create; + ce.get_iterator = _breakiterator_get_iterator; + BreakIterator_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + + memcpy( &BreakIterator_handlers, zend_get_std_object_handlers(), + sizeof BreakIterator_handlers); + BreakIterator_handlers.compare_objects = BreakIterator_compare_objects; + BreakIterator_handlers.clone_obj = BreakIterator_clone_obj; + BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info; + + zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, + zend_ce_traversable); + + zend_declare_class_constant_long(BreakIterator_ce_ptr, + "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); + + /* Create and register 'RuleBasedBreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "RuleBasedBreakIterator", + RuleBasedBreakIterator_class_functions); + RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, + BreakIterator_ce_ptr, NULL TSRMLS_CC); +} +/* }}} */ diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h new file mode 100644 index 00000000000..a3872662832 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_class.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef BREAKITERATOR_CLASS_H +#define BREAKITERATOR_CLASS_H + +//redefinition of inline in PHP headers causes problems, so include this before +#include + +#include +#include "../intl_error.h" +#include "../intl_data.h" + +#ifndef USE_BREAKITERATOR_POINTER +typedef void BreakIterator; +#endif + +typedef struct { + zend_object zo; + + // error handling + intl_error err; + + // ICU break iterator + BreakIterator* biter; + + // current text + zval *text; +} BreakIterator_object; + +#define BREAKITER_ERROR(bio) (bio)->err +#define BREAKITER_ERROR_P(bio) &(BREAKITER_ERROR(bio)) + +#define BREAKITER_ERROR_CODE(bio) INTL_ERROR_CODE(BREAKITER_ERROR(bio)) +#define BREAKITER_ERROR_CODE_P(bio) &(INTL_ERROR_CODE(BREAKITER_ERROR(bio))) + +#define BREAKITER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(BreakIterator, bio) +#define BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(BreakIterator, bio) +#define BREAKITER_METHOD_FETCH_OBJECT \ + BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (bio->biter == NULL) \ + { \ + intl_errors_set(&bio->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed BreakIterator", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + +void breakiterator_object_create(zval *object, BreakIterator *break_iter TSRMLS_DC); + +void breakiterator_object_construct(zval *object, BreakIterator *break_iter TSRMLS_DC); + +void breakiterator_register_BreakIterator_class(TSRMLS_D); + +extern zend_class_entry *BreakIterator_ce_ptr, + *RuleBasedBreakIterator_ce_ptr; + +extern zend_object_handlers BreakIterator_handlers; + +#endif /* #ifndef BREAKITERATOR_CLASS_H */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp new file mode 100644 index 00000000000..4a0cf1da80c --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -0,0 +1,218 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "breakiterator_iterators.h" + +extern "C" { +#define USE_BREAKITERATOR_POINTER +#include "breakiterator_class.h" +#include "../intl_convert.h" +#include "../locale/locale.h" +#include +} + +/* BreakIterator's iterator */ + +inline BreakIterator *_breakiter_prolog(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator_object *bio; + bio = (BreakIterator_object*)zend_object_store_get_object( + (const zval*)iter->data TSRMLS_CC); + intl_errors_reset(BREAKITER_ERROR_P(bio) TSRMLS_CC); + if (bio->biter == NULL) { + intl_errors_set(BREAKITER_ERROR_P(bio), U_INVALID_STATE_ERROR, + "The BreakIterator object backing the PHP iterator is not " + "properly constructed", 0 TSRMLS_CC); + } + return bio->biter; +} + +static void _breakiterator_destroy_it(zend_object_iterator *iter TSRMLS_DC) +{ + zval_ptr_dtor((zval**)&iter->data); +} + +static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator *biter = _breakiter_prolog(iter TSRMLS_CC); + zoi_with_current *zoi_iter = (zoi_with_current*)iter; + + iter->funcs->invalidate_current(iter TSRMLS_CC); + + if (biter == NULL) { + return; + } + + int32_t pos = biter->next(); + if (pos != BreakIterator::DONE) { + MAKE_STD_ZVAL(zoi_iter->current); + ZVAL_LONG(zoi_iter->current, (long)pos); + } //else we've reached the end of the enum, nothing more is required +} + +static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) +{ + BreakIterator *biter = _breakiter_prolog(iter TSRMLS_CC); + zoi_with_current *zoi_iter = (zoi_with_current*)iter; + + int32_t pos = biter->first(); + MAKE_STD_ZVAL(zoi_iter->current); + ZVAL_LONG(zoi_iter->current, (long)pos); +} + +static zend_object_iterator_funcs breakiterator_iterator_funcs = { + zoi_with_current_dtor, + zoi_with_current_valid, + zoi_with_current_get_current_data, + NULL, + _breakiterator_move_forward, + _breakiterator_rewind, + zoi_with_current_invalidate_current +}; + +U_CFUNC zend_object_iterator *_breakiterator_get_iterator( + zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) +{ + BreakIterator_object *bio; + if (by_ref) { + zend_throw_exception(NULL, + "Iteration by reference is not supported", 0 TSRMLS_CC); + return NULL; + } + + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + BreakIterator *biter = bio->biter; + + if (biter == NULL) { + zend_throw_exception(NULL, + "The BreakIterator is not properly constructed", 0 TSRMLS_CC); + return NULL; + } + + zoi_with_current *zoi_iter = + static_cast(emalloc(sizeof *zoi_iter)); + zoi_iter->zoi.data = static_cast(object); + zoi_iter->zoi.funcs = &breakiterator_iterator_funcs; + zoi_iter->zoi.index = 0; + zoi_iter->destroy_it = _breakiterator_destroy_it; + zoi_iter->wrapping_obj = NULL; /* not used; object is in zoi.data */ + zoi_iter->current = NULL; + + zval_add_ref(&object); + + return reinterpret_cast(zoi_iter); +} + +/* BreakIterator parts iterator */ + +typedef struct zoi_break_iter_parts { + zoi_with_current zoi_cur; + BreakIterator_object *bio; /* so we don't have to fetch it all the time */ +} zoi_break_iter_parts; + +static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC) +{ + zval_ptr_dtor(reinterpret_cast(&iter->data)); +} + +static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) +{ + zoi_break_iter_parts *zoi_bit = (zoi_break_iter_parts*)iter; + BreakIterator_object *bio = zoi_bit->bio; + + iter->funcs->invalidate_current(iter TSRMLS_CC); + + int32_t cur, + next; + + cur = bio->biter->current(); + if (cur == BreakIterator::DONE) { + return; + } + next = bio->biter->next(); + if (next == BreakIterator::DONE) { + return; + } + + const char *s = Z_STRVAL_P(bio->text); + int32_t slen = Z_STRLEN_P(bio->text), + len; + char *res; + + if (next == BreakIterator::DONE) { + next = slen; + } + assert(next <= slen && next >= cur); + len = next - cur; + res = static_cast(emalloc(len + 1)); + + memcpy(res, &s[cur], len); + res[len] = '\0'; + + MAKE_STD_ZVAL(zoi_bit->zoi_cur.current); + ZVAL_STRINGL(zoi_bit->zoi_cur.current, res, len, 0); +} + +static void _breakiterator_parts_rewind(zend_object_iterator *iter TSRMLS_DC) +{ + zoi_break_iter_parts *zoi_bit = (zoi_break_iter_parts*)iter; + BreakIterator_object *bio = zoi_bit->bio; + + if (zoi_bit->zoi_cur.current) { + iter->funcs->invalidate_current(iter TSRMLS_CC); + } + + bio->biter->first(); + + iter->funcs->move_forward(iter TSRMLS_CC); +} + +static zend_object_iterator_funcs breakiterator_parts_it_funcs = { + zoi_with_current_dtor, + zoi_with_current_valid, + zoi_with_current_get_current_data, + NULL, + _breakiterator_parts_move_forward, + _breakiterator_parts_rewind, + zoi_with_current_invalidate_current +}; + +void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, + zval *object TSRMLS_DC) +{ + IntlIterator_object *ii; + + zval_add_ref(&break_iter_zv); + + object_init_ex(object, IntlIterator_ce_ptr); + ii = (IntlIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + + ii->iterator = (zend_object_iterator*)emalloc(sizeof(zoi_break_iter_parts)); + ii->iterator->data = break_iter_zv; + ii->iterator->funcs = &breakiterator_parts_it_funcs; + ii->iterator->index = 0; + ((zoi_with_current*)ii->iterator)->destroy_it = _breakiterator_parts_destroy_it; + ((zoi_with_current*)ii->iterator)->wrapping_obj = object; + ((zoi_with_current*)ii->iterator)->current = NULL; + + ((zoi_break_iter_parts*)ii->iterator)->bio = (BreakIterator_object*) + zend_object_store_get_object(break_iter_zv TSRMLS_CC); + assert(((zoi_break_iter_parts*)ii->iterator)->bio->biter != NULL); +} diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h new file mode 100644 index 00000000000..4ef5a2f4eff --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_iterators.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ +#ifndef INTL_BREAKITERATOR_ITERATORS_H +#define INTL_BREAKITERATOR_ITERATORS_H + +#ifndef __cplusplus +#error Header for C++ only +#endif + +#include +#include + +#include "../common/common_enum.h" + +extern "C" { +#include +#include +} + +void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, + zval *object TSRMLS_DC); + +U_CFUNC zend_object_iterator *_breakiterator_get_iterator( + zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp new file mode 100644 index 00000000000..4aca6ef23f5 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -0,0 +1,442 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "breakiterator_iterators.h" + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include "../locale/locale.h" +#include +} + +U_CFUNC PHP_METHOD(BreakIterator, __construct) +{ + zend_throw_exception( NULL, + "An object of this type cannot be created with the new operator", + 0 TSRMLS_CC ); +} + +static void _breakiter_factory(const char *func_name, + BreakIterator *(*func)(const Locale&, UErrorCode&), + INTERNAL_FUNCTION_PARAMETERS) +{ + BreakIterator *biter; + const char *locale_str = NULL; + int dummy; + char *msg; + UErrorCode status = UErrorCode(); + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", + &locale_str, &dummy) == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_NULL(); + } + + if (locale_str == NULL) { + locale_str = intl_locale_get_default(TSRMLS_C); + } + + biter = func(Locale::createFromName(locale_str), status); + intl_error_set_code(NULL, status TSRMLS_CC); + if (U_FAILURE(status)) { + spprintf(&msg, NULL, "%s: error creating BreakIterator", + func_name); + intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_NULL(); + } + + breakiterator_object_create(return_value, biter TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_word_instance) +{ + _breakiter_factory("breakiter_create_word_instance", + &BreakIterator::createWordInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_line_instance) +{ + _breakiter_factory("breakiter_create_line_instance", + &BreakIterator::createLineInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_character_instance) +{ + _breakiter_factory("breakiter_create_character_instance", + &BreakIterator::createCharacterInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_sentence_instance) +{ + _breakiter_factory("breakiter_create_sentence_instance", + &BreakIterator::createSentenceInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) +{ + _breakiter_factory("breakiter_create_title_instance", + &BreakIterator::createTitleInstance, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_available_locales) +{ + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_available_locales: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + const Locale *locales; + int32_t count; + + locales = BreakIterator::getAvailableLocales(count); + array_init_size(return_value, (uint)count); + for (int i = 0; i < count; i++) { + Locale locale = locales[i]; + add_next_index_string(return_value, locale.getName(), 1); + } +} + +U_CFUNC PHP_FUNCTION(breakiter_get_text) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_text: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + if (bio->text == NULL) { + RETURN_NULL(); + } else { + RETURN_ZVAL(bio->text, 1, 0); + } +} + +U_CFUNC PHP_FUNCTION(breakiter_set_text) +{ + char *text; + int text_len; + UText *ut = NULL; + zval **textzv; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", + &object, BreakIterator_ce_ptr, &text, &text_len) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_set_text: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + int res = zend_get_parameters_ex(1, &textzv); + assert(res == SUCCESS); + + BREAKITER_METHOD_FETCH_OBJECT; + + /* assert it's safe to use text and text_len because zpp changes the + * arguments in the stack */ + assert(text == Z_STRVAL_PP(textzv)); + + ut = utext_openUTF8(ut, text, text_len, BREAKITER_ERROR_CODE_P(bio)); + INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error opening UText"); + + bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio)); + utext_close(ut); /* ICU shallow clones the UText */ + INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error calling " + "BreakIterator::setText()"); + + /* When ICU clones the UText, it does not copy the buffer, so we have to + * keep the string buffer around by holding a reference to its zval. This + * also allows a faste implementation of getText() */ + if (bio->text != NULL) { + zval_ptr_dtor(&bio->text); + } + bio->text = *textzv; + zval_add_ref(&bio->text); + + RETURN_TRUE; +} + +static void _breakiter_no_args_ret_int32( + const char *func_name, + int32_t (BreakIterator::*func)(), + INTERNAL_FUNCTION_PARAMETERS) +{ + char *msg; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t res = (bio->biter->*func)(); + + RETURN_LONG((long)res); +} + +static void _breakiter_int32_ret_int32( + const char *func_name, + int32_t (BreakIterator::*func)(int32_t), + INTERNAL_FUNCTION_PARAMETERS) +{ + char *msg; + long arg; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + &object, BreakIterator_ce_ptr, &arg) == FAILURE) { + spprintf(&msg, NULL, "%s: bad arguments", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + if (arg < INT32_MIN || arg > INT32_MAX) { + spprintf(&msg, NULL, "%s: offset argument is outside bounds of " + "a 32-bit wide integer", func_name); + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_FALSE; + } + + int32_t res = (bio->biter->*func)((int32_t)arg); + + RETURN_LONG((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_first) +{ + _breakiter_no_args_ret_int32("breakiter_first", + &BreakIterator::first, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_last) +{ + _breakiter_no_args_ret_int32("breakiter_last", + &BreakIterator::last, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_previous) +{ + _breakiter_no_args_ret_int32("breakiter_previous", + &BreakIterator::previous, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_next) +{ + bool no_arg_version = false; + + if (ZEND_NUM_ARGS() == 0) { + no_arg_version = true; + } else if (ZEND_NUM_ARGS() == 1) { + zval **arg; + int res = zend_get_parameters_ex(1, &arg); + assert(res == SUCCESS); + if (Z_TYPE_PP(arg) == IS_NULL) { + no_arg_version = true; + ht = 0; /* pretend we don't have any argument */ + } else { + no_arg_version = false; + } + } + + if (no_arg_version) { + _breakiter_no_args_ret_int32("breakiter_next", + &BreakIterator::next, + INTERNAL_FUNCTION_PARAM_PASSTHRU); + } else { + _breakiter_int32_ret_int32("breakiter_next", + &BreakIterator::next, + INTERNAL_FUNCTION_PARAM_PASSTHRU); + } +} + +U_CFUNC PHP_FUNCTION(breakiter_current) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_current: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t res = bio->biter->current(); + + RETURN_LONG((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_following) +{ + _breakiter_int32_ret_int32("breakiter_following", + &BreakIterator::following, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_preceding) +{ + _breakiter_int32_ret_int32("breakiter_preceding", + &BreakIterator::preceding, + INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +U_CFUNC PHP_FUNCTION(breakiter_is_boundary) +{ + long offset; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + &object, BreakIterator_ce_ptr, &offset) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (offset < INT32_MIN || offset > INT32_MAX) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_is_boundary: offset argument is outside bounds of " + "a 32-bit wide integer", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + UBool res = bio->biter->isBoundary((int32_t)offset); + + RETURN_BOOL((long)res); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_locale) +{ + long locale_type; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "Ol", &object, BreakIterator_ce_ptr, &locale_type) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_locale: invalid locale type", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + Locale locale = bio->biter->getLocale((ULocDataLocaleType)locale_type, + BREAKITER_ERROR_CODE(bio)); + INTL_METHOD_CHECK_STATUS(bio, + "breakiter_get_locale: Call to ICU method has failed"); + + RETURN_STRING(locale.getName(), 1); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + IntlIterator_from_BreakIterator_parts(object, return_value TSRMLS_CC); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_error_code) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_error_code: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + /* Fetch the object (without resetting its last error code ). */ + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + if (bio == NULL) + RETURN_FALSE; + + RETURN_LONG((long)BREAKITER_ERROR_CODE(bio)); +} + +U_CFUNC PHP_FUNCTION(breakiter_get_error_message) +{ + const char* message = NULL; + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_error_message: bad arguments", 0 TSRMLS_CC ); + RETURN_FALSE; + } + + + /* Fetch the object (without resetting its last error code ). */ + bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); + if (bio == NULL) + RETURN_FALSE; + + /* Return last error message. */ + message = intl_error_get_message(BREAKITER_ERROR_P(bio) TSRMLS_CC); + RETURN_STRING(message, 0); +} diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h new file mode 100644 index 00000000000..42a6f3a1b30 --- /dev/null +++ b/ext/intl/breakiterator/breakiterator_methods.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef BREAKITERATOR_METHODS_H +#define BREAKITERATOR_METHODS_H + +#include + +PHP_METHOD(BreakIterator, __construct); + +PHP_FUNCTION(breakiter_create_word_instance); + +PHP_FUNCTION(breakiter_create_line_instance); + +PHP_FUNCTION(breakiter_create_character_instance); + +PHP_FUNCTION(breakiter_create_sentence_instance); + +PHP_FUNCTION(breakiter_create_title_instance); + +PHP_FUNCTION(breakiter_get_available_locales); + +PHP_FUNCTION(breakiter_get_text); + +PHP_FUNCTION(breakiter_set_text); + +PHP_FUNCTION(breakiter_first); + +PHP_FUNCTION(breakiter_last); + +PHP_FUNCTION(breakiter_previous); + +PHP_FUNCTION(breakiter_next); + +PHP_FUNCTION(breakiter_current); + +PHP_FUNCTION(breakiter_following); + +PHP_FUNCTION(breakiter_preceding); + +PHP_FUNCTION(breakiter_is_boundary); + +PHP_FUNCTION(breakiter_get_locale); + +PHP_FUNCTION(breakiter_get_parts_iterator); + +PHP_FUNCTION(breakiter_get_error_code); + +PHP_FUNCTION(breakiter_get_error_message); + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp new file mode 100644 index 00000000000..5ccef90707c --- /dev/null +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -0,0 +1,227 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +#include +#include +} + +#include "../intl_convertcpp.h" + +static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) { + return (RuleBasedBreakIterator*)bio->biter; +} + +static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) +{ + zval *object = getThis(); + char *rules; + int rules_len; + zend_bool compiled = 0; + UErrorCode status = U_ZERO_ERROR; + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", + &rules, &rules_len, &compiled) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_create_instance: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + // instantiation of ICU object + RuleBasedBreakIterator *rbbi; + + if (!compiled) { + UnicodeString rulesStr; + UParseError parseError = UParseError(); + if (intl_stringFromChar(rulesStr, rules, rules_len, &status) + == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_create_instance: rules were not a valid UTF-8 string", + 0 TSRMLS_CC); + RETURN_NULL(); + } + + rbbi = new RuleBasedBreakIterator(rulesStr, parseError, status); + intl_error_set_code(NULL, status TSRMLS_CC); + if (U_FAILURE(status)) { + char *msg; + smart_str parse_error_str; + parse_error_str = intl_parse_error_to_string(&parseError); + spprintf(&msg, 0, "rbbi_create_instance: unable to create " + "RuleBasedBreakIterator from rules (%s)", parse_error_str.c); + smart_str_free(&parse_error_str); + intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC); + efree(msg); + RETURN_NULL(); + } + } else { // compiled + rbbi = new RuleBasedBreakIterator((uint8_t*)rules, rules_len, status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, "rbbi_create_instance: unable to " + "creaete instance from compiled rules", 0 TSRMLS_CC); + RETURN_NULL(); + } + } + + breakiterator_object_create(return_value, rbbi TSRMLS_CC); +} + +U_CFUNC PHP_METHOD(RuleBasedBreakIterator, __construct) +{ + zval orig_this = *getThis(); + + return_value = getThis(); + //changes this to IS_NULL (without first destroying) if there's an error + _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_TYPE_P(return_value) == IS_NULL) { + zend_object_store_ctor_failed(&orig_this TSRMLS_CC); + zval_dtor(&orig_this); + } +} + +U_CFUNC PHP_FUNCTION(rbbi_hash_code) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_hash_code: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + RETURN_LONG(fetch_rbbi(bio)->hashCode()); +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rules) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_hash_code: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + const UnicodeString rules = fetch_rbbi(bio)->getRules(); + + Z_TYPE_P(return_value) = IS_STRING; + if (intl_charFromString(rules, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), BREAKITER_ERROR_CODE_P(bio)) == FAILURE) + { + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_hash_code: Error converting result to UTF-8 string", + 0 TSRMLS_CC); + RETURN_FALSE; + } +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_rule_status: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); +} + +U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_rule_status_vec: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0, + BREAKITER_ERROR_CODE(bio)); + if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) { + BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR; + } else { + // should not happen + INTL_METHOD_CHECK_STATUS(bio, "rbbi_get_rule_status_vec: failed " + " determining the number of status values"); + } + int32_t *rules = new int32_t[num_rules]; + num_rules = fetch_rbbi(bio)->getRuleStatusVec(rules, num_rules, + BREAKITER_ERROR_CODE(bio)); + if (U_FAILURE(BREAKITER_ERROR_CODE(bio))) { + delete[] rules; + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_get_rule_status_vec: failed obtaining the status values", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + array_init_size(return_value, num_rules); + for (int32_t i = 0; i < num_rules; i++) { + add_next_index_long(return_value, rules[i]); + } + delete[] rules; +} + +U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) +{ + BREAKITER_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", + &object, BreakIterator_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + uint32_t rules_len; + const uint8_t *rules = fetch_rbbi(bio)->getBinaryRules(rules_len); + + if (rules_len > INT_MAX - 1) { + intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), + "rbbi_get_binary_rules: the rules are too large", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + char *ret_rules = static_cast(emalloc(rules_len + 1)); + memcpy(ret_rules, rules, rules_len); + ret_rules[rules_len] = '\0'; + + RETURN_STRINGL(ret_rules, rules_len, 0); +} diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h new file mode 100644 index 00000000000..b645e0c1cc7 --- /dev/null +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef RULEBASEDBREAKITERATOR_METHODS_H +#define RULEBASEDBREAKITERATOR_METHODS_H + +#include + +PHP_METHOD(RuleBasedBreakIterator, __construct); + +PHP_FUNCTION(rbbi_hash_code); + +PHP_FUNCTION(rbbi_get_rules); + +PHP_FUNCTION(rbbi_get_rule_status); + +PHP_FUNCTION(rbbi_get_rule_status_vec); + +PHP_FUNCTION(rbbi_get_binary_rules); + +#endif \ No newline at end of file diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index a0e346061a7..6dfacd7e3a7 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -26,45 +26,14 @@ #include "common_enum.h" extern "C" { -#include "intl_error.h" -#include "intl_data.h" #include #include } -static zend_class_entry *IntlIterator_ce_ptr; +zend_class_entry *IntlIterator_ce_ptr; static zend_object_handlers IntlIterator_handlers; -typedef struct { - zend_object zo; - intl_error err; - zend_object_iterator *iterator; -} IntlIterator_object; - -#define INTLITERATOR_ERROR(ii) (ii)->err -#define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii)) - -#define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)) -#define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))) - -#define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii) -#define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii) -#define INTLITERATOR_METHOD_FETCH_OBJECT\ - object = getThis(); \ - INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \ - if (ii->iterator == NULL) { \ - intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \ - RETURN_FALSE; \ - } - -typedef struct { - zend_object_iterator zoi; - zval *current; - zval *wrapping_obj; - void (*destroy_free_it)(zend_object_iterator *iterator TSRMLS_DC); -} zoi_with_current; - -static void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) +void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) { zoi_with_current *zoiwc = (zoi_with_current*)iter; @@ -84,22 +53,22 @@ static void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) * function being called by the iterator wrapper destructor function and * not finding the memory of this iterator allocated anymore. */ iter->funcs->invalidate_current(iter TSRMLS_CC); - zoiwc->destroy_free_it(iter TSRMLS_CC); + zoiwc->destroy_it(iter TSRMLS_CC); efree(iter); } } -static int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC) +U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC) { return ((zoi_with_current*)iter)->current != NULL ? SUCCESS : FAILURE; } -static void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) +U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) { *data = &((zoi_with_current*)iter)->current; } -static void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC) +U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC) { zoi_with_current *zoi_iter = (zoi_with_current*)iter; if (zoi_iter->current) { @@ -155,7 +124,7 @@ static void string_enum_rewind(zend_object_iterator *iter TSRMLS_DC) } } -static void string_enum_destroy_free_it(zend_object_iterator *iter TSRMLS_DC) +static void string_enum_destroy_it(zend_object_iterator *iter TSRMLS_DC) { delete (StringEnumeration*)iter->data; } @@ -179,7 +148,7 @@ U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *ob ii->iterator->data = (void*)se; ii->iterator->funcs = &string_enum_object_iterator_funcs; ii->iterator->index = 0; - ((zoi_with_current*)ii->iterator)->destroy_free_it = string_enum_destroy_free_it; + ((zoi_with_current*)ii->iterator)->destroy_it = string_enum_destroy_it; ((zoi_with_current*)ii->iterator)->wrapping_obj = object; ((zoi_with_current*)ii->iterator)->current = NULL; } @@ -331,7 +300,7 @@ static PHP_METHOD(IntlIterator, rewind) if (ii->iterator->funcs->rewind) { ii->iterator->funcs->rewind(ii->iterator TSRMLS_CC); } else { - intl_error_set(NULL, U_UNSUPPORTED_ERROR, + intl_errors_set(INTLITERATOR_ERROR_P(ii), U_UNSUPPORTED_ERROR, "IntlIterator::rewind: rewind not supported", 0 TSRMLS_CC); } } diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h index f3c8bfcead8..bcd9f447968 100644 --- a/ext/intl/common/common_enum.h +++ b/ext/intl/common/common_enum.h @@ -25,10 +25,48 @@ extern "C" { #include #endif #include +#include "../intl_error.h" +#include "../intl_data.h" #ifdef __cplusplus } #endif +#define INTLITERATOR_ERROR(ii) (ii)->err +#define INTLITERATOR_ERROR_P(ii) &(INTLITERATOR_ERROR(ii)) + +#define INTLITERATOR_ERROR_CODE(ii) INTL_ERROR_CODE(INTLITERATOR_ERROR(ii)) +#define INTLITERATOR_ERROR_CODE_P(ii) &(INTL_ERROR_CODE(INTLITERATOR_ERROR(ii))) + +#define INTLITERATOR_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlIterator, ii) +#define INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlIterator, ii) +#define INTLITERATOR_METHOD_FETCH_OBJECT\ + object = getThis(); \ + INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (ii->iterator == NULL) { \ + intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + +typedef struct { + zend_object zo; + intl_error err; + zend_object_iterator *iterator; +} IntlIterator_object; + +typedef struct { + zend_object_iterator zoi; + zval *current; + zval *wrapping_obj; + void (*destroy_it)(zend_object_iterator *iterator TSRMLS_DC); +} zoi_with_current; + +extern zend_class_entry *IntlIterator_ce_ptr; + +U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC); +U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC); +U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC); +U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC); + #ifdef __cplusplus U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC); #endif diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 431deeb7d29..227368334df 100755 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -75,6 +75,10 @@ if test "$PHP_INTL" != "no"; then calendar/calendar_class.cpp \ calendar/calendar_methods.cpp \ calendar/gregoriancalendar_methods.cpp \ + breakiterator/breakiterator_class.cpp \ + breakiterator/breakiterator_iterators.cpp \ + breakiterator/breakiterator_methods.cpp \ + breakiterator/rulebasedbreakiterator_methods.cpp \ idn/idn.c \ $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) PHP_ADD_BUILD_DIR($ext_builddir/collator) diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 index 735749ab438..6b7d15d56d8 100755 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -102,6 +102,13 @@ if (PHP_INTL != "no") { gregoriancalendar_methods.cpp \ calendar_class.cpp", "intl"); + + ADD_SOURCES(configure_module_dirname + "/breakiterator", "\ + breakiterator_class.cpp \ + breakiterator_methods.cpp \ + breakiterator_iterators.cpp \ + rulebasedbreakiterator_methods.cpp", + "intl"); ADD_FLAG("LIBS_INTL", "icudt.lib icuin.lib icuio.lib icule.lib iculx.lib"); AC_DEFINE("HAVE_INTL", 1, "Internationalization support enabled"); diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index 2c7066b0817..99b1c6001cd 100755 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -25,6 +25,7 @@ #include "php_intl.h" #include "intl_error.h" +#include "intl_convert.h" ZEND_EXTERN_MODULE_GLOBALS( intl ) @@ -242,7 +243,82 @@ void intl_register_IntlException_class( TSRMLS_D ) default_exception_ce, NULL TSRMLS_CC ); IntlException_ce_ptr->create_object = default_exception_ce->create_object; } -/* }}} */ + +smart_str intl_parse_error_to_string( UParseError* pe ) +{ + smart_str ret = {0}; + char *buf; + int u8len; + UErrorCode status; + int any = 0; + + assert( pe != NULL ); + + smart_str_appends( &ret, "parse error " ); + if( pe->line > 0 ) + { + smart_str_appends( &ret, "on line " ); + smart_str_append_long( &ret, (long ) pe->line ); + any = 1; + } + if( pe->offset >= 0 ) { + if( any ) + smart_str_appends( &ret, ", " ); + else + smart_str_appends( &ret, "at " ); + + smart_str_appends( &ret, "offset " ); + smart_str_append_long( &ret, (long ) pe->offset ); + any = 1; + } + + if (pe->preContext[0] != 0 ) { + if( any ) + smart_str_appends( &ret, ", " ); + + smart_str_appends( &ret, "after \"" ); + intl_convert_utf16_to_utf8( &buf, &u8len, pe->preContext, -1, &status ); + if( U_FAILURE( status ) ) + { + smart_str_appends( &ret, "(could not convert parser error pre-context to UTF-8)" ); + } + else { + smart_str_appendl( &ret, buf, u8len ); + efree( buf ); + } + smart_str_appends( &ret, "\"" ); + any = 1; + } + + if( pe->postContext[0] != 0 ) + { + if( any ) + smart_str_appends( &ret, ", " ); + + smart_str_appends( &ret, "before or at \"" ); + intl_convert_utf16_to_utf8( &buf, &u8len, pe->postContext, -1, &status ); + if( U_FAILURE( status ) ) + { + smart_str_appends( &ret, "(could not convert parser error post-context to UTF-8)" ); + } + else + { + smart_str_appendl( &ret, buf, u8len ); + efree( buf ); + } + smart_str_appends( &ret, "\"" ); + any = 1; + } + + if( !any ) + { + smart_str_free( &ret ); + smart_str_appends( &ret, "no parse error" ); + } + + smart_str_0( &ret ); + return ret; +} /* * Local variables: diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h index b5000a15de6..4d8eb79327f 100755 --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -20,6 +20,8 @@ #define INTL_ERROR_H #include +#include +#include #define INTL_ERROR_CODE(e) (e).code @@ -44,6 +46,9 @@ void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC ); void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC ); +// Other error helpers +smart_str intl_parse_error_to_string( UParseError* pe ); + // exported to be called on extension MINIT void intl_register_IntlException_class( TSRMLS_D ); diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 59272db7127..5d8aa6be957 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -78,6 +78,8 @@ #include "calendar/calendar_methods.h" #include "calendar/gregoriancalendar_methods.h" +#include "breakiterator/breakiterator_class.h" + #include "idn/idn.h" #if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 @@ -958,6 +960,9 @@ PHP_MINIT_FUNCTION( intl ) /* Register 'IntlIterator' PHP class */ intl_register_IntlIterator_class( TSRMLS_C ); + /* Register 'BreakIterator' class */ + breakiterator_register_BreakIterator_class( TSRMLS_C ); + /* Global error handling. */ intl_error_init( NULL TSRMLS_CC ); diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 75c9eaabdaa..8ee49e1e51b 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -49,85 +49,6 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) } /* }}} */ -/* {{{ transliterator_parse_error_to_string - * Transforms parse errors in strings. - */ -smart_str transliterator_parse_error_to_string( UParseError* pe ) -{ - smart_str ret = {0}; - char *buf; - int u8len; - UErrorCode status; - int any = 0; - - assert( pe != NULL ); - - smart_str_appends( &ret, "parse error " ); - if( pe->line > 0 ) - { - smart_str_appends( &ret, "on line " ); - smart_str_append_long( &ret, (long ) pe->line ); - any = 1; - } - if( pe->offset >= 0 ) { - if( any ) - smart_str_appends( &ret, ", " ); - else - smart_str_appends( &ret, "at " ); - - smart_str_appends( &ret, "offset " ); - smart_str_append_long( &ret, (long ) pe->offset ); - any = 1; - } - - if (pe->preContext[0] != 0 ) { - if( any ) - smart_str_appends( &ret, ", " ); - - smart_str_appends( &ret, "after \"" ); - intl_convert_utf16_to_utf8( &buf, &u8len, pe->preContext, -1, &status ); - if( U_FAILURE( status ) ) - { - smart_str_appends( &ret, "(could not convert parser error pre-context to UTF-8)" ); - } - else { - smart_str_appendl( &ret, buf, u8len ); - efree( buf ); - } - smart_str_appends( &ret, "\"" ); - any = 1; - } - - if( pe->postContext[0] != 0 ) - { - if( any ) - smart_str_appends( &ret, ", " ); - - smart_str_appends( &ret, "before or at \"" ); - intl_convert_utf16_to_utf8( &buf, &u8len, pe->postContext, -1, &status ); - if( U_FAILURE( status ) ) - { - smart_str_appends( &ret, "(could not convert parser error post-context to UTF-8)" ); - } - else - { - smart_str_appendl( &ret, buf, u8len ); - efree( buf ); - } - smart_str_appends( &ret, "\"" ); - any = 1; - } - - if( !any ) - { - smart_str_free( &ret ); - smart_str_appends( &ret, "no parse error" ); - } - - smart_str_0( &ret ); - return ret; -} - /* * Local variables: * tab-width: 4 diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index d0cfb9790d9..1aa39c54b98 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -183,7 +183,7 @@ PHP_FUNCTION( transliterator_create_from_rules ) { char *msg = NULL; smart_str parse_error_str; - parse_error_str = transliterator_parse_error_to_string( &parse_error ); + parse_error_str = intl_parse_error_to_string( &parse_error ); spprintf( &msg, 0, "transliterator_create_from_rules: unable to " "create ICU transliterator from rules (%s)", parse_error_str.c ); smart_str_free( &parse_error_str ); From 036b1eb2912872ade10e35f26daf10c65cc3cdea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 31 May 2012 13:02:02 +0200 Subject: [PATCH 067/641] Tests for (RuleBased)BreakIterator. --- ext/intl/tests/breakiter___construct.phpt | 13 +++++ .../tests/breakiter___construct_error.phpt | 35 ++++++++++++ ext/intl/tests/breakiter_clone_basic.phpt | 23 ++++++++ ext/intl/tests/breakiter_current_basic.phpt | 24 ++++++++ ext/intl/tests/breakiter_factories_basic.phpt | 45 +++++++++++++++ ext/intl/tests/breakiter_factories_error.phpt | 39 +++++++++++++ ext/intl/tests/breakiter_first_basic.phpt | 21 +++++++ ...ter_first_last_previous_current_error.phpt | 35 ++++++++++++ ext/intl/tests/breakiter_following_basic.phpt | 20 +++++++ ..._following_preceding_isBoundary_error.phpt | 47 ++++++++++++++++ .../breakiter_getAvailableLocales_basic.phpt | 12 ++++ .../breakiter_getAvailableLocales_error.phpt | 14 +++++ ext/intl/tests/breakiter_getLocale_basic.phpt | 17 ++++++ ext/intl/tests/breakiter_getLocale_error.phpt | 29 ++++++++++ .../breakiter_getPartsIterator_basic.phpt | 29 ++++++++++ ext/intl/tests/breakiter_getText_basic.phpt | 16 ++++++ ext/intl/tests/breakiter_getText_error.phpt | 15 +++++ .../tests/breakiter_isBoundary_basic.phpt | 24 ++++++++ ext/intl/tests/breakiter_last_basic.phpt | 19 +++++++ ext/intl/tests/breakiter_next_basic.phpt | 26 +++++++++ ext/intl/tests/breakiter_next_error.phpt | 23 ++++++++ ext/intl/tests/breakiter_preceding_basic.phpt | 20 +++++++ ext/intl/tests/breakiter_previous_basic.phpt | 18 ++++++ ext/intl/tests/breakiter_setText_basic.phpt | 35 ++++++++++++ ext/intl/tests/breakiter_setText_error.phpt | 40 ++++++++++++++ ext/intl/tests/rbbiter___construct_basic.phpt | 27 +++++++++ .../tests/rbbiter_getBinaryRules_basic.phpt | 36 ++++++++++++ .../tests/rbbiter_getRuleStatusVec_basic.phpt | 55 +++++++++++++++++++ .../tests/rbbiter_getRuleStatus_basic.phpt | 42 ++++++++++++++ ext/intl/tests/rbbiter_getRules_basic.phpt | 28 ++++++++++ ext/intl/tests/rbbiter_hashCode_basic.phpt | 15 +++++ 31 files changed, 842 insertions(+) create mode 100644 ext/intl/tests/breakiter___construct.phpt create mode 100644 ext/intl/tests/breakiter___construct_error.phpt create mode 100644 ext/intl/tests/breakiter_clone_basic.phpt create mode 100644 ext/intl/tests/breakiter_current_basic.phpt create mode 100644 ext/intl/tests/breakiter_factories_basic.phpt create mode 100644 ext/intl/tests/breakiter_factories_error.phpt create mode 100644 ext/intl/tests/breakiter_first_basic.phpt create mode 100644 ext/intl/tests/breakiter_first_last_previous_current_error.phpt create mode 100644 ext/intl/tests/breakiter_following_basic.phpt create mode 100644 ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt create mode 100644 ext/intl/tests/breakiter_getAvailableLocales_basic.phpt create mode 100644 ext/intl/tests/breakiter_getAvailableLocales_error.phpt create mode 100644 ext/intl/tests/breakiter_getLocale_basic.phpt create mode 100644 ext/intl/tests/breakiter_getLocale_error.phpt create mode 100644 ext/intl/tests/breakiter_getPartsIterator_basic.phpt create mode 100644 ext/intl/tests/breakiter_getText_basic.phpt create mode 100644 ext/intl/tests/breakiter_getText_error.phpt create mode 100644 ext/intl/tests/breakiter_isBoundary_basic.phpt create mode 100644 ext/intl/tests/breakiter_last_basic.phpt create mode 100644 ext/intl/tests/breakiter_next_basic.phpt create mode 100644 ext/intl/tests/breakiter_next_error.phpt create mode 100644 ext/intl/tests/breakiter_preceding_basic.phpt create mode 100644 ext/intl/tests/breakiter_previous_basic.phpt create mode 100644 ext/intl/tests/breakiter_setText_basic.phpt create mode 100644 ext/intl/tests/breakiter_setText_error.phpt create mode 100644 ext/intl/tests/rbbiter___construct_basic.phpt create mode 100644 ext/intl/tests/rbbiter_getBinaryRules_basic.phpt create mode 100644 ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt create mode 100644 ext/intl/tests/rbbiter_getRuleStatus_basic.phpt create mode 100644 ext/intl/tests/rbbiter_getRules_basic.phpt create mode 100644 ext/intl/tests/rbbiter_hashCode_basic.phpt diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt new file mode 100644 index 00000000000..a379b19f92e --- /dev/null +++ b/ext/intl/tests/breakiter___construct.phpt @@ -0,0 +1,13 @@ +--TEST-- +BreakIterator::__construct() should not be callable +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foobar'); +$bi_clone = clone $bi; +var_dump(get_class($bi), get_class($bi_clone)); +var_dump($bi == $bi_clone); + +--EXPECT-- +string(22) "RuleBasedBreakIterator" +string(22) "RuleBasedBreakIterator" +bool(true) +string(22) "RuleBasedBreakIterator" +string(22) "RuleBasedBreakIterator" +bool(true) diff --git a/ext/intl/tests/breakiter_current_basic.phpt b/ext/intl/tests/breakiter_current_basic.phpt new file mode 100644 index 00000000000..26f1d5f46e2 --- /dev/null +++ b/ext/intl/tests/breakiter_current_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +BreakIterator::current(): basic test +--FILE-- +current()); +$bi->setText('foo bar trans zoo bee'); + +var_dump($bi->first()); +var_dump($bi->current()); +var_dump($bi->next()); +var_dump($bi->current()); +?> +==DONE== +--EXPECT-- +int(0) +int(0) +int(0) +int(3) +int(3) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt new file mode 100644 index 00000000000..30fb312cd55 --- /dev/null +++ b/ext/intl/tests/breakiter_factories_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +BreakIterator factories: basic tests +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar trans'); + +var_dump($bi->current()); +var_dump($bi->next()); +var_dump($bi->first()); +var_dump($bi->current()); +--EXPECT-- +int(0) +int(3) +int(0) +int(0) diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt new file mode 100644 index 00000000000..a56228e284f --- /dev/null +++ b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +BreakIterator::first()/last()/previous()/current(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->first(1)); +var_dump($bi->last(1)); +var_dump($bi->previous(1)); +var_dump($bi->current(1)); + +--EXPECTF-- + +Warning: BreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: BreakIterator::first(): breakiter_first: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: BreakIterator::last(): breakiter_last: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: BreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: BreakIterator::current(): breakiter_current: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt new file mode 100644 index 00000000000..f460ecbf7ad --- /dev/null +++ b/ext/intl/tests/breakiter_following_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +BreakIterator::following(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->following(5)); +var_dump($bi->following(50)); +var_dump($bi->following(-1)); +?> +==DONE== +--EXPECT-- +int(7) +int(-1) +int(0) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt new file mode 100644 index 00000000000..016db6441e3 --- /dev/null +++ b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +BreakIterator::following()/preceding()/isBoundary(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->following(1, 2)); +var_dump($bi->following(array())); +var_dump($bi->preceding(1, 2)); +var_dump($bi->preceding(array())); +var_dump($bi->isBoundary(1, 2)); +var_dump($bi->isBoundary(array())); + +--EXPECTF-- + +Warning: BreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::following() expects parameter 1 to be long, array given in %s on line %d + +Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::preceding() expects parameter 1 to be long, array given in %s on line %d + +Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::isBoundary() expects parameter 1 to be long, array given in %s on line %d + +Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt b/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt new file mode 100644 index 00000000000..5cba4c548f7 --- /dev/null +++ b/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +BreakIterator::getAvailableLocales(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- + 150); +--EXPECT-- +bool(true) diff --git a/ext/intl/tests/breakiter_getAvailableLocales_error.phpt b/ext/intl/tests/breakiter_getAvailableLocales_error.phpt new file mode 100644 index 00000000000..4772e8ae2bf --- /dev/null +++ b/ext/intl/tests/breakiter_getAvailableLocales_error.phpt @@ -0,0 +1,14 @@ +--TEST-- +BreakIterator::getAvailableLocales(): arg errors +--FILE-- +getLocale(0)); +var_dump($bi->getLocale(1)); +?> +==DONE== +--EXPECT-- +string(4) "root" +string(4) "root" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt new file mode 100644 index 00000000000..7d822ab5630 --- /dev/null +++ b/ext/intl/tests/breakiter_getLocale_error.phpt @@ -0,0 +1,29 @@ +--TEST-- +BreakIterator::getLocale(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->getLocale(1, 2)); +var_dump($bi->getLocale(array())); +var_dump($bi->getLocale()); + +--EXPECTF-- + +Warning: BreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::getLocale() expects parameter 1 to be long, array given in %s on line %d + +Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt new file mode 100644 index 00000000000..5c23bfdfa7a --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +BreakIterator::getPartsIterator(): basic test +--FILE-- +getPartsIterator(); +var_dump(get_class($pi)); +print_r(iterator_to_array($pi)); + +$bi->setText("foo bar"); +$pi = $bi->getPartsIterator(); +print_r(iterator_to_array($pi)); +?> +==DONE== +--EXPECT-- +string(12) "IntlIterator" +Array +( +) +Array +( + [0] => foo + [1] => + [2] => bar +) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_getText_basic.phpt b/ext/intl/tests/breakiter_getText_basic.phpt new file mode 100644 index 00000000000..60801ccc453 --- /dev/null +++ b/ext/intl/tests/breakiter_getText_basic.phpt @@ -0,0 +1,16 @@ +--TEST-- +BreakIterator::getText(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +getText()); +$bi->setText('foo bar'); +var_dump($bi->getText()); +--EXPECTF-- +NULL +string(7) "foo bar" diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt new file mode 100644 index 00000000000..79d152831cf --- /dev/null +++ b/ext/intl/tests/breakiter_getText_error.phpt @@ -0,0 +1,15 @@ +--TEST-- +BreakIterator::getText(): arg errors +--FILE-- +getText(array())); + +--EXPECTF-- + +Warning: BreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: BreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt new file mode 100644 index 00000000000..5e8a9f04ecd --- /dev/null +++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt @@ -0,0 +1,24 @@ +--TEST-- +BreakIterator::isBoundary(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->isBoundary(0)); +var_dump($bi->isBoundary(7)); +var_dump($bi->isBoundary(-1)); +var_dump($bi->isBoundary(1)); +var_dump($bi->isBoundary(50)); +?> +==DONE== +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_last_basic.phpt b/ext/intl/tests/breakiter_last_basic.phpt new file mode 100644 index 00000000000..9e260594d9e --- /dev/null +++ b/ext/intl/tests/breakiter_last_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +BreakIterator::last(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar trans'); + +var_dump($bi->current()); +var_dump($bi->last()); +var_dump($bi->current()); +--EXPECTF-- +int(0) +int(13) +int(13) diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt new file mode 100644 index 00000000000..8e4827e2d4d --- /dev/null +++ b/ext/intl/tests/breakiter_next_basic.phpt @@ -0,0 +1,26 @@ +--TEST-- +BreakIterator::next(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->first()); +var_dump($bi->next()); +var_dump($bi->next(2)); +var_dump($bi->next(-1)); +var_dump($bi->next(0)); +var_dump($bi->next(NULL)); +?> +==DONE== +--EXPECT-- +int(0) +int(3) +int(7) +int(4) +int(4) +int(7) +==DONE== diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt new file mode 100644 index 00000000000..08e4aa4c32b --- /dev/null +++ b/ext/intl/tests/breakiter_next_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +BreakIterator::next(): arg errors +--FILE-- +setText("\x80sdfé\x90d888 dfsa9"); + +var_dump($bi->next(1, 2)); +var_dump($bi->next(array())); + +--EXPECTF-- + +Warning: BreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::next() expects parameter 1 to be long, array given in %s on line %d + +Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d +bool(false) diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt new file mode 100644 index 00000000000..5a321b6f3cc --- /dev/null +++ b/ext/intl/tests/breakiter_preceding_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +BreakIterator::preceding(): basic test +--FILE-- +setText('foo bar trans zoo bee'); + +var_dump($bi->preceding(5)); +var_dump($bi->preceding(50)); +var_dump($bi->preceding(-1)); +?> +==DONE== +--EXPECT-- +int(4) +int(21) +int(0) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt new file mode 100644 index 00000000000..2d0e71656d0 --- /dev/null +++ b/ext/intl/tests/breakiter_previous_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +BreakIterator::previous(): basic test +--FILE-- +setText('foo bar trans'); + +var_dump($bi->last()); +var_dump($bi->previous()); +?> +==DONE== +--EXPECT-- +int(13) +int(8) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/breakiter_setText_basic.phpt b/ext/intl/tests/breakiter_setText_basic.phpt new file mode 100644 index 00000000000..72ea48371b4 --- /dev/null +++ b/ext/intl/tests/breakiter_setText_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +BreakIterator::setText(): basic test +--SKIPIF-- +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +setText('foo bar')); +var_dump($bi->getText()); +var_dump($bi->setText(1)); +var_dump($bi->getText()); +var_dump($bi->setText(new A)); +var_dump($bi->getText()); + +/* setText resets the pointer */ +var_dump($bi->next()); +var_dump($bi->setText('foo bar')); +var_dump($bi->current()); +--EXPECT-- +bool(true) +string(7) "foo bar" +bool(true) +string(1) "1" +bool(true) +string(3) "aaa" +int(3) +bool(true) +int(0) diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt new file mode 100644 index 00000000000..08d69070a50 --- /dev/null +++ b/ext/intl/tests/breakiter_setText_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +BreakIterator::setText(): arg errors +--FILE-- +setText()); +var_dump($bi->setText(array())); +var_dump($bi->setText(1,2)); + +class A { +function __destruct() { var_dump('destructed'); throw new Exception('e'); } +function __tostring() { return 'foo'; } +} + +try { +var_dump($bi->setText(new A)); +} catch (Exception $e) { +var_dump($e->getMessage()); +} + +--EXPECTF-- + +Warning: BreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d + +Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) + +Warning: BreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +bool(false) +string(10) "destructed" +string(1) "e" diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt new file mode 100644 index 00000000000..567a09fa2de --- /dev/null +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -0,0 +1,27 @@ +--TEST-- +RuleBasedBreakIterator::__construct: basic test +--FILE-- + +==DONE== +--EXPECT-- +string(22) "RuleBasedBreakIterator" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt new file mode 100644 index 00000000000..815c711cfcb --- /dev/null +++ b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +RuleBasedBreakIterator::getBinaryRules(): basic test +--FILE-- +setText('sdfkjsdf88á.... ,;');; + +$br = $rbbi->getBinaryRules(); + +$rbbi2 = new RuleBasedBreakIterator($br, true); + +var_dump($rbbi->getRules(), $rbbi2->getRules()); +var_dump($rbbi->getRules() == $rbbi2->getRules()); +?> +==DONE== +--EXPECT-- +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +bool(true) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt new file mode 100644 index 00000000000..bbc00e9b48a --- /dev/null +++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt @@ -0,0 +1,55 @@ +--TEST-- +RuleBasedBreakIterator::getRuleStatusVec(): basic test +--FILE-- +setText('sdfkjsdf88á.... ,;');; + +do { + var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); +} while ($rbbi->next() != BreakIterator::DONE); + +?> +==DONE== +--EXPECT-- +int(0) +array(1) { + [0]=> + int(0) +} +int(12) +array(2) { + [0]=> + int(1) + [1]=> + int(4) +} +int(16) +array(1) { + [0]=> + int(42) +} +int(19) +array(1) { + [0]=> + int(4) +} +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt new file mode 100644 index 00000000000..1bce102489f --- /dev/null +++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +RuleBasedBreakIterator::getRuleStatus(): basic test +--FILE-- +setText('sdfkjsdf88á.... ,;'); + +do { + echo "pos : {$rbbi->current()}\n", + "rule status: {$rbbi->getRuleStatus()}\n"; +} while ($rbbi->next() != BreakIterator::DONE); + +?> +==DONE== +--EXPECT-- +pos : 0 +rule status: 0 +pos : 12 +rule status: 1 +pos : 16 +rule status: 42 +pos : 17 +rule status: 0 +pos : 19 +rule status: 42 +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt new file mode 100644 index 00000000000..7f510484be9 --- /dev/null +++ b/ext/intl/tests/rbbiter_getRules_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +RuleBasedBreakIterator::getRules(): basic test +--FILE-- +getRules()); + +?> +==DONE== +--EXPECT-- +string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_hashCode_basic.phpt b/ext/intl/tests/rbbiter_hashCode_basic.phpt new file mode 100644 index 00000000000..83155b5c97b --- /dev/null +++ b/ext/intl/tests/rbbiter_hashCode_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +RuleBasedBreakIterator::hashCode(): basic test +--FILE-- +hashCode()); + +?> +==DONE== +--EXPECTF-- +int(%d) +==DONE== \ No newline at end of file From c6593a0e9b3ea1a6045f8a52a1b9d8bce4d63773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 23:09:10 +0200 Subject: [PATCH 068/641] BreakIterator: add rules status constants --- .../breakiterator/breakiterator_class.cpp | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 47e5fb52df1..f273a2f74ae 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -333,6 +333,35 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_declare_class_constant_long(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); + /* Declare constants that are defined in the C header */ +#define BREAKITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ + sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) + + BREAKITER_DECL_LONG_CONST(WORD_NONE); + BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_LETTER); + BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_KANA); + BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_IDEO); + BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_LONG_CONST(LINE_SOFT); + BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_LONG_CONST(LINE_HARD); + BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_LONG_CONST + + /* Create and register 'RuleBasedBreakIterator' class. */ INIT_CLASS_ENTRY(ce, "RuleBasedBreakIterator", RuleBasedBreakIterator_class_functions); From 15213768e6cc098ab4e53cacc3b5eb86fa85284a Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 4 Jun 2012 20:07:14 -0300 Subject: [PATCH 069/641] - Fixed bug #62227 (Invalid phar stream path causes crash) --- ext/phar/phar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 4ab2b863765..8a0ebfae188 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1799,7 +1799,11 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in #ifdef PHP_WIN32 phar_unixify_path_separators(realpath, strlen(realpath)); #endif - a = strstr(realpath, fname) + ((ext - fname) + ext_len); + if ((a = strstr(realpath, fname)) == NULL) { + return FAILURE; + } + + a += ((ext - fname) + ext_len); *a = '\0'; slash = strrchr(realpath, '/'); From 40760ecb90d1b024c76862e33d13d40137650af7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 3 Jun 2012 02:40:03 +0200 Subject: [PATCH 070/641] Fix cloning of generator methods Forgot to add a reference to the this variable --- Zend/tests/generators/clone_with_this.phpt | 24 ++++++++++++++++++++++ Zend/zend_generators.c | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 Zend/tests/generators/clone_with_this.phpt diff --git a/Zend/tests/generators/clone_with_this.phpt b/Zend/tests/generators/clone_with_this.phpt new file mode 100644 index 00000000000..b0f28be3c9c --- /dev/null +++ b/Zend/tests/generators/clone_with_this.phpt @@ -0,0 +1,24 @@ +--TEST-- +Cloning a generator method (with this) +--FILE-- +foo = 'bar'; + yield; // interrupt + var_dump($this->foo); + } +} + +$g1 = (new Test)->gen(); +$g1->rewind(); // goto yield +$g2 = clone $g1; +$g1->close(); +$g2->next(); + +?> +--EXPECT-- +string(3) "bar" diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index a3277e6eebd..b5642ddcc7a 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -233,6 +233,10 @@ static void zend_generator_clone_storage(zend_generator *orig, zend_generator ** Z_ADDREF_P(clone->send_target->var.ptr); } + if (execute_data->current_this) { + Z_ADDREF_P(execute_data->current_this); + } + if (execute_data->object) { Z_ADDREF_P(execute_data->object); } From 45b3fa4deea739c8a3bf8778efac2f748a2685bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Tue, 5 Jun 2012 16:47:00 +0200 Subject: [PATCH 071/641] Fixed tests in ext/intl 21 is not a valid value for UNUM_PADDING_POSITION. Changed the test to use 2 instead. Remove ICU 4.2- test. No one cares. --- .../tests/formatter_get_set_attribute.phpt | 10 +- .../tests/formatter_get_set_attribute2.phpt | 194 ------------------ 2 files changed, 5 insertions(+), 199 deletions(-) delete mode 100644 ext/intl/tests/formatter_get_set_attribute2.phpt diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt index cb5e4157559..51c7d3658a3 100755 --- a/ext/intl/tests/formatter_get_set_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_attribute.phpt @@ -1,8 +1,8 @@ --TEST-- -numfmt_get/set_attribute() icu < 4.2 +numfmt_get/set_attribute() --SKIPIF-- - + --FILE-- array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), + 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 2, 12345.123456 ), 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), @@ -159,7 +159,7 @@ Setting attribute: ok New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 Attribute ROUNDING_INCREMENT -Old attribute value: 1.0E-5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 @@ -171,7 +171,7 @@ New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse Attribute PADDING_POSITION Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +New attribute value: 2 ; Format result: '0,012,345.12346************' ; Parse result: 12345.12346 Attribute SECONDARY_GROUPING_SIZE Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 diff --git a/ext/intl/tests/formatter_get_set_attribute2.phpt b/ext/intl/tests/formatter_get_set_attribute2.phpt deleted file mode 100644 index 7d5fe69dca8..00000000000 --- a/ext/intl/tests/formatter_get_set_attribute2.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -numfmt_get/set_attribute() icu >= 4.8 ---SKIPIF-- - - ---FILE-- - array( attr, value ) - $attributes = array( - 'PARSE_INT_ONLY' => array( NumberFormatter::PARSE_INT_ONLY, 1, 12345.123456 ), - 'GROUPING_USED' => array( NumberFormatter::GROUPING_USED, 0, 12345.123456 ), - 'DECIMAL_ALWAYS_SHOWN' => array( NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1, 12345 ), - 'MAX_INTEGER_DIGITS' => array( NumberFormatter::MAX_INTEGER_DIGITS, 2, 12345.123456 ), - 'MIN_INTEGER_DIGITS' => array( NumberFormatter::MIN_INTEGER_DIGITS, 20, 12345.123456 ), - 'INTEGER_DIGITS' => array( NumberFormatter::INTEGER_DIGITS, 7, 12345.123456 ), - 'MAX_FRACTION_DIGITS' => array( NumberFormatter::MAX_FRACTION_DIGITS, 2, 12345.123456 ), - 'MIN_FRACTION_DIGITS' => array( NumberFormatter::MIN_FRACTION_DIGITS, 20, 12345.123456 ), - 'FRACTION_DIGITS' => array( NumberFormatter::FRACTION_DIGITS, 5, 12345.123456 ), - 'MULTIPLIER' => array( NumberFormatter::MULTIPLIER, 2, 12345.123456 ), - 'GROUPING_SIZE' => array( NumberFormatter::GROUPING_SIZE, 2, 12345.123456 ), - 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), - 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), - 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), - 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), - 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), - 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), - 'MAX_SIGNIFICANT_DIGITS' => array( NumberFormatter::MAX_SIGNIFICANT_DIGITS, 4, 12345.123456 ), - // 'LENIENT_PARSE' => array( NumberFormatter::LENIENT_PARSE, 2, 12345.123456 ) - ); - - $res_str = ''; - - $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL ); - - foreach( $attributes as $attr_name => $args ) - { - list( $attr, $new_val, $number ) = $args; - $res_str .= "\nAttribute $attr_name\n"; - - // Get original value of the attribute. - $orig_val = ut_nfmt_get_attribute( $fmt, $attr ); - - // Format the number using the original attribute value. - $rc = ut_nfmt_format( $fmt, $number ); - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "Old attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $orig_val ), - dump( $rc ), - dump( $ps ) ); - - // Set new attribute value. - $rc = ut_nfmt_set_attribute( $fmt, $attr, $new_val ); - if( $rc ) - $res_str .= "Setting attribute: ok\n"; - else - $res_str .= sprintf( "Setting attribute failed: %s\n", ut_nfmt_get_error_message( $fmt ) ); - - // Format the number using the new value. - $rc = ut_nfmt_format( $fmt, $number ); - - // Get current value of the attribute and check if it equals $new_val. - $attr_val_check = ut_nfmt_get_attribute( $fmt, $attr ); - if( $attr_val_check !== $new_val ) - $res_str .= "ERROR: New $attr_name attribute value has not been set correctly.\n"; - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "New attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $new_val ), - dump( $rc ), - dump( $ps ) ); - - - // Restore original attribute of the value - if( $attr != NumberFormatter::INTEGER_DIGITS && $attr != NumberFormatter::FRACTION_DIGITS - && $attr != NumberFormatter::FORMAT_WIDTH && $attr != NumberFormatter::SIGNIFICANT_DIGITS_USED ) - ut_nfmt_set_attribute( $fmt, $attr, $orig_val ); - } - - return $res_str; -} - -include_once( 'ut_common.inc' ); - -// Run the test -ut_run(); - -?> ---EXPECT-- -Attribute PARSE_INT_ONLY -Old attribute value: 0 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345 - -Attribute GROUPING_USED -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 0 ; Format result: '12345.123' ; Parse result: 12345.123 - -Attribute DECIMAL_ALWAYS_SHOWN -Old attribute value: 0 ; Format result: '12,345' ; Parse result: 12345 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.' ; Parse result: 12345 - -Attribute MAX_INTEGER_DIGITS -Old attribute value: 309 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '45.123' ; Parse result: 45.123 - -Attribute MIN_INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '00,000,000,000,000,012,345.123' ; Parse result: 12345.123 - -Attribute INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 7 ; Format result: '0,012,345.123' ; Parse result: 12345.123 - -Attribute MAX_FRACTION_DIGITS -Old attribute value: 3 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,345.12' ; Parse result: 12345.12 - -Attribute MIN_FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '0,012,345.12345600000000000000' ; Parse result: 12345.123456 - -Attribute FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123456' ; Parse result: 12345.123456 -Setting attribute: ok -New attribute value: 5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute MULTIPLIER -Old attribute value: 1 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,024,690.24691' ; Parse result: 12345.123455 - -Attribute GROUPING_SIZE -Old attribute value: 3 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,01,23,45.12346' ; Parse result: 12345.12346 - -Attribute ROUNDING_MODE -Old attribute value: 4 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 - -Attribute ROUNDING_INCREMENT -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 - -Attribute FORMAT_WIDTH -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 - -Attribute PADDING_POSITION -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute SECONDARY_GROUPING_SIZE -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '************00,12,345.12346' ; Parse result: 12345.12346 - -Attribute SIGNIFICANT_DIGITS_USED -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 - -Attribute MIN_SIGNIFICANT_DIGITS -Old attribute value: 1 ; Format result: '**************************1' ; Parse result: 1 -Setting attribute: ok -New attribute value: 3 ; Format result: '***********************1.00' ; Parse result: 1 - -Attribute MAX_SIGNIFICANT_DIGITS -Old attribute value: 6 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 -Setting attribute: ok -New attribute value: 4 ; Format result: '*********************12,350' ; Parse result: 12350 From 52d541a3149d4a21e9f45fa80b26c338636f92c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 6 Jun 2012 11:36:00 +0200 Subject: [PATCH 072/641] Optimization in ext/intl/msgformat Don't transform the string to make it apostrophe friendly in ICU 4.8+ as that it is now the default. --- ext/intl/msgformat/msgformat.c | 2 ++ ext/intl/msgformat/msgformat_attr.c | 2 ++ ext/intl/msgformat/msgformat_class.h | 12 +++++++++--- ext/intl/msgformat/msgformat_data.c | 2 ++ ext/intl/msgformat/msgformat_data.h | 7 +++++-- ext/intl/msgformat/msgformat_format.c | 2 ++ ext/intl/msgformat/msgformat_parse.c | 2 ++ 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 84f14de1bdc..0a01204fae9 100755 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -64,9 +64,11 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) locale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to quote-friendly format"); } +#endif if ((mfo)->mf_data.orig_format) { msgformat_data_free(&mfo->mf_data TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c index cf346651424..ed2dae27d13 100755 --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -82,11 +82,13 @@ PHP_FUNCTION( msgfmt_set_pattern ) intl_convert_utf8_to_utf16(&spattern, &spattern_len, value, value_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" ); +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_set_pattern: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* TODO: add parse error information */ umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h index 0afa792ae3c..b6b8e33226e 100755 --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -19,9 +19,11 @@ #include -#include "intl_common.h" -#include "intl_error.h" -#include "intl_data.h" +#include + +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include "msgformat_data.h" typedef struct { @@ -38,4 +40,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr; #define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 +# define MSG_FORMAT_QUOTE_APOS 1 +#endif + #endif // #ifndef MSG_FORMAT_CLASS_H diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 95e81d3ea74..4f93d6d98c3 100755 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -69,6 +69,7 @@ msgformat_data* msgformat_data_create( TSRMLS_D ) } /* }}} */ +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) { if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) { @@ -86,6 +87,7 @@ int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *e } return SUCCESS; } +#endif /* diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 44001753b35..6479888f8fc 100755 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -19,9 +19,9 @@ #include -#include +#include "../intl_error.h" -#include "intl_error.h" +#include typedef struct { // error hangling @@ -36,6 +36,9 @@ typedef struct { msgformat_data* msgformat_data_create( TSRMLS_D ); void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ); void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC ); + +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec); +#endif #endif // MSG_FORMAT_DATA_H diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index b664c83ec11..9a18ac0a70f 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -154,11 +154,13 @@ PHP_FUNCTION( msgfmt_format_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_format_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 8393d4c6e39..f540b1d0c4a 100755 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -129,11 +129,13 @@ PHP_FUNCTION( msgfmt_parse_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_parse_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); From c1ac3252288c2eeb0b9278458ad15e19912a945a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 6 Jun 2012 12:10:00 +0200 Subject: [PATCH 073/641] Fix ext/intl build on ICU < 4.8 --- ext/intl/msgformat/msgformat_data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 4f93d6d98c3..527c1d4d179 100755 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -21,6 +21,8 @@ #include #include "msgformat_data.h" +#include "msgformat_class.h" + /* {{{ void msgformat_data_init( msgformat_data* mf_data ) * Initialize internals of msgformat_data. */ From 74b4ef5036ccdb2d71a514732c6b521aa2aa62d3 Mon Sep 17 00:00:00 2001 From: Jille Timmermans Date: Wed, 6 Jun 2012 22:34:51 +0200 Subject: [PATCH 074/641] Implement boolval() with a test --- ext/standard/basic_functions.c | 5 ++++ ext/standard/php_type.h | 1 + .../tests/general_functions/boolval.phpt | 29 +++++++++++++++++++ ext/standard/type.c | 15 ++++++++++ 4 files changed, 50 insertions(+) create mode 100644 ext/standard/tests/general_functions/boolval.phpt diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 528e4f65b96..63d40efde44 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2522,6 +2522,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_strval, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0) + ZEND_ARG_INFO(0, var) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() @@ -3045,6 +3049,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(floatval, arginfo_floatval) PHP_FALIAS(doubleval, floatval, arginfo_floatval) PHP_FE(strval, arginfo_strval) + PHP_FE(boolval, arginfo_boolval) PHP_FE(gettype, arginfo_gettype) PHP_FE(settype, arginfo_settype) PHP_FE(is_null, arginfo_is_null) diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h index 1927deded8d..12e916b886a 100644 --- a/ext/standard/php_type.h +++ b/ext/standard/php_type.h @@ -24,6 +24,7 @@ PHP_FUNCTION(intval); PHP_FUNCTION(floatval); PHP_FUNCTION(strval); +PHP_FUNCTION(boolval); PHP_FUNCTION(gettype); PHP_FUNCTION(settype); PHP_FUNCTION(is_null); diff --git a/ext/standard/tests/general_functions/boolval.phpt b/ext/standard/tests/general_functions/boolval.phpt new file mode 100644 index 00000000000..9d0eac4ebd0 --- /dev/null +++ b/ext/standard/tests/general_functions/boolval.phpt @@ -0,0 +1,29 @@ +--TEST-- +Testing boolval() +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/type.c b/ext/standard/type.c index 543fdeac103..59d7314bba7 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -176,6 +176,21 @@ PHP_FUNCTION(floatval) } /* }}} */ +/* {{{ proto bool boolval(mixed var) + Get the boolean value of a variable */ +PHP_FUNCTION(boolval) +{ + zval **val; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &val) == FAILURE) { + return; + } + + RETVAL_ZVAL(*val, 1, 0); + convert_to_boolean(return_value); +} +/* }}} */ + /* {{{ proto string strval(mixed var) Get the string value of a variable */ PHP_FUNCTION(strval) From db1e425b1aecb152498bf908f188d5041767a33a Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 6 Jun 2012 23:00:33 -0700 Subject: [PATCH 075/641] restore NEWS --- NEWS | 84 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index 363a8b7f252..d3448e950b7 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,58 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2012, PHP 5.4.5 + +- Core: + . Fixed bug #61998 (Using traits with method aliases appears to result in + crash during execution). (Dmitry) + +- EXIF: + . Fixed information leak in ext exif (discovered by Martin Noga, + Matthew "j00ru" Jurczyk, Gynvael Coldwind) + +- FPM + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) + . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) + . Fixed bug #62153 (when using unix sockets, multiples FPM instances + . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). + (fat) + . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) + . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) + . Fixed bug #61295 (php-fpm should not fail with commented 'user' + . Fixed bug #61218 (FPM drops connection while receiving some binary values + in FastCGI requests). (fat) + . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + for non-root start). (fat) + . Fixed bug #61026 (FPM pools can listen on the same address). (fat) + can be launched without errors). (fat) + +- Iconv: + . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) + +- Intl + . ResourceBundle constructor now accepts NULL for the first two arguments. + (Gustavo) + +- Readline: + . Fixed bug #62186 (readline fails to compile - void function should not + return a value). (Johannes) + +- Reflection: + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) + +- Sockets: + . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) + +- XML Writer: + . Fixed bug #62064 (memory leak in the XML Writer module). + (jean-pierre dot lozi at lip6 dot fr) + ?? ??? 2012, PHP 5.4.4 +- COM: + . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) + - CLI Server: . Implemented FR #61977 (Need CLI web-server support for files with .htm & svg extensions). (Sixd, Laruence) @@ -17,10 +68,10 @@ PHP NEWS - Core: . Fixed missing bound check in iptcparse(). (chris at chiappa.net) + . Fixed CVE-2012-2143. (Solar Designer) + . Fixed bug #62097 (fix for for bug #54547). (Gustavo) . Fixed bug #62005 (unexpected behavior when incrementally assigning to a member of a null object). (Laruence) - . Fixed bug #61998 (Using traits with method aliases appears to result in - crash during execution). (Dmitry) . Fixed bug #61978 (Object recursion not detected for classes that implement JsonSerializable). (Felipe) . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) @@ -45,7 +96,7 @@ PHP NEWS . Changed php://fd to be available only for CLI. - Phar: - . Fix bug #61065 (Secunia SA44335). (Rasmus) + . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) - Pgsql: . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) @@ -54,36 +105,13 @@ PHP NEWS . Fixed bug #61812 (Uninitialised value used in libmagic). (Laruence, Gustavo) -- FPM - . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) - . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - . Fixed bug #61295 (php-fpm should not fail with commented 'user' - for non-root start). (fat) - . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) - . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). - (fat) - . Fixed bug #62153 (when using unix sockets, multiples FPM instances - can be launched without errors). (fat) - . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - . Fixed bug #61218 (FPM drops connection while receiving some binary values - in FastCGI requests). (fat) - . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - - Intl - . ResourceBundle constructor now accepts NULL for the first two arguments. - (Gustavo) + . Fixed bug #62082 (Memory corruption in internal function + get_icu_disp_value_src_php()). (Gustavo) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). (Laruence) - -- Sockets: - . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) - -- XML Writer: - . Fixed bug #62064 (memory leak in the XML Writer module). - (jean-pierre dot lozi at lip6 dot fr) - Zlib: . Fixed bug #61820 (using ob_gzhandler will complain about headers already From e118a0794a93e54d97ac42636e56c9b7e5904ecd Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 6 Jun 2012 23:20:14 -0700 Subject: [PATCH 076/641] merge 5.3 entries --- NEWS | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d3448e950b7..9ab8b622ab9 100644 --- a/NEWS +++ b/NEWS @@ -30,16 +30,22 @@ PHP NEWS . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) - Intl + . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) . ResourceBundle constructor now accepts NULL for the first two arguments. (Gustavo) + . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called + twice). (Gustavo) + . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) + . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks + pattern). (Gustavo) - Readline: . Fixed bug #62186 (readline fails to compile - void function should not return a value). (Johannes) - Reflection: - . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks - with constant). (Laruence) + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) - Sockets: . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) @@ -104,6 +110,10 @@ PHP NEWS - Fileinfo . Fixed bug #61812 (Uninitialised value used in libmagic). (Laruence, Gustavo) + . Fixed bug #61566 failure caused by the posix lseek and read versions + under windows in cdf_read(). (Anatoliy) + . Fixed bug #61565 where php_stream_open_wrapper_ex tries to open a + directory descriptor under windows. (Anatoliy) - Intl . Fixed bug #62082 (Memory corruption in internal function @@ -697,6 +707,14 @@ PHP NEWS . Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression). (Mike) +08 May 2012, PHP 5.3.13 +- CGI + . Improve fix for PHP-CGI query string parameter vulnerability, CVE-2012-2311. + (Stas) + +03 May 2012, PHP 5.3.12 +- Fix PHP-CGI query string parameter vulnerability, CVE-2012-1823. (Rasmus) + 26 Apr 2012, PHP 5.3.11 - Core: From d9810af45ae9e3cbd2c97543b5dfa2d7c93e81c1 Mon Sep 17 00:00:00 2001 From: slayercat Date: Wed, 23 May 2012 20:30:16 +0800 Subject: [PATCH 077/641] based on microsoft's description,the direct convert from FILETIME struct to __int64 is unsafe. via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx "Do not cast a pointer to a FILETIME structure to either a ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows." --- win32/time.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/win32/time.c b/win32/time.c index a376fd61be0..8b847b09ff0 100644 --- a/win32/time.c +++ b/win32/time.c @@ -1,4 +1,3 @@ - /***************************************************************************** * * * DH_TIME.C * @@ -37,10 +36,21 @@ int getfilesystemtime(struct timeval *time_Info) { FILETIME ft; __int64 ff; +ULARGE_INTEGER convFromft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ /* resolution seems to be 0.01 sec */ - ff = *(__int64*)(&ft); + /* ff = *(__int64*)(&ft); */ + /* + Do not cast a pointer to a FILETIME structure to either a + ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. + + via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx + */ + convFromft.HighPart = ft.dwHighDateTime; + convFromft.LowPart = ft.dwLowDateTime; + ff = convFromft.QuadPart; + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); time_Info->tv_usec = (int)(ff % 10000000)/10; return 0; From 6ecc9f1d9dfbfa264725aabcf52b75e31ce59deb Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 7 Jun 2012 14:31:35 +0800 Subject: [PATCH 078/641] Remove unused codes --- win32/time.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/win32/time.c b/win32/time.c index 8b847b09ff0..391a8a81e99 100644 --- a/win32/time.c +++ b/win32/time.c @@ -34,23 +34,21 @@ int getfilesystemtime(struct timeval *time_Info) { -FILETIME ft; -__int64 ff; -ULARGE_INTEGER convFromft; + FILETIME ft; + __int64 ff; + ULARGE_INTEGER convFromft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ - /* resolution seems to be 0.01 sec */ - /* ff = *(__int64*)(&ft); */ + /* resolution seems to be 0.01 sec */ /* - Do not cast a pointer to a FILETIME structure to either a - ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. - - via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx + * Do not cast a pointer to a FILETIME structure to either a + * ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. + * via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx */ convFromft.HighPart = ft.dwHighDateTime; convFromft.LowPart = ft.dwLowDateTime; ff = convFromft.QuadPart; - + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); time_Info->tv_usec = (int)(ff % 10000000)/10; return 0; From 6af01ed5a0a2be2aa2fb7bd39ad1e3c286d54cf5 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 7 Jun 2012 09:37:26 +0200 Subject: [PATCH 079/641] NEWS entry for boolval() --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 87ecf08bfc3..3adefae873e 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ PHP NEWS (Nikita Popov) - Core: + . Added boolval(). (Jille Timmermans). . Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence). . Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected). (srgoogleguy, Gustavo) From c56ff39c05be5b846973760ef8bdad8401defe24 Mon Sep 17 00:00:00 2001 From: Till Klampaeckel Date: Wed, 6 Jun 2012 19:49:47 +0300 Subject: [PATCH 080/641] Don't depend on a fixed path for PHP shebang but use /usr/bin/env (cherry picked from commit 89c5d981603ed4a2a54f86c20cec4f263c58ded6) --- run-tests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-tests.php b/run-tests.php index 2b37ec4f4af..9a01f56c975 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/bin/env php Date: Thu, 7 Jun 2012 17:44:20 +0200 Subject: [PATCH 081/641] Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includes a semi-colon) Modify the scanner to check if the first char of the raw data is an opening " in which case we need to find the closing one. Otherwise just search for the next end of value char [\r\n;\000] --- NEWS | 4 ++++ Zend/zend_ini_scanner.l | 33 ++++++++++++++++++++++----- ext/standard/tests/file/bug51094.phpt | 22 ++++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 ext/standard/tests/file/bug51094.phpt diff --git a/NEWS b/NEWS index 42eb5b464ea..a6b41f4cec1 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.3.15 +- Zend Engine: + . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that + includes a semi-colon). (Pierrick) + - COM: . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 0c452e659bf..8aeb076eab0 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -347,7 +347,7 @@ DOLLAR_CURLY "${" SECTION_RAW_CHARS [^\]\n\r] SINGLE_QUOTED_CHARS [^'] -RAW_VALUE_CHARS [^\n\r;\000] +RAW_VALUE_CHARS [^"\n\r;\000] LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR}))) VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR}) @@ -445,12 +445,33 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) return '='; } -{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; +["] { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} + +{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } diff --git a/ext/standard/tests/file/bug51094.phpt b/ext/standard/tests/file/bug51094.phpt new file mode 100644 index 00000000000..78235587227 --- /dev/null +++ b/ext/standard/tests/file/bug51094.phpt @@ -0,0 +1,22 @@ +--TEST-- +Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includes a semi-colon). +--FILE-- + Date: Thu, 7 Jun 2012 18:02:27 +0200 Subject: [PATCH 082/641] Regenerated files --- Zend/zend_ini_scanner.c | 3186 +++++++++++++++++----------------- Zend/zend_ini_scanner_defs.h | 2 +- 2 files changed, 1613 insertions(+), 1575 deletions(-) diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index de61aa24179..26f98748eb5 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:07:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:37:03 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -481,7 +481,7 @@ yy4: yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 547 "Zend/zend_ini_scanner.l" +#line 568 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; @@ -493,7 +493,7 @@ yy6: yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 552 "Zend/zend_ini_scanner.l" +#line 573 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; @@ -533,7 +533,7 @@ yy10: ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 475 "Zend/zend_ini_scanner.l" +#line 496 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } @@ -554,7 +554,7 @@ yy14: goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -926,7 +926,7 @@ yy55: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; @@ -1012,7 +1012,7 @@ yy64: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 563 "Zend/zend_ini_scanner.l" +#line 584 "Zend/zend_ini_scanner.l" { /* #Comment */ zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); BEGIN(INITIAL); @@ -1159,7 +1159,7 @@ yyc_ST_DOUBLE_QUOTES: yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 507 "Zend/zend_ini_scanner.l" +#line 528 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1204,7 +1204,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 502 "Zend/zend_ini_scanner.l" +#line 523 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; @@ -1323,7 +1323,7 @@ yy86: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" +#line 514 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } @@ -1344,7 +1344,7 @@ yy89: yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -1355,7 +1355,7 @@ yy91: yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; @@ -1422,7 +1422,7 @@ yy97: yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } @@ -1452,7 +1452,7 @@ yy99: yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } @@ -1833,7 +1833,7 @@ yyc_ST_RAW: 160, 224, 0, 160, 160, 0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 224, 160, 160, 160, 160, 160, 160, 160, + 224, 160, 32, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 32, 160, 160, 160, 160, @@ -1865,66 +1865,64 @@ yyc_ST_RAW: YYDEBUG(135, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy139; - } else { - if (yych <= '\t') goto yy141; - if (yych <= '\n') goto yy142; - goto yy139; - } - } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy144; - if (yych <= 0x1F) goto yy139; + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy137; + if (yych <= 0x08) goto yy139; goto yy141; } else { - if (yych == ';') goto yy145; + if (yych <= '\n') goto yy142; + if (yych <= '\f') goto yy139; + goto yy144; + } + } else { + if (yych <= '!') { + if (yych == ' ') goto yy141; + goto yy139; + } else { + if (yych <= '"') goto yy145; + if (yych == ';') goto yy147; goto yy139; } } +yy137: YYDEBUG(137, *YYCURSOR); ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1896 "Zend/zend_ini_scanner.c" +#line 1899 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy156; + goto yy158; yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 448 "Zend/zend_ini_scanner.l" +#line 474 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1914 "Zend/zend_ini_scanner.c" +#line 1912 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { - goto yy152; + goto yy154; } if (yych <= '\f') { - if (yych == '\n') goto yy151; - goto yy156; + if (yych == '\n') goto yy153; + goto yy158; } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy156; + if (yych <= '\r') goto yy156; + if (yych == ';') goto yy148; + goto yy158; } yy142: YYDEBUG(142, *YYCURSOR); @@ -1932,89 +1930,129 @@ yy142: yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1942 "Zend/zend_ini_scanner.c" +#line 1940 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy151; + if (yych == '\n') goto yy153; goto yy143; yy145: YYDEBUG(145, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy147; -yy146: - YYDEBUG(146, *YYCURSOR); ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 448 "Zend/zend_ini_scanner.l" + { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } + } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1977 "Zend/zend_ini_scanner.c" yy147: YYDEBUG(147, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy146; - } - if (yych >= '\r') goto yy150; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy149; yy148: YYDEBUG(148, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy149: YYDEBUG(149, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy148; + } + if (yych >= '\r') goto yy152; +yy150: + YYDEBUG(150, *YYCURSOR); + ++YYCURSOR; +yy151: + YYDEBUG(151, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1976 "Zend/zend_ini_scanner.c" -yy150: - YYDEBUG(150, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy148; - goto yy149; -yy151: - YYDEBUG(151, *YYCURSOR); - yych = *++YYCURSOR; - goto yy143; +#line 2006 "Zend/zend_ini_scanner.c" yy152: YYDEBUG(152, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy150; + goto yy151; +yy153: + YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + goto yy143; +yy154: + YYDEBUG(154, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(153, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy152; - } - if (yych <= '\f') { - if (yych <= 0x00) goto yy140; - if (yych == '\n') goto yy151; - goto yy155; - } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy155; - } -yy154: - YYDEBUG(154, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy151; - goto yy143; -yy155: YYDEBUG(155, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy154; + } + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy140; + goto yy157; + } else { + if (yych <= '\n') goto yy153; + if (yych <= '\f') goto yy157; + } + } else { + if (yych <= '"') { + if (yych <= '!') goto yy157; + goto yy140; + } else { + if (yych == ';') goto yy148; + goto yy157; + } + } +yy156: + YYDEBUG(156, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy153; + goto yy143; +yy157: + YYDEBUG(157, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy156: - YYDEBUG(156, *YYCURSOR); +yy158: + YYDEBUG(158, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy155; + goto yy157; } goto yy140; } @@ -2055,85 +2093,85 @@ yyc_ST_SECTION_RAW: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(157, *YYCURSOR); + YYDEBUG(159, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '\f') { - if (yych == '\n') goto yy161; + if (yych == '\n') goto yy163; } else { - if (yych <= '\r') goto yy161; - if (yych == ']') goto yy163; + if (yych <= '\r') goto yy163; + if (yych == ']') goto yy165; } - YYDEBUG(159, *YYCURSOR); + YYDEBUG(161, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy170; -yy160: - YYDEBUG(160, *YYCURSOR); + goto yy172; +yy162: + YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 457 "Zend/zend_ini_scanner.l" +#line 478 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2079 "Zend/zend_ini_scanner.c" -yy161: - YYDEBUG(161, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(162, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2089 "Zend/zend_ini_scanner.c" +#line 2117 "Zend/zend_ini_scanner.c" yy163: YYDEBUG(163, *YYCURSOR); ++YYCURSOR; - yych = *YYCURSOR; - goto yy166; -yy164: YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2127 "Zend/zend_ini_scanner.c" +yy165: + YYDEBUG(165, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy168; +yy166: + YYDEBUG(166, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2104 "Zend/zend_ini_scanner.c" -yy165: - YYDEBUG(165, *YYCURSOR); +#line 2142 "Zend/zend_ini_scanner.c" +yy167: + YYDEBUG(167, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy166: - YYDEBUG(166, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy165; - } - if (yych == '\n') goto yy167; - if (yych == '\r') goto yy168; - goto yy164; -yy167: - YYDEBUG(167, *YYCURSOR); - yych = *++YYCURSOR; - goto yy164; yy168: YYDEBUG(168, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy167; - goto yy164; + if (yybm[0+yych] & 64) { + goto yy167; + } + if (yych == '\n') goto yy169; + if (yych == '\r') goto yy170; + goto yy166; yy169: YYDEBUG(169, *YYCURSOR); + yych = *++YYCURSOR; + goto yy166; +yy170: + YYDEBUG(170, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy169; + goto yy166; +yy171: + YYDEBUG(171, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy170: - YYDEBUG(170, *YYCURSOR); +yy172: + YYDEBUG(172, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy169; + goto yy171; } - goto yy160; + goto yy162; } /* *********************************** */ yyc_ST_SECTION_VALUE: @@ -2172,203 +2210,203 @@ yyc_ST_SECTION_VALUE: 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, }; - YYDEBUG(171, *YYCURSOR); + YYDEBUG(173, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '-') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x08) goto yy173; - if (yych <= '\t') goto yy175; - goto yy176; + if (yych <= 0x08) goto yy175; + if (yych <= '\t') goto yy177; + goto yy178; } else { - if (yych == '\r') goto yy176; - if (yych >= ' ') goto yy175; + if (yych == '\r') goto yy178; + if (yych >= ' ') goto yy177; } } else { if (yych <= '$') { - if (yych == '"') goto yy178; - if (yych >= '$') goto yy180; + if (yych == '"') goto yy180; + if (yych >= '$') goto yy182; } else { - if (yych == '\'') goto yy181; - if (yych >= '-') goto yy182; + if (yych == '\'') goto yy183; + if (yych >= '-') goto yy184; } } } else { if (yych <= 'Z') { if (yych <= '9') { - if (yych <= '.') goto yy183; - if (yych >= '0') goto yy184; + if (yych <= '.') goto yy185; + if (yych >= '0') goto yy186; } else { - if (yych == ';') goto yy176; - if (yych >= 'A') goto yy186; + if (yych == ';') goto yy178; + if (yych >= 'A') goto yy188; } } else { if (yych <= '^') { - if (yych <= '[') goto yy173; - if (yych <= '\\') goto yy188; - if (yych <= ']') goto yy189; + if (yych <= '[') goto yy175; + if (yych <= '\\') goto yy190; + if (yych <= ']') goto yy191; } else { - if (yych == '`') goto yy173; - if (yych <= 'z') goto yy186; + if (yych == '`') goto yy175; + if (yych <= 'z') goto yy188; } } } -yy173: - YYDEBUG(173, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy196; -yy174: - YYDEBUG(174, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" - { /* Get rest as section/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2230 "Zend/zend_ini_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 0x1F) { - if (yych == '\t') goto yy222; - goto yy196; - } else { - if (yych <= ' ') goto yy222; - if (yych == '"') goto yy224; - goto yy196; - } + goto yy198; yy176: YYDEBUG(176, *YYCURSOR); - ++YYCURSOR; + yyleng = YYCURSOR - SCNG(yy_text); +#line 514 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2268 "Zend/zend_ini_scanner.c" yy177: YYDEBUG(177, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2253 "Zend/zend_ini_scanner.c" + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy224; + goto yy198; + } else { + if (yych <= ' ') goto yy224; + if (yych == '"') goto yy226; + goto yy198; + } yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2291 "Zend/zend_ini_scanner.c" +yy180: + YYDEBUG(180, *YYCURSOR); + ++YYCURSOR; +yy181: + YYDEBUG(181, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2265 "Zend/zend_ini_scanner.c" -yy180: - YYDEBUG(180, *YYCURSOR); +#line 2303 "Zend/zend_ini_scanner.c" +yy182: + YYDEBUG(182, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy177; - if (yych <= '[') goto yy195; - goto yy200; + if (yych <= 0x00) goto yy179; + if (yych <= '[') goto yy197; + goto yy202; } else { - if (yych == '{') goto yy220; - goto yy195; + if (yych == '{') goto yy222; + goto yy197; } -yy181: - YYDEBUG(181, *YYCURSOR); +yy183: + YYDEBUG(183, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy216; + goto yy218; } - goto yy177; -yy182: - YYDEBUG(182, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy214; - goto yy196; -yy183: - YYDEBUG(183, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy212; - goto yy196; + goto yy179; yy184: YYDEBUG(184, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy216; + goto yy198; +yy185: + YYDEBUG(185, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy214; + goto yy198; +yy186: + YYDEBUG(186, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '\'') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy196; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy198; } else { - if (yych == '"') goto yy185; - if (yych <= '&') goto yy196; + if (yych == '"') goto yy187; + if (yych <= '&') goto yy198; } } else { if (yych <= '9') { - if (yych == '.') goto yy208; - if (yych <= '/') goto yy196; - goto yy210; + if (yych == '.') goto yy210; + if (yych <= '/') goto yy198; + goto yy212; } else { if (yych <= ';') { - if (yych <= ':') goto yy196; + if (yych <= ':') goto yy198; } else { - if (yych != ']') goto yy196; + if (yych != ']') goto yy198; } } } -yy185: - YYDEBUG(185, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 2331 "Zend/zend_ini_scanner.c" -yy186: - YYDEBUG(186, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '"') { - if (yych <= '\f') { - if (yych != '\n') goto yy196; - } else { - if (yych <= '\r') goto yy187; - if (yych <= '!') goto yy196; - } - } else { - if (yych <= ':') { - if (yych != '\'') goto yy196; - } else { - if (yych <= ';') goto yy187; - if (yych != ']') goto yy196; - } - } yy187: YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2369 "Zend/zend_ini_scanner.c" +yy188: + YYDEBUG(188, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy208; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy198; + } else { + if (yych <= '\r') goto yy189; + if (yych <= '!') goto yy198; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy198; + } else { + if (yych <= ';') goto yy189; + if (yych != ']') goto yy198; + } + } +yy189: + YYDEBUG(189, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2361 "Zend/zend_ini_scanner.c" -yy188: - YYDEBUG(188, *YYCURSOR); - yych = *++YYCURSOR; - goto yy195; -yy189: - YYDEBUG(189, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy192; +#line 2399 "Zend/zend_ini_scanner.c" yy190: YYDEBUG(190, *YYCURSOR); + yych = *++YYCURSOR; + goto yy197; +yy191: + YYDEBUG(191, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy194; +yy192: + YYDEBUG(192, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ @@ -2376,97 +2414,86 @@ yy190: SCNG(lineno)++; return ']'; } -#line 2380 "Zend/zend_ini_scanner.c" -yy191: - YYDEBUG(191, *YYCURSOR); +#line 2418 "Zend/zend_ini_scanner.c" +yy193: + YYDEBUG(193, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy192: - YYDEBUG(192, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy191; - } - if (yych == '\n') goto yy193; - if (yych == '\r') goto yy194; - goto yy190; -yy193: - YYDEBUG(193, *YYCURSOR); - yych = *++YYCURSOR; - goto yy190; yy194: YYDEBUG(194, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy193; - goto yy190; + if (yybm[0+yych] & 2) { + goto yy193; + } + if (yych == '\n') goto yy195; + if (yych == '\r') goto yy196; + goto yy192; yy195: YYDEBUG(195, *YYCURSOR); + yych = *++YYCURSOR; + goto yy192; +yy196: + YYDEBUG(196, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy195; + goto yy192; +yy197: + YYDEBUG(197, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy196: - YYDEBUG(196, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy195; - } - if (yych == '$') goto yy198; - if (yych != '\\') goto yy174; -yy197: - YYDEBUG(197, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - goto yy195; yy198: YYDEBUG(198, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy197; + } + if (yych == '$') goto yy200; + if (yych != '\\') goto yy176; +yy199: + YYDEBUG(199, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy199; - if (yych <= '[') goto yy195; - goto yy200; - } else { - if (yych != '{') goto yy195; - } -yy199: - YYDEBUG(199, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy174; - } else { - goto yy177; - } - } else { - if (yyaccept <= 2) { - goto yy185; - } else { - goto yy187; - } - } + goto yy197; yy200: YYDEBUG(200, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; + if (yych <= '\\') { + if (yych <= 0x00) goto yy201; + if (yych <= '[') goto yy197; + goto yy202; + } else { + if (yych != '{') goto yy197; } - if (yych == '\\') goto yy203; - goto yy195; yy201: YYDEBUG(201, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy176; + } else { + goto yy179; + } + } else { + if (yyaccept <= 2) { + goto yy187; + } else { + goto yy189; + } + } +yy202: + YYDEBUG(202, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(202, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } if (yych == '\\') goto yy205; - goto yy195; + goto yy197; yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -2474,82 +2501,61 @@ yy203: yych = *YYCURSOR; YYDEBUG(204, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } - if (yych == '\\') goto yy203; - goto yy195; + if (yych == '\\') goto yy207; + goto yy197; yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; - } - if (yych == '\\') goto yy203; - goto yy195; -yy206: YYDEBUG(206, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy207: + YYDEBUG(207, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy208: + YYDEBUG(208, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(207, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy187; - if (yych <= '\f') goto yy195; - goto yy187; - } else { - if (yych == '"') goto yy187; - if (yych <= '#') goto yy195; - goto yy198; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy187; - if (yych <= ':') goto yy195; - goto yy187; - } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy187; - goto yy195; - } - } -yy208: - YYDEBUG(208, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; YYDEBUG(209, *YYCURSOR); - if (yybm[0+yych] & 64) { + if (yybm[0+yych] & 32) { goto yy208; } if (yych <= '$') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy189; + if (yych <= '\f') goto yy197; + goto yy189; } else { - if (yych == '"') goto yy185; - if (yych <= '#') goto yy195; - goto yy198; + if (yych == '"') goto yy189; + if (yych <= '#') goto yy197; + goto yy200; } } else { if (yych <= ';') { - if (yych == '\'') goto yy185; - if (yych <= ':') goto yy195; - goto yy185; + if (yych == '\'') goto yy189; + if (yych <= ':') goto yy197; + goto yy189; } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy189; + goto yy197; } } yy210: @@ -2559,44 +2565,29 @@ yy210: YYFILL(1); yych = *YYCURSOR; YYDEBUG(211, *YYCURSOR); - if (yych <= '\'') { - if (yych <= '!') { - if (yych <= '\n') { - if (yych <= '\t') goto yy195; - goto yy185; - } else { - if (yych == '\r') goto yy185; - goto yy195; - } + if (yybm[0+yych] & 64) { + goto yy210; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { - if (yych <= '#') { - if (yych <= '"') goto yy185; - goto yy195; - } else { - if (yych <= '$') goto yy198; - if (yych <= '&') goto yy195; - goto yy185; - } + if (yych == '"') goto yy187; + if (yych <= '#') goto yy197; + goto yy200; } } else { - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy195; - goto yy208; - } else { - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy210; - goto yy195; - } + if (yych <= ';') { + if (yych == '\'') goto yy187; + if (yych <= ':') goto yy197; + goto yy187; } else { - if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; - } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; - } + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } yy212: @@ -2606,34 +2597,43 @@ yy212: YYFILL(1); yych = *YYCURSOR; YYDEBUG(213, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '\r') goto yy187; + goto yy197; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy187; + goto yy197; + } else { + if (yych <= '$') goto yy200; + if (yych <= '&') goto yy197; + goto yy187; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy212; - goto yy195; + if (yych <= '.') { + if (yych <= '-') goto yy197; + goto yy210; + } else { + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy212; + goto yy197; + } } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } @@ -2646,47 +2646,85 @@ yy214: YYDEBUG(215, *YYCURSOR); if (yych <= '&') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '!') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '$') goto yy200; + goto yy197; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; if (yych <= '9') goto yy214; - goto yy195; + goto yy197; } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } yy216: YYDEBUG(216, *YYCURSOR); - ++YYCURSOR; + yyaccept = 2; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(217, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy216; + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy197; + goto yy187; + } else { + if (yych == '$') goto yy200; + goto yy197; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy216; + goto yy197; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy187; + goto yy197; + } else { + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; + } + } } +yy218: YYDEBUG(218, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(219, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy218; + } + YYDEBUG(220, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -2697,65 +2735,65 @@ yy216: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2701 "Zend/zend_ini_scanner.c" -yy220: - YYDEBUG(220, *YYCURSOR); +#line 2739 "Zend/zend_ini_scanner.c" +yy222: + YYDEBUG(222, *YYCURSOR); ++YYCURSOR; - YYDEBUG(221, *YYCURSOR); + YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 2712 "Zend/zend_ini_scanner.c" -yy222: - YYDEBUG(222, *YYCURSOR); +#line 2750 "Zend/zend_ini_scanner.c" +yy224: + YYDEBUG(224, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(223, *YYCURSOR); + YYDEBUG(225, *YYCURSOR); if (yych <= '"') { if (yych <= '\f') { - if (yych <= 0x08) goto yy195; - if (yych <= '\t') goto yy222; - if (yych <= '\n') goto yy174; - goto yy195; + if (yych <= 0x08) goto yy197; + if (yych <= '\t') goto yy224; + if (yych <= '\n') goto yy176; + goto yy197; } else { if (yych <= 0x1F) { - if (yych <= '\r') goto yy174; - goto yy195; + if (yych <= '\r') goto yy176; + goto yy197; } else { - if (yych <= ' ') goto yy222; - if (yych <= '!') goto yy195; + if (yych <= ' ') goto yy224; + if (yych <= '!') goto yy197; } } } else { if (yych <= ':') { if (yych <= '$') { - if (yych <= '#') goto yy195; - goto yy198; + if (yych <= '#') goto yy197; + goto yy200; } else { - if (yych == '\'') goto yy174; - goto yy195; + if (yych == '\'') goto yy176; + goto yy197; } } else { if (yych <= '[') { - if (yych <= ';') goto yy174; - goto yy195; + if (yych <= ';') goto yy176; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy174; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy176; + goto yy197; } } } -yy224: - YYDEBUG(224, *YYCURSOR); +yy226: + YYDEBUG(226, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy179; + goto yy181; } /* *********************************** */ yyc_ST_VALUE: @@ -2794,27 +2832,27 @@ yyc_ST_VALUE: 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, }; - YYDEBUG(225, *YYCURSOR); + YYDEBUG(227, *YYCURSOR); YYFILL(6); yych = *YYCURSOR; YYDEBUG(-1, yych); switch (yych) { - case 0x00: goto yy227; + case 0x00: goto yy229; case '\t': - case ' ': goto yy231; - case '\n': goto yy233; - case '\r': goto yy235; + case ' ': goto yy233; + case '\n': goto yy235; + case '\r': goto yy237; case '!': case '&': case '(': case ')': case '|': - case '~': goto yy236; - case '"': goto yy238; - case '$': goto yy240; - case '\'': goto yy241; - case '-': goto yy242; - case '.': goto yy243; + case '~': goto yy238; + case '"': goto yy240; + case '$': goto yy242; + case '\'': goto yy243; + case '-': goto yy244; + case '.': goto yy245; case '0': case '1': case '2': @@ -2824,9 +2862,9 @@ yyc_ST_VALUE: case '6': case '7': case '8': - case '9': goto yy244; - case ';': goto yy246; - case '=': goto yy247; + case '9': goto yy246; + case ';': goto yy248; + case '=': goto yy249; case 'A': case 'B': case 'C': @@ -2869,405 +2907,283 @@ yyc_ST_VALUE: case 'v': case 'w': case 'x': - case 'z': goto yy249; + case 'z': goto yy251; case 'F': - case 'f': goto yy251; + case 'f': goto yy253; case 'N': - case 'n': goto yy252; + case 'n': goto yy254; case 'O': - case 'o': goto yy253; + case 'o': goto yy255; case 'T': - case 't': goto yy254; + case 't': goto yy256; case 'Y': - case 'y': goto yy255; - default: goto yy229; + case 'y': goto yy257; + default: goto yy231; } -yy227: - YYDEBUG(227, *YYCURSOR); +yy229: + YYDEBUG(229, *YYCURSOR); ++YYCURSOR; -yy228: - YYDEBUG(228, *YYCURSOR); +yy230: + YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2897 "Zend/zend_ini_scanner.c" -yy229: - YYDEBUG(229, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy257; -yy230: - YYDEBUG(230, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" - { /* Get everything else as option/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2910 "Zend/zend_ini_scanner.c" +#line 2935 "Zend/zend_ini_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); - yyaccept = 1; + yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy307; + goto yy259; yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 543 "Zend/zend_ini_scanner.l" - { - RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +#line 510 "Zend/zend_ini_scanner.l" + { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2923 "Zend/zend_ini_scanner.c" +#line 2948 "Zend/zend_ini_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); - ++YYCURSOR; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy309; yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 564 "Zend/zend_ini_scanner.l" + { + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} +#line 2961 "Zend/zend_ini_scanner.c" +yy235: + YYDEBUG(235, *YYCURSOR); + ++YYCURSOR; +yy236: + YYDEBUG(236, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2936 "Zend/zend_ini_scanner.c" -yy235: - YYDEBUG(235, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy305; - goto yy234; -yy236: - YYDEBUG(236, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy304; +#line 2974 "Zend/zend_ini_scanner.c" yy237: YYDEBUG(237, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 479 "Zend/zend_ini_scanner.l" - { /* Boolean operators */ - return yytext[0]; -} -#line 2954 "Zend/zend_ini_scanner.c" + yych = *++YYCURSOR; + if (yych == '\n') goto yy307; + goto yy236; yy238: YYDEBUG(238, *YYCURSOR); ++YYCURSOR; + yych = *YYCURSOR; + goto yy306; yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 500 "Zend/zend_ini_scanner.l" + { /* Boolean operators */ + return yytext[0]; +} +#line 2992 "Zend/zend_ini_scanner.c" +yy240: + YYDEBUG(240, *YYCURSOR); + ++YYCURSOR; +yy241: + YYDEBUG(241, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2966 "Zend/zend_ini_scanner.c" -yy240: - YYDEBUG(240, *YYCURSOR); +#line 3004 "Zend/zend_ini_scanner.c" +yy242: + YYDEBUG(242, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy228; - if (yych <= '[') goto yy256; - goto yy263; + if (yych <= 0x00) goto yy230; + if (yych <= '[') goto yy258; + goto yy265; } else { - if (yych == '{') goto yy301; - goto yy256; + if (yych == '{') goto yy303; + goto yy258; } -yy241: - YYDEBUG(241, *YYCURSOR); +yy243: + YYDEBUG(243, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy297; + goto yy299; } - goto yy228; -yy242: - YYDEBUG(242, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy295; - goto yy257; -yy243: - YYDEBUG(243, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy293; - goto yy257; + goto yy230; yy244: YYDEBUG(244, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy297; + goto yy259; +yy245: + YYDEBUG(245, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy295; + goto yy259; +yy246: + YYDEBUG(246, *YYCURSOR); yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '.') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych >= 0x01) goto yy259; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy257; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy259; } } else { if (yych <= '%') { - if (yych <= 0x1F) goto yy257; - if (yych >= '#') goto yy257; + if (yych <= 0x1F) goto yy259; + if (yych >= '#') goto yy259; } else { - if (yych <= ')') goto yy245; - if (yych <= '-') goto yy257; - goto yy289; + if (yych <= ')') goto yy247; + if (yych <= '-') goto yy259; + goto yy291; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy257; - goto yy291; + if (yych <= '/') goto yy259; + goto yy293; } else { - if (yych != ';') goto yy257; + if (yych != ';') goto yy259; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy257; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy245: - YYDEBUG(245, *YYCURSOR); +yy247: + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3046 "Zend/zend_ini_scanner.c" -yy246: - YYDEBUG(246, *YYCURSOR); +#line 3084 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - goto yy285; -yy247: - YYDEBUG(247, *YYCURSOR); + goto yy287; +yy249: + YYDEBUG(249, *YYCURSOR); ++YYCURSOR; - YYDEBUG(248, *YYCURSOR); + YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 483 "Zend/zend_ini_scanner.l" +#line 504 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3063 "Zend/zend_ini_scanner.c" -yy249: - YYDEBUG(249, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= ')') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych >= '\v') goto yy257; - } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; - } else { - if (yych <= '"') goto yy250; - if (yych <= '%') goto yy257; - } - } - } else { - if (yych <= '=') { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - } else { - if (yych != '~') goto yy257; - } - } - } -yy250: - YYDEBUG(250, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 3103 "Zend/zend_ini_scanner.c" +#line 3101 "Zend/zend_ini_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '<') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= ')') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych >= '\v') goto yy259; } else { - if (yych <= '/') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - goto yy257; + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy250; - goto yy257; + if (yych <= '"') goto yy252; + if (yych <= '%') goto yy259; } } } else { - if (yych <= '`') { - if (yych <= 'A') { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy281; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } + if (yych <= '=') { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; } else { - if (yych <= '{') { - if (yych <= 'a') goto yy281; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych != '~') goto yy259; } } } yy252: YYDEBUG(252, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'N') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; - } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; - } - } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; - } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } - } - } - } else { - if (yych <= 'n') { - if (yych <= 'Z') { - if (yych <= 'O') goto yy277; - if (yych == 'U') goto yy278; - goto yy258; - } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; - } - } else { - if (yych <= 'z') { - if (yych <= 'o') goto yy277; - if (yych == 'u') goto yy278; - goto yy258; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } - } - } - } + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 3141 "Zend/zend_ini_scanner.c" yy253: YYDEBUG(253, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'E') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; + if (yych <= '<') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; + if (yych <= '/') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + goto yy259; } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } + if (yych <= '9') goto yy260; + if (yych == ';') goto yy252; + goto yy259; } } } else { - if (yych <= 'e') { - if (yych <= 'Z') { - if (yych <= 'F') goto yy272; - if (yych == 'N') goto yy266; - goto yy258; + if (yych <= '`') { + if (yych <= 'A') { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy283; } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= 'z') { - if (yych <= 'f') goto yy272; - if (yych == 'n') goto yy266; - goto yy258; + if (yych <= '{') { + if (yych <= 'a') goto yy283; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -3275,49 +3191,60 @@ yy254: YYDEBUG(254, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'N') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'R') { - if (yych <= '@') goto yy257; - if (yych <= 'Q') goto yy258; - goto yy270; + if (yych <= 'n') { + if (yych <= 'Z') { + if (yych <= 'O') goto yy279; + if (yych == 'U') goto yy280; + goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'r') goto yy270; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'o') goto yy279; + if (yych == 'u') goto yy280; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } @@ -3325,386 +3252,398 @@ yy255: YYDEBUG(255, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'E') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; + if (yych <= 'e') { + if (yych <= 'Z') { + if (yych <= 'F') goto yy274; + if (yych == 'N') goto yy268; goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'e') goto yy260; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'f') goto yy274; + if (yych == 'n') goto yy268; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } yy256: YYDEBUG(256, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy257: - YYDEBUG(257, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy256; - } - if (yych == '$') goto yy261; - goto yy230; -yy258: - YYDEBUG(258, *YYCURSOR); - yyaccept = 4; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(259, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy250; - goto yy256; - } else { - if (yych <= '\n') goto yy250; - if (yych <= '\f') goto yy256; - goto yy250; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy250; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy250; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy250; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy256; - } - } - } -yy260: - YYDEBUG(260, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'R') { + if (yych <= '@') goto yy259; + if (yych <= 'Q') goto yy260; + goto yy272; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'r') goto yy272; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy257: + YYDEBUG(257, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy262; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy262; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy258: + YYDEBUG(258, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy259: + YYDEBUG(259, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy258; + } + if (yych == '$') goto yy263; + goto yy232; +yy260: + YYDEBUG(260, *YYCURSOR); + yyaccept = 4; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(261, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy252; goto yy258; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '\n') goto yy252; + if (yych <= '\f') goto yy258; + goto yy252; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy252; + } else { + if (yych == '$') goto yy263; + goto yy258; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy252; + goto yy258; + } else { + if (yych == '<') goto yy258; + goto yy252; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy258; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy258; + } + } + } +yy262: + YYDEBUG(262, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; - goto yy266; + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + goto yy268; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 's') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy261: - YYDEBUG(261, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy262; - if (yych <= '[') goto yy256; - goto yy263; - } else { - if (yych != '{') goto yy256; - } -yy262: - YYDEBUG(262, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 3) { - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy230; - } else { - goto yy232; - } - } else { - if (yyaccept <= 2) { - goto yy228; - } else { - goto yy245; - } - } - } else { - if (yyaccept <= 5) { - if (yyaccept <= 4) { - goto yy250; - } else { - goto yy267; - } - } else { - goto yy274; - } - } yy263: YYDEBUG(263, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy264; + if (yych <= '\\') { + if (yych <= 0x00) goto yy264; + if (yych <= '[') goto yy258; + goto yy265; + } else { + if (yych != '{') goto yy258; } - goto yy256; yy264: YYDEBUG(264, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy232; + } else { + goto yy234; + } + } else { + if (yyaccept <= 2) { + goto yy230; + } else { + goto yy247; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy252; + } else { + goto yy269; + } + } else { + goto yy276; + } + } +yy265: + YYDEBUG(265, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(265, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy264; + goto yy266; } - if (yych <= 0x00) goto yy230; - if (yych == '\\') goto yy263; - goto yy256; + goto yy258; yy266: YYDEBUG(266, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(267, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy266; + } + if (yych <= 0x00) goto yy232; + if (yych == '\\') goto yy265; + goto yy258; +yy268: + YYDEBUG(268, *YYCURSOR); yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 16) { - goto yy268; + goto yy270; } if (yych <= ';') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy267; - if (yych <= '\t') goto yy257; + if (yych <= 0x00) goto yy269; + if (yych <= '\t') goto yy259; } else { - if (yych != '\r') goto yy257; + if (yych != '\r') goto yy259; } } else { if (yych <= ')') { - if (yych <= '"') goto yy267; - if (yych <= '%') goto yy257; + if (yych <= '"') goto yy269; + if (yych <= '%') goto yy259; } else { - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - if (yych <= ':') goto yy257; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + if (yych <= ':') goto yy259; } } } else { if (yych <= '_') { if (yych <= '@') { - if (yych != '=') goto yy257; + if (yych != '=') goto yy259; } else { - if (yych <= 'Z') goto yy258; - if (yych <= '^') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych <= '^') goto yy259; + goto yy260; } } else { if (yych <= '{') { - if (yych <= '`') goto yy257; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '`') goto yy259; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych >= 0x7F) goto yy257; + if (yych == '}') goto yy259; + if (yych >= 0x7F) goto yy259; } } } -yy267: - YYDEBUG(267, *YYCURSOR); +yy269: + YYDEBUG(269, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 421 "Zend/zend_ini_scanner.l" { /* TRUE value (when used outside option value/offset this causes parse error!) */ RETURN_TOKEN(BOOL_TRUE, "1", 1); } -#line 3599 "Zend/zend_ini_scanner.c" -yy268: - YYDEBUG(268, *YYCURSOR); +#line 3637 "Zend/zend_ini_scanner.c" +yy270: + YYDEBUG(270, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(269, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy268; - } - goto yy267; -yy270: - YYDEBUG(270, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'U') { - if (yych <= '@') goto yy257; - if (yych <= 'T') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'u') goto yy271; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy271: YYDEBUG(271, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy266; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } + if (yybm[0+yych] & 16) { + goto yy270; } + goto yy269; yy272: YYDEBUG(272, *YYCURSOR); yyaccept = 4; @@ -3712,251 +3651,251 @@ yy272: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'F') { - if (yych <= '@') goto yy257; - if (yych <= 'E') goto yy258; + if (yych <= 'U') { + if (yych <= '@') goto yy259; + if (yych <= 'T') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'f') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'u') goto yy273; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy273: YYDEBUG(273, *YYCURSOR); - yyaccept = 6; + yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\t') goto yy275; - if (yych >= '\v') goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych <= ' ') goto yy275; - if (yych >= '#') goto yy257; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych >= '*') goto yy257; + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy268; } else { - if (yych == '<') goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; + if (yych <= '{') { + if (yych == 'e') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych != '~') goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy274: YYDEBUG(274, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'F') { + if (yych <= '@') goto yy259; + if (yych <= 'E') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'f') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy275: + YYDEBUG(275, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy259; + } else { + if (yych <= '\t') goto yy277; + if (yych >= '\v') goto yy259; + } + } else { + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; + } else { + if (yych <= ' ') goto yy277; + if (yych >= '#') goto yy259; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych >= '*') goto yy259; + } else { + if (yych == '<') goto yy259; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy259; + } else { + if (yych != '~') goto yy259; + } + } + } +yy276: + YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 425 "Zend/zend_ini_scanner.l" { /* FALSE value (when used outside option value/offset this causes parse error!)*/ RETURN_TOKEN(BOOL_FALSE, "", 0); } -#line 3803 "Zend/zend_ini_scanner.c" -yy275: - YYDEBUG(275, *YYCURSOR); +#line 3841 "Zend/zend_ini_scanner.c" +yy277: + YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(276, *YYCURSOR); - if (yych == '\t') goto yy275; - if (yych == ' ') goto yy275; - goto yy274; -yy277: - YYDEBUG(277, *YYCURSOR); + YYDEBUG(278, *YYCURSOR); + if (yych == '\t') goto yy277; + if (yych == ' ') goto yy277; + goto yy276; +yy279: + YYDEBUG(279, *YYCURSOR); yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '<') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy274; - if (yych <= 0x08) goto yy257; - if (yych <= '\t') goto yy275; - goto yy274; + if (yych <= 0x00) goto yy276; + if (yych <= 0x08) goto yy259; + if (yych <= '\t') goto yy277; + goto yy276; } else { - if (yych == '\r') goto yy274; - if (yych <= 0x1F) goto yy257; - goto yy275; + if (yych == '\r') goto yy276; + if (yych <= 0x1F) goto yy259; + goto yy277; } } else { if (yych <= '/') { - if (yych <= '"') goto yy274; - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy274; - goto yy257; + if (yych <= '"') goto yy276; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy276; + goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy274; - goto yy257; + if (yych <= '9') goto yy260; + if (yych == ';') goto yy276; + goto yy259; } } } else { if (yych <= '`') { if (yych <= 'N') { - if (yych <= '=') goto yy274; - if (yych <= '@') goto yy257; - if (yych <= 'M') goto yy258; - goto yy280; + if (yych <= '=') goto yy276; + if (yych <= '@') goto yy259; + if (yych <= 'M') goto yy260; + goto yy282; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'n') goto yy280; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'n') goto yy282; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy274; - goto yy257; - } - } - } -yy278: - YYDEBUG(278, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy279; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy279: - YYDEBUG(279, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - goto yy273; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy276; + goto yy259; } } } @@ -3967,46 +3906,45 @@ yy280: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4017,45 +3955,46 @@ yy281: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy282; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4066,45 +4005,46 @@ yy282: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy283; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4115,126 +4055,176 @@ yy283: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy284; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy284: YYDEBUG(284, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'S') { + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy285; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } yy285: YYDEBUG(285, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy284; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } } - if (yych >= '\r') goto yy288; yy286: YYDEBUG(286, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy287: YYDEBUG(287, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy286; + } + if (yych >= '\r') goto yy290; +yy288: + YYDEBUG(288, *YYCURSOR); + ++YYCURSOR; +yy289: + YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4185 "Zend/zend_ini_scanner.c" -yy288: - YYDEBUG(288, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy286; - goto yy287; -yy289: - YYDEBUG(289, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; +#line 4223 "Zend/zend_ini_scanner.c" +yy290: YYDEBUG(290, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy289; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; - } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy245; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy245; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy245; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy245; - } else { - if (yych == '~') goto yy245; - goto yy256; - } - } - } + yych = *++YYCURSOR; + if (yych == '\n') goto yy288; + goto yy289; yy291: YYDEBUG(291, *YYCURSOR); yyaccept = 3; @@ -4242,45 +4232,44 @@ yy291: YYFILL(1); yych = *YYCURSOR; YYDEBUG(292, *YYCURSOR); - if (yych <= '-') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy245; - if (yych <= 0x08) goto yy256; - goto yy245; + if (yybm[0+yych] & 64) { + goto yy291; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych == '\r') goto yy245; - goto yy256; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { - if (yych <= '$') { - if (yych <= '"') goto yy245; - if (yych <= '#') goto yy256; - goto yy261; + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy247; } else { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy245; - goto yy256; + if (yych == '$') goto yy263; + goto yy258; } } } else { - if (yych <= '<') { - if (yych <= '9') { - if (yych <= '.') goto yy289; - if (yych <= '/') goto yy256; - goto yy291; + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy247; + goto yy258; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == '<') goto yy258; + goto yy247; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4291,44 +4280,45 @@ yy293: YYFILL(1); yych = *YYCURSOR; YYDEBUG(294, *YYCURSOR); - if (yych <= ')') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= '-') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy247; + if (yych <= 0x08) goto yy258; + goto yy247; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych == '\r') goto yy247; + goto yy258; } } else { - if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= '$') { + if (yych <= '"') goto yy247; + if (yych <= '#') goto yy258; + goto yy263; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '%') goto yy258; + if (yych <= ')') goto yy247; + goto yy258; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '.') goto yy291; + if (yych <= '/') goto yy258; goto yy293; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4342,56 +4332,104 @@ yy295: if (yych <= ')') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '/') goto yy258; goto yy295; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } yy297: YYDEBUG(297, *YYCURSOR); - ++YYCURSOR; + yyaccept = 3; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(298, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy297; + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; + } else { + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; + } else { + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy258; + goto yy297; + } else { + if (yych == ';') goto yy247; + goto yy258; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; + } else { + if (yych == '~') goto yy247; + goto yy258; + } + } } +yy299: YYDEBUG(299, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(300, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy299; + } + YYDEBUG(301, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -4402,66 +4440,66 @@ yy297: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4406 "Zend/zend_ini_scanner.c" -yy301: - YYDEBUG(301, *YYCURSOR); +#line 4444 "Zend/zend_ini_scanner.c" +yy303: + YYDEBUG(303, *YYCURSOR); ++YYCURSOR; - YYDEBUG(302, *YYCURSOR); + YYDEBUG(304, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 4417 "Zend/zend_ini_scanner.c" -yy303: - YYDEBUG(303, *YYCURSOR); +#line 4455 "Zend/zend_ini_scanner.c" +yy305: + YYDEBUG(305, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy304: - YYDEBUG(304, *YYCURSOR); - if (yych == '\t') goto yy303; - if (yych == ' ') goto yy303; - goto yy237; -yy305: - YYDEBUG(305, *YYCURSOR); - yych = *++YYCURSOR; - goto yy234; yy306: YYDEBUG(306, *YYCURSOR); + if (yych == '\t') goto yy305; + if (yych == ' ') goto yy305; + goto yy239; +yy307: + YYDEBUG(307, *YYCURSOR); + yych = *++YYCURSOR; + goto yy236; +yy308: + YYDEBUG(308, *YYCURSOR); yyaccept = 1; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy307: - YYDEBUG(307, *YYCURSOR); +yy309: + YYDEBUG(309, *YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { - if (yych <= 0x08) goto yy232; - if (yych <= '\t') goto yy306; - goto yy305; + if (yych <= 0x08) goto yy234; + if (yych <= '\t') goto yy308; + goto yy307; } else { - if (yych == '\r') goto yy309; - goto yy232; + if (yych == '\r') goto yy311; + goto yy234; } } else { if (yych <= '"') { - if (yych <= ' ') goto yy306; - if (yych <= '!') goto yy232; + if (yych <= ' ') goto yy308; + if (yych <= '!') goto yy234; } else { - if (yych == ';') goto yy284; - goto yy232; + if (yych == ';') goto yy286; + goto yy234; } } - YYDEBUG(308, *YYCURSOR); + YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - goto yy239; -yy309: - YYDEBUG(309, *YYCURSOR); + goto yy241; +yy311: + YYDEBUG(311, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy305; - goto yy234; + if ((yych = *YYCURSOR) == '\n') goto yy307; + goto yy236; } /* *********************************** */ yyc_ST_VARNAME: @@ -4500,47 +4538,47 @@ yyc_ST_VARNAME: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(310, *YYCURSOR); + YYDEBUG(312, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '\'') { if (yych <= ' ') { if (yych <= '\n') { - if (yych >= '\t') goto yy314; + if (yych >= '\t') goto yy316; } else { - if (yych == '\r') goto yy314; + if (yych == '\r') goto yy316; } } else { if (yych <= '$') { - if (yych != '#') goto yy314; + if (yych != '#') goto yy316; } else { - if (yych == '&') goto yy314; + if (yych == '&') goto yy316; } } } else { if (yych <= 'Z') { if (yych <= ';') { - if (yych <= ')') goto yy314; - if (yych >= ';') goto yy314; + if (yych <= ')') goto yy316; + if (yych >= ';') goto yy316; } else { - if (yych == '=') goto yy314; + if (yych == '=') goto yy316; } } else { if (yych <= '|') { - if (yych <= '[') goto yy314; - if (yych >= '{') goto yy314; + if (yych <= '[') goto yy316; + if (yych >= '{') goto yy316; } else { - if (yych <= '}') goto yy316; - if (yych <= '~') goto yy314; + if (yych <= '}') goto yy318; + if (yych <= '~') goto yy316; } } } - YYDEBUG(312, *YYCURSOR); + YYDEBUG(314, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy319; -yy313: - YYDEBUG(313, *YYCURSOR); + goto yy321; +yy315: + YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ @@ -4552,41 +4590,41 @@ yy313: RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4556 "Zend/zend_ini_scanner.c" -yy314: - YYDEBUG(314, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(315, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 4566 "Zend/zend_ini_scanner.c" +#line 4594 "Zend/zend_ini_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); ++YYCURSOR; YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 4604 "Zend/zend_ini_scanner.c" +yy318: + YYDEBUG(318, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(319, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4577 "Zend/zend_ini_scanner.c" -yy318: - YYDEBUG(318, *YYCURSOR); +#line 4615 "Zend/zend_ini_scanner.c" +yy320: + YYDEBUG(320, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy319: - YYDEBUG(319, *YYCURSOR); +yy321: + YYDEBUG(321, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy318; + goto yy320; } - goto yy313; + goto yy315; } } -#line 579 "Zend/zend_ini_scanner.l" +#line 600 "Zend/zend_ini_scanner.l" } diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index b2563e3b2a3..f5a158aa6b8 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:07:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:37:03 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { From c975320eb9261b616df8b5dcd904395b5c56ab54 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Thu, 7 Jun 2012 18:04:15 +0200 Subject: [PATCH 083/641] Regenerated files --- Zend/zend_ini_scanner.c | 3186 +++++++++++++++++----------------- Zend/zend_ini_scanner_defs.h | 2 +- 2 files changed, 1613 insertions(+), 1575 deletions(-) diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 9d0265e9016..94c48c89773 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Mar 2 11:49:21 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:48:25 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -481,7 +481,7 @@ yy4: yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 547 "Zend/zend_ini_scanner.l" +#line 568 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; @@ -493,7 +493,7 @@ yy6: yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 552 "Zend/zend_ini_scanner.l" +#line 573 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; @@ -533,7 +533,7 @@ yy10: ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 475 "Zend/zend_ini_scanner.l" +#line 496 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } @@ -554,7 +554,7 @@ yy14: goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -926,7 +926,7 @@ yy55: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; @@ -1012,7 +1012,7 @@ yy64: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 563 "Zend/zend_ini_scanner.l" +#line 584 "Zend/zend_ini_scanner.l" { /* #Comment */ zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); BEGIN(INITIAL); @@ -1159,7 +1159,7 @@ yyc_ST_DOUBLE_QUOTES: yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 507 "Zend/zend_ini_scanner.l" +#line 528 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1204,7 +1204,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 502 "Zend/zend_ini_scanner.l" +#line 523 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; @@ -1323,7 +1323,7 @@ yy86: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" +#line 514 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } @@ -1344,7 +1344,7 @@ yy89: yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -1355,7 +1355,7 @@ yy91: yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; @@ -1422,7 +1422,7 @@ yy97: yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } @@ -1452,7 +1452,7 @@ yy99: yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } @@ -1833,7 +1833,7 @@ yyc_ST_RAW: 160, 224, 0, 160, 160, 0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 224, 160, 160, 160, 160, 160, 160, 160, + 224, 160, 32, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 32, 160, 160, 160, 160, @@ -1865,66 +1865,64 @@ yyc_ST_RAW: YYDEBUG(135, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy139; - } else { - if (yych <= '\t') goto yy141; - if (yych <= '\n') goto yy142; - goto yy139; - } - } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy144; - if (yych <= 0x1F) goto yy139; + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy137; + if (yych <= 0x08) goto yy139; goto yy141; } else { - if (yych == ';') goto yy145; + if (yych <= '\n') goto yy142; + if (yych <= '\f') goto yy139; + goto yy144; + } + } else { + if (yych <= '!') { + if (yych == ' ') goto yy141; + goto yy139; + } else { + if (yych <= '"') goto yy145; + if (yych == ';') goto yy147; goto yy139; } } +yy137: YYDEBUG(137, *YYCURSOR); ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1896 "Zend/zend_ini_scanner.c" +#line 1899 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy156; + goto yy158; yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 448 "Zend/zend_ini_scanner.l" +#line 474 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1914 "Zend/zend_ini_scanner.c" +#line 1912 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { - goto yy152; + goto yy154; } if (yych <= '\f') { - if (yych == '\n') goto yy151; - goto yy156; + if (yych == '\n') goto yy153; + goto yy158; } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy156; + if (yych <= '\r') goto yy156; + if (yych == ';') goto yy148; + goto yy158; } yy142: YYDEBUG(142, *YYCURSOR); @@ -1932,89 +1930,129 @@ yy142: yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1942 "Zend/zend_ini_scanner.c" +#line 1940 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy151; + if (yych == '\n') goto yy153; goto yy143; yy145: YYDEBUG(145, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy147; -yy146: - YYDEBUG(146, *YYCURSOR); ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 448 "Zend/zend_ini_scanner.l" + { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } + } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1977 "Zend/zend_ini_scanner.c" yy147: YYDEBUG(147, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy146; - } - if (yych >= '\r') goto yy150; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy149; yy148: YYDEBUG(148, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy149: YYDEBUG(149, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy148; + } + if (yych >= '\r') goto yy152; +yy150: + YYDEBUG(150, *YYCURSOR); + ++YYCURSOR; +yy151: + YYDEBUG(151, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1976 "Zend/zend_ini_scanner.c" -yy150: - YYDEBUG(150, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy148; - goto yy149; -yy151: - YYDEBUG(151, *YYCURSOR); - yych = *++YYCURSOR; - goto yy143; +#line 2006 "Zend/zend_ini_scanner.c" yy152: YYDEBUG(152, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy150; + goto yy151; +yy153: + YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + goto yy143; +yy154: + YYDEBUG(154, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(153, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy152; - } - if (yych <= '\f') { - if (yych <= 0x00) goto yy140; - if (yych == '\n') goto yy151; - goto yy155; - } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy155; - } -yy154: - YYDEBUG(154, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy151; - goto yy143; -yy155: YYDEBUG(155, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy154; + } + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy140; + goto yy157; + } else { + if (yych <= '\n') goto yy153; + if (yych <= '\f') goto yy157; + } + } else { + if (yych <= '"') { + if (yych <= '!') goto yy157; + goto yy140; + } else { + if (yych == ';') goto yy148; + goto yy157; + } + } +yy156: + YYDEBUG(156, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy153; + goto yy143; +yy157: + YYDEBUG(157, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy156: - YYDEBUG(156, *YYCURSOR); +yy158: + YYDEBUG(158, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy155; + goto yy157; } goto yy140; } @@ -2055,85 +2093,85 @@ yyc_ST_SECTION_RAW: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(157, *YYCURSOR); + YYDEBUG(159, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '\f') { - if (yych == '\n') goto yy161; + if (yych == '\n') goto yy163; } else { - if (yych <= '\r') goto yy161; - if (yych == ']') goto yy163; + if (yych <= '\r') goto yy163; + if (yych == ']') goto yy165; } - YYDEBUG(159, *YYCURSOR); + YYDEBUG(161, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy170; -yy160: - YYDEBUG(160, *YYCURSOR); + goto yy172; +yy162: + YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 457 "Zend/zend_ini_scanner.l" +#line 478 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2079 "Zend/zend_ini_scanner.c" -yy161: - YYDEBUG(161, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(162, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2089 "Zend/zend_ini_scanner.c" +#line 2117 "Zend/zend_ini_scanner.c" yy163: YYDEBUG(163, *YYCURSOR); ++YYCURSOR; - yych = *YYCURSOR; - goto yy166; -yy164: YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2127 "Zend/zend_ini_scanner.c" +yy165: + YYDEBUG(165, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy168; +yy166: + YYDEBUG(166, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2104 "Zend/zend_ini_scanner.c" -yy165: - YYDEBUG(165, *YYCURSOR); +#line 2142 "Zend/zend_ini_scanner.c" +yy167: + YYDEBUG(167, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy166: - YYDEBUG(166, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy165; - } - if (yych == '\n') goto yy167; - if (yych == '\r') goto yy168; - goto yy164; -yy167: - YYDEBUG(167, *YYCURSOR); - yych = *++YYCURSOR; - goto yy164; yy168: YYDEBUG(168, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy167; - goto yy164; + if (yybm[0+yych] & 64) { + goto yy167; + } + if (yych == '\n') goto yy169; + if (yych == '\r') goto yy170; + goto yy166; yy169: YYDEBUG(169, *YYCURSOR); + yych = *++YYCURSOR; + goto yy166; +yy170: + YYDEBUG(170, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy169; + goto yy166; +yy171: + YYDEBUG(171, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy170: - YYDEBUG(170, *YYCURSOR); +yy172: + YYDEBUG(172, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy169; + goto yy171; } - goto yy160; + goto yy162; } /* *********************************** */ yyc_ST_SECTION_VALUE: @@ -2172,203 +2210,203 @@ yyc_ST_SECTION_VALUE: 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, }; - YYDEBUG(171, *YYCURSOR); + YYDEBUG(173, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '-') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x08) goto yy173; - if (yych <= '\t') goto yy175; - goto yy176; + if (yych <= 0x08) goto yy175; + if (yych <= '\t') goto yy177; + goto yy178; } else { - if (yych == '\r') goto yy176; - if (yych >= ' ') goto yy175; + if (yych == '\r') goto yy178; + if (yych >= ' ') goto yy177; } } else { if (yych <= '$') { - if (yych == '"') goto yy178; - if (yych >= '$') goto yy180; + if (yych == '"') goto yy180; + if (yych >= '$') goto yy182; } else { - if (yych == '\'') goto yy181; - if (yych >= '-') goto yy182; + if (yych == '\'') goto yy183; + if (yych >= '-') goto yy184; } } } else { if (yych <= 'Z') { if (yych <= '9') { - if (yych <= '.') goto yy183; - if (yych >= '0') goto yy184; + if (yych <= '.') goto yy185; + if (yych >= '0') goto yy186; } else { - if (yych == ';') goto yy176; - if (yych >= 'A') goto yy186; + if (yych == ';') goto yy178; + if (yych >= 'A') goto yy188; } } else { if (yych <= '^') { - if (yych <= '[') goto yy173; - if (yych <= '\\') goto yy188; - if (yych <= ']') goto yy189; + if (yych <= '[') goto yy175; + if (yych <= '\\') goto yy190; + if (yych <= ']') goto yy191; } else { - if (yych == '`') goto yy173; - if (yych <= 'z') goto yy186; + if (yych == '`') goto yy175; + if (yych <= 'z') goto yy188; } } } -yy173: - YYDEBUG(173, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy196; -yy174: - YYDEBUG(174, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" - { /* Get rest as section/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2230 "Zend/zend_ini_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 0x1F) { - if (yych == '\t') goto yy222; - goto yy196; - } else { - if (yych <= ' ') goto yy222; - if (yych == '"') goto yy224; - goto yy196; - } + goto yy198; yy176: YYDEBUG(176, *YYCURSOR); - ++YYCURSOR; + yyleng = YYCURSOR - SCNG(yy_text); +#line 514 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2268 "Zend/zend_ini_scanner.c" yy177: YYDEBUG(177, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2253 "Zend/zend_ini_scanner.c" + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy224; + goto yy198; + } else { + if (yych <= ' ') goto yy224; + if (yych == '"') goto yy226; + goto yy198; + } yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2291 "Zend/zend_ini_scanner.c" +yy180: + YYDEBUG(180, *YYCURSOR); + ++YYCURSOR; +yy181: + YYDEBUG(181, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2265 "Zend/zend_ini_scanner.c" -yy180: - YYDEBUG(180, *YYCURSOR); +#line 2303 "Zend/zend_ini_scanner.c" +yy182: + YYDEBUG(182, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy177; - if (yych <= '[') goto yy195; - goto yy200; + if (yych <= 0x00) goto yy179; + if (yych <= '[') goto yy197; + goto yy202; } else { - if (yych == '{') goto yy220; - goto yy195; + if (yych == '{') goto yy222; + goto yy197; } -yy181: - YYDEBUG(181, *YYCURSOR); +yy183: + YYDEBUG(183, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy216; + goto yy218; } - goto yy177; -yy182: - YYDEBUG(182, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy214; - goto yy196; -yy183: - YYDEBUG(183, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy212; - goto yy196; + goto yy179; yy184: YYDEBUG(184, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy216; + goto yy198; +yy185: + YYDEBUG(185, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy214; + goto yy198; +yy186: + YYDEBUG(186, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '\'') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy196; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy198; } else { - if (yych == '"') goto yy185; - if (yych <= '&') goto yy196; + if (yych == '"') goto yy187; + if (yych <= '&') goto yy198; } } else { if (yych <= '9') { - if (yych == '.') goto yy208; - if (yych <= '/') goto yy196; - goto yy210; + if (yych == '.') goto yy210; + if (yych <= '/') goto yy198; + goto yy212; } else { if (yych <= ';') { - if (yych <= ':') goto yy196; + if (yych <= ':') goto yy198; } else { - if (yych != ']') goto yy196; + if (yych != ']') goto yy198; } } } -yy185: - YYDEBUG(185, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 2331 "Zend/zend_ini_scanner.c" -yy186: - YYDEBUG(186, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '"') { - if (yych <= '\f') { - if (yych != '\n') goto yy196; - } else { - if (yych <= '\r') goto yy187; - if (yych <= '!') goto yy196; - } - } else { - if (yych <= ':') { - if (yych != '\'') goto yy196; - } else { - if (yych <= ';') goto yy187; - if (yych != ']') goto yy196; - } - } yy187: YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2369 "Zend/zend_ini_scanner.c" +yy188: + YYDEBUG(188, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy208; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy198; + } else { + if (yych <= '\r') goto yy189; + if (yych <= '!') goto yy198; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy198; + } else { + if (yych <= ';') goto yy189; + if (yych != ']') goto yy198; + } + } +yy189: + YYDEBUG(189, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2361 "Zend/zend_ini_scanner.c" -yy188: - YYDEBUG(188, *YYCURSOR); - yych = *++YYCURSOR; - goto yy195; -yy189: - YYDEBUG(189, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy192; +#line 2399 "Zend/zend_ini_scanner.c" yy190: YYDEBUG(190, *YYCURSOR); + yych = *++YYCURSOR; + goto yy197; +yy191: + YYDEBUG(191, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy194; +yy192: + YYDEBUG(192, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ @@ -2376,97 +2414,86 @@ yy190: SCNG(lineno)++; return ']'; } -#line 2380 "Zend/zend_ini_scanner.c" -yy191: - YYDEBUG(191, *YYCURSOR); +#line 2418 "Zend/zend_ini_scanner.c" +yy193: + YYDEBUG(193, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy192: - YYDEBUG(192, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy191; - } - if (yych == '\n') goto yy193; - if (yych == '\r') goto yy194; - goto yy190; -yy193: - YYDEBUG(193, *YYCURSOR); - yych = *++YYCURSOR; - goto yy190; yy194: YYDEBUG(194, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy193; - goto yy190; + if (yybm[0+yych] & 2) { + goto yy193; + } + if (yych == '\n') goto yy195; + if (yych == '\r') goto yy196; + goto yy192; yy195: YYDEBUG(195, *YYCURSOR); + yych = *++YYCURSOR; + goto yy192; +yy196: + YYDEBUG(196, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy195; + goto yy192; +yy197: + YYDEBUG(197, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy196: - YYDEBUG(196, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy195; - } - if (yych == '$') goto yy198; - if (yych != '\\') goto yy174; -yy197: - YYDEBUG(197, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - goto yy195; yy198: YYDEBUG(198, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy197; + } + if (yych == '$') goto yy200; + if (yych != '\\') goto yy176; +yy199: + YYDEBUG(199, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy199; - if (yych <= '[') goto yy195; - goto yy200; - } else { - if (yych != '{') goto yy195; - } -yy199: - YYDEBUG(199, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy174; - } else { - goto yy177; - } - } else { - if (yyaccept <= 2) { - goto yy185; - } else { - goto yy187; - } - } + goto yy197; yy200: YYDEBUG(200, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; + if (yych <= '\\') { + if (yych <= 0x00) goto yy201; + if (yych <= '[') goto yy197; + goto yy202; + } else { + if (yych != '{') goto yy197; } - if (yych == '\\') goto yy203; - goto yy195; yy201: YYDEBUG(201, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy176; + } else { + goto yy179; + } + } else { + if (yyaccept <= 2) { + goto yy187; + } else { + goto yy189; + } + } +yy202: + YYDEBUG(202, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(202, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } if (yych == '\\') goto yy205; - goto yy195; + goto yy197; yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -2474,82 +2501,61 @@ yy203: yych = *YYCURSOR; YYDEBUG(204, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } - if (yych == '\\') goto yy203; - goto yy195; + if (yych == '\\') goto yy207; + goto yy197; yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; - } - if (yych == '\\') goto yy203; - goto yy195; -yy206: YYDEBUG(206, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy207: + YYDEBUG(207, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy208: + YYDEBUG(208, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(207, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy187; - if (yych <= '\f') goto yy195; - goto yy187; - } else { - if (yych == '"') goto yy187; - if (yych <= '#') goto yy195; - goto yy198; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy187; - if (yych <= ':') goto yy195; - goto yy187; - } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy187; - goto yy195; - } - } -yy208: - YYDEBUG(208, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; YYDEBUG(209, *YYCURSOR); - if (yybm[0+yych] & 64) { + if (yybm[0+yych] & 32) { goto yy208; } if (yych <= '$') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy189; + if (yych <= '\f') goto yy197; + goto yy189; } else { - if (yych == '"') goto yy185; - if (yych <= '#') goto yy195; - goto yy198; + if (yych == '"') goto yy189; + if (yych <= '#') goto yy197; + goto yy200; } } else { if (yych <= ';') { - if (yych == '\'') goto yy185; - if (yych <= ':') goto yy195; - goto yy185; + if (yych == '\'') goto yy189; + if (yych <= ':') goto yy197; + goto yy189; } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy189; + goto yy197; } } yy210: @@ -2559,44 +2565,29 @@ yy210: YYFILL(1); yych = *YYCURSOR; YYDEBUG(211, *YYCURSOR); - if (yych <= '\'') { - if (yych <= '!') { - if (yych <= '\n') { - if (yych <= '\t') goto yy195; - goto yy185; - } else { - if (yych == '\r') goto yy185; - goto yy195; - } + if (yybm[0+yych] & 64) { + goto yy210; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { - if (yych <= '#') { - if (yych <= '"') goto yy185; - goto yy195; - } else { - if (yych <= '$') goto yy198; - if (yych <= '&') goto yy195; - goto yy185; - } + if (yych == '"') goto yy187; + if (yych <= '#') goto yy197; + goto yy200; } } else { - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy195; - goto yy208; - } else { - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy210; - goto yy195; - } + if (yych <= ';') { + if (yych == '\'') goto yy187; + if (yych <= ':') goto yy197; + goto yy187; } else { - if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; - } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; - } + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } yy212: @@ -2606,34 +2597,43 @@ yy212: YYFILL(1); yych = *YYCURSOR; YYDEBUG(213, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '\r') goto yy187; + goto yy197; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy187; + goto yy197; + } else { + if (yych <= '$') goto yy200; + if (yych <= '&') goto yy197; + goto yy187; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy212; - goto yy195; + if (yych <= '.') { + if (yych <= '-') goto yy197; + goto yy210; + } else { + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy212; + goto yy197; + } } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } @@ -2646,47 +2646,85 @@ yy214: YYDEBUG(215, *YYCURSOR); if (yych <= '&') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '!') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '$') goto yy200; + goto yy197; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; if (yych <= '9') goto yy214; - goto yy195; + goto yy197; } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } yy216: YYDEBUG(216, *YYCURSOR); - ++YYCURSOR; + yyaccept = 2; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(217, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy216; + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy197; + goto yy187; + } else { + if (yych == '$') goto yy200; + goto yy197; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy216; + goto yy197; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy187; + goto yy197; + } else { + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; + } + } } +yy218: YYDEBUG(218, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(219, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy218; + } + YYDEBUG(220, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -2697,65 +2735,65 @@ yy216: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2701 "Zend/zend_ini_scanner.c" -yy220: - YYDEBUG(220, *YYCURSOR); +#line 2739 "Zend/zend_ini_scanner.c" +yy222: + YYDEBUG(222, *YYCURSOR); ++YYCURSOR; - YYDEBUG(221, *YYCURSOR); + YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 2712 "Zend/zend_ini_scanner.c" -yy222: - YYDEBUG(222, *YYCURSOR); +#line 2750 "Zend/zend_ini_scanner.c" +yy224: + YYDEBUG(224, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(223, *YYCURSOR); + YYDEBUG(225, *YYCURSOR); if (yych <= '"') { if (yych <= '\f') { - if (yych <= 0x08) goto yy195; - if (yych <= '\t') goto yy222; - if (yych <= '\n') goto yy174; - goto yy195; + if (yych <= 0x08) goto yy197; + if (yych <= '\t') goto yy224; + if (yych <= '\n') goto yy176; + goto yy197; } else { if (yych <= 0x1F) { - if (yych <= '\r') goto yy174; - goto yy195; + if (yych <= '\r') goto yy176; + goto yy197; } else { - if (yych <= ' ') goto yy222; - if (yych <= '!') goto yy195; + if (yych <= ' ') goto yy224; + if (yych <= '!') goto yy197; } } } else { if (yych <= ':') { if (yych <= '$') { - if (yych <= '#') goto yy195; - goto yy198; + if (yych <= '#') goto yy197; + goto yy200; } else { - if (yych == '\'') goto yy174; - goto yy195; + if (yych == '\'') goto yy176; + goto yy197; } } else { if (yych <= '[') { - if (yych <= ';') goto yy174; - goto yy195; + if (yych <= ';') goto yy176; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy174; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy176; + goto yy197; } } } -yy224: - YYDEBUG(224, *YYCURSOR); +yy226: + YYDEBUG(226, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy179; + goto yy181; } /* *********************************** */ yyc_ST_VALUE: @@ -2794,27 +2832,27 @@ yyc_ST_VALUE: 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, }; - YYDEBUG(225, *YYCURSOR); + YYDEBUG(227, *YYCURSOR); YYFILL(6); yych = *YYCURSOR; YYDEBUG(-1, yych); switch (yych) { - case 0x00: goto yy227; + case 0x00: goto yy229; case '\t': - case ' ': goto yy231; - case '\n': goto yy233; - case '\r': goto yy235; + case ' ': goto yy233; + case '\n': goto yy235; + case '\r': goto yy237; case '!': case '&': case '(': case ')': case '|': - case '~': goto yy236; - case '"': goto yy238; - case '$': goto yy240; - case '\'': goto yy241; - case '-': goto yy242; - case '.': goto yy243; + case '~': goto yy238; + case '"': goto yy240; + case '$': goto yy242; + case '\'': goto yy243; + case '-': goto yy244; + case '.': goto yy245; case '0': case '1': case '2': @@ -2824,9 +2862,9 @@ yyc_ST_VALUE: case '6': case '7': case '8': - case '9': goto yy244; - case ';': goto yy246; - case '=': goto yy247; + case '9': goto yy246; + case ';': goto yy248; + case '=': goto yy249; case 'A': case 'B': case 'C': @@ -2869,405 +2907,283 @@ yyc_ST_VALUE: case 'v': case 'w': case 'x': - case 'z': goto yy249; + case 'z': goto yy251; case 'F': - case 'f': goto yy251; + case 'f': goto yy253; case 'N': - case 'n': goto yy252; + case 'n': goto yy254; case 'O': - case 'o': goto yy253; + case 'o': goto yy255; case 'T': - case 't': goto yy254; + case 't': goto yy256; case 'Y': - case 'y': goto yy255; - default: goto yy229; + case 'y': goto yy257; + default: goto yy231; } -yy227: - YYDEBUG(227, *YYCURSOR); +yy229: + YYDEBUG(229, *YYCURSOR); ++YYCURSOR; -yy228: - YYDEBUG(228, *YYCURSOR); +yy230: + YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2897 "Zend/zend_ini_scanner.c" -yy229: - YYDEBUG(229, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy257; -yy230: - YYDEBUG(230, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" - { /* Get everything else as option/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2910 "Zend/zend_ini_scanner.c" +#line 2935 "Zend/zend_ini_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); - yyaccept = 1; + yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy307; + goto yy259; yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 543 "Zend/zend_ini_scanner.l" - { - RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +#line 510 "Zend/zend_ini_scanner.l" + { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2923 "Zend/zend_ini_scanner.c" +#line 2948 "Zend/zend_ini_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); - ++YYCURSOR; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy309; yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 564 "Zend/zend_ini_scanner.l" + { + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} +#line 2961 "Zend/zend_ini_scanner.c" +yy235: + YYDEBUG(235, *YYCURSOR); + ++YYCURSOR; +yy236: + YYDEBUG(236, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2936 "Zend/zend_ini_scanner.c" -yy235: - YYDEBUG(235, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy305; - goto yy234; -yy236: - YYDEBUG(236, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy304; +#line 2974 "Zend/zend_ini_scanner.c" yy237: YYDEBUG(237, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 479 "Zend/zend_ini_scanner.l" - { /* Boolean operators */ - return yytext[0]; -} -#line 2954 "Zend/zend_ini_scanner.c" + yych = *++YYCURSOR; + if (yych == '\n') goto yy307; + goto yy236; yy238: YYDEBUG(238, *YYCURSOR); ++YYCURSOR; + yych = *YYCURSOR; + goto yy306; yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 500 "Zend/zend_ini_scanner.l" + { /* Boolean operators */ + return yytext[0]; +} +#line 2992 "Zend/zend_ini_scanner.c" +yy240: + YYDEBUG(240, *YYCURSOR); + ++YYCURSOR; +yy241: + YYDEBUG(241, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2966 "Zend/zend_ini_scanner.c" -yy240: - YYDEBUG(240, *YYCURSOR); +#line 3004 "Zend/zend_ini_scanner.c" +yy242: + YYDEBUG(242, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy228; - if (yych <= '[') goto yy256; - goto yy263; + if (yych <= 0x00) goto yy230; + if (yych <= '[') goto yy258; + goto yy265; } else { - if (yych == '{') goto yy301; - goto yy256; + if (yych == '{') goto yy303; + goto yy258; } -yy241: - YYDEBUG(241, *YYCURSOR); +yy243: + YYDEBUG(243, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy297; + goto yy299; } - goto yy228; -yy242: - YYDEBUG(242, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy295; - goto yy257; -yy243: - YYDEBUG(243, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy293; - goto yy257; + goto yy230; yy244: YYDEBUG(244, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy297; + goto yy259; +yy245: + YYDEBUG(245, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy295; + goto yy259; +yy246: + YYDEBUG(246, *YYCURSOR); yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '.') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych >= 0x01) goto yy259; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy257; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy259; } } else { if (yych <= '%') { - if (yych <= 0x1F) goto yy257; - if (yych >= '#') goto yy257; + if (yych <= 0x1F) goto yy259; + if (yych >= '#') goto yy259; } else { - if (yych <= ')') goto yy245; - if (yych <= '-') goto yy257; - goto yy289; + if (yych <= ')') goto yy247; + if (yych <= '-') goto yy259; + goto yy291; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy257; - goto yy291; + if (yych <= '/') goto yy259; + goto yy293; } else { - if (yych != ';') goto yy257; + if (yych != ';') goto yy259; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy257; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy245: - YYDEBUG(245, *YYCURSOR); +yy247: + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3046 "Zend/zend_ini_scanner.c" -yy246: - YYDEBUG(246, *YYCURSOR); +#line 3084 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - goto yy285; -yy247: - YYDEBUG(247, *YYCURSOR); + goto yy287; +yy249: + YYDEBUG(249, *YYCURSOR); ++YYCURSOR; - YYDEBUG(248, *YYCURSOR); + YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 483 "Zend/zend_ini_scanner.l" +#line 504 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3063 "Zend/zend_ini_scanner.c" -yy249: - YYDEBUG(249, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= ')') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych >= '\v') goto yy257; - } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; - } else { - if (yych <= '"') goto yy250; - if (yych <= '%') goto yy257; - } - } - } else { - if (yych <= '=') { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - } else { - if (yych != '~') goto yy257; - } - } - } -yy250: - YYDEBUG(250, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 3103 "Zend/zend_ini_scanner.c" +#line 3101 "Zend/zend_ini_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '<') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= ')') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych >= '\v') goto yy259; } else { - if (yych <= '/') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - goto yy257; + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy250; - goto yy257; + if (yych <= '"') goto yy252; + if (yych <= '%') goto yy259; } } } else { - if (yych <= '`') { - if (yych <= 'A') { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy281; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } + if (yych <= '=') { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; } else { - if (yych <= '{') { - if (yych <= 'a') goto yy281; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych != '~') goto yy259; } } } yy252: YYDEBUG(252, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'N') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; - } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; - } - } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; - } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } - } - } - } else { - if (yych <= 'n') { - if (yych <= 'Z') { - if (yych <= 'O') goto yy277; - if (yych == 'U') goto yy278; - goto yy258; - } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; - } - } else { - if (yych <= 'z') { - if (yych <= 'o') goto yy277; - if (yych == 'u') goto yy278; - goto yy258; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } - } - } - } + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 3141 "Zend/zend_ini_scanner.c" yy253: YYDEBUG(253, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'E') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; + if (yych <= '<') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; + if (yych <= '/') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + goto yy259; } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } + if (yych <= '9') goto yy260; + if (yych == ';') goto yy252; + goto yy259; } } } else { - if (yych <= 'e') { - if (yych <= 'Z') { - if (yych <= 'F') goto yy272; - if (yych == 'N') goto yy266; - goto yy258; + if (yych <= '`') { + if (yych <= 'A') { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy283; } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= 'z') { - if (yych <= 'f') goto yy272; - if (yych == 'n') goto yy266; - goto yy258; + if (yych <= '{') { + if (yych <= 'a') goto yy283; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -3275,49 +3191,60 @@ yy254: YYDEBUG(254, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'N') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'R') { - if (yych <= '@') goto yy257; - if (yych <= 'Q') goto yy258; - goto yy270; + if (yych <= 'n') { + if (yych <= 'Z') { + if (yych <= 'O') goto yy279; + if (yych == 'U') goto yy280; + goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'r') goto yy270; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'o') goto yy279; + if (yych == 'u') goto yy280; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } @@ -3325,386 +3252,398 @@ yy255: YYDEBUG(255, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'E') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; + if (yych <= 'e') { + if (yych <= 'Z') { + if (yych <= 'F') goto yy274; + if (yych == 'N') goto yy268; goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'e') goto yy260; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'f') goto yy274; + if (yych == 'n') goto yy268; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } yy256: YYDEBUG(256, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy257: - YYDEBUG(257, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy256; - } - if (yych == '$') goto yy261; - goto yy230; -yy258: - YYDEBUG(258, *YYCURSOR); - yyaccept = 4; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(259, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy250; - goto yy256; - } else { - if (yych <= '\n') goto yy250; - if (yych <= '\f') goto yy256; - goto yy250; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy250; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy250; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy250; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy256; - } - } - } -yy260: - YYDEBUG(260, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'R') { + if (yych <= '@') goto yy259; + if (yych <= 'Q') goto yy260; + goto yy272; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'r') goto yy272; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy257: + YYDEBUG(257, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy262; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy262; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy258: + YYDEBUG(258, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy259: + YYDEBUG(259, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy258; + } + if (yych == '$') goto yy263; + goto yy232; +yy260: + YYDEBUG(260, *YYCURSOR); + yyaccept = 4; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(261, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy252; goto yy258; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '\n') goto yy252; + if (yych <= '\f') goto yy258; + goto yy252; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy252; + } else { + if (yych == '$') goto yy263; + goto yy258; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy252; + goto yy258; + } else { + if (yych == '<') goto yy258; + goto yy252; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy258; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy258; + } + } + } +yy262: + YYDEBUG(262, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; - goto yy266; + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + goto yy268; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 's') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy261: - YYDEBUG(261, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy262; - if (yych <= '[') goto yy256; - goto yy263; - } else { - if (yych != '{') goto yy256; - } -yy262: - YYDEBUG(262, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 3) { - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy230; - } else { - goto yy232; - } - } else { - if (yyaccept <= 2) { - goto yy228; - } else { - goto yy245; - } - } - } else { - if (yyaccept <= 5) { - if (yyaccept <= 4) { - goto yy250; - } else { - goto yy267; - } - } else { - goto yy274; - } - } yy263: YYDEBUG(263, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy264; + if (yych <= '\\') { + if (yych <= 0x00) goto yy264; + if (yych <= '[') goto yy258; + goto yy265; + } else { + if (yych != '{') goto yy258; } - goto yy256; yy264: YYDEBUG(264, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy232; + } else { + goto yy234; + } + } else { + if (yyaccept <= 2) { + goto yy230; + } else { + goto yy247; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy252; + } else { + goto yy269; + } + } else { + goto yy276; + } + } +yy265: + YYDEBUG(265, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(265, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy264; + goto yy266; } - if (yych <= 0x00) goto yy230; - if (yych == '\\') goto yy263; - goto yy256; + goto yy258; yy266: YYDEBUG(266, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(267, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy266; + } + if (yych <= 0x00) goto yy232; + if (yych == '\\') goto yy265; + goto yy258; +yy268: + YYDEBUG(268, *YYCURSOR); yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 16) { - goto yy268; + goto yy270; } if (yych <= ';') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy267; - if (yych <= '\t') goto yy257; + if (yych <= 0x00) goto yy269; + if (yych <= '\t') goto yy259; } else { - if (yych != '\r') goto yy257; + if (yych != '\r') goto yy259; } } else { if (yych <= ')') { - if (yych <= '"') goto yy267; - if (yych <= '%') goto yy257; + if (yych <= '"') goto yy269; + if (yych <= '%') goto yy259; } else { - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - if (yych <= ':') goto yy257; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + if (yych <= ':') goto yy259; } } } else { if (yych <= '_') { if (yych <= '@') { - if (yych != '=') goto yy257; + if (yych != '=') goto yy259; } else { - if (yych <= 'Z') goto yy258; - if (yych <= '^') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych <= '^') goto yy259; + goto yy260; } } else { if (yych <= '{') { - if (yych <= '`') goto yy257; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '`') goto yy259; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych >= 0x7F) goto yy257; + if (yych == '}') goto yy259; + if (yych >= 0x7F) goto yy259; } } } -yy267: - YYDEBUG(267, *YYCURSOR); +yy269: + YYDEBUG(269, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 421 "Zend/zend_ini_scanner.l" { /* TRUE value (when used outside option value/offset this causes parse error!) */ RETURN_TOKEN(BOOL_TRUE, "1", 1); } -#line 3599 "Zend/zend_ini_scanner.c" -yy268: - YYDEBUG(268, *YYCURSOR); +#line 3637 "Zend/zend_ini_scanner.c" +yy270: + YYDEBUG(270, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(269, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy268; - } - goto yy267; -yy270: - YYDEBUG(270, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'U') { - if (yych <= '@') goto yy257; - if (yych <= 'T') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'u') goto yy271; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy271: YYDEBUG(271, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy266; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } + if (yybm[0+yych] & 16) { + goto yy270; } + goto yy269; yy272: YYDEBUG(272, *YYCURSOR); yyaccept = 4; @@ -3712,251 +3651,251 @@ yy272: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'F') { - if (yych <= '@') goto yy257; - if (yych <= 'E') goto yy258; + if (yych <= 'U') { + if (yych <= '@') goto yy259; + if (yych <= 'T') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'f') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'u') goto yy273; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy273: YYDEBUG(273, *YYCURSOR); - yyaccept = 6; + yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\t') goto yy275; - if (yych >= '\v') goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych <= ' ') goto yy275; - if (yych >= '#') goto yy257; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych >= '*') goto yy257; + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy268; } else { - if (yych == '<') goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; + if (yych <= '{') { + if (yych == 'e') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych != '~') goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy274: YYDEBUG(274, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'F') { + if (yych <= '@') goto yy259; + if (yych <= 'E') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'f') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy275: + YYDEBUG(275, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy259; + } else { + if (yych <= '\t') goto yy277; + if (yych >= '\v') goto yy259; + } + } else { + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; + } else { + if (yych <= ' ') goto yy277; + if (yych >= '#') goto yy259; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych >= '*') goto yy259; + } else { + if (yych == '<') goto yy259; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy259; + } else { + if (yych != '~') goto yy259; + } + } + } +yy276: + YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 425 "Zend/zend_ini_scanner.l" { /* FALSE value (when used outside option value/offset this causes parse error!)*/ RETURN_TOKEN(BOOL_FALSE, "", 0); } -#line 3803 "Zend/zend_ini_scanner.c" -yy275: - YYDEBUG(275, *YYCURSOR); +#line 3841 "Zend/zend_ini_scanner.c" +yy277: + YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(276, *YYCURSOR); - if (yych == '\t') goto yy275; - if (yych == ' ') goto yy275; - goto yy274; -yy277: - YYDEBUG(277, *YYCURSOR); + YYDEBUG(278, *YYCURSOR); + if (yych == '\t') goto yy277; + if (yych == ' ') goto yy277; + goto yy276; +yy279: + YYDEBUG(279, *YYCURSOR); yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '<') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy274; - if (yych <= 0x08) goto yy257; - if (yych <= '\t') goto yy275; - goto yy274; + if (yych <= 0x00) goto yy276; + if (yych <= 0x08) goto yy259; + if (yych <= '\t') goto yy277; + goto yy276; } else { - if (yych == '\r') goto yy274; - if (yych <= 0x1F) goto yy257; - goto yy275; + if (yych == '\r') goto yy276; + if (yych <= 0x1F) goto yy259; + goto yy277; } } else { if (yych <= '/') { - if (yych <= '"') goto yy274; - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy274; - goto yy257; + if (yych <= '"') goto yy276; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy276; + goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy274; - goto yy257; + if (yych <= '9') goto yy260; + if (yych == ';') goto yy276; + goto yy259; } } } else { if (yych <= '`') { if (yych <= 'N') { - if (yych <= '=') goto yy274; - if (yych <= '@') goto yy257; - if (yych <= 'M') goto yy258; - goto yy280; + if (yych <= '=') goto yy276; + if (yych <= '@') goto yy259; + if (yych <= 'M') goto yy260; + goto yy282; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'n') goto yy280; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'n') goto yy282; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy274; - goto yy257; - } - } - } -yy278: - YYDEBUG(278, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy279; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy279: - YYDEBUG(279, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - goto yy273; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy276; + goto yy259; } } } @@ -3967,46 +3906,45 @@ yy280: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4017,45 +3955,46 @@ yy281: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy282; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4066,45 +4005,46 @@ yy282: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy283; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4115,126 +4055,176 @@ yy283: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy284; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy284: YYDEBUG(284, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'S') { + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy285; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } yy285: YYDEBUG(285, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy284; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } } - if (yych >= '\r') goto yy288; yy286: YYDEBUG(286, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy287: YYDEBUG(287, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy286; + } + if (yych >= '\r') goto yy290; +yy288: + YYDEBUG(288, *YYCURSOR); + ++YYCURSOR; +yy289: + YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4185 "Zend/zend_ini_scanner.c" -yy288: - YYDEBUG(288, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy286; - goto yy287; -yy289: - YYDEBUG(289, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; +#line 4223 "Zend/zend_ini_scanner.c" +yy290: YYDEBUG(290, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy289; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; - } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy245; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy245; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy245; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy245; - } else { - if (yych == '~') goto yy245; - goto yy256; - } - } - } + yych = *++YYCURSOR; + if (yych == '\n') goto yy288; + goto yy289; yy291: YYDEBUG(291, *YYCURSOR); yyaccept = 3; @@ -4242,45 +4232,44 @@ yy291: YYFILL(1); yych = *YYCURSOR; YYDEBUG(292, *YYCURSOR); - if (yych <= '-') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy245; - if (yych <= 0x08) goto yy256; - goto yy245; + if (yybm[0+yych] & 64) { + goto yy291; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych == '\r') goto yy245; - goto yy256; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { - if (yych <= '$') { - if (yych <= '"') goto yy245; - if (yych <= '#') goto yy256; - goto yy261; + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy247; } else { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy245; - goto yy256; + if (yych == '$') goto yy263; + goto yy258; } } } else { - if (yych <= '<') { - if (yych <= '9') { - if (yych <= '.') goto yy289; - if (yych <= '/') goto yy256; - goto yy291; + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy247; + goto yy258; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == '<') goto yy258; + goto yy247; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4291,44 +4280,45 @@ yy293: YYFILL(1); yych = *YYCURSOR; YYDEBUG(294, *YYCURSOR); - if (yych <= ')') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= '-') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy247; + if (yych <= 0x08) goto yy258; + goto yy247; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych == '\r') goto yy247; + goto yy258; } } else { - if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= '$') { + if (yych <= '"') goto yy247; + if (yych <= '#') goto yy258; + goto yy263; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '%') goto yy258; + if (yych <= ')') goto yy247; + goto yy258; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '.') goto yy291; + if (yych <= '/') goto yy258; goto yy293; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4342,56 +4332,104 @@ yy295: if (yych <= ')') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '/') goto yy258; goto yy295; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } yy297: YYDEBUG(297, *YYCURSOR); - ++YYCURSOR; + yyaccept = 3; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(298, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy297; + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; + } else { + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; + } else { + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy258; + goto yy297; + } else { + if (yych == ';') goto yy247; + goto yy258; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; + } else { + if (yych == '~') goto yy247; + goto yy258; + } + } } +yy299: YYDEBUG(299, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(300, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy299; + } + YYDEBUG(301, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -4402,66 +4440,66 @@ yy297: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4406 "Zend/zend_ini_scanner.c" -yy301: - YYDEBUG(301, *YYCURSOR); +#line 4444 "Zend/zend_ini_scanner.c" +yy303: + YYDEBUG(303, *YYCURSOR); ++YYCURSOR; - YYDEBUG(302, *YYCURSOR); + YYDEBUG(304, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 4417 "Zend/zend_ini_scanner.c" -yy303: - YYDEBUG(303, *YYCURSOR); +#line 4455 "Zend/zend_ini_scanner.c" +yy305: + YYDEBUG(305, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy304: - YYDEBUG(304, *YYCURSOR); - if (yych == '\t') goto yy303; - if (yych == ' ') goto yy303; - goto yy237; -yy305: - YYDEBUG(305, *YYCURSOR); - yych = *++YYCURSOR; - goto yy234; yy306: YYDEBUG(306, *YYCURSOR); + if (yych == '\t') goto yy305; + if (yych == ' ') goto yy305; + goto yy239; +yy307: + YYDEBUG(307, *YYCURSOR); + yych = *++YYCURSOR; + goto yy236; +yy308: + YYDEBUG(308, *YYCURSOR); yyaccept = 1; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy307: - YYDEBUG(307, *YYCURSOR); +yy309: + YYDEBUG(309, *YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { - if (yych <= 0x08) goto yy232; - if (yych <= '\t') goto yy306; - goto yy305; + if (yych <= 0x08) goto yy234; + if (yych <= '\t') goto yy308; + goto yy307; } else { - if (yych == '\r') goto yy309; - goto yy232; + if (yych == '\r') goto yy311; + goto yy234; } } else { if (yych <= '"') { - if (yych <= ' ') goto yy306; - if (yych <= '!') goto yy232; + if (yych <= ' ') goto yy308; + if (yych <= '!') goto yy234; } else { - if (yych == ';') goto yy284; - goto yy232; + if (yych == ';') goto yy286; + goto yy234; } } - YYDEBUG(308, *YYCURSOR); + YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - goto yy239; -yy309: - YYDEBUG(309, *YYCURSOR); + goto yy241; +yy311: + YYDEBUG(311, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy305; - goto yy234; + if ((yych = *YYCURSOR) == '\n') goto yy307; + goto yy236; } /* *********************************** */ yyc_ST_VARNAME: @@ -4500,47 +4538,47 @@ yyc_ST_VARNAME: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(310, *YYCURSOR); + YYDEBUG(312, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '\'') { if (yych <= ' ') { if (yych <= '\n') { - if (yych >= '\t') goto yy314; + if (yych >= '\t') goto yy316; } else { - if (yych == '\r') goto yy314; + if (yych == '\r') goto yy316; } } else { if (yych <= '$') { - if (yych != '#') goto yy314; + if (yych != '#') goto yy316; } else { - if (yych == '&') goto yy314; + if (yych == '&') goto yy316; } } } else { if (yych <= 'Z') { if (yych <= ';') { - if (yych <= ')') goto yy314; - if (yych >= ';') goto yy314; + if (yych <= ')') goto yy316; + if (yych >= ';') goto yy316; } else { - if (yych == '=') goto yy314; + if (yych == '=') goto yy316; } } else { if (yych <= '|') { - if (yych <= '[') goto yy314; - if (yych >= '{') goto yy314; + if (yych <= '[') goto yy316; + if (yych >= '{') goto yy316; } else { - if (yych <= '}') goto yy316; - if (yych <= '~') goto yy314; + if (yych <= '}') goto yy318; + if (yych <= '~') goto yy316; } } } - YYDEBUG(312, *YYCURSOR); + YYDEBUG(314, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy319; -yy313: - YYDEBUG(313, *YYCURSOR); + goto yy321; +yy315: + YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ @@ -4552,41 +4590,41 @@ yy313: RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4556 "Zend/zend_ini_scanner.c" -yy314: - YYDEBUG(314, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(315, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 4566 "Zend/zend_ini_scanner.c" +#line 4594 "Zend/zend_ini_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); ++YYCURSOR; YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 4604 "Zend/zend_ini_scanner.c" +yy318: + YYDEBUG(318, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(319, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4577 "Zend/zend_ini_scanner.c" -yy318: - YYDEBUG(318, *YYCURSOR); +#line 4615 "Zend/zend_ini_scanner.c" +yy320: + YYDEBUG(320, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy319: - YYDEBUG(319, *YYCURSOR); +yy321: + YYDEBUG(321, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy318; + goto yy320; } - goto yy313; + goto yy315; } } -#line 579 "Zend/zend_ini_scanner.l" +#line 600 "Zend/zend_ini_scanner.l" } diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index f7b9e1ffb26..0c0471373c7 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Mar 2 11:49:21 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:48:25 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { From 93b041e6c2860a0aeebf6e7fd6746bf4b5ca226b Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Thu, 7 Jun 2012 18:05:25 +0200 Subject: [PATCH 084/641] Regenerated files --- Zend/zend_ini_scanner.c | 3186 +++++++++++++++++----------------- Zend/zend_ini_scanner_defs.h | 2 +- 2 files changed, 1613 insertions(+), 1575 deletions(-) diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 4bbf604bd49..470f5236003 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:04:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:55:40 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -481,7 +481,7 @@ yy4: yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 547 "Zend/zend_ini_scanner.l" +#line 568 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; @@ -493,7 +493,7 @@ yy6: yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 552 "Zend/zend_ini_scanner.l" +#line 573 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; @@ -533,7 +533,7 @@ yy10: ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 475 "Zend/zend_ini_scanner.l" +#line 496 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } @@ -554,7 +554,7 @@ yy14: goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -926,7 +926,7 @@ yy55: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; @@ -1012,7 +1012,7 @@ yy64: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 563 "Zend/zend_ini_scanner.l" +#line 584 "Zend/zend_ini_scanner.l" { /* #Comment */ zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); BEGIN(INITIAL); @@ -1159,7 +1159,7 @@ yyc_ST_DOUBLE_QUOTES: yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 507 "Zend/zend_ini_scanner.l" +#line 528 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1204,7 +1204,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 502 "Zend/zend_ini_scanner.l" +#line 523 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; @@ -1323,7 +1323,7 @@ yy86: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" +#line 514 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } @@ -1344,7 +1344,7 @@ yy89: yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" { return 0; } @@ -1355,7 +1355,7 @@ yy91: yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; @@ -1422,7 +1422,7 @@ yy97: yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } @@ -1452,7 +1452,7 @@ yy99: yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } @@ -1833,7 +1833,7 @@ yyc_ST_RAW: 160, 224, 0, 160, 160, 0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 224, 160, 160, 160, 160, 160, 160, 160, + 224, 160, 32, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 32, 160, 160, 160, 160, @@ -1865,66 +1865,64 @@ yyc_ST_RAW: YYDEBUG(135, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy139; - } else { - if (yych <= '\t') goto yy141; - if (yych <= '\n') goto yy142; - goto yy139; - } - } else { - if (yych <= ' ') { - if (yych <= '\r') goto yy144; - if (yych <= 0x1F) goto yy139; + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy137; + if (yych <= 0x08) goto yy139; goto yy141; } else { - if (yych == ';') goto yy145; + if (yych <= '\n') goto yy142; + if (yych <= '\f') goto yy139; + goto yy144; + } + } else { + if (yych <= '!') { + if (yych == ' ') goto yy141; + goto yy139; + } else { + if (yych <= '"') goto yy145; + if (yych == ';') goto yy147; goto yy139; } } +yy137: YYDEBUG(137, *YYCURSOR); ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1896 "Zend/zend_ini_scanner.c" +#line 1899 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy156; + goto yy158; yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 448 "Zend/zend_ini_scanner.l" +#line 474 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ - /* Eat leading and trailing double quotes */ - if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { - SCNG(yy_text)++; - yyleng = yyleng - 2; - } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1914 "Zend/zend_ini_scanner.c" +#line 1912 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { - goto yy152; + goto yy154; } if (yych <= '\f') { - if (yych == '\n') goto yy151; - goto yy156; + if (yych == '\n') goto yy153; + goto yy158; } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy156; + if (yych <= '\r') goto yy156; + if (yych == ';') goto yy148; + goto yy158; } yy142: YYDEBUG(142, *YYCURSOR); @@ -1932,89 +1930,129 @@ yy142: yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1942 "Zend/zend_ini_scanner.c" +#line 1940 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; - if (yych == '\n') goto yy151; + if (yych == '\n') goto yy153; goto yy143; yy145: YYDEBUG(145, *YYCURSOR); - yyaccept = 1; - yych = *(YYMARKER = ++YYCURSOR); - goto yy147; -yy146: - YYDEBUG(146, *YYCURSOR); ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + YYDEBUG(146, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 448 "Zend/zend_ini_scanner.l" + { + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '\n': + SCNG(lineno)++; + break; + case '\r': + if (*YYCURSOR != '\n') { + SCNG(lineno)++; + } + break; + case '"': + yyleng = YYCURSOR - SCNG(yy_text) - 2; + SCNG(yy_text)++; + RETURN_TOKEN(TC_RAW, yytext, yyleng); + case '\\': + if (YYCURSOR < YYLIMIT) { + YYCURSOR++; + } + break; + } + } + yyleng = YYCURSOR - SCNG(yy_text); + RETURN_TOKEN(TC_RAW, yytext, yyleng); +} +#line 1977 "Zend/zend_ini_scanner.c" yy147: YYDEBUG(147, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy146; - } - if (yych >= '\r') goto yy150; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy149; yy148: YYDEBUG(148, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy149: YYDEBUG(149, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy148; + } + if (yych >= '\r') goto yy152; +yy150: + YYDEBUG(150, *YYCURSOR); + ++YYCURSOR; +yy151: + YYDEBUG(151, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1976 "Zend/zend_ini_scanner.c" -yy150: - YYDEBUG(150, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy148; - goto yy149; -yy151: - YYDEBUG(151, *YYCURSOR); - yych = *++YYCURSOR; - goto yy143; +#line 2006 "Zend/zend_ini_scanner.c" yy152: YYDEBUG(152, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy150; + goto yy151; +yy153: + YYDEBUG(153, *YYCURSOR); + yych = *++YYCURSOR; + goto yy143; +yy154: + YYDEBUG(154, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; - YYDEBUG(153, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy152; - } - if (yych <= '\f') { - if (yych <= 0x00) goto yy140; - if (yych == '\n') goto yy151; - goto yy155; - } else { - if (yych <= '\r') goto yy154; - if (yych == ';') goto yy146; - goto yy155; - } -yy154: - YYDEBUG(154, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy151; - goto yy143; -yy155: YYDEBUG(155, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy154; + } + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x00) goto yy140; + goto yy157; + } else { + if (yych <= '\n') goto yy153; + if (yych <= '\f') goto yy157; + } + } else { + if (yych <= '"') { + if (yych <= '!') goto yy157; + goto yy140; + } else { + if (yych == ';') goto yy148; + goto yy157; + } + } +yy156: + YYDEBUG(156, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy153; + goto yy143; +yy157: + YYDEBUG(157, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy156: - YYDEBUG(156, *YYCURSOR); +yy158: + YYDEBUG(158, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy155; + goto yy157; } goto yy140; } @@ -2055,85 +2093,85 @@ yyc_ST_SECTION_RAW: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(157, *YYCURSOR); + YYDEBUG(159, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '\f') { - if (yych == '\n') goto yy161; + if (yych == '\n') goto yy163; } else { - if (yych <= '\r') goto yy161; - if (yych == ']') goto yy163; + if (yych <= '\r') goto yy163; + if (yych == ']') goto yy165; } - YYDEBUG(159, *YYCURSOR); + YYDEBUG(161, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy170; -yy160: - YYDEBUG(160, *YYCURSOR); + goto yy172; +yy162: + YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 457 "Zend/zend_ini_scanner.l" +#line 478 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2079 "Zend/zend_ini_scanner.c" -yy161: - YYDEBUG(161, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(162, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2089 "Zend/zend_ini_scanner.c" +#line 2117 "Zend/zend_ini_scanner.c" yy163: YYDEBUG(163, *YYCURSOR); ++YYCURSOR; - yych = *YYCURSOR; - goto yy166; -yy164: YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2127 "Zend/zend_ini_scanner.c" +yy165: + YYDEBUG(165, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy168; +yy166: + YYDEBUG(166, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2104 "Zend/zend_ini_scanner.c" -yy165: - YYDEBUG(165, *YYCURSOR); +#line 2142 "Zend/zend_ini_scanner.c" +yy167: + YYDEBUG(167, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy166: - YYDEBUG(166, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy165; - } - if (yych == '\n') goto yy167; - if (yych == '\r') goto yy168; - goto yy164; -yy167: - YYDEBUG(167, *YYCURSOR); - yych = *++YYCURSOR; - goto yy164; yy168: YYDEBUG(168, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy167; - goto yy164; + if (yybm[0+yych] & 64) { + goto yy167; + } + if (yych == '\n') goto yy169; + if (yych == '\r') goto yy170; + goto yy166; yy169: YYDEBUG(169, *YYCURSOR); + yych = *++YYCURSOR; + goto yy166; +yy170: + YYDEBUG(170, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy169; + goto yy166; +yy171: + YYDEBUG(171, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy170: - YYDEBUG(170, *YYCURSOR); +yy172: + YYDEBUG(172, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy169; + goto yy171; } - goto yy160; + goto yy162; } /* *********************************** */ yyc_ST_SECTION_VALUE: @@ -2172,203 +2210,203 @@ yyc_ST_SECTION_VALUE: 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, }; - YYDEBUG(171, *YYCURSOR); + YYDEBUG(173, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '-') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x08) goto yy173; - if (yych <= '\t') goto yy175; - goto yy176; + if (yych <= 0x08) goto yy175; + if (yych <= '\t') goto yy177; + goto yy178; } else { - if (yych == '\r') goto yy176; - if (yych >= ' ') goto yy175; + if (yych == '\r') goto yy178; + if (yych >= ' ') goto yy177; } } else { if (yych <= '$') { - if (yych == '"') goto yy178; - if (yych >= '$') goto yy180; + if (yych == '"') goto yy180; + if (yych >= '$') goto yy182; } else { - if (yych == '\'') goto yy181; - if (yych >= '-') goto yy182; + if (yych == '\'') goto yy183; + if (yych >= '-') goto yy184; } } } else { if (yych <= 'Z') { if (yych <= '9') { - if (yych <= '.') goto yy183; - if (yych >= '0') goto yy184; + if (yych <= '.') goto yy185; + if (yych >= '0') goto yy186; } else { - if (yych == ';') goto yy176; - if (yych >= 'A') goto yy186; + if (yych == ';') goto yy178; + if (yych >= 'A') goto yy188; } } else { if (yych <= '^') { - if (yych <= '[') goto yy173; - if (yych <= '\\') goto yy188; - if (yych <= ']') goto yy189; + if (yych <= '[') goto yy175; + if (yych <= '\\') goto yy190; + if (yych <= ']') goto yy191; } else { - if (yych == '`') goto yy173; - if (yych <= 'z') goto yy186; + if (yych == '`') goto yy175; + if (yych <= 'z') goto yy188; } } } -yy173: - YYDEBUG(173, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy196; -yy174: - YYDEBUG(174, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 493 "Zend/zend_ini_scanner.l" - { /* Get rest as section/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2230 "Zend/zend_ini_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 0x1F) { - if (yych == '\t') goto yy222; - goto yy196; - } else { - if (yych <= ' ') goto yy222; - if (yych == '"') goto yy224; - goto yy196; - } + goto yy198; yy176: YYDEBUG(176, *YYCURSOR); - ++YYCURSOR; + yyleng = YYCURSOR - SCNG(yy_text); +#line 514 "Zend/zend_ini_scanner.l" + { /* Get rest as section/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); +} +#line 2268 "Zend/zend_ini_scanner.c" yy177: YYDEBUG(177, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 2253 "Zend/zend_ini_scanner.c" + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 0x1F) { + if (yych == '\t') goto yy224; + goto yy198; + } else { + if (yych <= ' ') goto yy224; + if (yych == '"') goto yy226; + goto yy198; + } yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 2291 "Zend/zend_ini_scanner.c" +yy180: + YYDEBUG(180, *YYCURSOR); + ++YYCURSOR; +yy181: + YYDEBUG(181, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2265 "Zend/zend_ini_scanner.c" -yy180: - YYDEBUG(180, *YYCURSOR); +#line 2303 "Zend/zend_ini_scanner.c" +yy182: + YYDEBUG(182, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy177; - if (yych <= '[') goto yy195; - goto yy200; + if (yych <= 0x00) goto yy179; + if (yych <= '[') goto yy197; + goto yy202; } else { - if (yych == '{') goto yy220; - goto yy195; + if (yych == '{') goto yy222; + goto yy197; } -yy181: - YYDEBUG(181, *YYCURSOR); +yy183: + YYDEBUG(183, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy216; + goto yy218; } - goto yy177; -yy182: - YYDEBUG(182, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy214; - goto yy196; -yy183: - YYDEBUG(183, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy196; - if (yych <= '9') goto yy212; - goto yy196; + goto yy179; yy184: YYDEBUG(184, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy216; + goto yy198; +yy185: + YYDEBUG(185, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy198; + if (yych <= '9') goto yy214; + goto yy198; +yy186: + YYDEBUG(186, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '\'') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy196; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy198; } else { - if (yych == '"') goto yy185; - if (yych <= '&') goto yy196; + if (yych == '"') goto yy187; + if (yych <= '&') goto yy198; } } else { if (yych <= '9') { - if (yych == '.') goto yy208; - if (yych <= '/') goto yy196; - goto yy210; + if (yych == '.') goto yy210; + if (yych <= '/') goto yy198; + goto yy212; } else { if (yych <= ';') { - if (yych <= ':') goto yy196; + if (yych <= ':') goto yy198; } else { - if (yych != ']') goto yy196; + if (yych != ']') goto yy198; } } } -yy185: - YYDEBUG(185, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" - { /* Get number option value as string */ - RETURN_TOKEN(TC_NUMBER, yytext, yyleng); -} -#line 2331 "Zend/zend_ini_scanner.c" -yy186: - YYDEBUG(186, *YYCURSOR); - yyaccept = 3; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '"') { - if (yych <= '\f') { - if (yych != '\n') goto yy196; - } else { - if (yych <= '\r') goto yy187; - if (yych <= '!') goto yy196; - } - } else { - if (yych <= ':') { - if (yych != '\'') goto yy196; - } else { - if (yych <= ';') goto yy187; - if (yych != ']') goto yy196; - } - } yy187: YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" + { /* Get number option value as string */ + RETURN_TOKEN(TC_NUMBER, yytext, yyleng); +} +#line 2369 "Zend/zend_ini_scanner.c" +yy188: + YYDEBUG(188, *YYCURSOR); + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy208; + } + if (yych <= '"') { + if (yych <= '\f') { + if (yych != '\n') goto yy198; + } else { + if (yych <= '\r') goto yy189; + if (yych <= '!') goto yy198; + } + } else { + if (yych <= ':') { + if (yych != '\'') goto yy198; + } else { + if (yych <= ';') goto yy189; + if (yych != ']') goto yy198; + } + } +yy189: + YYDEBUG(189, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2361 "Zend/zend_ini_scanner.c" -yy188: - YYDEBUG(188, *YYCURSOR); - yych = *++YYCURSOR; - goto yy195; -yy189: - YYDEBUG(189, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy192; +#line 2399 "Zend/zend_ini_scanner.c" yy190: YYDEBUG(190, *YYCURSOR); + yych = *++YYCURSOR; + goto yy197; +yy191: + YYDEBUG(191, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy194; +yy192: + YYDEBUG(192, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 377 "Zend/zend_ini_scanner.l" { /* End of section */ @@ -2376,97 +2414,86 @@ yy190: SCNG(lineno)++; return ']'; } -#line 2380 "Zend/zend_ini_scanner.c" -yy191: - YYDEBUG(191, *YYCURSOR); +#line 2418 "Zend/zend_ini_scanner.c" +yy193: + YYDEBUG(193, *YYCURSOR); ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy192: - YYDEBUG(192, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy191; - } - if (yych == '\n') goto yy193; - if (yych == '\r') goto yy194; - goto yy190; -yy193: - YYDEBUG(193, *YYCURSOR); - yych = *++YYCURSOR; - goto yy190; yy194: YYDEBUG(194, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy193; - goto yy190; + if (yybm[0+yych] & 2) { + goto yy193; + } + if (yych == '\n') goto yy195; + if (yych == '\r') goto yy196; + goto yy192; yy195: YYDEBUG(195, *YYCURSOR); + yych = *++YYCURSOR; + goto yy192; +yy196: + YYDEBUG(196, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == '\n') goto yy195; + goto yy192; +yy197: + YYDEBUG(197, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy196: - YYDEBUG(196, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy195; - } - if (yych == '$') goto yy198; - if (yych != '\\') goto yy174; -yy197: - YYDEBUG(197, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - goto yy195; yy198: YYDEBUG(198, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy197; + } + if (yych == '$') goto yy200; + if (yych != '\\') goto yy176; +yy199: + YYDEBUG(199, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy199; - if (yych <= '[') goto yy195; - goto yy200; - } else { - if (yych != '{') goto yy195; - } -yy199: - YYDEBUG(199, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy174; - } else { - goto yy177; - } - } else { - if (yyaccept <= 2) { - goto yy185; - } else { - goto yy187; - } - } + goto yy197; yy200: YYDEBUG(200, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; + if (yych <= '\\') { + if (yych <= 0x00) goto yy201; + if (yych <= '[') goto yy197; + goto yy202; + } else { + if (yych != '{') goto yy197; } - if (yych == '\\') goto yy203; - goto yy195; yy201: YYDEBUG(201, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy176; + } else { + goto yy179; + } + } else { + if (yyaccept <= 2) { + goto yy187; + } else { + goto yy189; + } + } +yy202: + YYDEBUG(202, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(202, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } if (yych == '\\') goto yy205; - goto yy195; + goto yy197; yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -2474,82 +2501,61 @@ yy203: yych = *YYCURSOR; YYDEBUG(204, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy201; + goto yy203; } - if (yych == '\\') goto yy203; - goto yy195; + if (yych == '\\') goto yy207; + goto yy197; yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy201; - } - if (yych == '\\') goto yy203; - goto yy195; -yy206: YYDEBUG(206, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy207: + YYDEBUG(207, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 8) { + goto yy203; + } + if (yych == '\\') goto yy205; + goto yy197; +yy208: + YYDEBUG(208, *YYCURSOR); yyaccept = 3; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(207, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy206; - } - if (yych <= '$') { - if (yych <= '\r') { - if (yych == '\n') goto yy187; - if (yych <= '\f') goto yy195; - goto yy187; - } else { - if (yych == '"') goto yy187; - if (yych <= '#') goto yy195; - goto yy198; - } - } else { - if (yych <= ';') { - if (yych == '\'') goto yy187; - if (yych <= ':') goto yy195; - goto yy187; - } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy187; - goto yy195; - } - } -yy208: - YYDEBUG(208, *YYCURSOR); - yyaccept = 2; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; YYDEBUG(209, *YYCURSOR); - if (yybm[0+yych] & 64) { + if (yybm[0+yych] & 32) { goto yy208; } if (yych <= '$') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy189; + if (yych <= '\f') goto yy197; + goto yy189; } else { - if (yych == '"') goto yy185; - if (yych <= '#') goto yy195; - goto yy198; + if (yych == '"') goto yy189; + if (yych <= '#') goto yy197; + goto yy200; } } else { if (yych <= ';') { - if (yych == '\'') goto yy185; - if (yych <= ':') goto yy195; - goto yy185; + if (yych == '\'') goto yy189; + if (yych <= ':') goto yy197; + goto yy189; } else { - if (yych <= '[') goto yy195; - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy189; + goto yy197; } } yy210: @@ -2559,44 +2565,29 @@ yy210: YYFILL(1); yych = *YYCURSOR; YYDEBUG(211, *YYCURSOR); - if (yych <= '\'') { - if (yych <= '!') { - if (yych <= '\n') { - if (yych <= '\t') goto yy195; - goto yy185; - } else { - if (yych == '\r') goto yy185; - goto yy195; - } + if (yybm[0+yych] & 64) { + goto yy210; + } + if (yych <= '$') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { - if (yych <= '#') { - if (yych <= '"') goto yy185; - goto yy195; - } else { - if (yych <= '$') goto yy198; - if (yych <= '&') goto yy195; - goto yy185; - } + if (yych == '"') goto yy187; + if (yych <= '#') goto yy197; + goto yy200; } } else { - if (yych <= ':') { - if (yych <= '.') { - if (yych <= '-') goto yy195; - goto yy208; - } else { - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy210; - goto yy195; - } + if (yych <= ';') { + if (yych == '\'') goto yy187; + if (yych <= ':') goto yy197; + goto yy187; } else { - if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; - } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; - } + if (yych <= '[') goto yy197; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } yy212: @@ -2606,34 +2597,43 @@ yy212: YYFILL(1); yych = *YYCURSOR; YYDEBUG(213, *YYCURSOR); - if (yych <= '&') { - if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; - } else { - if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '\'') { + if (yych <= '!') { + if (yych <= '\n') { + if (yych <= '\t') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '\r') goto yy187; + goto yy197; + } + } else { + if (yych <= '#') { + if (yych <= '"') goto yy187; + goto yy197; + } else { + if (yych <= '$') goto yy200; + if (yych <= '&') goto yy197; + goto yy187; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; - if (yych <= '9') goto yy212; - goto yy195; + if (yych <= '.') { + if (yych <= '-') goto yy197; + goto yy210; + } else { + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy212; + goto yy197; + } } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } @@ -2646,47 +2646,85 @@ yy214: YYDEBUG(215, *YYCURSOR); if (yych <= '&') { if (yych <= '\r') { - if (yych == '\n') goto yy185; - if (yych <= '\f') goto yy195; - goto yy185; + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; } else { if (yych <= '"') { - if (yych <= '!') goto yy195; - goto yy185; + if (yych <= '!') goto yy197; + goto yy187; } else { - if (yych == '$') goto yy198; - goto yy195; + if (yych == '$') goto yy200; + goto yy197; } } } else { if (yych <= ':') { - if (yych <= '\'') goto yy185; - if (yych <= '/') goto yy195; + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; if (yych <= '9') goto yy214; - goto yy195; + goto yy197; } else { if (yych <= '[') { - if (yych <= ';') goto yy185; - goto yy195; + if (yych <= ';') goto yy187; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy185; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; } } } yy216: YYDEBUG(216, *YYCURSOR); - ++YYCURSOR; + yyaccept = 2; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(217, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy216; + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') goto yy187; + if (yych <= '\f') goto yy197; + goto yy187; + } else { + if (yych <= '"') { + if (yych <= '!') goto yy197; + goto yy187; + } else { + if (yych == '$') goto yy200; + goto yy197; + } + } + } else { + if (yych <= ':') { + if (yych <= '\'') goto yy187; + if (yych <= '/') goto yy197; + if (yych <= '9') goto yy216; + goto yy197; + } else { + if (yych <= '[') { + if (yych <= ';') goto yy187; + goto yy197; + } else { + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy187; + goto yy197; + } + } } +yy218: YYDEBUG(218, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(219, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy218; + } + YYDEBUG(220, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -2697,65 +2735,65 @@ yy216: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2701 "Zend/zend_ini_scanner.c" -yy220: - YYDEBUG(220, *YYCURSOR); +#line 2739 "Zend/zend_ini_scanner.c" +yy222: + YYDEBUG(222, *YYCURSOR); ++YYCURSOR; - YYDEBUG(221, *YYCURSOR); + YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 2712 "Zend/zend_ini_scanner.c" -yy222: - YYDEBUG(222, *YYCURSOR); +#line 2750 "Zend/zend_ini_scanner.c" +yy224: + YYDEBUG(224, *YYCURSOR); yyaccept = 0; YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(223, *YYCURSOR); + YYDEBUG(225, *YYCURSOR); if (yych <= '"') { if (yych <= '\f') { - if (yych <= 0x08) goto yy195; - if (yych <= '\t') goto yy222; - if (yych <= '\n') goto yy174; - goto yy195; + if (yych <= 0x08) goto yy197; + if (yych <= '\t') goto yy224; + if (yych <= '\n') goto yy176; + goto yy197; } else { if (yych <= 0x1F) { - if (yych <= '\r') goto yy174; - goto yy195; + if (yych <= '\r') goto yy176; + goto yy197; } else { - if (yych <= ' ') goto yy222; - if (yych <= '!') goto yy195; + if (yych <= ' ') goto yy224; + if (yych <= '!') goto yy197; } } } else { if (yych <= ':') { if (yych <= '$') { - if (yych <= '#') goto yy195; - goto yy198; + if (yych <= '#') goto yy197; + goto yy200; } else { - if (yych == '\'') goto yy174; - goto yy195; + if (yych == '\'') goto yy176; + goto yy197; } } else { if (yych <= '[') { - if (yych <= ';') goto yy174; - goto yy195; + if (yych <= ';') goto yy176; + goto yy197; } else { - if (yych <= '\\') goto yy197; - if (yych <= ']') goto yy174; - goto yy195; + if (yych <= '\\') goto yy199; + if (yych <= ']') goto yy176; + goto yy197; } } } -yy224: - YYDEBUG(224, *YYCURSOR); +yy226: + YYDEBUG(226, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy179; + goto yy181; } /* *********************************** */ yyc_ST_VALUE: @@ -2794,27 +2832,27 @@ yyc_ST_VALUE: 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, }; - YYDEBUG(225, *YYCURSOR); + YYDEBUG(227, *YYCURSOR); YYFILL(6); yych = *YYCURSOR; YYDEBUG(-1, yych); switch (yych) { - case 0x00: goto yy227; + case 0x00: goto yy229; case '\t': - case ' ': goto yy231; - case '\n': goto yy233; - case '\r': goto yy235; + case ' ': goto yy233; + case '\n': goto yy235; + case '\r': goto yy237; case '!': case '&': case '(': case ')': case '|': - case '~': goto yy236; - case '"': goto yy238; - case '$': goto yy240; - case '\'': goto yy241; - case '-': goto yy242; - case '.': goto yy243; + case '~': goto yy238; + case '"': goto yy240; + case '$': goto yy242; + case '\'': goto yy243; + case '-': goto yy244; + case '.': goto yy245; case '0': case '1': case '2': @@ -2824,9 +2862,9 @@ yyc_ST_VALUE: case '6': case '7': case '8': - case '9': goto yy244; - case ';': goto yy246; - case '=': goto yy247; + case '9': goto yy246; + case ';': goto yy248; + case '=': goto yy249; case 'A': case 'B': case 'C': @@ -2869,405 +2907,283 @@ yyc_ST_VALUE: case 'v': case 'w': case 'x': - case 'z': goto yy249; + case 'z': goto yy251; case 'F': - case 'f': goto yy251; + case 'f': goto yy253; case 'N': - case 'n': goto yy252; + case 'n': goto yy254; case 'O': - case 'o': goto yy253; + case 'o': goto yy255; case 'T': - case 't': goto yy254; + case 't': goto yy256; case 'Y': - case 'y': goto yy255; - default: goto yy229; + case 'y': goto yy257; + default: goto yy231; } -yy227: - YYDEBUG(227, *YYCURSOR); +yy229: + YYDEBUG(229, *YYCURSOR); ++YYCURSOR; -yy228: - YYDEBUG(228, *YYCURSOR); +yy230: + YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 570 "Zend/zend_ini_scanner.l" +#line 591 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2897 "Zend/zend_ini_scanner.c" -yy229: - YYDEBUG(229, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - goto yy257; -yy230: - YYDEBUG(230, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 489 "Zend/zend_ini_scanner.l" - { /* Get everything else as option/offset value */ - RETURN_TOKEN(TC_STRING, yytext, yyleng); -} -#line 2910 "Zend/zend_ini_scanner.c" +#line 2935 "Zend/zend_ini_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); - yyaccept = 1; + yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - goto yy307; + goto yy259; yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 543 "Zend/zend_ini_scanner.l" - { - RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +#line 510 "Zend/zend_ini_scanner.l" + { /* Get everything else as option/offset value */ + RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2923 "Zend/zend_ini_scanner.c" +#line 2948 "Zend/zend_ini_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); - ++YYCURSOR; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy309; yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 461 "Zend/zend_ini_scanner.l" +#line 564 "Zend/zend_ini_scanner.l" + { + RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); +} +#line 2961 "Zend/zend_ini_scanner.c" +yy235: + YYDEBUG(235, *YYCURSOR); + ++YYCURSOR; +yy236: + YYDEBUG(236, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 482 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2936 "Zend/zend_ini_scanner.c" -yy235: - YYDEBUG(235, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy305; - goto yy234; -yy236: - YYDEBUG(236, *YYCURSOR); - ++YYCURSOR; - yych = *YYCURSOR; - goto yy304; +#line 2974 "Zend/zend_ini_scanner.c" yy237: YYDEBUG(237, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 479 "Zend/zend_ini_scanner.l" - { /* Boolean operators */ - return yytext[0]; -} -#line 2954 "Zend/zend_ini_scanner.c" + yych = *++YYCURSOR; + if (yych == '\n') goto yy307; + goto yy236; yy238: YYDEBUG(238, *YYCURSOR); ++YYCURSOR; + yych = *YYCURSOR; + goto yy306; yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 497 "Zend/zend_ini_scanner.l" +#line 500 "Zend/zend_ini_scanner.l" + { /* Boolean operators */ + return yytext[0]; +} +#line 2992 "Zend/zend_ini_scanner.c" +yy240: + YYDEBUG(240, *YYCURSOR); + ++YYCURSOR; +yy241: + YYDEBUG(241, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 518 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2966 "Zend/zend_ini_scanner.c" -yy240: - YYDEBUG(240, *YYCURSOR); +#line 3004 "Zend/zend_ini_scanner.c" +yy242: + YYDEBUG(242, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '\\') { - if (yych <= 0x00) goto yy228; - if (yych <= '[') goto yy256; - goto yy263; + if (yych <= 0x00) goto yy230; + if (yych <= '[') goto yy258; + goto yy265; } else { - if (yych == '{') goto yy301; - goto yy256; + if (yych == '{') goto yy303; + goto yy258; } -yy241: - YYDEBUG(241, *YYCURSOR); +yy243: + YYDEBUG(243, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { - goto yy297; + goto yy299; } - goto yy228; -yy242: - YYDEBUG(242, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy295; - goto yy257; -yy243: - YYDEBUG(243, *YYCURSOR); - yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy293; - goto yy257; + goto yy230; yy244: YYDEBUG(244, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy297; + goto yy259; +yy245: + YYDEBUG(245, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy295; + goto yy259; +yy246: + YYDEBUG(246, *YYCURSOR); yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '.') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych >= 0x01) goto yy259; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy257; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy259; } } else { if (yych <= '%') { - if (yych <= 0x1F) goto yy257; - if (yych >= '#') goto yy257; + if (yych <= 0x1F) goto yy259; + if (yych >= '#') goto yy259; } else { - if (yych <= ')') goto yy245; - if (yych <= '-') goto yy257; - goto yy289; + if (yych <= ')') goto yy247; + if (yych <= '-') goto yy259; + goto yy291; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy257; - goto yy291; + if (yych <= '/') goto yy259; + goto yy293; } else { - if (yych != ';') goto yy257; + if (yych != ';') goto yy259; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy257; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy259; } else { - if (yych != '~') goto yy257; + if (yych != '~') goto yy259; } } } -yy245: - YYDEBUG(245, *YYCURSOR); +yy247: + YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 471 "Zend/zend_ini_scanner.l" +#line 492 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3046 "Zend/zend_ini_scanner.c" -yy246: - YYDEBUG(246, *YYCURSOR); +#line 3084 "Zend/zend_ini_scanner.c" +yy248: + YYDEBUG(248, *YYCURSOR); yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); - goto yy285; -yy247: - YYDEBUG(247, *YYCURSOR); + goto yy287; +yy249: + YYDEBUG(249, *YYCURSOR); ++YYCURSOR; - YYDEBUG(248, *YYCURSOR); + YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 483 "Zend/zend_ini_scanner.l" +#line 504 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3063 "Zend/zend_ini_scanner.c" -yy249: - YYDEBUG(249, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= ')') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych >= '\v') goto yy257; - } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; - } else { - if (yych <= '"') goto yy250; - if (yych <= '%') goto yy257; - } - } - } else { - if (yych <= '=') { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - } else { - if (yych != '~') goto yy257; - } - } - } -yy250: - YYDEBUG(250, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 467 "Zend/zend_ini_scanner.l" - { /* Get constant option value */ - RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); -} -#line 3103 "Zend/zend_ini_scanner.c" +#line 3101 "Zend/zend_ini_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '<') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= ')') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych >= '\v') goto yy259; } else { - if (yych <= '/') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - goto yy257; + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy250; - goto yy257; + if (yych <= '"') goto yy252; + if (yych <= '%') goto yy259; } } } else { - if (yych <= '`') { - if (yych <= 'A') { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy281; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } + if (yych <= '=') { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; } else { - if (yych <= '{') { - if (yych <= 'a') goto yy281; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych != '~') goto yy259; } } } yy252: YYDEBUG(252, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'N') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; - } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; - } - } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; - } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } - } - } - } else { - if (yych <= 'n') { - if (yych <= 'Z') { - if (yych <= 'O') goto yy277; - if (yych == 'U') goto yy278; - goto yy258; - } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; - } - } else { - if (yych <= 'z') { - if (yych <= 'o') goto yy277; - if (yych == 'u') goto yy278; - goto yy258; - } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } - } - } - } + yyleng = YYCURSOR - SCNG(yy_text); +#line 488 "Zend/zend_ini_scanner.l" + { /* Get constant option value */ + RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); +} +#line 3141 "Zend/zend_ini_scanner.c" yy253: YYDEBUG(253, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= 'E') { - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - if (yych <= '\n') goto yy250; - goto yy257; + if (yych <= '<') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - if (yych <= '"') goto yy250; - goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= ':') { - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - goto yy257; + if (yych <= '/') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + goto yy259; } else { - if (yych <= '<') { - if (yych <= ';') goto yy250; - goto yy257; - } else { - if (yych <= '=') goto yy250; - if (yych <= '@') goto yy257; - goto yy258; - } + if (yych <= '9') goto yy260; + if (yych == ';') goto yy252; + goto yy259; } } } else { - if (yych <= 'e') { - if (yych <= 'Z') { - if (yych <= 'F') goto yy272; - if (yych == 'N') goto yy266; - goto yy258; + if (yych <= '`') { + if (yych <= 'A') { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy283; } else { - if (yych == '_') goto yy258; - if (yych <= '`') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= 'z') { - if (yych <= 'f') goto yy272; - if (yych == 'n') goto yy266; - goto yy258; + if (yych <= '{') { + if (yych <= 'a') goto yy283; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy257; - } + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -3275,49 +3191,60 @@ yy254: YYDEBUG(254, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'N') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'R') { - if (yych <= '@') goto yy257; - if (yych <= 'Q') goto yy258; - goto yy270; + if (yych <= 'n') { + if (yych <= 'Z') { + if (yych <= 'O') goto yy279; + if (yych == 'U') goto yy280; + goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'r') goto yy270; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'o') goto yy279; + if (yych == 'u') goto yy280; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } @@ -3325,386 +3252,398 @@ yy255: YYDEBUG(255, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 'E') { + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + if (yych <= '\n') goto yy252; + goto yy259; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych <= '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + if (yych <= '"') goto yy252; + goto yy259; } } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= ':') { + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + goto yy259; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '<') { + if (yych <= ';') goto yy252; + goto yy259; + } else { + if (yych <= '=') goto yy252; + if (yych <= '@') goto yy259; + goto yy260; + } } } } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; + if (yych <= 'e') { + if (yych <= 'Z') { + if (yych <= 'F') goto yy274; + if (yych == 'N') goto yy268; goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych == '_') goto yy260; + if (yych <= '`') goto yy259; + goto yy260; } } else { - if (yych <= '{') { - if (yych == 'e') goto yy260; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= 'z') { + if (yych <= 'f') goto yy274; + if (yych == 'n') goto yy268; + goto yy260; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych <= '|') { + if (yych <= '{') goto yy259; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy259; + } } } } yy256: YYDEBUG(256, *YYCURSOR); - yyaccept = 0; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy257: - YYDEBUG(257, *YYCURSOR); - if (yybm[0+yych] & 2) { - goto yy256; - } - if (yych == '$') goto yy261; - goto yy230; -yy258: - YYDEBUG(258, *YYCURSOR); - yyaccept = 4; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - YYDEBUG(259, *YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy250; - goto yy256; - } else { - if (yych <= '\n') goto yy250; - if (yych <= '\f') goto yy256; - goto yy250; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy250; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy250; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy250; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy250; - } else { - if (yych == '~') goto yy250; - goto yy256; - } - } - } -yy260: - YYDEBUG(260, *YYCURSOR); yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'R') { + if (yych <= '@') goto yy259; + if (yych <= 'Q') goto yy260; + goto yy272; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'r') goto yy272; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy257: + YYDEBUG(257, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy262; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy262; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy258: + YYDEBUG(258, *YYCURSOR); + yyaccept = 0; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy259: + YYDEBUG(259, *YYCURSOR); + if (yybm[0+yych] & 2) { + goto yy258; + } + if (yych == '$') goto yy263; + goto yy232; +yy260: + YYDEBUG(260, *YYCURSOR); + yyaccept = 4; + YYMARKER = ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(261, *YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy252; goto yy258; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych <= '\n') goto yy252; + if (yych <= '\f') goto yy258; + goto yy252; + } + } else { + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy252; + } else { + if (yych == '$') goto yy263; + goto yy258; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy252; + goto yy258; + } else { + if (yych == '<') goto yy258; + goto yy252; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy258; + goto yy252; + } else { + if (yych == '~') goto yy252; + goto yy258; + } + } + } +yy262: + YYDEBUG(262, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; - goto yy266; + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + goto yy268; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 's') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } -yy261: - YYDEBUG(261, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; - if (yych <= '\\') { - if (yych <= 0x00) goto yy262; - if (yych <= '[') goto yy256; - goto yy263; - } else { - if (yych != '{') goto yy256; - } -yy262: - YYDEBUG(262, *YYCURSOR); - YYCURSOR = YYMARKER; - if (yyaccept <= 3) { - if (yyaccept <= 1) { - if (yyaccept <= 0) { - goto yy230; - } else { - goto yy232; - } - } else { - if (yyaccept <= 2) { - goto yy228; - } else { - goto yy245; - } - } - } else { - if (yyaccept <= 5) { - if (yyaccept <= 4) { - goto yy250; - } else { - goto yy267; - } - } else { - goto yy274; - } - } yy263: YYDEBUG(263, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 8) { - goto yy264; + if (yych <= '\\') { + if (yych <= 0x00) goto yy264; + if (yych <= '[') goto yy258; + goto yy265; + } else { + if (yych != '{') goto yy258; } - goto yy256; yy264: YYDEBUG(264, *YYCURSOR); + YYCURSOR = YYMARKER; + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy232; + } else { + goto yy234; + } + } else { + if (yyaccept <= 2) { + goto yy230; + } else { + goto yy247; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy252; + } else { + goto yy269; + } + } else { + goto yy276; + } + } +yy265: + YYDEBUG(265, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(265, *YYCURSOR); if (yybm[0+yych] & 8) { - goto yy264; + goto yy266; } - if (yych <= 0x00) goto yy230; - if (yych == '\\') goto yy263; - goto yy256; + goto yy258; yy266: YYDEBUG(266, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(267, *YYCURSOR); + if (yybm[0+yych] & 8) { + goto yy266; + } + if (yych <= 0x00) goto yy232; + if (yych == '\\') goto yy265; + goto yy258; +yy268: + YYDEBUG(268, *YYCURSOR); yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 16) { - goto yy268; + goto yy270; } if (yych <= ';') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy267; - if (yych <= '\t') goto yy257; + if (yych <= 0x00) goto yy269; + if (yych <= '\t') goto yy259; } else { - if (yych != '\r') goto yy257; + if (yych != '\r') goto yy259; } } else { if (yych <= ')') { - if (yych <= '"') goto yy267; - if (yych <= '%') goto yy257; + if (yych <= '"') goto yy269; + if (yych <= '%') goto yy259; } else { - if (yych <= '/') goto yy257; - if (yych <= '9') goto yy258; - if (yych <= ':') goto yy257; + if (yych <= '/') goto yy259; + if (yych <= '9') goto yy260; + if (yych <= ':') goto yy259; } } } else { if (yych <= '_') { if (yych <= '@') { - if (yych != '=') goto yy257; + if (yych != '=') goto yy259; } else { - if (yych <= 'Z') goto yy258; - if (yych <= '^') goto yy257; - goto yy258; + if (yych <= 'Z') goto yy260; + if (yych <= '^') goto yy259; + goto yy260; } } else { if (yych <= '{') { - if (yych <= '`') goto yy257; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych <= '`') goto yy259; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych >= 0x7F) goto yy257; + if (yych == '}') goto yy259; + if (yych >= 0x7F) goto yy259; } } } -yy267: - YYDEBUG(267, *YYCURSOR); +yy269: + YYDEBUG(269, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 421 "Zend/zend_ini_scanner.l" { /* TRUE value (when used outside option value/offset this causes parse error!) */ RETURN_TOKEN(BOOL_TRUE, "1", 1); } -#line 3599 "Zend/zend_ini_scanner.c" -yy268: - YYDEBUG(268, *YYCURSOR); +#line 3637 "Zend/zend_ini_scanner.c" +yy270: + YYDEBUG(270, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(269, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy268; - } - goto yy267; -yy270: - YYDEBUG(270, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'U') { - if (yych <= '@') goto yy257; - if (yych <= 'T') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'u') goto yy271; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy271: YYDEBUG(271, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy266; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'e') goto yy266; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } + if (yybm[0+yych] & 16) { + goto yy270; } + goto yy269; yy272: YYDEBUG(272, *YYCURSOR); yyaccept = 4; @@ -3712,251 +3651,251 @@ yy272: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'F') { - if (yych <= '@') goto yy257; - if (yych <= 'E') goto yy258; + if (yych <= 'U') { + if (yych <= '@') goto yy259; + if (yych <= 'T') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'f') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'u') goto yy273; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy273: YYDEBUG(273, *YYCURSOR); - yyaccept = 6; + yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); - if (yybm[0+yych] & 4) { - goto yy258; - } - if (yych <= '%') { - if (yych <= '\f') { - if (yych <= 0x08) { - if (yych >= 0x01) goto yy257; + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych <= '\t') goto yy275; - if (yych >= '\v') goto yy257; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { - if (yych <= 0x1F) { - if (yych >= 0x0E) goto yy257; + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych <= ' ') goto yy275; - if (yych >= '#') goto yy257; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych >= '*') goto yy257; + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy268; } else { - if (yych == '<') goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { - if (yych <= '|') { - if (yych <= '{') goto yy257; + if (yych <= '{') { + if (yych == 'e') goto yy268; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych != '~') goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy274: YYDEBUG(274, *YYCURSOR); + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'F') { + if (yych <= '@') goto yy259; + if (yych <= 'E') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'f') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } +yy275: + YYDEBUG(275, *YYCURSOR); + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 4) { + goto yy260; + } + if (yych <= '%') { + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych >= 0x01) goto yy259; + } else { + if (yych <= '\t') goto yy277; + if (yych >= '\v') goto yy259; + } + } else { + if (yych <= 0x1F) { + if (yych >= 0x0E) goto yy259; + } else { + if (yych <= ' ') goto yy277; + if (yych >= '#') goto yy259; + } + } + } else { + if (yych <= '=') { + if (yych <= ':') { + if (yych >= '*') goto yy259; + } else { + if (yych == '<') goto yy259; + } + } else { + if (yych <= '|') { + if (yych <= '{') goto yy259; + } else { + if (yych != '~') goto yy259; + } + } + } +yy276: + YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 425 "Zend/zend_ini_scanner.l" { /* FALSE value (when used outside option value/offset this causes parse error!)*/ RETURN_TOKEN(BOOL_FALSE, "", 0); } -#line 3803 "Zend/zend_ini_scanner.c" -yy275: - YYDEBUG(275, *YYCURSOR); +#line 3841 "Zend/zend_ini_scanner.c" +yy277: + YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(276, *YYCURSOR); - if (yych == '\t') goto yy275; - if (yych == ' ') goto yy275; - goto yy274; -yy277: - YYDEBUG(277, *YYCURSOR); + YYDEBUG(278, *YYCURSOR); + if (yych == '\t') goto yy277; + if (yych == ' ') goto yy277; + goto yy276; +yy279: + YYDEBUG(279, *YYCURSOR); yyaccept = 6; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '<') { if (yych <= ' ') { if (yych <= '\n') { - if (yych <= 0x00) goto yy274; - if (yych <= 0x08) goto yy257; - if (yych <= '\t') goto yy275; - goto yy274; + if (yych <= 0x00) goto yy276; + if (yych <= 0x08) goto yy259; + if (yych <= '\t') goto yy277; + goto yy276; } else { - if (yych == '\r') goto yy274; - if (yych <= 0x1F) goto yy257; - goto yy275; + if (yych == '\r') goto yy276; + if (yych <= 0x1F) goto yy259; + goto yy277; } } else { if (yych <= '/') { - if (yych <= '"') goto yy274; - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy274; - goto yy257; + if (yych <= '"') goto yy276; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy276; + goto yy259; } else { - if (yych <= '9') goto yy258; - if (yych == ';') goto yy274; - goto yy257; + if (yych <= '9') goto yy260; + if (yych == ';') goto yy276; + goto yy259; } } } else { if (yych <= '`') { if (yych <= 'N') { - if (yych <= '=') goto yy274; - if (yych <= '@') goto yy257; - if (yych <= 'M') goto yy258; - goto yy280; + if (yych <= '=') goto yy276; + if (yych <= '@') goto yy259; + if (yych <= 'M') goto yy260; + goto yy282; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'n') goto yy280; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'n') goto yy282; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy274; - goto yy257; - } - } - } -yy278: - YYDEBUG(278, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy279; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; - } - } - } -yy279: - YYDEBUG(279, *YYCURSOR); - yyaccept = 4; - yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '=') { - if (yych <= '"') { - if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; - } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; - } - } else { - if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; - } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; - } - } - } else { - if (yych <= '`') { - if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; - goto yy273; - } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; - } - } else { - if (yych <= '{') { - if (yych == 'l') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; - } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy276; + goto yy259; } } } @@ -3967,46 +3906,45 @@ yy280: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy281; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4017,45 +3955,46 @@ yy281: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { if (yych <= 'L') { - if (yych <= '@') goto yy257; - if (yych <= 'K') goto yy258; + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'l') goto yy282; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4066,45 +4005,46 @@ yy282: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'S') { - if (yych <= '@') goto yy257; - if (yych <= 'R') goto yy258; + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 's') goto yy283; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } @@ -4115,126 +4055,176 @@ yy283: if (yych <= '=') { if (yych <= '"') { if (yych <= '\n') { - if (yych <= 0x00) goto yy250; - if (yych <= 0x08) goto yy257; - goto yy250; + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; } else { - if (yych == '\r') goto yy250; - if (yych <= 0x1F) goto yy257; - goto yy250; + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; } } else { if (yych <= '9') { - if (yych <= '%') goto yy257; - if (yych <= ')') goto yy250; - if (yych <= '/') goto yy257; - goto yy258; + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; } else { - if (yych == ';') goto yy250; - if (yych <= '<') goto yy257; - goto yy250; + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; } } } else { if (yych <= '`') { - if (yych <= 'E') { - if (yych <= '@') goto yy257; - if (yych <= 'D') goto yy258; - goto yy273; + if (yych <= 'L') { + if (yych <= '@') goto yy259; + if (yych <= 'K') goto yy260; } else { - if (yych <= 'Z') goto yy258; - if (yych == '_') goto yy258; - goto yy257; + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; } } else { if (yych <= '{') { - if (yych == 'e') goto yy273; - if (yych <= 'z') goto yy258; - goto yy257; + if (yych == 'l') goto yy284; + if (yych <= 'z') goto yy260; + goto yy259; } else { - if (yych == '}') goto yy257; - if (yych <= '~') goto yy250; - goto yy257; + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; } } } yy284: YYDEBUG(284, *YYCURSOR); - ++YYCURSOR; - YYFILL(2); - yych = *YYCURSOR; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'S') { + if (yych <= '@') goto yy259; + if (yych <= 'R') goto yy260; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 's') goto yy285; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } + } yy285: YYDEBUG(285, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy284; + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '=') { + if (yych <= '"') { + if (yych <= '\n') { + if (yych <= 0x00) goto yy252; + if (yych <= 0x08) goto yy259; + goto yy252; + } else { + if (yych == '\r') goto yy252; + if (yych <= 0x1F) goto yy259; + goto yy252; + } + } else { + if (yych <= '9') { + if (yych <= '%') goto yy259; + if (yych <= ')') goto yy252; + if (yych <= '/') goto yy259; + goto yy260; + } else { + if (yych == ';') goto yy252; + if (yych <= '<') goto yy259; + goto yy252; + } + } + } else { + if (yych <= '`') { + if (yych <= 'E') { + if (yych <= '@') goto yy259; + if (yych <= 'D') goto yy260; + goto yy275; + } else { + if (yych <= 'Z') goto yy260; + if (yych == '_') goto yy260; + goto yy259; + } + } else { + if (yych <= '{') { + if (yych == 'e') goto yy275; + if (yych <= 'z') goto yy260; + goto yy259; + } else { + if (yych == '}') goto yy259; + if (yych <= '~') goto yy252; + goto yy259; + } + } } - if (yych >= '\r') goto yy288; yy286: YYDEBUG(286, *YYCURSOR); ++YYCURSOR; + YYFILL(2); + yych = *YYCURSOR; yy287: YYDEBUG(287, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy286; + } + if (yych >= '\r') goto yy290; +yy288: + YYDEBUG(288, *YYCURSOR); + ++YYCURSOR; +yy289: + YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 557 "Zend/zend_ini_scanner.l" +#line 578 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4185 "Zend/zend_ini_scanner.c" -yy288: - YYDEBUG(288, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == '\n') goto yy286; - goto yy287; -yy289: - YYDEBUG(289, *YYCURSOR); - yyaccept = 3; - YYMARKER = ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; +#line 4223 "Zend/zend_ini_scanner.c" +yy290: YYDEBUG(290, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy289; - } - if (yych <= '%') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; - } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; - } - } else { - if (yych <= '"') { - if (yych <= 0x1F) goto yy256; - goto yy245; - } else { - if (yych == '$') goto yy261; - goto yy256; - } - } - } else { - if (yych <= '=') { - if (yych <= ':') { - if (yych <= ')') goto yy245; - goto yy256; - } else { - if (yych == '<') goto yy256; - goto yy245; - } - } else { - if (yych <= '|') { - if (yych <= '{') goto yy256; - goto yy245; - } else { - if (yych == '~') goto yy245; - goto yy256; - } - } - } + yych = *++YYCURSOR; + if (yych == '\n') goto yy288; + goto yy289; yy291: YYDEBUG(291, *YYCURSOR); yyaccept = 3; @@ -4242,45 +4232,44 @@ yy291: YYFILL(1); yych = *YYCURSOR; YYDEBUG(292, *YYCURSOR); - if (yych <= '-') { - if (yych <= 0x1F) { - if (yych <= '\n') { - if (yych <= 0x00) goto yy245; - if (yych <= 0x08) goto yy256; - goto yy245; + if (yybm[0+yych] & 64) { + goto yy291; + } + if (yych <= '%') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych == '\r') goto yy245; - goto yy256; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { - if (yych <= '$') { - if (yych <= '"') goto yy245; - if (yych <= '#') goto yy256; - goto yy261; + if (yych <= '"') { + if (yych <= 0x1F) goto yy258; + goto yy247; } else { - if (yych <= '%') goto yy256; - if (yych <= ')') goto yy245; - goto yy256; + if (yych == '$') goto yy263; + goto yy258; } } } else { - if (yych <= '<') { - if (yych <= '9') { - if (yych <= '.') goto yy289; - if (yych <= '/') goto yy256; - goto yy291; + if (yych <= '=') { + if (yych <= ':') { + if (yych <= ')') goto yy247; + goto yy258; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == '<') goto yy258; + goto yy247; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4291,44 +4280,45 @@ yy293: YYFILL(1); yych = *YYCURSOR; YYDEBUG(294, *YYCURSOR); - if (yych <= ')') { - if (yych <= '\r') { - if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= '-') { + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x00) goto yy247; + if (yych <= 0x08) goto yy258; + goto yy247; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych == '\r') goto yy247; + goto yy258; } } else { - if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= '$') { + if (yych <= '"') goto yy247; + if (yych <= '#') goto yy258; + goto yy263; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '%') goto yy258; + if (yych <= ')') goto yy247; + goto yy258; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '.') goto yy291; + if (yych <= '/') goto yy258; goto yy293; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } @@ -4342,56 +4332,104 @@ yy295: if (yych <= ')') { if (yych <= '\r') { if (yych <= 0x08) { - if (yych <= 0x00) goto yy245; - goto yy256; + if (yych <= 0x00) goto yy247; + goto yy258; } else { - if (yych <= '\n') goto yy245; - if (yych <= '\f') goto yy256; - goto yy245; + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; } } else { if (yych <= '#') { - if (yych <= 0x1F) goto yy256; - if (yych <= '"') goto yy245; - goto yy256; + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; } else { - if (yych <= '$') goto yy261; - if (yych <= '%') goto yy256; - goto yy245; + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; } } } else { if (yych <= '<') { if (yych <= '9') { - if (yych <= '/') goto yy256; + if (yych <= '/') goto yy258; goto yy295; } else { - if (yych == ';') goto yy245; - goto yy256; + if (yych == ';') goto yy247; + goto yy258; } } else { if (yych <= '|') { - if (yych <= '=') goto yy245; - if (yych <= '{') goto yy256; - goto yy245; + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; } else { - if (yych == '~') goto yy245; - goto yy256; + if (yych == '~') goto yy247; + goto yy258; } } } yy297: YYDEBUG(297, *YYCURSOR); - ++YYCURSOR; + yyaccept = 3; + YYMARKER = ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(298, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy297; + if (yych <= ')') { + if (yych <= '\r') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy247; + goto yy258; + } else { + if (yych <= '\n') goto yy247; + if (yych <= '\f') goto yy258; + goto yy247; + } + } else { + if (yych <= '#') { + if (yych <= 0x1F) goto yy258; + if (yych <= '"') goto yy247; + goto yy258; + } else { + if (yych <= '$') goto yy263; + if (yych <= '%') goto yy258; + goto yy247; + } + } + } else { + if (yych <= '<') { + if (yych <= '9') { + if (yych <= '/') goto yy258; + goto yy297; + } else { + if (yych == ';') goto yy247; + goto yy258; + } + } else { + if (yych <= '|') { + if (yych <= '=') goto yy247; + if (yych <= '{') goto yy258; + goto yy247; + } else { + if (yych == '~') goto yy247; + goto yy258; + } + } } +yy299: YYDEBUG(299, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; YYDEBUG(300, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy299; + } + YYDEBUG(301, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ @@ -4402,66 +4440,66 @@ yy297: } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4406 "Zend/zend_ini_scanner.c" -yy301: - YYDEBUG(301, *YYCURSOR); +#line 4444 "Zend/zend_ini_scanner.c" +yy303: + YYDEBUG(303, *YYCURSOR); ++YYCURSOR; - YYDEBUG(302, *YYCURSOR); + YYDEBUG(304, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 4417 "Zend/zend_ini_scanner.c" -yy303: - YYDEBUG(303, *YYCURSOR); +#line 4455 "Zend/zend_ini_scanner.c" +yy305: + YYDEBUG(305, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy304: - YYDEBUG(304, *YYCURSOR); - if (yych == '\t') goto yy303; - if (yych == ' ') goto yy303; - goto yy237; -yy305: - YYDEBUG(305, *YYCURSOR); - yych = *++YYCURSOR; - goto yy234; yy306: YYDEBUG(306, *YYCURSOR); + if (yych == '\t') goto yy305; + if (yych == ' ') goto yy305; + goto yy239; +yy307: + YYDEBUG(307, *YYCURSOR); + yych = *++YYCURSOR; + goto yy236; +yy308: + YYDEBUG(308, *YYCURSOR); yyaccept = 1; YYMARKER = ++YYCURSOR; YYFILL(2); yych = *YYCURSOR; -yy307: - YYDEBUG(307, *YYCURSOR); +yy309: + YYDEBUG(309, *YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { - if (yych <= 0x08) goto yy232; - if (yych <= '\t') goto yy306; - goto yy305; + if (yych <= 0x08) goto yy234; + if (yych <= '\t') goto yy308; + goto yy307; } else { - if (yych == '\r') goto yy309; - goto yy232; + if (yych == '\r') goto yy311; + goto yy234; } } else { if (yych <= '"') { - if (yych <= ' ') goto yy306; - if (yych <= '!') goto yy232; + if (yych <= ' ') goto yy308; + if (yych <= '!') goto yy234; } else { - if (yych == ';') goto yy284; - goto yy232; + if (yych == ';') goto yy286; + goto yy234; } } - YYDEBUG(308, *YYCURSOR); + YYDEBUG(310, *YYCURSOR); yych = *++YYCURSOR; - goto yy239; -yy309: - YYDEBUG(309, *YYCURSOR); + goto yy241; +yy311: + YYDEBUG(311, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '\n') goto yy305; - goto yy234; + if ((yych = *YYCURSOR) == '\n') goto yy307; + goto yy236; } /* *********************************** */ yyc_ST_VARNAME: @@ -4500,47 +4538,47 @@ yyc_ST_VARNAME: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(310, *YYCURSOR); + YYDEBUG(312, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '\'') { if (yych <= ' ') { if (yych <= '\n') { - if (yych >= '\t') goto yy314; + if (yych >= '\t') goto yy316; } else { - if (yych == '\r') goto yy314; + if (yych == '\r') goto yy316; } } else { if (yych <= '$') { - if (yych != '#') goto yy314; + if (yych != '#') goto yy316; } else { - if (yych == '&') goto yy314; + if (yych == '&') goto yy316; } } } else { if (yych <= 'Z') { if (yych <= ';') { - if (yych <= ')') goto yy314; - if (yych >= ';') goto yy314; + if (yych <= ')') goto yy316; + if (yych >= ';') goto yy316; } else { - if (yych == '=') goto yy314; + if (yych == '=') goto yy316; } } else { if (yych <= '|') { - if (yych <= '[') goto yy314; - if (yych >= '{') goto yy314; + if (yych <= '[') goto yy316; + if (yych >= '{') goto yy316; } else { - if (yych <= '}') goto yy316; - if (yych <= '~') goto yy314; + if (yych <= '}') goto yy318; + if (yych <= '~') goto yy316; } } } - YYDEBUG(312, *YYCURSOR); + YYDEBUG(314, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy319; -yy313: - YYDEBUG(313, *YYCURSOR); + goto yy321; +yy315: + YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ @@ -4552,41 +4590,41 @@ yy313: RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4556 "Zend/zend_ini_scanner.c" -yy314: - YYDEBUG(314, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(315, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 575 "Zend/zend_ini_scanner.l" - { - return 0; -} -#line 4566 "Zend/zend_ini_scanner.c" +#line 4594 "Zend/zend_ini_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); ++YYCURSOR; YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); +#line 596 "Zend/zend_ini_scanner.l" + { + return 0; +} +#line 4604 "Zend/zend_ini_scanner.c" +yy318: + YYDEBUG(318, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(319, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); #line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4577 "Zend/zend_ini_scanner.c" -yy318: - YYDEBUG(318, *YYCURSOR); +#line 4615 "Zend/zend_ini_scanner.c" +yy320: + YYDEBUG(320, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy319: - YYDEBUG(319, *YYCURSOR); +yy321: + YYDEBUG(321, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy318; + goto yy320; } - goto yy313; + goto yy315; } } -#line 579 "Zend/zend_ini_scanner.l" +#line 600 "Zend/zend_ini_scanner.l" } diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index 2bd72dcf564..9c99cc43d0e 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Feb 25 22:04:14 2012 */ +/* Generated by re2c 0.13.5 on Thu Jun 7 17:55:41 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { From 7cae4ff02c593ed212a363d65c83c38a67a27f0d Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 7 Jun 2012 14:23:17 -0300 Subject: [PATCH 085/641] - BFN --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index a6b41f4cec1..d56b540ddf2 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,9 @@ PHP NEWS . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks pattern). (Gustavo) . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) + +- Phar: + . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) - Reflection: . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks From 0eaa6e95125be62688cf422c1e4cad49655ddf0a Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 7 Jun 2012 19:28:06 +0200 Subject: [PATCH 086/641] UPGRADING entry for boolval() --- UPGRADING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPGRADING b/UPGRADING index 0787087531a..3581b65dea7 100755 --- a/UPGRADING +++ b/UPGRADING @@ -94,6 +94,9 @@ PHP X.Y UPGRADE NOTES 5. New Functions ======================================== +- Core: + - boolval() + - Intl: - datefmt_get_calendar_object() - datefmt_get_timezone() From f8d60e2f0963da833a024347a3996a7bb8904822 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 7 Jun 2012 19:45:56 +0200 Subject: [PATCH 087/641] Travis stop spamming --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cfb40093653..5995773261a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ notifications: email: recipients: - php-qa@lists.php.net - on_success: change # [always|never|change] default: change - on_failure: always # [always|never|change] default: always + on_success: never # [always|never|change] default: change + on_failure: never # [always|never|change] default: always env: - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php From 335a11b14b35e261c484d44a0e1b5ea9cc758e19 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 4 Jun 2012 21:30:04 +0200 Subject: [PATCH 088/641] initial libzip upgrade patch to 0.10.1 --- ext/zip/config.m4 | 9 +- ext/zip/config.w32 | 9 +- ext/zip/lib/zip.h | 108 +++-- ext/zip/lib/zip_add.c | 13 +- ext/zip/lib/zip_add_dir.c | 14 +- ext/zip/lib/zip_close.c | 319 +++++++------- ext/zip/lib/zip_delete.c | 9 +- ext/zip/lib/zip_dirent.c | 9 +- ext/zip/lib/zip_entry_free.c | 3 + ext/zip/lib/zip_entry_new.c | 17 +- ext/zip/lib/zip_err_str.c | 8 + ext/zip/lib/zip_error.c | 13 +- ext/zip/lib/zip_error_to_str.c | 4 +- ext/zip/lib/zip_fclose.c | 26 +- ext/zip/lib/zip_fdopen.c | 62 +++ ext/zip/lib/zip_filerange_crc.c | 2 +- ext/zip/lib/zip_fopen.c | 4 +- ext/zip/lib/zip_fopen_encrypted.c | 50 +++ ext/zip/lib/zip_fopen_index.c | 173 +------- ext/zip/lib/zip_fopen_index_encrypted.c | 191 +++++++++ ext/zip/lib/zip_fread.c | 94 +---- ext/zip/lib/zip_free.c | 2 + ext/zip/lib/zip_get_archive_comment.c | 10 +- ext/zip/lib/zip_get_archive_flag.c | 2 +- .../lib/zip_get_compression_implementation.c | 46 ++ .../lib/zip_get_encryption_implementation.c | 46 ++ ext/zip/lib/zip_get_file_comment.c | 4 +- ext/zip/lib/zip_get_file_extra.c | 58 +++ ext/zip/lib/zip_get_name.c | 7 +- ext/zip/lib/zip_get_num_entries.c | 52 +++ ext/zip/lib/zip_name_locate.c | 14 +- ext/zip/lib/zip_new.c | 1 + ext/zip/lib/zip_open.c | 111 +++-- ext/zip/lib/zip_rename.c | 9 +- ext/zip/lib/zip_replace.c | 19 +- ext/zip/lib/zip_set_archive_comment.c | 7 +- ext/zip/lib/zip_set_archive_flag.c | 24 +- ext/zip/lib/zip_set_default_password.c | 62 +++ ext/zip/lib/zip_set_file_comment.c | 12 +- ext/zip/lib/zip_set_file_extra.c | 72 ++++ ext/zip/lib/zip_set_name.c | 6 +- ext/zip/lib/zip_source_buffer.c | 22 +- ext/zip/lib/zip_source_close.c | 54 +++ ext/zip/lib/zip_source_crc.c | 159 +++++++ ext/zip/lib/zip_source_deflate.c | 394 ++++++++++++++++++ ext/zip/lib/zip_source_error.c | 87 ++++ ext/zip/lib/zip_source_file.c | 7 +- ext/zip/lib/zip_source_filep.c | 113 +++-- ext/zip/lib/zip_source_free.c | 18 +- ext/zip/lib/zip_source_function.c | 29 +- ext/zip/lib/zip_source_layered.c | 59 +++ ext/zip/lib/zip_source_open.c | 76 ++++ ext/zip/lib/zip_source_pkware.c | 241 +++++++++++ ext/zip/lib/zip_source_pop.c | 63 +++ ext/zip/lib/zip_source_read.c | 64 +++ ext/zip/lib/zip_source_stat.c | 72 ++++ ext/zip/lib/zip_source_zip.c | 20 +- ext/zip/lib/zip_stat_index.c | 18 +- ext/zip/lib/zip_stat_init.c | 9 +- ext/zip/lib/zip_unchange.c | 9 +- ext/zip/lib/zip_unchange_archive.c | 2 +- ext/zip/lib/zip_unchange_data.c | 3 +- ext/zip/lib/zipconf.h | 47 +++ ext/zip/lib/zipint.h | 148 +++++-- 64 files changed, 2720 insertions(+), 695 deletions(-) create mode 100644 ext/zip/lib/zip_fdopen.c create mode 100644 ext/zip/lib/zip_fopen_encrypted.c create mode 100644 ext/zip/lib/zip_fopen_index_encrypted.c create mode 100644 ext/zip/lib/zip_get_compression_implementation.c create mode 100644 ext/zip/lib/zip_get_encryption_implementation.c create mode 100644 ext/zip/lib/zip_get_file_extra.c create mode 100644 ext/zip/lib/zip_get_num_entries.c create mode 100644 ext/zip/lib/zip_set_default_password.c create mode 100644 ext/zip/lib/zip_set_file_extra.c create mode 100644 ext/zip/lib/zip_source_close.c create mode 100644 ext/zip/lib/zip_source_crc.c create mode 100644 ext/zip/lib/zip_source_deflate.c create mode 100644 ext/zip/lib/zip_source_error.c create mode 100644 ext/zip/lib/zip_source_layered.c create mode 100644 ext/zip/lib/zip_source_open.c create mode 100644 ext/zip/lib/zip_source_pkware.c create mode 100644 ext/zip/lib/zip_source_pop.c create mode 100644 ext/zip/lib/zip_source_read.c create mode 100644 ext/zip/lib/zip_source_stat.c create mode 100644 ext/zip/lib/zipconf.h diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index d5c24ce9cf4..85f9119f5aa 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -89,7 +89,14 @@ yes lib/zip_new.c lib/zip_source_file.c lib/zip_stat_index.c \ lib/zip_set_archive_comment.c lib/zip_set_file_comment.c \ lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \ - lib/zip_error_clear.c lib/zip_file_error_clear.c" + lib/zip_error_clear.c lib/zip_file_error_clear.c \ + lib/zip_fdopen.c lib/zip_fopen_encrypted.c lib/zip_fopen_index_encrypted.c \ + lib/zip_get_compression_implementation.c lib/zip_get_encryption_implementation.c \ + lib/zip_get_file_extra.c lib/zip_get_num_entries.c lib/zip_set_default_password.c \ + lib/zip_set_file_extra.c lib/zip_source_close.c lib/zip_source_crc.c \ + lib/zip_source_deflate.c lib/zip_source_error.c lib/zip_source_layered.c \ + lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \ + lib/zip_source_read.c lib/zip_source_stat.c" AC_DEFINE(HAVE_ZIP,1,[ ]) PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index e60a983b3a8..b6381708073 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -27,7 +27,14 @@ if (PHP_ZIP != "no") { zip_get_archive_comment.c zip_get_file_comment.c \ zip_set_archive_comment.c zip_set_file_comment.c \ zip_unchange_archive.c zip_memdup.c zip_stat_init.c \ - zip_add_dir.c zip_file_error_clear.c zip_error_clear.c", "zip"); + zip_add_dir.c zip_file_error_clear.c zip_error_clear.c + lib/zip_fdopen.c lib/zip_fopen_encrypted.c lib/zip_fopen_index_encrypted.c \ + lib/zip_get_compression_implementation.c lib/zip_get_encryption_implementation.c \ + lib/zip_get_file_extra.c lib/zip_get_num_entries.c lib/zip_set_default_password.c \ + lib/zip_set_file_extra.c lib/zip_source_close.c lib/zip_source_crc.c \ + lib/zip_source_deflate.c lib/zip_source_error.c lib/zip_source_layered.c \ + lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \ + lib/zip_source_read.c lib/zip_source_stat.c", "zip"); AC_DEFINE('HAVE_ZIP', 1); } else { diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index 14a57bc5829..4a80c9e1065 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -3,7 +3,7 @@ /* zip.h -- exported declarations. - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -52,6 +52,8 @@ BEGIN_EXTERN_C() +#include + #include #include #include @@ -71,10 +73,19 @@ BEGIN_EXTERN_C() #define ZIP_FL_COMPRESSED 4 /* read compressed data */ #define ZIP_FL_UNCHANGED 8 /* use original data, ignoring changes */ #define ZIP_FL_RECOMPRESS 16 /* force recompression of data */ +#define ZIP_FL_ENCRYPTED 32 /* read encrypted data + (implies ZIP_FL_COMPRESSED) */ /* archive global flags flags */ #define ZIP_AFL_TORRENT 1 /* torrent zipped */ +#define ZIP_AFL_RDONLY 2 /* read only -- cannot be cleared */ + + +/* flags for compression and encryption sources */ + +#define ZIP_CODEC_ENCODE 1 /* compress/encrypt */ + /* libzip error codes */ @@ -102,7 +113,10 @@ BEGIN_EXTERN_C() #define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */ #define ZIP_ER_REMOVE 22 /* S Can't remove file */ #define ZIP_ER_DELETED 23 /* N Entry has been deleted */ - +#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */ +#define ZIP_ER_RDONLY 25 /* N Read-only archive */ +#define ZIP_ER_NOPASSWD 26 /* N No password provided */ +#define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */ /* type of system error value */ @@ -162,69 +176,99 @@ enum zip_source_cmd { ZIP_SOURCE_FREE /* cleanup and free resources */ }; -typedef ssize_t (*zip_source_callback)(void *state, void *data, - size_t len, enum zip_source_cmd cmd); +#define ZIP_SOURCE_ERR_LOWER -2 + +#define ZIP_STAT_NAME 0x0001 +#define ZIP_STAT_INDEX 0x0002 +#define ZIP_STAT_SIZE 0x0004 +#define ZIP_STAT_COMP_SIZE 0x0008 +#define ZIP_STAT_MTIME 0x0010 +#define ZIP_STAT_CRC 0x0020 +#define ZIP_STAT_COMP_METHOD 0x0040 +#define ZIP_STAT_ENCRYPTION_METHOD 0x0080 +#define ZIP_STAT_FLAGS 0x0100 struct zip_stat { + zip_uint64_t valid; /* which fields have valid values */ const char *name; /* name of the file */ - int index; /* index within archive */ - unsigned int crc; /* crc of file data */ + zip_uint64_t index; /* index within archive */ + zip_uint64_t size; /* size of file (uncompressed) */ + zip_uint64_t comp_size; /* size of file (compressed) */ time_t mtime; /* modification time */ - off_t size; /* size of file (uncompressed) */ - off_t comp_size; /* size of file (compressed) */ - unsigned short comp_method; /* compression method used */ - unsigned short encryption_method; /* encryption method used */ + zip_uint32_t crc; /* crc of file data */ + zip_uint16_t comp_method; /* compression method used */ + zip_uint16_t encryption_method; /* encryption method used */ + zip_uint32_t flags; /* reserved for future use */ }; struct zip; struct zip_file; struct zip_source; +typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, + enum zip_source_cmd); + -ZIP_EXTERN(int) zip_add(struct zip *, const char *, struct zip_source *); -ZIP_EXTERN(int) zip_add_dir(struct zip *, const char *); +ZIP_EXTERN(zip_int64_t) zip_add(struct zip *, const char *, struct zip_source *); +ZIP_EXTERN(zip_int64_t) zip_add_dir(struct zip *, const char *); ZIP_EXTERN(int) zip_close(struct zip *); -ZIP_EXTERN(int) zip_delete(struct zip *, int); +ZIP_EXTERN(int) zip_delete(struct zip *, zip_uint64_t); ZIP_EXTERN(void) zip_error_clear(struct zip *); ZIP_EXTERN(void) zip_error_get(struct zip *, int *, int *); ZIP_EXTERN(int) zip_error_get_sys_type(int); -ZIP_EXTERN(int) zip_error_to_str(char *, size_t, int, int); +ZIP_EXTERN(int) zip_error_to_str(char *, zip_uint64_t, int, int); ZIP_EXTERN(int) zip_fclose(struct zip_file *); +ZIP_EXTERN(struct zip *)zip_fdopen(int, int, int *); ZIP_EXTERN(void) zip_file_error_clear(struct zip_file *); ZIP_EXTERN(void) zip_file_error_get(struct zip_file *, int *, int *); ZIP_EXTERN(const char *)zip_file_strerror(struct zip_file *); -ZIP_EXTERN(struct zip_file *)zip_fopen(struct zip *, const char *, int); -ZIP_EXTERN(struct zip_file *)zip_fopen_index(struct zip *, int, int); -ZIP_EXTERN(ssize_t) zip_fread(struct zip_file *, void *, size_t); +ZIP_EXTERN(struct) zip_file *zip_fopen(struct zip *, const char *, int); +ZIP_EXTERN(struct) zip_file *zip_fopen_encrypted(struct zip *, const char *, + int, const char *); +ZIP_EXTERN(struct zip_file *)zip_fopen_index(struct zip *, zip_uint64_t, int); +ZIP_EXTERN(struct zip_file *)zip_fopen_index_encrypted(struct zip *, + zip_uint64_t, int, + const char *); +ZIP_EXTERN(zip_int64_t) zip_fread(struct zip_file *, void *, zip_uint64_t); ZIP_EXTERN(const char *)zip_get_archive_comment(struct zip *, int *, int); ZIP_EXTERN(int) zip_get_archive_flag(struct zip *, int, int); -ZIP_EXTERN(const char *)zip_get_file_comment(struct zip *, int, int *, int); -ZIP_EXTERN(const char *)zip_get_name(struct zip *, int, int); -ZIP_EXTERN(int) zip_get_num_files(struct zip *); +ZIP_EXTERN(const char *)zip_get_file_comment(struct zip *, zip_uint64_t, + int *, int); +ZIP_EXTERN(const char *)zip_get_file_extra(struct zip *, zip_uint64_t, + int *, int); +ZIP_EXTERN(const char *)zip_get_name(struct zip *, zip_uint64_t, int); +ZIP_EXTERN(zip_uint64_t) zip_get_num_entries(struct zip *, int); +ZIP_EXTERN(int) zip_get_num_files(struct zip *); /* deprecated, use zip_get_num_entries instead */ ZIP_EXTERN(int) zip_name_locate(struct zip *, const char *, int); ZIP_EXTERN(struct zip *)zip_open(const char *, int, int *); -ZIP_EXTERN(int) zip_rename(struct zip *, int, const char *); -ZIP_EXTERN(int) zip_replace(struct zip *, int, struct zip_source *); +ZIP_EXTERN(int) zip_rename(struct zip *, zip_uint64_t, const char *); +ZIP_EXTERN(int) zip_replace(struct zip *, zip_uint64_t, struct zip_source *); ZIP_EXTERN(int) zip_set_archive_comment(struct zip *, const char *, int); ZIP_EXTERN(int) zip_set_archive_flag(struct zip *, int, int); -ZIP_EXTERN(int) zip_set_file_comment(struct zip *, int, const char *, int); -ZIP_EXTERN(struct zip_source *)zip_source_buffer(struct zip *, const void *, - off_t, int); -ZIP_EXTERN(struct zip_source *)zip_source_file(struct zip *, const char *, - off_t, off_t); -ZIP_EXTERN(struct zip_source *)zip_source_filep(struct zip *, FILE *, - off_t, off_t); +ZIP_EXTERN(int) zip_set_default_password(struct zip *, const char *); +ZIP_EXTERN(int) zip_set_file_comment(struct zip *, zip_uint64_t, + const char *, int); +ZIP_EXTERN(int) zip_set_file_extra(struct zip *, zip_uint64_t, + const char *, int); +ZIP_EXTERN(struct) zip_source *zip_source_buffer(struct zip *, const void *, + zip_uint64_t, int); +ZIP_EXTERN(struct) zip_source *zip_source_file(struct zip *, const char *, + zip_uint64_t, zip_int64_t); +ZIP_EXTERN(struct) zip_source *zip_source_filep(struct zip *, FILE *, + zip_uint64_t, zip_int64_t); ZIP_EXTERN(void) zip_source_free(struct zip_source *); ZIP_EXTERN(struct zip_source *)zip_source_function(struct zip *, zip_source_callback, void *); ZIP_EXTERN(struct zip_source *)zip_source_zip(struct zip *, struct zip *, - int, int, off_t, off_t); + zip_uint64_t, int, + zip_uint64_t, zip_int64_t); ZIP_EXTERN(int) zip_stat(struct zip *, const char *, int, struct zip_stat *); -ZIP_EXTERN(int) zip_stat_index(struct zip *, int, int, struct zip_stat *); +ZIP_EXTERN(int) zip_stat_index(struct zip *, zip_uint64_t, int, + struct zip_stat *); ZIP_EXTERN(void) zip_stat_init(struct zip_stat *); ZIP_EXTERN(const char *)zip_strerror(struct zip *); -ZIP_EXTERN(int) zip_unchange(struct zip *, int); +ZIP_EXTERN(int) zip_unchange(struct zip *, zip_uint64_t); ZIP_EXTERN(int) zip_unchange_all(struct zip *); ZIP_EXTERN(int) zip_unchange_archive(struct zip *); diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c index 85d5997911b..6067abbac49 100644 --- a/ext/zip/lib/zip_add.c +++ b/ext/zip/lib/zip_add.c @@ -37,13 +37,20 @@ -ZIP_EXTERN(int) +/* + NOTE: Return type is signed so we can return -1 on error. + The index can not be larger than ZIP_INT64_MAX since the size + of the central directory cannot be larger than + ZIP_UINT64_MAX, and each entry is larger than 2 bytes. +*/ + +ZIP_EXTERN(zip_int64_t) zip_add(struct zip *za, const char *name, struct zip_source *source) { if (name == NULL || source == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - - return _zip_replace(za, -1, name, source); + + return _zip_replace(za, ZIP_UINT64_MAX, name, source); } diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index 9b234251942..0a9d7f48630 100644 --- a/ext/zip/lib/zip_add_dir.c +++ b/ext/zip/lib/zip_add_dir.c @@ -1,6 +1,6 @@ /* zip_add_dir.c -- add directory - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,13 +40,21 @@ -ZIP_EXTERN(int) +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +ZIP_EXTERN(zip_int64_t) zip_add_dir(struct zip *za, const char *name) { - int len, ret; + int len; + zip_int64_t ret; char *s; struct zip_source *source; + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (name == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 0796f27462b..fc1ad02d52c 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -1,6 +1,6 @@ /* zip_close.c -- close zip archive and update changes - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -33,26 +33,28 @@ +#include "zipint.h" + #include #include #include #include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include - -#include "zipint.h" +#ifdef PHP_WIN32 +#include +#include +#endif static int add_data(struct zip *, struct zip_source *, struct zip_dirent *, FILE *); -static int add_data_comp(zip_source_callback, void *, struct zip_stat *, - FILE *, struct zip_error *); -static int add_data_uncomp(struct zip *, zip_source_callback, void *, - struct zip_stat *, FILE *); -static void ch_set_error(struct zip_error *, zip_source_callback, void *); static int copy_data(FILE *, off_t, FILE *, struct zip_error *); +static int copy_source(struct zip *, struct zip_source *, FILE *); static int write_cdir(struct zip *, struct zip_cdir *, FILE *); static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *); -static int _zip_changed(struct zip *, int *); static char *_zip_create_temp_output(struct zip *, FILE **); static int _zip_torrentzip_cmp(const void *, const void *); @@ -72,7 +74,9 @@ zip_close(struct zip *za) int i, j, error; char *temp; FILE *out; +#ifndef PHP_WIN32 mode_t mask; +#endif struct zip_cdir *cd; struct zip_dirent de; struct filelist *filelist; @@ -99,7 +103,7 @@ zip_close(struct zip *za) } _zip_free(za); return 0; - } + } if ((filelist=(struct filelist *)malloc(sizeof(filelist[0])*survivors)) == NULL) @@ -126,11 +130,11 @@ zip_close(struct zip *za) cd->comment_len = TORRENT_SIG_LEN + TORRENT_CRC_LEN; } else if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, ZIP_FL_UNCHANGED) == 0) { - if (_zip_cdir_set_comment(cd, za) == -1) { - _zip_cdir_free(cd); + if (_zip_cdir_set_comment(cd, za) == -1) { + _zip_cdir_free(cd); free(filelist); - return -1; - } + return -1; + } } if ((temp=_zip_create_temp_output(za, &out)) == NULL) { @@ -198,8 +202,7 @@ zip_close(struct zip *za) error = 1; break; } - memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j])); - + memcpy(cd->entry+j, za->cdir->entry+i, sizeof(cd->entry[j])); if (de.bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { de.crc = za->cdir->entry[i].crc; de.comp_size = za->cdir->entry[i].comp_size; @@ -220,6 +223,22 @@ zip_close(struct zip *za) cd->entry[j].filename_len = de.filename_len; } + if (za->entry[i].ch_extra_len != -1) { + free(de.extrafield); + if ((de.extrafield=malloc(za->entry[i].ch_extra_len)) == NULL) { + error = 1; + break; + } + memcpy(de.extrafield, za->entry[i].ch_extra, za->entry[i].ch_extra_len); + de.extrafield_len = za->entry[i].ch_extra_len; + /* as the rest of cd entries, its malloc/free is done by za */ + /* TODO unsure if this should also be set in the CD -- + * not done for now + cd->entry[j].extrafield = za->entry[i].ch_extra; + cd->entry[j].extrafield_len = za->entry[i].ch_extra_len; + */ + } + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0 && za->entry[i].ch_comment_len != -1) { /* as the rest of cd entries, its malloc/free is done by za */ @@ -234,16 +253,22 @@ zip_close(struct zip *za) zs = NULL; if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) { - if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) == NULL) { - error = 1; - break; - } + if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) + == NULL) { + error = 1; + break; + } } if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) { error = 1; + if (zs) + zip_source_free(zs); break; } + if (zs) + zip_source_free(zs); + cd->entry[j].last_mod = de.last_mod; cd->entry[j].comp_method = de.comp_method; cd->entry[j].comp_size = de.comp_size; @@ -307,9 +332,11 @@ zip_close(struct zip *za) } return -1; } +#ifndef PHP_WIN32 mask = umask(0); umask(mask); chmod(za->zn, 0666&~mask); +#endif if (za->ch_comment) free(za->ch_comment); @@ -322,23 +349,17 @@ zip_close(struct zip *za) static int -add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) +add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, + FILE *ft) { - off_t offstart, offend; - zip_source_callback cb; - void *ud; + off_t offstart, offdata, offend; struct zip_stat st; - - cb = zs->f; - ud = zs->ud; - - if (cb(ud, &st, sizeof(st), ZIP_SOURCE_STAT) < (ssize_t)sizeof(st)) { - ch_set_error(&za->error, cb, ud); - return -1; - } - - if (cb(ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) { - ch_set_error(&za->error, cb, ud); + struct zip_source *s2; + zip_compression_implementation comp_impl; + int ret; + + if (zip_source_stat(src, &st) < 0) { + _zip_error_set_from_source(&za->error, src); return -1; } @@ -347,19 +368,49 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) if (_zip_dirent_write(de, ft, 1, &za->error) < 0) return -1; - if (st.comp_method != ZIP_CM_STORE) { - if (add_data_comp(cb, ud, &st, ft, &za->error) < 0) - return -1; - } - else { - if (add_data_uncomp(za, cb, ud, &st, ft) < 0) - return -1; - } - - if (cb(ud, NULL, 0, ZIP_SOURCE_CLOSE) < 0) { - ch_set_error(&za->error, cb, ud); + if ((s2=zip_source_crc(za, src, 0)) == NULL) { + zip_source_pop(s2); return -1; } + + /* XXX: deflate 0-byte files for torrentzip? */ + if (((st.valid & ZIP_STAT_COMP_METHOD) == 0 + || st.comp_method == ZIP_CM_STORE) + && ((st.valid & ZIP_STAT_SIZE) == 0 || st.size != 0)) { + comp_impl = NULL; + if ((comp_impl=zip_get_compression_implementation(ZIP_CM_DEFLATE)) + == NULL) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + zip_source_pop(s2); + return -1; + } + if ((s2=comp_impl(za, s2, ZIP_CM_DEFLATE, ZIP_CODEC_ENCODE)) + == NULL) { + /* XXX: set error? */ + zip_source_pop(s2); + return -1; + } + } + else + s2 = src; + + offdata = ftello(ft); + + ret = copy_source(za, s2, ft); + + if (zip_source_stat(s2, &st) < 0) + ret = -1; + + while (s2 != src) { + if ((s2=zip_source_pop(s2)) == NULL) { + /* XXX: set erorr */ + ret = -1; + break; + } + } + + if (ret < 0) + return -1; offend = ftello(ft); @@ -368,19 +419,18 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) return -1; } - de->last_mod = st.mtime; de->comp_method = st.comp_method; de->crc = st.crc; de->uncomp_size = st.size; - de->comp_size = st.comp_size; + de->comp_size = offend - offdata; if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) _zip_dirent_torrent_normalize(de); if (_zip_dirent_write(de, ft, 1, &za->error) < 0) return -1; - + if (fseeko(ft, offend, SEEK_SET) < 0) { _zip_error_set(&za->error, ZIP_ER_SEEK, errno); return -1; @@ -391,133 +441,6 @@ add_data(struct zip *za, struct zip_source *zs, struct zip_dirent *de, FILE *ft) -static int -add_data_comp(zip_source_callback cb, void *ud, struct zip_stat *st,FILE *ft, - struct zip_error *error) -{ - char buf[BUFSIZE]; - ssize_t n; - - st->comp_size = 0; - while ((n=cb(ud, buf, sizeof(buf), ZIP_SOURCE_READ)) > 0) { - if (fwrite(buf, 1, n, ft) != (size_t)n) { - _zip_error_set(error, ZIP_ER_WRITE, errno); - return -1; - } - - st->comp_size += n; - } - if (n < 0) { - ch_set_error(error, cb, ud); - return -1; - } - - return 0; -} - - - -static int -add_data_uncomp(struct zip *za, zip_source_callback cb, void *ud, - struct zip_stat *st, FILE *ft) -{ - char b1[BUFSIZE], b2[BUFSIZE]; - int end, flush, ret; - ssize_t n; - size_t n2; - z_stream zstr; - int mem_level; - - st->comp_method = ZIP_CM_DEFLATE; - st->comp_size = st->size = 0; - st->crc = crc32(0, NULL, 0); - - zstr.zalloc = Z_NULL; - zstr.zfree = Z_NULL; - zstr.opaque = NULL; - zstr.avail_in = 0; - zstr.avail_out = 0; - - if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) - mem_level = TORRENT_MEM_LEVEL; - else - mem_level = MAX_MEM_LEVEL; - - /* -MAX_WBITS: undocumented feature of zlib to _not_ write a zlib header */ - deflateInit2(&zstr, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, mem_level, - Z_DEFAULT_STRATEGY); - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - zstr.next_in = NULL; - zstr.avail_in = 0; - - flush = 0; - end = 0; - while (!end) { - if (zstr.avail_in == 0 && !flush) { - if ((n=cb(ud, b1, sizeof(b1), ZIP_SOURCE_READ)) < 0) { - ch_set_error(&za->error, cb, ud); - deflateEnd(&zstr); - return -1; - } - if (n > 0) { - zstr.avail_in = n; - zstr.next_in = (Bytef *)b1; - st->size += n; - st->crc = crc32(st->crc, (Bytef *)b1, n); - } - else - flush = Z_FINISH; - } - - ret = deflate(&zstr, flush); - if (ret != Z_OK && ret != Z_STREAM_END) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - return -1; - } - - if (zstr.avail_out != sizeof(b2)) { - n2 = sizeof(b2) - zstr.avail_out; - - if (fwrite(b2, 1, n2, ft) != n2) { - _zip_error_set(&za->error, ZIP_ER_WRITE, errno); - return -1; - } - - zstr.next_out = (Bytef *)b2; - zstr.avail_out = sizeof(b2); - st->comp_size += n2; - } - - if (ret == Z_STREAM_END) { - deflateEnd(&zstr); - end = 1; - } - } - - return 0; -} - - - -static void -ch_set_error(struct zip_error *error, zip_source_callback cb, void *ud) -{ - int e[2]; - - if ((cb(ud, e, sizeof(e), ZIP_SOURCE_ERROR)) < (ssize_t)sizeof(e)) { - error->zip_err = ZIP_ER_INTERNAL; - error->sys_err = 0; - } - else { - error->zip_err = e[0]; - error->sys_err = e[1]; - } -} - - - static int copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) { @@ -551,6 +474,40 @@ copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error) +static int +copy_source(struct zip *za, struct zip_source *src, FILE *ft) +{ + char buf[BUFSIZE]; + zip_int64_t n; + int ret; + + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + return -1; + } + + ret = 0; + while ((n=zip_source_read(src, buf, sizeof(buf))) > 0) { + if (fwrite(buf, 1, n, ft) != (size_t)n) { + _zip_error_set(&za->error, ZIP_ER_WRITE, errno); + ret = -1; + break; + } + } + + if (n < 0) { + if (ret == 0) + _zip_error_set_from_source(&za->error, src); + ret = -1; + } + + zip_source_close(src); + + return ret; +} + + + static int write_cdir(struct zip *za, struct zip_cdir *cd, FILE *out) { @@ -613,7 +570,7 @@ _zip_cdir_set_comment(struct zip_cdir *dest, struct zip *src) -static int +int _zip_changed(struct zip *za, int *survivorsp) { int changed, i, survivors; @@ -626,13 +583,15 @@ _zip_changed(struct zip *za, int *survivorsp) for (i=0; inentry; i++) { if ((za->entry[i].state != ZIP_ST_UNCHANGED) + || (za->entry[i].ch_extra_len != -1) || (za->entry[i].ch_comment_len != -1)) changed = 1; if (za->entry[i].state != ZIP_ST_DELETED) survivors++; } - *survivorsp = survivors; + if (survivorsp) + *survivorsp = survivors; return changed; } @@ -668,6 +627,10 @@ _zip_create_temp_output(struct zip *za, FILE **outp) return NULL; } #ifdef PHP_WIN32 + /* + According to Pierre Joye, Windows in some environments per + default creates text files, so force binary mode. + */ _setmode(_fileno(tfp), _O_BINARY ); #endif diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 4591ff7f86a..da3e65b28a3 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -1,6 +1,6 @@ /* zip_delete.c -- delete file from zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,13 +38,18 @@ ZIP_EXTERN(int) -zip_delete(struct zip *za, int idx) +zip_delete(struct zip *za, zip_uint64_t idx) { if (idx < 0 || idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + /* allow duplicate file names, because the file will * be removed directly afterwards */ if (_zip_unchange(za, idx, 1) != 0) diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index 59f8ab0af9c..6cb9ee3ee51 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -45,7 +45,6 @@ static time_t _zip_d2u_time(int, int); static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *); static char *_zip_readstr(unsigned char **, int, int, struct zip_error *); -static void _zip_u2d_time(time_t, unsigned short *, unsigned short *); static void _zip_write2(unsigned short, FILE *); static void _zip_write4(unsigned int, FILE *); @@ -213,13 +212,13 @@ _zip_dirent_init(struct zip_dirent *de) int _zip_dirent_read(struct zip_dirent *zde, FILE *fp, - unsigned char **bufp, unsigned int *leftp, int local, + unsigned char **bufp, zip_uint32_t *leftp, int local, struct zip_error *error) { unsigned char buf[CDENTRYSIZE]; unsigned char *cur; unsigned short dostime, dosdate; - unsigned int size; + zip_uint32_t size; if (local) size = LENTRYSIZE; @@ -475,6 +474,8 @@ _zip_d2u_time(int dtime, int ddate) { struct tm tm = {0}; + memset(&tm, 0, sizeof(tm)); + /* let mktime decide if DST is in effect */ tm.tm_isdst = -1; @@ -598,7 +599,7 @@ _zip_write4(unsigned int i, FILE *fp) -static void +void _zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate) { struct tm *tm; diff --git a/ext/zip/lib/zip_entry_free.c b/ext/zip/lib/zip_entry_free.c index c50c9434bdd..e8a77707f0b 100644 --- a/ext/zip/lib/zip_entry_free.c +++ b/ext/zip/lib/zip_entry_free.c @@ -44,6 +44,9 @@ _zip_entry_free(struct zip_entry *ze) { free(ze->ch_filename); ze->ch_filename = NULL; + free(ze->ch_extra); + ze->ch_extra = NULL; + ze->ch_extra_len = -1; free(ze->ch_comment); ze->ch_comment = NULL; ze->ch_comment_len = -1; diff --git a/ext/zip/lib/zip_entry_new.c b/ext/zip/lib/zip_entry_new.c index 7059b1b0607..ad5d59975a9 100644 --- a/ext/zip/lib/zip_entry_new.c +++ b/ext/zip/lib/zip_entry_new.c @@ -1,6 +1,6 @@ /* zip_entry_new.c -- create and init struct zip_entry - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -46,20 +46,21 @@ _zip_entry_new(struct zip *za) if (!za) { ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); if (!ze) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } } else { - if (za->nentry >= za->nentry_alloc-1) { + if (za->nentry+1 >= za->nentry_alloc) { + struct zip_entry *rentries; za->nentry_alloc += 16; - za->entry = (struct zip_entry *)realloc(za->entry, - sizeof(struct zip_entry) - * za->nentry_alloc); - if (!za->entry) { + rentries = (struct zip_entry *)realloc(za->entry, + sizeof(struct zip_entry) + * za->nentry_alloc); + if (!rentries) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } + za->entry = rentries; } ze = za->entry+za->nentry; } @@ -67,6 +68,8 @@ _zip_entry_new(struct zip *za) ze->state = ZIP_ST_UNCHANGED; ze->ch_filename = NULL; + ze->ch_extra = NULL; + ze->ch_extra_len = -1; ze->ch_comment = NULL; ze->ch_comment_len = -1; ze->source = NULL; diff --git a/ext/zip/lib/zip_err_str.c b/ext/zip/lib/zip_err_str.c index 3fcdf1738a8..8fb60036e07 100644 --- a/ext/zip/lib/zip_err_str.c +++ b/ext/zip/lib/zip_err_str.c @@ -32,6 +32,10 @@ const char * const _zip_err_str[] = { "Zip archive inconsistent", "Can't remove file", "Entry has been deleted", + "Encryption method not supported", + "Read-only archive", + "No password provided", + "Wrong password provided", }; const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]); @@ -65,4 +69,8 @@ const int _zip_err_type[] = { N, S, N, + N, + N, + N, + N, }; diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index aab70794566..b8d907abf4d 100644 --- a/ext/zip/lib/zip_error.c +++ b/ext/zip/lib/zip_error.c @@ -1,6 +1,6 @@ /* zip_error.c -- struct zip_error helper functions - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -99,3 +99,14 @@ _zip_error_set(struct zip_error *err, int ze, int se) err->sys_err = se; } } + + + +void +_zip_error_set_from_source(struct zip_error *err, struct zip_source *src) +{ + int ze, se; + + zip_source_error(src, &ze, &se); + _zip_error_set(err, ze, se); +} diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c index 4dea4d667a5..bafe74335a0 100644 --- a/ext/zip/lib/zip_error_to_str.c +++ b/ext/zip/lib/zip_error_to_str.c @@ -1,6 +1,6 @@ /* zip_error_to_str.c -- get string representation of zip error code - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -43,7 +43,7 @@ ZIP_EXTERN(int) -zip_error_to_str(char *buf, size_t len, int ze, int se) +zip_error_to_str(char *buf, zip_uint64_t len, int ze, int se) { const char *zs, *ss; diff --git a/ext/zip/lib/zip_fclose.c b/ext/zip/lib/zip_fclose.c index 8f062d9d090..eb55ddbcea4 100644 --- a/ext/zip/lib/zip_fclose.c +++ b/ext/zip/lib/zip_fclose.c @@ -44,28 +44,20 @@ zip_fclose(struct zip_file *zf) { int i, ret; - if (zf->zstr) - inflateEnd(zf->zstr); - free(zf->buffer); - free(zf->zstr); - if (zf->za) { - for (i=0; iza->nfile; i++) { - if (zf->za->file[i] == zf) { - zf->za->file[i] = zf->za->file[zf->za->nfile-1]; - zf->za->nfile--; - break; - } - } + if (zf->src) + zip_source_free(zf->src); + + for (i=0; iza->nfile; i++) { + if (zf->za->file[i] == zf) { + zf->za->file[i] = zf->za->file[zf->za->nfile-1]; + zf->za->nfile--; + break; } + } ret = 0; if (zf->error.zip_err) ret = zf->error.zip_err; - else if ((zf->flags & ZIP_ZF_CRC) && (zf->flags & ZIP_ZF_EOF)) { - /* if EOF, compare CRC */ - if (zf->crc_orig != zf->crc) - ret = ZIP_ER_CRC; - } free(zf); return ret; diff --git a/ext/zip/lib/zip_fdopen.c b/ext/zip/lib/zip_fdopen.c new file mode 100644 index 00000000000..df70f27561a --- /dev/null +++ b/ext/zip/lib/zip_fdopen.c @@ -0,0 +1,62 @@ +/* + zip_fdopen.c -- open read-only archive from file descriptor + Copyright (C) 2009-2010 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(struct zip *) +zip_fdopen(int fd_orig, int flags, int *zep) +{ + int fd; + FILE *fp; + + /* We dup() here to avoid messing with the passed in fd. + We could not restore it to the original state in case of error. */ + + if ((fd=dup(fd_orig)) < 0) { + *zep = ZIP_ER_OPEN; + return NULL; + } + + if ((fp=fdopen(fd, "rb")) == NULL) { + close(fd); + *zep = ZIP_ER_OPEN; + return NULL; + } + + close(fd_orig); + return _zip_open(NULL, fp, flags, ZIP_AFL_RDONLY, zep); +} diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c index c6890987b16..4d1ad566929 100644 --- a/ext/zip/lib/zip_filerange_crc.c +++ b/ext/zip/lib/zip_filerange_crc.c @@ -1,6 +1,6 @@ /* zip_filerange_crc.c -- compute CRC32 for a range of a file - Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index b4b76049f44..f62adbbf926 100644 --- a/ext/zip/lib/zip_fopen.c +++ b/ext/zip/lib/zip_fopen.c @@ -1,6 +1,6 @@ /* zip_fopen.c -- open file in zip archive for reading - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -45,5 +45,5 @@ zip_fopen(struct zip *za, const char *fname, int flags) if ((idx=zip_name_locate(za, fname, flags)) < 0) return NULL; - return zip_fopen_index(za, idx, flags); + return zip_fopen_index_encrypted(za, idx, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_encrypted.c b/ext/zip/lib/zip_fopen_encrypted.c new file mode 100644 index 00000000000..8aba0625672 --- /dev/null +++ b/ext/zip/lib/zip_fopen_encrypted.c @@ -0,0 +1,50 @@ +/* + zip_fopen_encrypted.c -- open file for reading with password + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(struct zip_file *) +zip_fopen_encrypted(struct zip *za, const char *fname, int flags, + const char *password) +{ + int idx; + + if ((idx=zip_name_locate(za, fname, flags)) < 0) + return NULL; + + return zip_fopen_index_encrypted(za, idx, flags, password); +} diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 1e7e4198970..5c777ee0ffa 100644 --- a/ext/zip/lib/zip_fopen_index.c +++ b/ext/zip/lib/zip_fopen_index.c @@ -1,6 +1,6 @@ /* zip_fopen_index.c -- open file in zip archive for reading by index - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -39,178 +39,11 @@ #include "zipint.h" -static struct zip_file *_zip_file_new(struct zip *za); ZIP_EXTERN(struct zip_file *) -zip_fopen_index(struct zip *za, int fileno, int flags) +zip_fopen_index(struct zip *za, zip_uint64_t fileno, int flags) { - int len, ret; - int zfflags; - struct zip_file *zf; - - if ((fileno < 0) || (fileno >= za->nentry)) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - if ((flags & ZIP_FL_UNCHANGED) == 0 - && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { - _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); - return NULL; - } - - if (fileno >= za->cdir->nentry) { - _zip_error_set(&za->error, ZIP_ER_INVAL, 0); - return NULL; - } - - zfflags = 0; - switch (za->cdir->entry[fileno].comp_method) { - case ZIP_CM_STORE: - zfflags |= ZIP_ZF_CRC; - break; - - case ZIP_CM_DEFLATE: - if ((flags & ZIP_FL_COMPRESSED) == 0) - zfflags |= ZIP_ZF_CRC | ZIP_ZF_DECOMP; - break; - default: - if ((flags & ZIP_FL_COMPRESSED) == 0) { - _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); - return NULL; - } - break; - } - - zf = _zip_file_new(za); - - zf->flags = zfflags; - /* zf->name = za->cdir->entry[fileno].filename; */ - zf->method = za->cdir->entry[fileno].comp_method; - zf->bytes_left = za->cdir->entry[fileno].uncomp_size; - zf->cbytes_left = za->cdir->entry[fileno].comp_size; - zf->crc_orig = za->cdir->entry[fileno].crc; - - if ((zf->fpos=_zip_file_get_offset(za, fileno)) == 0) { - zip_fclose(zf); - return NULL; - } - - if ((zf->flags & ZIP_ZF_DECOMP) == 0) - zf->bytes_left = zf->cbytes_left; - else { - if ((zf->buffer=(char *)malloc(BUFSIZE)) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - - len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (len <= 0) { - _zip_error_copy(&za->error, &zf->error); - zip_fclose(zf); - return NULL; - } - - if ((zf->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - zip_fclose(zf); - return NULL; - } - zf->zstr->zalloc = Z_NULL; - zf->zstr->zfree = Z_NULL; - zf->zstr->opaque = NULL; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = len; - - /* negative value to tell zlib that there is no header */ - if ((ret=inflateInit2(zf->zstr, -MAX_WBITS)) != Z_OK) { - _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); - zip_fclose(zf); - return NULL; - } - } - - return zf; -} - - - -int -_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf) -{ - int i, j; - - if (zf->error.zip_err != ZIP_ER_OK) - return -1; - - if ((zf->flags & ZIP_ZF_EOF) || zf->cbytes_left <= 0 || buflen <= 0) - return 0; - - if (fseeko(zf->za->zp, zf->fpos, SEEK_SET) < 0) { - _zip_error_set(&zf->error, ZIP_ER_SEEK, errno); - return -1; - } - if (buflen < zf->cbytes_left) - i = buflen; - else - i = zf->cbytes_left; - - j = fread(buf, 1, i, zf->za->zp); - if (j == 0) { - _zip_error_set(&zf->error, ZIP_ER_EOF, 0); - j = -1; - } - else if (j < 0) - _zip_error_set(&zf->error, ZIP_ER_READ, errno); - else { - zf->fpos += j; - zf->cbytes_left -= j; - } - - return j; -} - - - -static struct zip_file * -_zip_file_new(struct zip *za) -{ - struct zip_file *zf, **file; - int n; - - if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; - } - - if (za->nfile >= za->nfile_alloc-1) { - n = za->nfile_alloc + 10; - file = (struct zip_file **)realloc(za->file, - n*sizeof(struct zip_file *)); - if (file == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - free(zf); - return NULL; - } - za->nfile_alloc = n; - za->file = file; - } - - za->file[za->nfile++] = zf; - - zf->za = za; - _zip_error_init(&zf->error); - zf->flags = 0; - zf->crc = crc32(0L, Z_NULL, 0); - zf->crc_orig = 0; - zf->method = -1; - zf->bytes_left = zf->cbytes_left = 0; - zf->fpos = 0; - zf->buffer = NULL; - zf->zstr = NULL; - - return zf; + return zip_fopen_index_encrypted(za, fileno, flags, za->default_password); } diff --git a/ext/zip/lib/zip_fopen_index_encrypted.c b/ext/zip/lib/zip_fopen_index_encrypted.c new file mode 100644 index 00000000000..988a78fe03f --- /dev/null +++ b/ext/zip/lib/zip_fopen_index_encrypted.c @@ -0,0 +1,191 @@ +/* + zip_fopen_index_encrypted.c -- open file for reading by index w/ password + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include +#include + +#include "zipint.h" + +static struct zip_file *_zip_file_new(struct zip *za); + + + +ZIP_EXTERN(struct zip_file *) +zip_fopen_index_encrypted(struct zip *za, zip_uint64_t fileno, int flags, + const char *password) +{ + struct zip_file *zf; + zip_compression_implementation comp_impl; + zip_encryption_implementation enc_impl; + struct zip_source *src, *s2; + zip_uint64_t start; + struct zip_stat st; + + if (fileno >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) == 0 + && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return NULL; + } + + if (fileno >= za->cdir->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if (flags & ZIP_FL_ENCRYPTED) + flags |= ZIP_FL_COMPRESSED; + + zip_stat_index(za, fileno, flags, &st); + + enc_impl = NULL; + if ((flags & ZIP_FL_ENCRYPTED) == 0) { + if (st.encryption_method != ZIP_EM_NONE) { + if (password == NULL) { + _zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); + return NULL; + } + if ((enc_impl=zip_get_encryption_implementation( + st.encryption_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + } + } + + comp_impl = NULL; + if ((flags & ZIP_FL_COMPRESSED) == 0) { + if (st.comp_method != ZIP_CM_STORE) { + if ((comp_impl=zip_get_compression_implementation( + st.comp_method)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); + return NULL; + } + } + } + + if ((start=_zip_file_get_offset(za, fileno)) == 0) + return NULL; + + if (st.comp_size == 0) { + if ((src=zip_source_buffer(za, NULL, 0, 0)) == NULL) + return NULL; + } + else { + if ((src=_zip_source_file_or_p(za, NULL, za->zp, start, st.comp_size, + 0, &st)) == NULL) + return NULL; + if (enc_impl) { + if ((s2=enc_impl(za, src, ZIP_EM_TRAD_PKWARE, 0, + password)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + if (comp_impl) { + if ((s2=comp_impl(za, src, za->cdir->entry[fileno].comp_method, + 0)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + if ((flags & ZIP_FL_COMPRESSED) == 0 + || st.comp_method == ZIP_CM_STORE ) { + if ((s2=zip_source_crc(za, src, 1)) == NULL) { + zip_source_free(src); + /* XXX: set error (how?) */ + return NULL; + } + src = s2; + } + } + + if (zip_source_open(src) < 0) { + _zip_error_set_from_source(&za->error, src); + zip_source_free(src); + return NULL; + } + + zf = _zip_file_new(za); + + zf->src = src; + + return zf; +} + + + +static struct zip_file * +_zip_file_new(struct zip *za) +{ + struct zip_file *zf, **file; + int n; + + if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + if (za->nfile >= za->nfile_alloc-1) { + n = za->nfile_alloc + 10; + file = (struct zip_file **)realloc(za->file, + n*sizeof(struct zip_file *)); + if (file == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + free(zf); + return NULL; + } + za->nfile_alloc = n; + za->file = file; + } + + za->file[za->nfile++] = zf; + + zf->za = za; + _zip_error_init(&zf->error); + zf->eof = 0; + zf->src = NULL; + + return zf; +} diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index 00a6bdc4e05..4c828a84334 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -1,6 +1,6 @@ /* zip_fread.c -- read from file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -37,12 +37,10 @@ -ZIP_EXTERN(ssize_t) -zip_fread(struct zip_file *zf, void *outbuf, size_t toread) +ZIP_EXTERN(zip_int64_t) +zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread) { - int ret; - size_t out_before, len; - int i; + zip_int64_t n; if (!zf) return -1; @@ -50,81 +48,27 @@ zip_fread(struct zip_file *zf, void *outbuf, size_t toread) if (zf->error.zip_err != 0) return -1; - if ((zf->flags & ZIP_ZF_EOF) || (toread == 0)) - return 0; - - if (zf->bytes_left == 0) { - zf->flags |= ZIP_ZF_EOF; - if (zf->flags & ZIP_ZF_CRC) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - } - return 0; + if (toread > ZIP_INT64_MAX) { + _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + return -1; } - if ((zf->flags & ZIP_ZF_DECOMP) == 0) { - ret = _zip_file_fillbuf(outbuf, toread, zf); - if (ret > 0) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, ret); - zf->bytes_left -= ret; - } - return ret; + if ((zf->eof) || (toread == 0)) + return 0; + + if ((n=zip_source_read(zf->src, outbuf, toread)) < 0) { + _zip_error_set_from_source(&zf->error, zf->src); + return -1; } - zf->zstr->next_out = (Bytef *)outbuf; + /* XXX the following left from the previous PHP port, let's see how to use it now */ + /*zf->zstr->next_out = (Bytef *)outbuf; zf->zstr->avail_out = toread; - out_before = zf->zstr->total_out; + out_before = zf->zstr->total_out;*/ /* endless loop until something has been accomplished */ - for (;;) { - ret = inflate(zf->zstr, Z_SYNC_FLUSH); + /*for (;;) { + ret = inflate(zf->zstr, Z_SYNC_FLUSH);*/ - switch (ret) { - case Z_STREAM_END: - if (zf->zstr->total_out == out_before) { - if (zf->crc != zf->crc_orig) { - _zip_error_set(&zf->error, ZIP_ER_CRC, 0); - return -1; - } - else - return 0; - } - - /* fallthrough */ - - case Z_OK: - len = zf->zstr->total_out - out_before; - if (len >= zf->bytes_left || len >= toread) { - if (zf->flags & ZIP_ZF_CRC) - zf->crc = crc32(zf->crc, (Bytef *)outbuf, len); - zf->bytes_left -= len; - return len; - } - break; - - case Z_BUF_ERROR: - if (zf->zstr->avail_in == 0) { - i = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); - if (i == 0) { - _zip_error_set(&zf->error, ZIP_ER_INCONS, 0); - return -1; - } - else if (i < 0) - return -1; - zf->zstr->next_in = (Bytef *)zf->buffer; - zf->zstr->avail_in = i; - continue; - } - /* fallthrough */ - case Z_NEED_DICT: - case Z_DATA_ERROR: - case Z_STREAM_ERROR: - case Z_MEM_ERROR: - _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret); - return -1; - } - } + return n; } diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_free.c index 76c3a9673ff..9932c14fec9 100644 --- a/ext/zip/lib/zip_free.c +++ b/ext/zip/lib/zip_free.c @@ -57,7 +57,9 @@ _zip_free(struct zip *za) if (za->zp) fclose(za->zp); + free(za->default_password); _zip_cdir_free(za->cdir); + free(za->ch_comment); if (za->entry) { for (i=0; inentry; i++) { diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index ed1324fd5b9..fe97e6e8c18 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -42,11 +42,11 @@ zip_get_archive_comment(struct zip *za, int *lenp, int flags) { if ((flags & ZIP_FL_UNCHANGED) || (za->ch_comment_len == -1)) { - if (za->cdir) { - if (lenp != NULL) - *lenp = za->cdir->comment_len; - return za->cdir->comment; - } + if (za->cdir) { + if (lenp != NULL) + *lenp = za->cdir->comment_len; + return za->cdir->comment; + } else { if (lenp != NULL) *lenp = -1; diff --git a/ext/zip/lib/zip_get_archive_flag.c b/ext/zip/lib/zip_get_archive_flag.c index a595c51f599..2d46aa39ffb 100644 --- a/ext/zip/lib/zip_get_archive_flag.c +++ b/ext/zip/lib/zip_get_archive_flag.c @@ -1,6 +1,6 @@ /* zip_get_archive_flag.c -- get archive global flag - Copyright (C) 2008-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_get_compression_implementation.c b/ext/zip/lib/zip_get_compression_implementation.c new file mode 100644 index 00000000000..197cd49635d --- /dev/null +++ b/ext/zip/lib/zip_get_compression_implementation.c @@ -0,0 +1,46 @@ +/* + zip_get_compression_implementation.c -- get compression implementation + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(zip_compression_implementation) +zip_get_compression_implementation(zip_uint16_t cm) +{ + if (cm == ZIP_CM_DEFLATE) + return zip_source_deflate; + return NULL; +} diff --git a/ext/zip/lib/zip_get_encryption_implementation.c b/ext/zip/lib/zip_get_encryption_implementation.c new file mode 100644 index 00000000000..783d538d3f6 --- /dev/null +++ b/ext/zip/lib/zip_get_encryption_implementation.c @@ -0,0 +1,46 @@ +/* + zip_get_encryption_implementation.c -- get encryption implementation + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(zip_encryption_implementation) +zip_get_encryption_implementation(zip_uint16_t em) +{ + if (em == ZIP_EM_TRAD_PKWARE) + return zip_source_pkware; + return NULL; +} diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index 57dd9028bc1..43c1520e1d4 100644 --- a/ext/zip/lib/zip_get_file_comment.c +++ b/ext/zip/lib/zip_get_file_comment.c @@ -38,9 +38,9 @@ ZIP_EXTERN(const char *) -zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags) +zip_get_file_comment(struct zip *za, zip_uint64_t idx, int *lenp, int flags) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } diff --git a/ext/zip/lib/zip_get_file_extra.c b/ext/zip/lib/zip_get_file_extra.c new file mode 100644 index 00000000000..a27edd8ee94 --- /dev/null +++ b/ext/zip/lib/zip_get_file_extra.c @@ -0,0 +1,58 @@ +/* + zip_get_file_extra.c -- get file extra field + Copyright (C) 2006-2010 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(const char *) +zip_get_file_extra(struct zip *za, zip_uint64_t idx, int *lenp, int flags) +{ + if (idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((flags & ZIP_FL_UNCHANGED) + || (za->entry[idx].ch_extra_len == -1)) { + if (lenp != NULL) + *lenp = za->cdir->entry[idx].extrafield_len; + return za->cdir->entry[idx].extrafield; + } + + if (lenp != NULL) + *lenp = za->entry[idx].ch_extra_len; + return za->entry[idx].ch_extra; +} diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index b58d9720588..945e24e1501 100644 --- a/ext/zip/lib/zip_get_name.c +++ b/ext/zip/lib/zip_get_name.c @@ -38,7 +38,7 @@ ZIP_EXTERN(const char *) -zip_get_name(struct zip *za, int idx, int flags) +zip_get_name(struct zip *za, zip_uint64_t idx, int flags) { return _zip_get_name(za, idx, flags, &za->error); } @@ -46,9 +46,10 @@ zip_get_name(struct zip *za, int idx, int flags) const char * -_zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error) +_zip_get_name(struct zip *za, zip_uint64_t idx, int flags, + struct zip_error *error) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } diff --git a/ext/zip/lib/zip_get_num_entries.c b/ext/zip/lib/zip_get_num_entries.c new file mode 100644 index 00000000000..dd392e90959 --- /dev/null +++ b/ext/zip/lib/zip_get_num_entries.c @@ -0,0 +1,52 @@ +/* + zip_get_num_entries.c -- get number of entries in archive + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(zip_uint64_t) +zip_get_num_entries(struct zip *za, int flags) +{ + if (za == NULL) + return -1; + + if (flags & ZIP_FL_UNCHANGED) { + if (za->cdir == NULL) + return 0; + return za->cdir->nentry; + } + return za->nentry; +} diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 96c4f937e05..08d5b1fbf80 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -1,6 +1,6 @@ /* zip_name_locate.c -- get index by name - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -55,16 +55,20 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, const char *fn, *p; int i, n; + if (za == NULL) + return -1; + if (fname == NULL) { _zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - if((flags & ZIP_FL_UNCHANGED) && !za->cdir) { - return -1; + if ((flags & ZIP_FL_UNCHANGED) && za->cdir == NULL) { + _zip_error_set(error, ZIP_ER_NOENT, 0); + return -1; } - cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; + cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; for (i=0; infile = za->nfile_alloc = 0; za->file = NULL; za->flags = za->ch_flags = 0; + za->default_password = NULL; return za; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 31e12f4fc5f..11c6fe05a68 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -1,6 +1,6 @@ /* - zip_open.c -- open zip archive - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + zip_open.c -- open zip archive by name + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -52,7 +52,7 @@ static int _zip_headercomp(struct zip_dirent *, int, struct zip_dirent *, int); static unsigned char *_zip_memmem(const unsigned char *, int, const unsigned char *, int); -static struct zip_cdir *_zip_readcdir(FILE *, unsigned char *, unsigned char *, +static struct zip_cdir *_zip_readcdir(FILE *, off_t, unsigned char *, unsigned char *, int, int, struct zip_error *); @@ -61,24 +61,12 @@ ZIP_EXTERN(struct zip *) zip_open(const char *fn, int flags, int *zep) { FILE *fp; - struct zip *za; - struct zip_cdir *cdir; - int i; - off_t len; - - if (flags & ZIP_OVERWRITE) { - return _zip_allocate_new(fn, zep); - } - + switch (_zip_file_exists(fn, flags, zep)) { case -1: - if (!(flags & ZIP_OVERWRITE)) { - return NULL; - } - + return NULL; case 0: return _zip_allocate_new(fn, zep); - default: break; } @@ -88,7 +76,23 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } - fseeko(fp, 0, SEEK_END); + return _zip_open(fn, fp, flags, 0, zep); +} + + + +struct zip * +_zip_open(const char *fn, FILE *fp, int flags, int aflags, int *zep) +{ + struct zip *za; + struct zip_cdir *cdir; + int i; + off_t len; + + if (fseeko(fp, 0, SEEK_END) < 0) { + *zep = ZIP_ER_SEEK; + return NULL; + } len = ftello(fp); /* treat empty files as empty archives */ @@ -156,13 +160,13 @@ set_error(int *zep, struct zip_error *err, int ze) entries, or NULL if unsuccessful. */ static struct zip_cdir * -_zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, +_zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eocd, int buflen, int flags, struct zip_error *error) { struct zip_cdir *cd; unsigned char *cdp, **bufp; int i, comlen, nentry; - unsigned int left; + zip_uint32_t left; comlen = buf + buflen - eocd - EOCDLEN; if (comlen < 0) { @@ -196,14 +200,24 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, cd->comment = NULL; cd->comment_len = _zip_read2(&cdp); + if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { + /* cdir spans past EOCD record */ + _zip_error_set(error, ZIP_ER_INCONS, 0); + cd->nentry = 0; + _zip_cdir_free(cd); + return NULL; + } + if ((comlen < cd->comment_len) || (cd->nentry != i)) { _zip_error_set(error, ZIP_ER_NOZIP, 0); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) { _zip_error_set(error, ZIP_ER_INCONS, 0); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } @@ -211,14 +225,15 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN, cd->comment_len, error)) == NULL) { - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } } - if (cd->size < (unsigned int)(eocd-buf)) { + if (cd->offset >= buf_offset) { /* if buffer already read in, use it */ - cdp = eocd - cd->size; + cdp = buf + (cd->offset - buf_offset); bufp = &cdp; } else { @@ -234,20 +249,15 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, _zip_error_set(error, ZIP_ER_SEEK, errno); else _zip_error_set(error, ZIP_ER_NOZIP, 0); - free(cd); + cd->nentry = 0; + _zip_cdir_free(cd); return NULL; } } left = cd->size; i=0; - do { - if (i == cd->nentry && left > 0) { - /* Infozip extension for more than 64k entries: - nentries wraps around, size indicates correct EOCD */ - _zip_cdir_grow(cd, cd->nentry+0x10000, error); - } - + while (inentry && left > 0) { if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) { cd->nentry = i; _zip_cdir_free(cd); @@ -255,7 +265,18 @@ _zip_readcdir(FILE *fp, unsigned char *buf, unsigned char *eocd, int buflen, } i++; - } while (inentry); + if (i == cd->nentry && left > 0) { + /* Infozip extension for more than 64k entries: + nentries wraps around, size indicates correct EOCD */ + if (_zip_cdir_grow(cd, cd->nentry+ZIP_UINT16_MAX, error) < 0) { + cd->nentry = i; + _zip_cdir_free(cd); + return NULL; + } + } + } + + cd->nentry = i; return cd; } @@ -434,12 +455,16 @@ _zip_allocate_new(const char *fn, int *zep) set_error(zep, &error, 0); return NULL; } - - za->zn = strdup(fn); - if (!za->zn) { - _zip_free(za); - set_error(zep, NULL, ZIP_ER_MEMORY); - return NULL; + + if (fn == NULL) + za->zn = NULL; + else { + za->zn = strdup(fn); + if (!za->zn) { + _zip_free(za); + set_error(zep, NULL, ZIP_ER_MEMORY); + return NULL; + } } return za; } @@ -481,6 +506,7 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) { struct zip_cdir *cdir, *cdirnew; unsigned char *buf, *match; + off_t buf_offset; int a, best, buflen, i; struct zip_error zerr; @@ -490,7 +516,8 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) set_error(zep, NULL, ZIP_ER_SEEK); return NULL; } - + buf_offset = ftello(fp); + /* 64k is too much for stack */ if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) { set_error(zep, NULL, ZIP_ER_MEMORY); @@ -516,7 +543,7 @@ _zip_find_central_dir(FILE *fp, int flags, int *zep, off_t len) /* found match -- check, if good */ /* to avoid finding the same match all over again */ match++; - if ((cdirnew=_zip_readcdir(fp, buf, match-1, buflen, flags, + if ((cdirnew=_zip_readcdir(fp, buf_offset, buf, match-1, buflen, flags, &zerr)) == NULL) continue; diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index e40ab27674f..6b5a0359172 100644 --- a/ext/zip/lib/zip_rename.c +++ b/ext/zip/lib/zip_rename.c @@ -40,16 +40,21 @@ ZIP_EXTERN(int) -zip_rename(struct zip *za, int idx, const char *name) +zip_rename(struct zip *za, zip_uint64_t idx, const char *name) { const char *old_name; int old_is_dir, new_is_dir; - if (idx >= za->nentry || idx < 0 || name[0] == '\0') { + if (idx >= za->nentry || name[0] == '\0') { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if ((old_name=zip_get_name(za, idx, 0)) == NULL) return -1; diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index ae69a86f632..6dc3dd5ab50 100644 --- a/ext/zip/lib/zip_replace.c +++ b/ext/zip/lib/zip_replace.c @@ -1,6 +1,6 @@ /* zip_replace.c -- replace file via callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,9 +38,9 @@ ZIP_EXTERN(int) -zip_replace(struct zip *za, int idx, struct zip_source *source) +zip_replace(struct zip *za, zip_uint64_t idx, struct zip_source *source) { - if (idx < 0 || idx >= za->nentry || source == NULL) { + if (idx >= za->nentry || source == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -54,11 +54,18 @@ zip_replace(struct zip *za, int idx, struct zip_source *source) -int -_zip_replace(struct zip *za, int idx, const char *name, +/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */ + +zip_int64_t +_zip_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip_source *source) { - if (idx == -1) { + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (idx == ZIP_UINT64_MAX) { if (_zip_entry_new(za) == NULL) return -1; diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index c4bd070ddcd..3cd069c7577 100644 --- a/ext/zip/lib/zip_set_archive_comment.c +++ b/ext/zip/lib/zip_set_archive_comment.c @@ -1,6 +1,6 @@ /* zip_set_archive_comment.c -- set archive comment - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -50,6 +50,11 @@ zip_set_archive_comment(struct zip *za, const char *comment, int len) return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (len > 0) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1; diff --git a/ext/zip/lib/zip_set_archive_flag.c b/ext/zip/lib/zip_set_archive_flag.c index 20316e4614a..07bcfbe304d 100644 --- a/ext/zip/lib/zip_set_archive_flag.c +++ b/ext/zip/lib/zip_set_archive_flag.c @@ -40,10 +40,30 @@ ZIP_EXTERN(int) zip_set_archive_flag(struct zip *za, int flag, int value) { + unsigned int new_flags; + if (value) - za->ch_flags |= flag; + new_flags = za->ch_flags | flag; else - za->ch_flags &= ~flag; + new_flags = za->ch_flags & ~flag; + + if (new_flags == za->ch_flags) + return 0; + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if ((flag & ZIP_AFL_RDONLY) && value + && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { + if (_zip_changed(za, NULL)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); + return -1; + } + } + + za->ch_flags = new_flags; return 0; } diff --git a/ext/zip/lib/zip_set_default_password.c b/ext/zip/lib/zip_set_default_password.c new file mode 100644 index 00000000000..c274d1100bb --- /dev/null +++ b/ext/zip/lib/zip_set_default_password.c @@ -0,0 +1,62 @@ +/* + zip_set_default_password.c -- set default password for decryption + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + + + +ZIP_EXTERN(int) +zip_set_default_password(struct zip *za, const char *passwd) +{ + if (za == NULL) + return -1; + + if (za->default_password) + free(za->default_password); + + if (passwd) { + if ((za->default_password=strdup(passwd)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return -1; + } + } + else + za->default_password = NULL; + + return 0; +} diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index 3d5dd6b5e3e..5e63dc2730a 100644 --- a/ext/zip/lib/zip_set_file_comment.c +++ b/ext/zip/lib/zip_set_file_comment.c @@ -1,6 +1,6 @@ /* zip_set_file_comment.c -- set comment for file in archive - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,17 +40,23 @@ ZIP_EXTERN(int) -zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) +zip_set_file_comment(struct zip *za, zip_uint64_t idx, + const char *comment, int len) { char *tmpcom; - if (idx < 0 || idx >= za->nentry + if (idx >= za->nentry || len < 0 || len > MAXCOMLEN || (len > 0 && comment == NULL)) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (len > 0) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1; diff --git a/ext/zip/lib/zip_set_file_extra.c b/ext/zip/lib/zip_set_file_extra.c new file mode 100644 index 00000000000..db829e2e0a8 --- /dev/null +++ b/ext/zip/lib/zip_set_file_extra.c @@ -0,0 +1,72 @@ +/* + zip_set_file_extra.c -- set extra field for file in archive + Copyright (C) 2006-2010 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +ZIP_EXTERN(int) +zip_set_file_extra(struct zip *za, zip_uint64_t idx, + const char *extra, int len) +{ + char *tmpext; + + if (idx >= za->nentry + || len < 0 || len > MAXEXTLEN + || (len > 0 && extra == NULL)) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return -1; + } + + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + + if (len > 0) { + if ((tmpext=(char *)_zip_memdup(extra, len, &za->error)) == NULL) + return -1; + } + else + tmpext = NULL; + + free(za->entry[idx].ch_extra); + za->entry[idx].ch_extra = tmpext; + za->entry[idx].ch_extra_len = len; + + return 0; +} diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c index 5c7da3d7c51..2a90601bfec 100644 --- a/ext/zip/lib/zip_set_name.c +++ b/ext/zip/lib/zip_set_name.c @@ -41,12 +41,12 @@ int -_zip_set_name(struct zip *za, int idx, const char *name) +_zip_set_name(struct zip *za, zip_uint64_t idx, const char *name) { char *s; - int i; + zip_int64_t i; - if (idx < 0 || idx >= za->nentry || name == NULL) { + if (idx >= za->nentry || name == NULL) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index 867d3dfa3ed..8c9154ce3c5 100644 --- a/ext/zip/lib/zip_source_buffer.c +++ b/ext/zip/lib/zip_source_buffer.c @@ -1,6 +1,6 @@ /* zip_source_buffer.c -- create zip data source from buffer - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -44,13 +44,12 @@ struct read_data { int freep; }; -static ssize_t read_data(void *state, void *data, size_t len, - enum zip_source_cmd cmd); +static zip_int64_t read_data(void *, void *, zip_uint64_t, enum zip_source_cmd); ZIP_EXTERN(struct zip_source *) -zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) +zip_source_buffer(struct zip *za, const void *data, zip_uint64_t len, int freep) { struct read_data *f; struct zip_source *zs; @@ -58,7 +57,7 @@ zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) if (za == NULL) return NULL; - if (len < 0 || (data == NULL && len > 0)) { + if (data == NULL && len > 0) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -83,12 +82,12 @@ zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) -static ssize_t -read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) +static zip_int64_t +read_data(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_data *z; char *buf; - size_t n; + zip_uint64_t n; z = (struct read_data *)state; buf = (char *)data; @@ -99,6 +98,8 @@ read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) return 0; case ZIP_SOURCE_READ: + /* XXX: return error if (len > ZIP_INT64_MAX) */ + n = z->end - z->buf; if (n > len) n = len; @@ -125,6 +126,11 @@ read_data(void *state, void *data, size_t len, enum zip_source_cmd cmd) zip_stat_init(st); st->mtime = z->mtime; st->size = z->end - z->data; + st->comp_size = st->size; + st->comp_method = ZIP_CM_STORE; + st->encryption_method = ZIP_EM_NONE; + st->valid = ZIP_STAT_MTIME|ZIP_STAT_SIZE|ZIP_STAT_COMP_SIZE + |ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD; return sizeof(*st); } diff --git a/ext/zip/lib/zip_source_close.c b/ext/zip/lib/zip_source_close.c new file mode 100644 index 00000000000..a3bf7e5e1d9 --- /dev/null +++ b/ext/zip/lib/zip_source_close.c @@ -0,0 +1,54 @@ +/* + zip_source_close.c -- close zip_source (stop reading) + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(void) +zip_source_close(struct zip_source *src) +{ + if (!src->is_open) + return; + + if (src->src == NULL) + (void)src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + else { + (void)src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + zip_source_close(src->src); + } + + src->is_open = 0; +} diff --git a/ext/zip/lib/zip_source_crc.c b/ext/zip/lib/zip_source_crc.c new file mode 100644 index 00000000000..7fd78f56970 --- /dev/null +++ b/ext/zip/lib/zip_source_crc.c @@ -0,0 +1,159 @@ +/* + zip_source_crc.c -- pass-through source that calculates CRC32 and size + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + +struct crc { + int eof; + int validate; + int e[2]; + zip_uint64_t size; + zip_uint32_t crc; +}; + +static zip_int64_t crc_read(struct zip_source *, void *, void * + , zip_uint64_t, enum zip_source_cmd); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_crc(struct zip *za, struct zip_source *src, int validate) +{ + struct crc *ctx; + + if (src == NULL) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx=(struct crc *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->validate = validate; + + return zip_source_layered(za, src, crc_read, ctx); +} + + + +static zip_int64_t +crc_read(struct zip_source *src, void *_ctx, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct crc *ctx; + zip_int64_t n; + + ctx = (struct crc *)_ctx; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->eof = 0; + ctx->crc = crc32(0, NULL, 0); + ctx->size = 0; + + return 0; + + case ZIP_SOURCE_READ: + if (ctx->eof || len == 0) + return 0; + + if ((n=zip_source_read(src, data, len)) < 0) + return ZIP_SOURCE_ERR_LOWER; + + if (n == 0) { + ctx->eof = 1; + if (ctx->validate) { + struct zip_stat st; + + if (zip_source_stat(src, &st) < 0) + return ZIP_SOURCE_ERR_LOWER; + + if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { + ctx->e[0] = ZIP_ER_CRC; + ctx->e[1] = 0; + + return -1; + } + if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) { + ctx->e[0] = ZIP_ER_INCONS; + ctx->e[1] = 0; + + return -1; + } + } + } + else { + ctx->size += n; + ctx->crc = crc32(ctx->crc, data, n); + } + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + if (ctx->eof) { + /* XXX: Set comp_size, comp_method, encryption_method? + After all, this only works for uncompressed data. */ + st->size = ctx->size; + st->crc = ctx->crc; + st->valid |= ZIP_STAT_SIZE|ZIP_STAT_CRC; + } + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(ctx->e)); + return 0; + + case ZIP_SOURCE_FREE: + free(ctx); + return 0; + + default: + return -1; + } + +} diff --git a/ext/zip/lib/zip_source_deflate.c b/ext/zip/lib/zip_source_deflate.c new file mode 100644 index 00000000000..5d9c5e67bb6 --- /dev/null +++ b/ext/zip/lib/zip_source_deflate.c @@ -0,0 +1,394 @@ +/* + zip_source_deflate.c -- deflate (de)compressoin routines + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + +struct deflate { + int e[2]; + + int eof; + int mem_level; + zip_uint64_t size; + char buffer[BUFSIZE]; + z_stream zstr; +}; + +static zip_int64_t compress_read(struct zip_source *, struct deflate *, + void *, zip_uint64_t); +static zip_int64_t decompress_read(struct zip_source *, struct deflate *, + void *, zip_uint64_t); +static zip_int64_t deflate_compress(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static zip_int64_t deflate_decompress(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static void deflate_free(struct deflate *); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_deflate(struct zip *za, struct zip_source *src, + zip_uint16_t cm, int flags) +{ + struct deflate *ctx; + struct zip_source *s2; + + if (src == NULL || cm != ZIP_CM_DEFLATE) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + + if ((ctx=(struct deflate *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->e[0] = ctx->e[1] = 0; + ctx->eof = 0; + if (flags & ZIP_CODEC_ENCODE) { + if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) + ctx->mem_level = TORRENT_MEM_LEVEL; + else + ctx->mem_level = MAX_MEM_LEVEL; + } + + if ((s2=zip_source_layered(za, src, + ((flags & ZIP_CODEC_ENCODE) + ? deflate_compress : deflate_decompress), + ctx)) == NULL) { + deflate_free(ctx); + return NULL; + } + + return s2; +} + + + +static zip_int64_t +compress_read(struct zip_source *src, struct deflate *ctx, + void *data, zip_uint64_t len) +{ + int end, ret; + zip_int64_t n; + + if (ctx->e[0] != 0) + return -1; + + if (len == 0) + return 0; + + ctx->zstr.next_out = (Bytef *)data; + ctx->zstr.avail_out = len; + + end = 0; + while (!end) { + ret = deflate(&ctx->zstr, ctx->eof ? Z_FINISH : 0); + + switch (ret) { + case Z_OK: + case Z_STREAM_END: + /* all ok */ + + if (ctx->zstr.avail_out == 0 + || (ctx->eof && ctx->zstr.avail_in == 0)) + end = 1; + break; + + case Z_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + if (ctx->eof) { + end = 1; + break; + } + + if ((n=zip_source_read(src, ctx->buffer, + sizeof(ctx->buffer))) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + end = 1; + break; + } + else if (n == 0) { + ctx->eof = 1; + ctx->size = ctx->zstr.total_in; + /* XXX: check against stat of src? */ + } + else { + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + } + continue; + } + /* fallthrough */ + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_STREAM_ERROR: + case Z_MEM_ERROR: + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + + end = 1; + break; + } + } + + if (ctx->zstr.avail_out < len) + return len - ctx->zstr.avail_out; + + return (ctx->e[0] == 0) ? 0 : -1; +} + + + +static zip_int64_t +decompress_read(struct zip_source *src, struct deflate *ctx, + void *data, zip_uint64_t len) +{ + int end, ret; + zip_int64_t n; + + if (ctx->e[0] != 0) + return -1; + + if (len == 0) + return 0; + + ctx->zstr.next_out = (Bytef *)data; + ctx->zstr.avail_out = len; + + end = 0; + while (!end && ctx->zstr.avail_out) { + ret = inflate(&ctx->zstr, Z_SYNC_FLUSH); + + switch (ret) { + case Z_OK: + break; + + case Z_STREAM_END: + ctx->eof = 1; + end = 1; + break; + + case Z_BUF_ERROR: + if (ctx->zstr.avail_in == 0) { + if (ctx->eof) { + end = 1; + break; + } + + if ((n=zip_source_read(src, ctx->buffer, + sizeof(ctx->buffer))) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + end = 1; + break; + } + else if (n == 0) + ctx->eof = 1; + else { + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + } + continue; + } + /* fallthrough */ + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_STREAM_ERROR: + case Z_MEM_ERROR: + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + end = 1; + break; + } + } + + if (ctx->zstr.avail_out < len) + return len - ctx->zstr.avail_out; + + return (ctx->e[0] == 0) ? 0 : -1; +} + + + +static zip_int64_t +deflate_compress(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct deflate *ctx; + int ret; + + ctx = (struct deflate *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + ctx->zstr.zalloc = Z_NULL; + ctx->zstr.zfree = Z_NULL; + ctx->zstr.opaque = NULL; + ctx->zstr.avail_in = 0; + ctx->zstr.next_in = NULL; + ctx->zstr.avail_out = 0; + ctx->zstr.next_out = NULL; + + /* negative value to tell zlib not to write a header */ + if ((ret=deflateInit2(&ctx->zstr, Z_BEST_COMPRESSION, Z_DEFLATED, + -MAX_WBITS, ctx->mem_level, + Z_DEFAULT_STRATEGY)) != Z_OK) { + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + return -1; + } + + return 0; + + case ZIP_SOURCE_READ: + return compress_read(src, ctx, data, len); + + case ZIP_SOURCE_CLOSE: + deflateEnd(&ctx->zstr); + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->comp_method = ZIP_CM_DEFLATE; + st->valid |= ZIP_STAT_COMP_METHOD; + if (ctx->eof) { + st->comp_size = ctx->size; + st->valid |= ZIP_STAT_COMP_SIZE; + } + else + st->valid &= ~ZIP_STAT_COMP_SIZE; + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + deflate_free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } +} + + + +static zip_int64_t +deflate_decompress(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct deflate *ctx; + zip_int64_t n; + int ret; + + ctx = (struct deflate *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + if ((n=zip_source_read(src, ctx->buffer, sizeof(ctx->buffer))) < 0) + return ZIP_SOURCE_ERR_LOWER; + + ctx->zstr.zalloc = Z_NULL; + ctx->zstr.zfree = Z_NULL; + ctx->zstr.opaque = NULL; + ctx->zstr.next_in = (Bytef *)ctx->buffer; + ctx->zstr.avail_in = n; + + /* negative value to tell zlib that there is no header */ + if ((ret=inflateInit2(&ctx->zstr, -MAX_WBITS)) != Z_OK) { + ctx->e[0] = ZIP_ER_ZLIB; + ctx->e[1] = ret; + + return -1; + } + return 0; + + case ZIP_SOURCE_READ: + return decompress_read(src, ctx, data, len); + + case ZIP_SOURCE_CLOSE: + inflateEnd(&ctx->zstr); + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->comp_method = ZIP_CM_STORE; + if (st->comp_size > 0 && st->size > 0) + st->comp_size = st->size; + } + return 0; + + case ZIP_SOURCE_ERROR: + if (len < sizeof(int)*2) + return -1; + + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + /* XXX: inflateEnd if close was not called */ + free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } + +} + + + +static void +deflate_free(struct deflate *ctx) +{ + /* XXX: deflateEnd if close was not called */ + free(ctx); +} diff --git a/ext/zip/lib/zip_source_error.c b/ext/zip/lib/zip_source_error.c new file mode 100644 index 00000000000..ffb4652d336 --- /dev/null +++ b/ext/zip/lib/zip_source_error.c @@ -0,0 +1,87 @@ +/* + zip_source_error.c -- get last error from zip_source + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(void) +zip_source_error(struct zip_source *src, int *ze, int *se) +{ + int e[2]; + + if (src->src == NULL) { + } + else { + switch (src->error_source) { + case ZIP_LES_NONE: + if (src->src == NULL) { + if (src->cb.f(src->ud, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) { + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } + } + else + e[0] = e[1] = 0; + break; + + case ZIP_LES_INVAL: + e[0] = ZIP_ER_INVAL; + e[1] = 0; + break; + + case ZIP_LES_LOWER: + zip_source_error(src->src, ze, se); + return; + + case ZIP_LES_UPPER: + if (src->cb.l(src->src, src->ud, e, sizeof(e), + ZIP_SOURCE_ERROR) < 0) { + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } + break; + + default: + e[0] = ZIP_ER_INTERNAL; + e[1] = 0; + } + } + + if (ze) + *ze = e[0]; + if (se) + *se = e[1]; +} diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index ab6466dcbd9..681cc2f3ea6 100644 --- a/ext/zip/lib/zip_source_file.c +++ b/ext/zip/lib/zip_source_file.c @@ -41,15 +41,16 @@ ZIP_EXTERN(struct zip_source *) -zip_source_file(struct zip *za, const char *fname, off_t start, off_t len) +zip_source_file(struct zip *za, const char *fname, zip_uint64_t start, + zip_int64_t len) { if (za == NULL) return NULL; - if (fname == NULL || start < 0 || len < -1) { + if (fname == NULL || len < -1) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } - return _zip_source_file_or_p(za, fname, NULL, start, len); + return _zip_source_file_or_p(za, fname, NULL, start, len, 1, NULL); } diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index 2a06a9f028e..4d896a4c01b 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -44,19 +44,23 @@ struct read_file { char *fname; /* name of file to copy from */ FILE *f; /* file to copy from */ - off_t off; /* start offset of */ - off_t len; /* lengt of data to copy */ - off_t remain; /* bytes remaining to be copied */ + int closep; /* close f */ + struct zip_stat st; /* stat information passed in */ + + zip_uint64_t off; /* start offset of */ + zip_int64_t len; /* length of data to copy */ + zip_int64_t remain; /* bytes remaining to be copied */ int e[2]; /* error codes */ }; -static ssize_t read_file(void *state, void *data, size_t len, +static zip_int64_t read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd); ZIP_EXTERN(struct zip_source *) -zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) +zip_source_filep(struct zip *za, FILE *file, zip_uint64_t start, + zip_int64_t len) { if (za == NULL) return NULL; @@ -66,14 +70,15 @@ zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) return NULL; } - return _zip_source_file_or_p(za, NULL, file, start, len); + return _zip_source_file_or_p(za, NULL, file, start, len, 1, NULL); } struct zip_source * _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, - off_t start, off_t len) + zip_uint64_t start, zip_int64_t len, int closep, + const struct zip_stat *st) { struct read_file *f; struct zip_source *zs; @@ -99,7 +104,12 @@ _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, f->f = file; f->off = start; f->len = (len ? len : -1); - + f->closep = f->fname ? 1 : closep; + if (st) + memcpy(&f->st, st, sizeof(f->st)); + else + zip_stat_init(&f->st); + if ((zs=zip_source_function(za, read_file, f)) == NULL) { free(f); return NULL; @@ -110,8 +120,8 @@ _zip_source_file_or_p(struct zip *za, const char *fname, FILE *file, -static ssize_t -read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) +static zip_int64_t +read_file(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_file *z; char *buf; @@ -130,20 +140,33 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) } } - if (fseeko(z->f, z->off, SEEK_SET) < 0) { - z->e[0] = ZIP_ER_SEEK; - z->e[1] = errno; - return -1; + if (z->closep) { + if (fseeko(z->f, (off_t)z->off, SEEK_SET) < 0) { + z->e[0] = ZIP_ER_SEEK; + z->e[1] = errno; + return -1; + } } z->remain = z->len; return 0; case ZIP_SOURCE_READ: + /* XXX: return INVAL if len > size_t max */ if (z->remain != -1) n = len > z->remain ? z->remain : len; else n = len; - + + if (!z->closep) { + /* we might share this file with others, so let's be safe */ + if (fseeko(z->f, (off_t)(z->off + z->len-z->remain), + SEEK_SET) < 0) { + z->e[0] = ZIP_ER_SEEK; + z->e[1] = errno; + return -1; + } + } + if ((i=fread(buf, 1, n, z->f)) < 0) { z->e[0] = ZIP_ER_READ; z->e[1] = errno; @@ -164,34 +187,42 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_STAT: { - struct zip_stat *st; - struct stat fst; - int err; + if (len < sizeof(z->st)) + return -1; + + if (z->st.valid != 0) + memcpy(data, &z->st, sizeof(z->st)); + else { + struct zip_stat *st; + struct stat fst; + int err; - if (len < sizeof(*st)) - return -1; + if (z->f) + err = fstat(fileno(z->f), &fst); + else + err = stat(z->fname, &fst); - if (z->f) - err = fstat(fileno(z->f), &fst); - else - err = stat(z->fname, &fst); + if (err != 0) { + z->e[0] = ZIP_ER_READ; /* best match */ + z->e[1] = errno; + return -1; + } - if (err != 0) { - z->e[0] = ZIP_ER_READ; /* best match */ - z->e[1] = errno; - return -1; + st = (struct zip_stat *)data; + + zip_stat_init(st); + st->mtime = fst.st_mtime; + st->valid |= ZIP_STAT_MTIME; + if (z->len != -1) { + st->size = z->len; + st->valid |= ZIP_STAT_SIZE; + } + else if ((fst.st_mode&S_IFMT) == S_IFREG) { + st->size = fst.st_size; + st->valid |= ZIP_STAT_SIZE; + } } - - st = (struct zip_stat *)data; - - zip_stat_init(st); - st->mtime = fst.st_mtime; - if (z->len != -1) - st->size = z->len; - else if ((fst.st_mode&S_IFMT) == S_IFREG) - st->size = fst.st_size; - - return sizeof(*st); + return sizeof(z->st); } case ZIP_SOURCE_ERROR: @@ -203,8 +234,8 @@ read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd) case ZIP_SOURCE_FREE: free(z->fname); - if (z->f) - fclose(z->f); + if (z->closep && z->f) + fclose(z->f); free(z); return 0; diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index 293e7f7e114..f71c71ed6c5 100644 --- a/ext/zip/lib/zip_source_free.c +++ b/ext/zip/lib/zip_source_free.c @@ -1,6 +1,6 @@ /* zip_source_free.c -- free zip data source - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,12 +40,20 @@ ZIP_EXTERN(void) -zip_source_free(struct zip_source *source) +zip_source_free(struct zip_source *src) { - if (source == NULL) + if (src == NULL) return; - (void)source->f(source->ud, NULL, 0, ZIP_SOURCE_FREE); + if (src->is_open) + zip_source_close(src); - free(source); + if (src->src == NULL) + (void)src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_FREE); + else { + (void)src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_FREE); + zip_source_free(src->src); + } + + free(src); } diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index fe3e82aa5ba..984b107f7ba 100644 --- a/ext/zip/lib/zip_source_function.c +++ b/ext/zip/lib/zip_source_function.c @@ -1,6 +1,6 @@ /* zip_source_function.c -- create zip data source from callback function - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -47,13 +47,32 @@ zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) if (za == NULL) return NULL; - if ((zs=(struct zip_source *)malloc(sizeof(*zs))) == NULL) { - _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + if ((zs=_zip_source_new(za)) == NULL) return NULL; - } - zs->f = zcb; + zs->cb.f = zcb; zs->ud = ud; return zs; } + + + +struct zip_source * +_zip_source_new(struct zip *za) +{ + struct zip_source *src; + + if ((src=(struct zip_source *)malloc(sizeof(*src))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + src->src = NULL; + src->cb.f = NULL; + src->ud = NULL; + src->error_source = ZIP_LES_NONE; + src->is_open = 0; + + return src; +} diff --git a/ext/zip/lib/zip_source_layered.c b/ext/zip/lib/zip_source_layered.c new file mode 100644 index 00000000000..86ed4204070 --- /dev/null +++ b/ext/zip/lib/zip_source_layered.c @@ -0,0 +1,59 @@ +/* + zip_source_layered.c -- create layered source + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +ZIP_EXTERN(struct zip_source *) +zip_source_layered(struct zip *za, struct zip_source *src, + zip_source_layered_callback cb, void *ud) +{ + struct zip_source *zs; + + if (za == NULL) + return NULL; + + if ((zs=_zip_source_new(za)) == NULL) + return NULL; + + zs->src = src; + zs->cb.l = cb; + zs->ud = ud; + + return zs; +} diff --git a/ext/zip/lib/zip_source_open.c b/ext/zip/lib/zip_source_open.c new file mode 100644 index 00000000000..2c768f7f3a4 --- /dev/null +++ b/ext/zip/lib/zip_source_open.c @@ -0,0 +1,76 @@ +/* + zip_source_open.c -- open zip_source (prepare for reading) + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(int) +zip_source_open(struct zip_source *src) +{ + zip_int64_t ret; + + if (src->is_open) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) { + if (src->cb.f(src->ud, NULL, 0, ZIP_SOURCE_OPEN) < 0) + return -1; + } + else { + if (zip_source_open(src->src) < 0) { + src->error_source = ZIP_LES_LOWER; + return -1; + } + + ret = src->cb.l(src->src, src->ud, NULL, 0, ZIP_SOURCE_OPEN); + + if (ret < 0) { + (void)zip_source_close(src->src); + + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + } + + src->is_open = 1; + + return 0; +} diff --git a/ext/zip/lib/zip_source_pkware.c b/ext/zip/lib/zip_source_pkware.c new file mode 100644 index 00000000000..83b5cc5ad5b --- /dev/null +++ b/ext/zip/lib/zip_source_pkware.c @@ -0,0 +1,241 @@ +/* + zip_source_pkware.c -- Traditional PKWARE de/encryption routines + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include +#include + +#include "zipint.h" + +struct trad_pkware { + int e[2]; + + zip_uint32_t key[3]; +}; + +#define HEADERLEN 12 +#define KEY0 305419896 +#define KEY1 591751049 +#define KEY2 878082192 + +static const uLongf *crc = NULL; + +#define CRC32(c, b) (crc[((c) ^ (b)) & 0xff] ^ ((c) >> 8)) + + + +static void decrypt(struct trad_pkware *, zip_uint8_t *, + const zip_uint8_t *, zip_uint64_t, int); +static int decrypt_header(struct zip_source *, struct trad_pkware *); +static zip_int64_t pkware_decrypt(struct zip_source *, void *, void *, + zip_uint64_t, enum zip_source_cmd); +static void pkware_free(struct trad_pkware *); + + + +ZIP_EXTERN(struct zip_source *) +zip_source_pkware(struct zip *za, struct zip_source *src, + zip_uint16_t em, int flags, const char *password) +{ + struct trad_pkware *ctx; + struct zip_source *s2; + + if (password == NULL || src == NULL || em != ZIP_EM_TRAD_PKWARE) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); + return NULL; + } + if (flags & ZIP_CODEC_ENCODE) { + _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); + return NULL; + } + + if (crc == NULL) + crc = get_crc_table(); + + if ((ctx=(struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; + } + + ctx->e[0] = ctx->e[1] = 0; + + ctx->key[0] = KEY0; + ctx->key[1] = KEY1; + ctx->key[2] = KEY2; + decrypt(ctx, NULL, (const zip_uint8_t *)password, strlen(password), 1); + + if ((s2=zip_source_layered(za, src, pkware_decrypt, ctx)) == NULL) { + pkware_free(ctx); + return NULL; + } + + return s2; +} + + + +static void +decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, + zip_uint64_t len, int update_only) +{ + zip_uint16_t tmp; + zip_uint64_t i; + Bytef b; + + for (i=0; ikey[2] | 2; + tmp = (tmp * (tmp ^ 1)) >> 8; + b ^= tmp; + } + + /* store cleartext */ + if (out) + out[i] = b; + + /* update keys */ + ctx->key[0] = CRC32(ctx->key[0], b); + ctx->key[1] = (ctx->key[1] + (ctx->key[0] & 0xff)) * 134775813 + 1; + b = ctx->key[1] >> 24; + ctx->key[2] = CRC32(ctx->key[2], b); + } +} + + + +static int +decrypt_header(struct zip_source *src, struct trad_pkware *ctx) +{ + zip_uint8_t header[HEADERLEN]; + struct zip_stat st; + zip_int64_t n; + unsigned short dostime, dosdate; + + if ((n=zip_source_read(src, header, HEADERLEN)) < 0) { + zip_source_error(src, ctx->e, ctx->e+1); + return -1; + } + + if (n != HEADERLEN) { + ctx->e[0] = ZIP_ER_EOF; + ctx->e[1] = 0; + return -1; + } + + decrypt(ctx, header, header, HEADERLEN, 0); + + if (zip_source_stat(src, &st) < 0) { + /* stat failed, skip password validation */ + return 0; + } + + _zip_u2d_time(st.mtime, &dostime, &dosdate); + + if (header[HEADERLEN-1] != st.crc>>24 + && header[HEADERLEN-1] != dostime>>8) { + ctx->e[0] = ZIP_ER_WRONGPASSWD; + ctx->e[1] = 0; + return -1; + } + + return 0; +} + + + +static zip_int64_t +pkware_decrypt(struct zip_source *src, void *ud, void *data, + zip_uint64_t len, enum zip_source_cmd cmd) +{ + struct trad_pkware *ctx; + zip_int64_t n; + + ctx = (struct trad_pkware *)ud; + + switch (cmd) { + case ZIP_SOURCE_OPEN: + if (decrypt_header(src, ctx) < 0) + return -1; + return 0; + + case ZIP_SOURCE_READ: + if ((n=zip_source_read(src, data, len)) < 0) + return ZIP_SOURCE_ERR_LOWER; + + decrypt(ud, (zip_uint8_t *)data, (zip_uint8_t *)data, (zip_uint64_t)n, + 0); + return n; + + case ZIP_SOURCE_CLOSE: + return 0; + + case ZIP_SOURCE_STAT: + { + struct zip_stat *st; + + st = (struct zip_stat *)data; + + st->encryption_method = ZIP_EM_NONE; + st->valid |= ZIP_STAT_ENCRYPTION_METHOD; + /* XXX: deduce HEADERLEN from size for uncompressed */ + if (st->valid & ZIP_STAT_COMP_SIZE) + st->comp_size -= HEADERLEN; + } + return 0; + + case ZIP_SOURCE_ERROR: + memcpy(data, ctx->e, sizeof(int)*2); + return sizeof(int)*2; + + case ZIP_SOURCE_FREE: + pkware_free(ctx); + return 0; + + default: + ctx->e[0] = ZIP_ER_INVAL; + ctx->e[1] = 0; + return -1; + } +} + + + +static void +pkware_free(struct trad_pkware *ctx) +{ + free(ctx); +} diff --git a/ext/zip/lib/zip_source_pop.c b/ext/zip/lib/zip_source_pop.c new file mode 100644 index 00000000000..406093869b9 --- /dev/null +++ b/ext/zip/lib/zip_source_pop.c @@ -0,0 +1,63 @@ +/* + zip_source_pop.c -- pop top layer from zip data source + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include + +#include "zipint.h" + + + +ZIP_EXTERN(struct zip_source *) +zip_source_pop(struct zip_source *src) +{ + struct zip_source *lower; + + if (src == NULL) + return NULL; + + lower = src->src; + + if (lower == NULL) + zip_source_free(src); + else { + if (src->is_open) + (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_CLOSE); + (void)src->cb.l(src, src->ud, NULL, 0, ZIP_SOURCE_FREE); + + free(src); + } + + return lower; +} diff --git a/ext/zip/lib/zip_source_read.c b/ext/zip/lib/zip_source_read.c new file mode 100644 index 00000000000..7246f9ccb53 --- /dev/null +++ b/ext/zip/lib/zip_source_read.c @@ -0,0 +1,64 @@ +/* + zip_source_read.c -- read data from zip_source + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(zip_int64_t) +zip_source_read(struct zip_source *src, void *data, zip_uint64_t len) +{ + zip_int64_t ret; + + if (!src->is_open || len > ZIP_INT64_MAX || (len > 0 && data == NULL)) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) + return src->cb.f(src->ud, data, len, ZIP_SOURCE_READ); + + ret = src->cb.l(src->src, src->ud, data, len, ZIP_SOURCE_READ); + + if (ret < 0) { + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + + return ret; +} diff --git a/ext/zip/lib/zip_source_stat.c b/ext/zip/lib/zip_source_stat.c new file mode 100644 index 00000000000..662779eb6cf --- /dev/null +++ b/ext/zip/lib/zip_source_stat.c @@ -0,0 +1,72 @@ +/* + zip_source_stat.c -- get meta information from zip_source + Copyright (C) 2009 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + + +#include "zipint.h" + + + +ZIP_EXTERN(int) +zip_source_stat(struct zip_source *src, struct zip_stat *st) +{ + zip_int64_t ret; + + if (st == NULL) { + src->error_source = ZIP_LES_INVAL; + return -1; + } + + if (src->src == NULL) { + if (src->cb.f(src->ud, st, sizeof(*st), ZIP_SOURCE_STAT) < 0) + return -1; + return 0; + } + + if (zip_source_stat(src->src, st) < 0) { + src->error_source = ZIP_LES_LOWER; + return -1; + } + + ret = src->cb.l(src->src, src->ud, st, sizeof(*st), ZIP_SOURCE_STAT); + + if (ret < 0) { + if (ret == ZIP_SOURCE_ERR_LOWER) + src->error_source = ZIP_LES_LOWER; + else + src->error_source = ZIP_LES_UPPER; + return -1; + } + + return 0; +} diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index 58119dd39f3..228803c717f 100644 --- a/ext/zip/lib/zip_source_zip.c +++ b/ext/zip/lib/zip_source_zip.c @@ -1,6 +1,6 @@ /* zip_source_zip.c -- create data source from zip file - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -41,17 +41,18 @@ struct read_zip { struct zip_file *zf; struct zip_stat st; - off_t off, len; + zip_uint64_t off; + zip_int64_t len; }; -static ssize_t read_zip(void *st, void *data, size_t len, +static zip_int64_t read_zip(void *st, void *data, zip_uint64_t len, enum zip_source_cmd cmd); ZIP_EXTERN(struct zip_source *) -zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, - off_t start, off_t len) +zip_source_zip(struct zip *za, struct zip *srcza, zip_uint64_t srcidx, + int flags, zip_uint64_t start, zip_int64_t len) { struct zip_error error; struct zip_source *zs; @@ -62,7 +63,7 @@ zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, if (za == NULL) return NULL; - if (srcza == NULL || start < 0 || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { + if (srcza == NULL || len < -1 || srcidx < 0 || srcidx >= srcza->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } @@ -115,12 +116,13 @@ zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, -static ssize_t -read_zip(void *state, void *data, size_t len, enum zip_source_cmd cmd) +static zip_int64_t +read_zip(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) { struct read_zip *z; char b[8192], *buf; - int i, n; + int i; + zip_uint64_t n; z = (struct read_zip *)state; buf = (char *)data; diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index 26425206ca3..8faa8cc3949 100644 --- a/ext/zip/lib/zip_stat_index.c +++ b/ext/zip/lib/zip_stat_index.c @@ -1,6 +1,6 @@ /* zip_stat_index.c -- get information about file by index - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,11 +38,12 @@ ZIP_EXTERN(int) -zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) +zip_stat_index(struct zip *za, zip_uint64_t index, int flags, + struct zip_stat *st) { const char *name; - if (index < 0 || index >= za->nentry) { + if (index >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -53,8 +54,7 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) if ((flags & ZIP_FL_UNCHANGED) == 0 && ZIP_ENTRY_DATA_CHANGED(za->entry+index)) { - if (za->entry[index].source->f(za->entry[index].source->ud, - st, sizeof(*st), ZIP_SOURCE_STAT) < 0) { + if (zip_source_stat(za->entry[index].source, st) < 0) { _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); return -1; } @@ -64,7 +64,9 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + + zip_stat_init(st); + st->crc = za->cdir->entry[index].crc; st->size = za->cdir->entry[index].uncomp_size; st->mtime = za->cdir->entry[index].last_mod; @@ -80,11 +82,13 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) } else st->encryption_method = ZIP_EM_NONE; - /* st->bitflags = za->cdir->entry[index].bitflags; */ + st->valid = ZIP_STAT_CRC|ZIP_STAT_SIZE|ZIP_STAT_MTIME + |ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD; } st->index = index; st->name = name; + st->valid |= ZIP_STAT_INDEX|ZIP_STAT_NAME; return 0; } diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c index cb451dc3bca..74e1ffd0b0d 100644 --- a/ext/zip/lib/zip_stat_init.c +++ b/ext/zip/lib/zip_stat_init.c @@ -1,6 +1,6 @@ /* zip_stat_init.c -- initialize struct zip_stat. - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -40,12 +40,13 @@ ZIP_EXTERN(void) zip_stat_init(struct zip_stat *st) { + st->valid = 0; st->name = NULL; - st->index = -1; + st->index = ZIP_UINT64_MAX; st->crc = 0; st->mtime = (time_t)-1; - st->size = -1; - st->comp_size = -1; + st->size = 0; + st->comp_size = 0; st->comp_method = ZIP_CM_STORE; st->encryption_method = ZIP_EM_NONE; } diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 7366c9cc716..550e8b99031 100644 --- a/ext/zip/lib/zip_unchange.c +++ b/ext/zip/lib/zip_unchange.c @@ -40,7 +40,7 @@ ZIP_EXTERN(int) -zip_unchange(struct zip *za, int idx) +zip_unchange(struct zip *za, zip_uint64_t idx) { return _zip_unchange(za, idx, 0); } @@ -48,11 +48,11 @@ zip_unchange(struct zip *za, int idx) int -_zip_unchange(struct zip *za, int idx, int allow_duplicates) +_zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates) { int i; - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } @@ -72,6 +72,9 @@ _zip_unchange(struct zip *za, int idx, int allow_duplicates) za->entry[idx].ch_filename = NULL; } + free(za->entry[idx].ch_extra); + za->entry[idx].ch_extra = NULL; + za->entry[idx].ch_extra_len = -1; free(za->entry[idx].ch_comment); za->entry[idx].ch_comment = NULL; za->entry[idx].ch_comment_len = -1; diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index fe30a5ad2c1..ca2b6785443 100644 --- a/ext/zip/lib/zip_unchange_archive.c +++ b/ext/zip/lib/zip_unchange_archive.c @@ -1,6 +1,6 @@ /* zip_unchange_archive.c -- undo global changes to ZIP archive - Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c index 6fe89f4fb2b..7dd93b768a8 100644 --- a/ext/zip/lib/zip_unchange_data.c +++ b/ext/zip/lib/zip_unchange_data.c @@ -43,8 +43,7 @@ void _zip_unchange_data(struct zip_entry *ze) { if (ze->source) { - (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE); - free(ze->source); + zip_source_free(ze->source); ze->source = NULL; } diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h new file mode 100644 index 00000000000..b65d91eb77d --- /dev/null +++ b/ext/zip/lib/zipconf.h @@ -0,0 +1,47 @@ +#ifndef _HAD_ZIPCONF_H +#define _HAD_ZIPCONF_H + +/* + zipconf.h -- platform specific include file + + This file was generated automatically by ./make_zipconf.sh + based on ../config.h. + */ + +#define LIBZIP_VERSION "0.10.1" +#define LIBZIP_VERSION_MAJOR 0 +#define LIBZIP_VERSION_MINOR 10 +#define LIBZIP_VERSION_MICRO 0 + +#include + +typedef int8_t zip_int8_t; +#define ZIP_INT8_MIN INT8_MIN +#define ZIP_INT8_MAX INT8_MAX + +typedef uint8_t zip_uint8_t; +#define ZIP_UINT8_MAX UINT8_MAX + +typedef int16_t zip_int16_t; +#define ZIP_INT16_MIN INT16_MIN +#define ZIP_INT16_MAX INT16_MAX + +typedef uint16_t zip_uint16_t; +#define ZIP_UINT16_MAX UINT16_MAX + +typedef int32_t zip_int32_t; +#define ZIP_INT32_MIN INT32_MIN +#define ZIP_INT32_MAX INT32_MAX + +typedef uint32_t zip_uint32_t; +#define ZIP_UINT32_MAX UINT32_MAX + +typedef int64_t zip_int64_t; +#define ZIP_INT64_MIN INT64_MIN +#define ZIP_INT64_MAX INT64_MAX + +typedef uint64_t zip_uint64_t; +#define ZIP_UINT64_MAX UINT64_MAX + + +#endif /* zipconf.h */ diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index d72ed144d42..67fae80ade5 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -3,7 +3,7 @@ /* zipint.h -- internal declarations. - Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -38,12 +38,35 @@ #include "zip.h" +#ifndef HAVE_FSEEKO +#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) +#endif + +#ifndef HAVE_FTELLO +#define ftello(s) ((long)ftell((s))) +#endif + +#ifndef HAVE_MKSTEMP +int _zip_mkstemp(char *); +#define mkstemp _zip_mkstemp +#endif + #ifdef PHP_WIN32 #include #include #define _zip_rename(s, t) \ (!MoveFileExA((s), (t), \ MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING)) + +/* for dup(), close(), etc. */ +#include + +#if !defined(HAVE_OPEN) +#if defined(HAVE__OPEN) +#define open(a, b, c) _open((a), (b)) +#endif +#endif + #else #define _zip_rename rename #endif @@ -52,12 +75,6 @@ # define strcmpi strcasecmp #endif -#ifndef HAVE_FSEEKO -#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) -#endif -#ifndef HAVE_FTELLO -#define ftello(s) ((long)ftell((s))) -#endif @@ -73,22 +90,77 @@ #define LENTRYSIZE 30 #undef MAXCOMLEN /* defined as 19 on BSD for max command name */ #define MAXCOMLEN 65536 +#define MAXEXTLEN 65536 #define EOCDLEN 22 #define CDBUFSIZE (MAXCOMLEN+EOCDLEN) #define BUFSIZE 8192 +/* This section contains API that won't materialize like this. It's + placed in the internal section, pending cleanup. */ + +typedef struct zip_source *(*zip_compression_implementation)(struct zip *, + struct zip_source *, + zip_uint16_t, int); +typedef struct zip_source *(*zip_encryption_implementation)(struct zip *, + struct zip_source *, + zip_uint16_t, int, + const char *); + +ZIP_EXTERN(zip_compression_implementation) zip_get_compression_implementation( + zip_uint16_t); +ZIP_EXTERN(zip_encryption_implementation) zip_get_encryption_implementation( + zip_uint16_t); + + + + +/* This section contains API that is of limited use until support for + user-supplied compression/encryption implementation is finished. + Thus we will keep it private for now. */ + +typedef zip_int64_t (*zip_source_layered_callback)(struct zip_source *, void *, + void *, zip_uint64_t, + enum zip_source_cmd); + +ZIP_EXTERN(void) zip_source_close(struct zip_source *); +ZIP_EXTERN(struct zip_source *)zip_source_crc(struct zip *, struct zip_source *, + int); +ZIP_EXTERN(struct zip_source *)zip_source_deflate(struct zip *, + struct zip_source *, + zip_uint16_t, int); +ZIP_EXTERN(void) zip_source_error(struct zip_source *, int *, int *); +ZIP_EXTERN(struct zip_source *)zip_source_layered(struct zip *, + struct zip_source *, + zip_source_layered_callback, + void *); +ZIP_EXTERN(int) zip_source_open(struct zip_source *); +ZIP_EXTERN(struct zip_source *)zip_source_pkware(struct zip *, + struct zip_source *, + zip_uint16_t, int, + const char *); +ZIP_EXTERN(zip_int64_t) zip_source_read(struct zip_source *, void *, + zip_uint64_t); +ZIP_EXTERN(int) zip_source_stat(struct zip_source *, struct zip_stat *); + + +/* This function will probably remain private. It is not needed to + implement compression/encryption routines. (We should probably + rename it to _zip_source_pop.) */ + +ZIP_EXTERN(struct zip_source *)zip_source_pop(struct zip_source *); + + + /* state of change of a file in zip archive */ enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED, ZIP_ST_ADDED, ZIP_ST_RENAMED }; -/* constants for struct zip_file's member flags */ +/* error source for layered sources */ -#define ZIP_ZF_EOF 1 /* EOF reached */ -#define ZIP_ZF_DECOMP 2 /* decompress data */ -#define ZIP_ZF_CRC 4 /* compute and compare CRC */ +enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL }; /* directory entry: general purpose bit flags */ @@ -114,12 +186,14 @@ struct zip { unsigned int flags; /* archive global flags */ unsigned int ch_flags; /* changed archive global flags */ + char *default_password; /* password used when no other supplied */ + struct zip_cdir *cdir; /* central directory */ char *ch_comment; /* changed archive comment */ int ch_comment_len; /* length of changed zip archive * comment, -1 if unchanged */ - int nentry; /* number of entries */ - int nentry_alloc; /* number of entries allocated */ + zip_uint64_t nentry; /* number of entries */ + zip_uint64_t nentry_alloc; /* number of entries allocated */ struct zip_entry *entry; /* entries */ int nfile; /* number of opened files within archive */ int nfile_alloc; /* number of files allocated */ @@ -131,18 +205,8 @@ struct zip { struct zip_file { struct zip *za; /* zip archive containing this file */ struct zip_error error; /* error information */ - int flags; /* -1: eof, >0: error */ - - int method; /* compression method */ - off_t fpos; /* position within zip file (fread/fwrite) */ - unsigned long bytes_left; /* number of bytes left to read */ - unsigned long cbytes_left; /* number of bytes of compressed data left */ - - unsigned long crc; /* CRC so far */ - unsigned long crc_orig; /* CRC recorded in archive */ - - char *buffer; - z_stream *zstr; + int eof; + struct zip_source *src; /* data source */ }; /* zip archive directory entry (central or local) */ @@ -183,8 +247,14 @@ struct zip_cdir { struct zip_source { - zip_source_callback f; + struct zip_source *src; + union { + zip_source_callback f; + zip_source_layered_callback l; + } cb; void *ud; + enum zip_les error_source; + int is_open; }; /* entry in zip archive directory */ @@ -193,6 +263,8 @@ struct zip_entry { enum zip_state state; struct zip_source *source; char *ch_filename; + char *ch_extra; + int ch_extra_len; char *ch_comment; int ch_comment_len; }; @@ -209,6 +281,8 @@ extern const int _zip_err_type[]; ((x)->state == ZIP_ST_REPLACED \ || (x)->state == ZIP_ST_ADDED) +#define ZIP_IS_RDONLY(za) ((za)->ch_flags & ZIP_AFL_RDONLY) + int _zip_cdir_compute_crc(struct zip *, uLong *); @@ -220,7 +294,7 @@ int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); void _zip_dirent_finalize(struct zip_dirent *); void _zip_dirent_init(struct zip_dirent *); int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **, - unsigned int *, int, struct zip_error *); + zip_uint32_t *, int, struct zip_error *); void _zip_dirent_torrent_normalize(struct zip_dirent *); int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); @@ -234,6 +308,7 @@ void _zip_error_fini(struct zip_error *); void _zip_error_get(struct zip_error *, int *, int *); void _zip_error_init(struct zip_error *); void _zip_error_set(struct zip_error *, int, int); +void _zip_error_set_from_source(struct zip_error *, struct zip_source *); const char *_zip_error_strerror(struct zip_error *); int _zip_file_fillbuf(void *, size_t, struct zip_file *); @@ -241,20 +316,27 @@ unsigned int _zip_file_get_offset(struct zip *, int); int _zip_filerange_crc(FILE *, off_t, off_t, uLong *, struct zip_error *); -struct zip_source *_zip_source_file_or_p(struct zip *, const char *, FILE *, - off_t, off_t); +struct zip *_zip_open(const char *, FILE *, int, int, int *); +struct zip_source *_zip_source_file_or_p(struct zip *, const char *, FILE *, + zip_uint64_t, zip_int64_t, int, + const struct zip_stat *); +struct zip_source *_zip_source_new(struct zip *); + +int _zip_changed(struct zip *, int *); void _zip_free(struct zip *); -const char *_zip_get_name(struct zip *, int, int, struct zip_error *); +const char *_zip_get_name(struct zip *, zip_uint64_t, int, struct zip_error *); int _zip_local_header_read(struct zip *, int); void *_zip_memdup(const void *, size_t, struct zip_error *); int _zip_name_locate(struct zip *, const char *, int, struct zip_error *); struct zip *_zip_new(struct zip_error *); unsigned short _zip_read2(unsigned char **); unsigned int _zip_read4(unsigned char **); -int _zip_replace(struct zip *, int, const char *, struct zip_source *); -int _zip_set_name(struct zip *, int, const char *); -int _zip_unchange(struct zip *, int, int); +zip_int64_t _zip_replace(struct zip *, zip_uint64_t, const char *, + struct zip_source *); +int _zip_set_name(struct zip *, zip_uint64_t, const char *); +void _zip_u2d_time(time_t, unsigned short *, unsigned short *); +int _zip_unchange(struct zip *, zip_uint64_t, int); void _zip_unchange_data(struct zip_entry *); #endif /* zipint.h */ From 9a2365412e69d452679fe2b834e8c594ae9f57ea Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 4 Jun 2012 22:51:00 +0200 Subject: [PATCH 089/641] fixed header include --- ext/zip/lib/zip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index 4a80c9e1065..f11c9aba7f9 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -52,7 +52,7 @@ BEGIN_EXTERN_C() -#include +#include "zipconf.h" #include #include From a39bcfc5ee3931c25bdbc5dc2409e6d9dd98ff52 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 4 Jun 2012 22:51:31 +0200 Subject: [PATCH 090/641] fixed a double freeing crash --- ext/zip/lib/zip_close.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index fc1ad02d52c..b0e3c75c1c9 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -337,8 +337,6 @@ zip_close(struct zip *za) umask(mask); chmod(za->zn, 0666&~mask); #endif - if (za->ch_comment) - free(za->ch_comment); _zip_free(za); free(temp); From f4a44f18b8fe5d23a11d12b048d4effce283379f Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 5 Jun 2012 22:11:07 +0200 Subject: [PATCH 091/641] rechecked the merged libzip, took also the indents from the original to avoid confusion next time --- ext/zip/lib/zip_close.c | 26 +++++++++++++------------- ext/zip/lib/zip_delete.c | 2 +- ext/zip/lib/zip_dirent.c | 2 +- ext/zip/lib/zip_fopen_index.c | 1 - ext/zip/lib/zip_fread.c | 9 --------- ext/zip/lib/zip_open.c | 6 +++--- 6 files changed, 18 insertions(+), 28 deletions(-) diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index b0e3c75c1c9..362f92d749c 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -316,22 +316,22 @@ zip_close(struct zip *za) free(temp); return -1; } - - if (za->zp) { - fclose(za->zp); - za->zp = NULL; - reopen_on_error = 1; + + if (za->zp) { + fclose(za->zp); + za->zp = NULL; + reopen_on_error = 1; } if (_zip_rename(temp, za->zn) != 0) { - _zip_error_set(&za->error, ZIP_ER_RENAME, errno); - remove(temp); - free(temp); - if (reopen_on_error) { - /* ignore errors, since we're already in an error case */ - za->zp = fopen(za->zn, "rb"); - } - return -1; + _zip_error_set(&za->error, ZIP_ER_RENAME, errno); + remove(temp); + free(temp); + if (reopen_on_error) { + /* ignore errors, since we're already in an error case */ + za->zp = fopen(za->zn, "rb"); } + return -1; + } #ifndef PHP_WIN32 mask = umask(0); umask(mask); diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index da3e65b28a3..131d444124c 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -40,7 +40,7 @@ ZIP_EXTERN(int) zip_delete(struct zip *za, zip_uint64_t idx) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index 6cb9ee3ee51..b5b9d273be4 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -472,7 +472,7 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp, static time_t _zip_d2u_time(int dtime, int ddate) { - struct tm tm = {0}; + struct tm tm; memset(&tm, 0, sizeof(tm)); diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 5c777ee0ffa..b60fd33e8f5 100644 --- a/ext/zip/lib/zip_fopen_index.c +++ b/ext/zip/lib/zip_fopen_index.c @@ -39,7 +39,6 @@ #include "zipint.h" - ZIP_EXTERN(struct zip_file *) diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index 4c828a84334..a6c0851b0aa 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -60,15 +60,6 @@ zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread) _zip_error_set_from_source(&zf->error, zf->src); return -1; } - - /* XXX the following left from the previous PHP port, let's see how to use it now */ - /*zf->zstr->next_out = (Bytef *)outbuf; - zf->zstr->avail_out = toread; - out_before = zf->zstr->total_out;*/ - - /* endless loop until something has been accomplished */ - /*for (;;) { - ret = inflate(zf->zstr, Z_SYNC_FLUSH);*/ return n; } diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 11c6fe05a68..5aba34f67aa 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -357,17 +357,17 @@ _zip_check_torrentzip(struct zip *za) if (za->cdir->comment_len != TORRENT_SIG_LEN+8 || strncmp(za->cdir->comment, TORRENT_SIG, TORRENT_SIG_LEN) != 0) return; - + memcpy(buf, za->cdir->comment+TORRENT_SIG_LEN, 8); buf[8] = '\0'; errno = 0; crc_should = strtoul(buf, &end, 16); if ((crc_should == UINT_MAX && errno != 0) || (end && *end)) return; - + if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size, &crc_got, NULL) < 0) - return; + return; if (crc_got == crc_should) za->flags |= ZIP_AFL_TORRENT; From a37e84e549669dbcca0b94a69a5409591eb0c6bb Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 5 Jun 2012 22:49:31 +0200 Subject: [PATCH 092/641] fixed zip entry freeing --- ext/zip/php_zip.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 01233159cef..f3d37c8d8f5 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1148,7 +1148,13 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) if (zr_rsrc) { if (zr_rsrc->zf) { - zip_fclose(zr_rsrc->zf); + if (zr_rsrc->zf->za) { + zip_fclose(zr_rsrc->zf); + } else { + if (zr_rsrc->zf->src) + zip_source_free(zr_rsrc->zf->src); + free(zr_rsrc->zf); + } zr_rsrc->zf = NULL; } efree(zr_rsrc); @@ -1321,9 +1327,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open) } /* }}} */ -/* {{{ proto void zip_entry_close(resource zip_ent) +/* {{{ proto bool zip_entry_close(resource zip_ent) Close a zip entry */ -/* another dummy function to fit in the old api*/ static PHP_NAMED_FUNCTION(zif_zip_entry_close) { zval * zip_entry; @@ -1334,8 +1339,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close) } ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry); - /* we got a zip_entry resource, be happy */ - RETURN_TRUE; + + RETURN_BOOL(SUCCESS == zend_list_delete(Z_LVAL_P(zip_entry))); } /* }}} */ From b8cdc731b840cf3b8fd49d34ede7485180326a9c Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 5 Jun 2012 23:22:27 +0200 Subject: [PATCH 093/641] brought the fix for #47667 back --- ext/zip/lib/zip_open.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 5aba34f67aa..2f56881b0a9 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -61,10 +61,16 @@ ZIP_EXTERN(struct zip *) zip_open(const char *fn, int flags, int *zep) { FILE *fp; - + + if (flags & ZIP_OVERWRITE) { + return _zip_allocate_new(fn, zep); + } + switch (_zip_file_exists(fn, flags, zep)) { case -1: - return NULL; + if (!(flags & ZIP_OVERWRITE)) { + return NULL; + } case 0: return _zip_allocate_new(fn, zep); default: From e8838926644cfb9a0ec9525a5b519da15b3e022a Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 6 Jun 2012 00:57:12 +0200 Subject: [PATCH 094/641] fixed a bit overlooked from the last libzip port --- ext/zip/lib/zip_name_locate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index 08d5b1fbf80..8cdd2c4d7ea 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -68,7 +68,7 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, return -1; } - cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; + cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp; n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; for (i=0; i Date: Thu, 7 Jun 2012 16:27:47 +0200 Subject: [PATCH 095/641] fixed bc break related to #57905 --- ext/zip/lib/zip_open.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 2f56881b0a9..a348d9800dd 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -206,7 +206,9 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc cd->comment = NULL; cd->comment_len = _zip_read2(&cdp); - if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { + /* without checking the ZIP_CHECKCONS flag we'll not able even to open inconsistent + archives at this place, which would break bc in PHP */ + if ((ZIP_CHECKCONS == (flags & ZIP_CHECKCONS)) && ((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { /* cdir spans past EOCD record */ _zip_error_set(error, ZIP_ER_INCONS, 0); cd->nentry = 0; @@ -237,7 +239,13 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc } } - if (cd->offset >= buf_offset) { + /* the first if branch goes the old way of libzip 0.9 so we don't loose + the bc for reading inconsistent files */ + if ((ZIP_CHECKCONS != (flags & ZIP_CHECKCONS)) && cd->size < (unsigned int)(eocd-buf)) { + cdp = eocd - cd->size; + bufp = &cdp; + } + else if (cd->offset >= buf_offset) { /* if buffer already read in, use it */ cdp = buf + (cd->offset - buf_offset); bufp = &cdp; From bde0e8c2a14944016d9dbd0653b74e9e2b75c965 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 7 Jun 2012 17:59:57 +0200 Subject: [PATCH 096/641] zip windows fixes --- ext/zip/config.w32 | 16 ++++++++-------- ext/zip/lib/zipconf.h | 4 ++++ ext/zip/lib/zipint.h | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index b6381708073..fa0a5180df5 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -27,14 +27,14 @@ if (PHP_ZIP != "no") { zip_get_archive_comment.c zip_get_file_comment.c \ zip_set_archive_comment.c zip_set_file_comment.c \ zip_unchange_archive.c zip_memdup.c zip_stat_init.c \ - zip_add_dir.c zip_file_error_clear.c zip_error_clear.c - lib/zip_fdopen.c lib/zip_fopen_encrypted.c lib/zip_fopen_index_encrypted.c \ - lib/zip_get_compression_implementation.c lib/zip_get_encryption_implementation.c \ - lib/zip_get_file_extra.c lib/zip_get_num_entries.c lib/zip_set_default_password.c \ - lib/zip_set_file_extra.c lib/zip_source_close.c lib/zip_source_crc.c \ - lib/zip_source_deflate.c lib/zip_source_error.c lib/zip_source_layered.c \ - lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \ - lib/zip_source_read.c lib/zip_source_stat.c", "zip"); + zip_add_dir.c zip_file_error_clear.c zip_error_clear.c \ + zip_fdopen.c zip_fopen_encrypted.c zip_fopen_index_encrypted.c \ + zip_get_compression_implementation.c zip_get_encryption_implementation.c \ + zip_get_file_extra.c zip_get_num_entries.c zip_set_default_password.c \ + zip_set_file_extra.c zip_source_close.c zip_source_crc.c \ + zip_source_deflate.c zip_source_error.c zip_source_layered.c \ + zip_source_open.c zip_source_pkware.c zip_source_pop.c \ + zip_source_read.c zip_source_stat.c", "zip"); AC_DEFINE('HAVE_ZIP', 1); } else { diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h index b65d91eb77d..2b4340c861c 100644 --- a/ext/zip/lib/zipconf.h +++ b/ext/zip/lib/zipconf.h @@ -13,7 +13,11 @@ #define LIBZIP_VERSION_MINOR 10 #define LIBZIP_VERSION_MICRO 0 +#ifdef PHP_WIN32 +#include +#else #include +#endif typedef int8_t zip_int8_t; #define ZIP_INT8_MIN INT8_MIN diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index 67fae80ade5..ea21dddcd42 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -46,10 +46,12 @@ #define ftello(s) ((long)ftell((s))) #endif +#ifndef PHP_WIN32 #ifndef HAVE_MKSTEMP int _zip_mkstemp(char *); #define mkstemp _zip_mkstemp #endif +#endif #ifdef PHP_WIN32 #include From 9ecb67d5a424d132a3e7c1ef6413b58343d72415 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 7 Jun 2012 21:43:07 +0200 Subject: [PATCH 097/641] updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index d56b540ddf2..9d70ebd43e0 100644 --- a/NEWS +++ b/NEWS @@ -50,6 +50,8 @@ PHP NEWS - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) +- Zip: + . Upgraded libzip to 0.10.1 (Anatoliy) ?? ??? 2012, PHP 5.3.14 From 7907dc4d666e9879997c7a9b18074da9d05dadbd Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 7 Jun 2012 21:45:30 +0200 Subject: [PATCH 098/641] updated NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 9ab8b622ab9..31a62182553 100644 --- a/NEWS +++ b/NEWS @@ -53,6 +53,8 @@ PHP NEWS - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) +- Zip: + . Upgraded libzip to 0.10.1 (Anatoliy) ?? ??? 2012, PHP 5.4.4 From 0c7ebf50fbe51e1a1a25ebc83d8e92df65528847 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 7 Jun 2012 21:46:51 +0200 Subject: [PATCH 099/641] updated NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 3adefae873e..e9e70e9039a 100644 --- a/NEWS +++ b/NEWS @@ -53,4 +53,7 @@ PHP NEWS - pgsql . Added pg_escape_literal() and pg_escape_identifier() (Yasuo) +- Zip: + . Upgraded libzip to 0.10.1 (Anatoliy) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> From baacc2cb135280f18f6c908b4b99160fba262c6a Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 7 Jun 2012 22:32:03 +0200 Subject: [PATCH 100/641] set current versions for libzip and zip ext --- ext/zip/php_zip.c | 2 +- ext/zip/php_zip.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index f3d37c8d8f5..e6a30a00661 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2879,7 +2879,7 @@ static PHP_MINFO_FUNCTION(zip) php_info_print_table_row(2, "Zip", "enabled"); php_info_print_table_row(2, "Extension Version","$Id$"); php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING); - php_info_print_table_row(2, "Libzip version", "0.9.0"); + php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION); php_info_print_table_end(); } diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h index a321d90b045..c9e88d652a6 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -30,7 +30,7 @@ extern zend_module_entry zip_module_entry; #include "lib/zip.h" -#define PHP_ZIP_VERSION_STRING "1.9.1" +#define PHP_ZIP_VERSION_STRING "1.9.2" #if ((PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6) # define PHP_ZIP_USE_OO 1 From 7d04e0fb2ec8be9b1c4b16a9f0b4958f853597f1 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 7 Jun 2012 23:05:23 -0700 Subject: [PATCH 101/641] fix potential overflow in _php_stream_scandir --- NEWS | 2 ++ main/streams/streams.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9d70ebd43e0..380979b14b4 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ PHP NEWS - Core: . Fixed CVE-2012-2143. (Solar Designer) + . Fixed potential overflow in _php_stream_scandir. (Jason Powell, + Stas) - Fileinfo: . Fixed magic file regex support. (Felipe) diff --git a/main/streams/streams.c b/main/streams/streams.c index fe7800b9feb..43cb0104f35 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2262,8 +2262,8 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ php_stream *stream; php_stream_dirent sdp; char **vector = NULL; - int vector_size = 0; - int nfiles = 0; + unsigned int vector_size = 0; + unsigned int nfiles = 0; if (!namelist) { return FAILURE; @@ -2281,12 +2281,17 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ } else { vector_size *= 2; } - vector = (char **) erealloc(vector, vector_size * sizeof(char *)); + vector = (char **) safe_erealloc(vector, vector_size, sizeof(char *), 0); } vector[nfiles] = estrdup(sdp.d_name); nfiles++; + if(vector_size < 10 || nfiles == 0) { + /* overflow */ + efree(vector); + return FAILURE; + } } php_stream_closedir(stream); From 10e8da1738dc5331c595524837e69fd17ad9236a Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 7 Jun 2012 23:05:23 -0700 Subject: [PATCH 102/641] fix potential overflow in _php_stream_scandir --- main/streams/streams.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/streams/streams.c b/main/streams/streams.c index db6e25f6879..bf1143c56d9 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2332,8 +2332,8 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ php_stream *stream; php_stream_dirent sdp; char **vector = NULL; - int vector_size = 0; - int nfiles = 0; + unsigned int vector_size = 0; + unsigned int nfiles = 0; if (!namelist) { return FAILURE; @@ -2351,12 +2351,17 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ } else { vector_size *= 2; } - vector = (char **) erealloc(vector, vector_size * sizeof(char *)); + vector = (char **) safe_erealloc(vector, vector_size, sizeof(char *), 0); } vector[nfiles] = estrdup(sdp.d_name); nfiles++; + if(vector_size < 10 || nfiles == 0) { + /* overflow */ + efree(vector); + return FAILURE; + } } php_stream_closedir(stream); From 0e3a650e748b2bf79147d76a4739e17f3817c10c Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 7 Jun 2012 23:11:28 -0700 Subject: [PATCH 103/641] add NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 31a62182553..348a06e6281 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Core: . Fixed bug #61998 (Using traits with method aliases appears to result in crash during execution). (Dmitry) + . Fixed potential overflow in _php_stream_scandir. (Jason Powell, + Stas) - EXIF: . Fixed information leak in ext exif (discovered by Martin Noga, From fc74503792b1ee92e4b813690890f3ed38fa3ad5 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 8 Jun 2012 01:21:37 -0700 Subject: [PATCH 104/641] improve overflow checks --- main/streams/streams.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/streams/streams.c b/main/streams/streams.c index 43cb0104f35..dfd60940fca 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2279,6 +2279,11 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ if (vector_size == 0) { vector_size = 10; } else { + if(vector_size*2 < vector_size) { + /* overflow */ + efree(vector); + return FAILURE; + } vector_size *= 2; } vector = (char **) safe_erealloc(vector, vector_size, sizeof(char *), 0); @@ -2287,11 +2292,6 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ vector[nfiles] = estrdup(sdp.d_name); nfiles++; - if(vector_size < 10 || nfiles == 0) { - /* overflow */ - efree(vector); - return FAILURE; - } } php_stream_closedir(stream); From 17c0ff11949f81c5fb5b32f6f64b3e8ad4063aeb Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 8 Jun 2012 01:24:49 -0700 Subject: [PATCH 105/641] typo --- Zend/zend_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 17454f85f21..4c31f7c3685 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1336,7 +1336,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); if (CG(current_namespace)) { - /* Prefix function name with current namespcae name */ + /* Prefix function name with current namespace name */ znode tmp; tmp.u.constant = *CG(current_namespace); From c467e81c86b3f4d312459553c23792492009a917 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Fri, 8 Jun 2012 18:02:49 +0200 Subject: [PATCH 106/641] NEWS File --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 348a06e6281..ee7dc764985 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.5 +- Zend Engine: + . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that + includes a semi-colon). (Pierrick) - Core: . Fixed bug #61998 (Using traits with method aliases appears to result in @@ -55,6 +58,7 @@ PHP NEWS - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) + - Zip: . Upgraded libzip to 0.10.1 (Anatoliy) From ba8333cdb0feafbdbe2b7ae07532236c3b043b25 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 8 Jun 2012 01:24:49 -0700 Subject: [PATCH 107/641] typo --- Zend/zend_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 28f98249d2a..cca7c1976e9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1685,7 +1685,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zval key; if (CG(current_namespace)) { - /* Prefix function name with current namespcae name */ + /* Prefix function name with current namespace name */ znode tmp; tmp.u.constant = *CG(current_namespace); From d1debecd90ea334713a909f5b7ec64416283cf48 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 8 Jun 2012 01:24:49 -0700 Subject: [PATCH 108/641] typo --- Zend/zend_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b09e43c8fa5..5b991e84b99 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1685,7 +1685,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zval key; if (CG(current_namespace)) { - /* Prefix function name with current namespcae name */ + /* Prefix function name with current namespace name */ znode tmp; tmp.u.constant = *CG(current_namespace); From c4cc43169c0ae05127eb406fcfd837597b72b71e Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 8 Jun 2012 13:27:24 -0700 Subject: [PATCH 109/641] rearrange news --- NEWS | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ee7dc764985..17d1c580f7e 100644 --- a/NEWS +++ b/NEWS @@ -1,13 +1,12 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.5 -- Zend Engine: - . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that - includes a semi-colon). (Pierrick) - Core: . Fixed bug #61998 (Using traits with method aliases appears to result in crash during execution). (Dmitry) + . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that + includes a semi-colon). (Pierrick) . Fixed potential overflow in _php_stream_scandir. (Jason Powell, Stas) From 0d85a86bbb151537a2362f17224d076556252ada Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Fri, 8 Jun 2012 22:56:02 +0200 Subject: [PATCH 110/641] Disable email notifications for travis-ci --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5995773261a..2939e3e92a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,7 @@ php: - 5.4 notifications: - email: - recipients: - - php-qa@lists.php.net - on_success: never # [always|never|change] default: change - on_failure: never # [always|never|change] default: always + email: false env: - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php From f169b26dd7a4047996ab1284e649fda0cfb1a10b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 9 Jun 2012 00:40:47 +0200 Subject: [PATCH 111/641] Fix backtraces and func_get_args() To make the generator function show up in backtraces one has to insert an additional execute_data into the chain, as prev_execute_data->function_state is used to determine the called function. Adding the additional stack frame is also required for func_get_args(), as the arguments are fetched from there too. The arguments have to be copied in order to keep them around. Due to the way they are saved doing so is quite ugly, so I added another function zend_copy_arguments to zend_execute.c which handles this. --- Zend/tests/generators/backtrace.phpt | 9 ++-- Zend/zend_execute.c | 19 ++++++++ Zend/zend_execute.h | 1 + Zend/zend_generators.c | 44 +++++++++++++++-- Zend/zend_vm_def.h | 72 +++++++++++++++++----------- Zend/zend_vm_execute.h | 72 +++++++++++++++++----------- 6 files changed, 154 insertions(+), 63 deletions(-) diff --git a/Zend/tests/generators/backtrace.phpt b/Zend/tests/generators/backtrace.phpt index cbf8de1114e..77976f93244 100644 --- a/Zend/tests/generators/backtrace.phpt +++ b/Zend/tests/generators/backtrace.phpt @@ -7,7 +7,7 @@ function f1() { debug_print_backtrace(); } -function *f2() { +function *f2($arg1, $arg2) { f1(); } @@ -15,11 +15,12 @@ function f3($gen) { $gen->rewind(); // trigger run } -$gen = f2(); +$gen = f2('foo', 'bar'); f3($gen); ?> --EXPECTF-- #0 f1() called at [%s:%d] -#1 Generator->rewind() called at [%s:%d] -#2 f3(Generator Object ()) called at [%s:%d] +#1 f2(foo, bar) called at [%s:%d] +#2 Generator->rewind() called at [%s:%d] +#3 f3(Generator Object ()) called at [%s:%d] diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 9031fb5557c..c7ef212887e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1563,6 +1563,25 @@ void zend_free_compiled_variables(zval ***CVs, int num) /* {{{ */ } /* }}} */ +void** zend_copy_arguments(void **arguments_end) /* {{{ */ +{ + int arguments_count = (int) (zend_uintptr_t) *arguments_end; + size_t arguments_size = (arguments_count + 1) * sizeof(void **); + void **arguments_start = arguments_end - arguments_count; + void **copied_arguments_start = emalloc(arguments_size); + void **copied_arguments_end = copied_arguments_start + arguments_count; + int i; + + memcpy(copied_arguments_start, arguments_start, arguments_size); + + for (i = 0; i < arguments_count; i++) { + Z_ADDREF_P((zval *) arguments_start[i]); + } + + return copied_arguments_end; +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 6dfd607d1bb..48f46bb8a44 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -434,6 +434,7 @@ ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); void zend_clean_and_cache_symbol_table(HashTable *symbol_table); void zend_free_compiled_variables(zval ***CVs, int num); +void **zend_copy_arguments(void **arguments_end); #define CACHED_PTR(num) \ EG(active_op_array)->run_time_cache[(num)] diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index b5642ddcc7a..6efa7106609 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -94,6 +94,28 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio efree(generator->backed_up_stack); } + /* We have added an additional stack frame in prev_execute_data, so we + * have to free it. It also contains the arguments passed to the + * generator (for func_get_args) so those have to be freed too. */ + { + zend_execute_data *prev_execute_data = execute_data->prev_execute_data; + void **arguments = prev_execute_data->function_state.arguments; + + if (arguments) { + int arguments_count = (int) (zend_uintptr_t) *arguments; + zval **arguments_start = (zval **) (arguments - arguments_count); + int i; + + for (i = 0; i < arguments_count; ++i) { + zval_ptr_dtor(arguments_start + i); + } + + efree(arguments_start); + } + + efree(prev_execute_data); + } + efree(execute_data); generator->execute_data = NULL; } @@ -240,6 +262,18 @@ static void zend_generator_clone_storage(zend_generator *orig, zend_generator ** if (execute_data->object) { Z_ADDREF_P(execute_data->object); } + + /* Prev execute data contains an additional stack frame (for proper) + * backtraces) which has to be copied. */ + clone->execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data)); + memcpy(clone->execute_data->prev_execute_data, execute_data->prev_execute_data, sizeof(zend_execute_data)); + + /* It also contains the arguments passed to the generator, which also + * have to be copied */ + if (execute_data->prev_execute_data->function_state.arguments) { + clone->execute_data->prev_execute_data->function_state.arguments + = zend_copy_arguments(execute_data->prev_execute_data->function_state.arguments); + } } /* The value and key are known not to be references, so simply add refs */ @@ -329,9 +363,13 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS EG(scope) = generator->execute_data->current_scope; EG(called_scope) = generator->execute_data->current_called_scope; - /* Set prev_execute_data to the current execute_data to get halfways - * reasonable backtraces */ - generator->execute_data->prev_execute_data = original_execute_data; + /* We want the backtrace to look as if the generator function was + * called from whatever method we are current running (e.g. next()). + * The first prev_execute_data contains an additional stack frame, + * which makes the generator function show up in the backtrace and + * makes the arguments available to func_get_args(). So we have to + * set the prev_execute_data of that prev_execute_data :) */ + generator->execute_data->prev_execute_data->prev_execute_data = original_execute_data; /* Go to next opcode (we don't want to run the last one again) */ generator->execute_data->opline++; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index de63d8b5e22..27afc49fa38 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5220,7 +5220,8 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) { - zend_bool nested; + zend_bool nested = EX(nested); + zend_execute_data *prev_execute_data = EX(prev_execute_data); if (EG(return_value_ptr_ptr)) { zval *return_value; @@ -5240,11 +5241,23 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; + + /* We have to add another stack frame so the generator function shows + * up in backtraces and func_get_all() can access the function + * arguments. */ + EX(prev_execute_data) = emalloc(sizeof(zend_execute_data)); + if (prev_execute_data) { + memcpy(EX(prev_execute_data), prev_execute_data, sizeof(zend_execute_data)); + EX(prev_execute_data)->function_state.arguments = zend_copy_arguments(prev_execute_data->function_state.arguments); + } else { + memset(EX(prev_execute_data), 0, sizeof(zend_execute_data)); + EX(prev_execute_data)->function_state.function = (zend_function *) EX(op_array); + EX(prev_execute_data)->function_state.arguments = NULL; + } } /* restore the previous execution context */ - EG(current_execute_data) = EX(prev_execute_data); - nested = EX(nested); + EG(current_execute_data) = prev_execute_data; /* if there is no return value pointer we are responsible for freeing the * execution data */ @@ -5257,34 +5270,37 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) efree(execute_data); } - EG(opline_ptr) = NULL; - if (nested) { - /* so we can use EX() again */ - execute_data = EG(current_execute_data); - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - EG(active_symbol_table) = EX(symbol_table); - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - zend_vm_stack_clear_multiple(TSRMLS_C); - - LOAD_REGS(); - LOAD_OPLINE(); - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); + /* Happens whenever the function is invoked using call_user_function, + * e.g. when doing a dynamic function call using call_user_func(). */ + if (!nested) { + EG(opline_ptr) = NULL; + ZEND_VM_RETURN(); } - ZEND_VM_RETURN(); + /* Bring back the previous execution context */ + execute_data = EG(current_execute_data); + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + EG(active_symbol_table) = EX(symbol_table); + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + LOAD_REGS(); + LOAD_OPLINE(); + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 98d849bbd68..987e4ceee03 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1203,7 +1203,8 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_bool nested; + zend_bool nested = EX(nested); + zend_execute_data *prev_execute_data = EX(prev_execute_data); if (EG(return_value_ptr_ptr)) { zval *return_value; @@ -1223,11 +1224,23 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; + + /* We have to add another stack frame so the generator function shows + * up in backtraces and func_get_all() can access the function + * arguments. */ + EX(prev_execute_data) = emalloc(sizeof(zend_execute_data)); + if (prev_execute_data) { + memcpy(EX(prev_execute_data), prev_execute_data, sizeof(zend_execute_data)); + EX(prev_execute_data)->function_state.arguments = zend_copy_arguments(prev_execute_data->function_state.arguments); + } else { + memset(EX(prev_execute_data), 0, sizeof(zend_execute_data)); + EX(prev_execute_data)->function_state.function = (zend_function *) EX(op_array); + EX(prev_execute_data)->function_state.arguments = NULL; + } } /* restore the previous execution context */ - EG(current_execute_data) = EX(prev_execute_data); - nested = EX(nested); + EG(current_execute_data) = prev_execute_data; /* if there is no return value pointer we are responsible for freeing the * execution data */ @@ -1240,34 +1253,37 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP efree(execute_data); } - EG(opline_ptr) = NULL; - if (nested) { - /* so we can use EX() again */ - execute_data = EG(current_execute_data); - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - EG(active_symbol_table) = EX(symbol_table); - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - zend_vm_stack_clear_multiple(TSRMLS_C); - - LOAD_REGS(); - LOAD_OPLINE(); - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); + /* Happens whenever the function is invoked using call_user_function, + * e.g. when doing a dynamic function call using call_user_func(). */ + if (!nested) { + EG(opline_ptr) = NULL; + ZEND_VM_RETURN(); } - ZEND_VM_RETURN(); + /* Bring back the previous execution context */ + execute_data = EG(current_execute_data); + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + EG(active_symbol_table) = EX(symbol_table); + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + LOAD_REGS(); + LOAD_OPLINE(); + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From 503358c1797e0f7b05fb49f22dd44bc7f517069f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sat, 9 Jun 2012 17:29:47 +0100 Subject: [PATCH 112/641] Fix bug #62266 Custom extension segfaults during xmlParseFile with FPM SAPI because the regular list is not prepared during the MINIT phase and our custom external entity loader tries to open PHP streams. --- NEWS | 8 ++++++-- ext/libxml/libxml.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 17d1c580f7e..b91b5d78a92 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,7 @@ PHP NEWS . Fixed information leak in ext exif (discovered by Martin Noga, Matthew "j00ru" Jurczyk, Gynvael Coldwind) -- FPM +- FPM: . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #62153 (when using unix sockets, multiples FPM instances @@ -33,7 +33,7 @@ PHP NEWS - Iconv: . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) -- Intl +- Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) . ResourceBundle constructor now accepts NULL for the first two arguments. (Gustavo) @@ -43,6 +43,10 @@ PHP NEWS . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks pattern). (Gustavo) +- libxml: + . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM + SAPI). (Gustavo) + - Readline: . Fixed bug #62186 (readline fails to compile - void function should not return a value). (Johannes) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index e42d845f902..a39c875b2c7 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -677,9 +677,18 @@ is_string: static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL, const char *ID, xmlParserCtxtPtr context) { + TSRMLS_FETCH(); + /* Check whether we're running in a PHP context, since the entity loader - * we've defined is an application level (true global) setting */ - if (xmlGenericError == php_libxml_error_handler) { + * we've defined is an application level (true global) setting. + * If we are, we also want to check whether we've finished activating + * the modules (RINIT phase). Using our external entity loader during a + * RINIT should not be problem per se (though during MINIT it is, because + * we don't even have a resource list by then), but then whether one + * extension would be using the custom external entity loader or not + * could depend on extension loading order + * (if _php_libxml_per_request_initialization */ + if (xmlGenericError == php_libxml_error_handler && PG(modules_activated)) { return _php_libxml_external_entity_loader(URL, ID, context); } else { return _php_libxml_default_entity_loader(URL, ID, context); From 4ec75539dba8cefef16e56f02c62755a9aa9c60b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 7 Jun 2012 15:20:00 +0200 Subject: [PATCH 113/641] Change in BreakIterator::getPartsIterator() BreakIterator::getPartsIterator() now returns an IntlIterator subclass with a special method, getBreakIterator(), that returns the associated BreakIterator. Any call to getRuleStatus() is forwarded to the BreakIterator. --- .../breakiterator/breakiterator_iterators.cpp | 99 ++++++++++++++++++- .../breakiterator/breakiterator_iterators.h | 16 ++- ext/intl/common/common_enum.cpp | 2 +- ext/intl/common/common_enum.h | 1 + ext/intl/php_intl.c | 4 + .../breakiter_getPartsIterator_basic.phpt | 6 +- 6 files changed, 115 insertions(+), 13 deletions(-) diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 4a0cf1da80c..66f42922596 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -18,7 +18,10 @@ #include "config.h" #endif +#include + #include "breakiterator_iterators.h" +#include "../common/common_enum.h" extern "C" { #define USE_BREAKITERATOR_POINTER @@ -28,6 +31,9 @@ extern "C" { #include } +static zend_class_entry *IntlPartsIterator_ce_ptr; +static zend_object_handlers IntlPartsIterator_handlers; + /* BreakIterator's iterator */ inline BreakIterator *_breakiter_prolog(zend_object_iterator *iter TSRMLS_DC) @@ -201,7 +207,7 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, zval_add_ref(&break_iter_zv); - object_init_ex(object, IntlIterator_ce_ptr); + object_init_ex(object, IntlPartsIterator_ce_ptr); ii = (IntlIterator_object*)zend_object_store_get_object(object TSRMLS_CC); ii->iterator = (zend_object_iterator*)emalloc(sizeof(zoi_break_iter_parts)); @@ -216,3 +222,94 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, zend_object_store_get_object(break_iter_zv TSRMLS_CC); assert(((zoi_break_iter_parts*)ii->iterator)->bio->biter != NULL); } + +U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce TSRMLS_DC) +{ + zend_object_value retval; + + retval = IntlIterator_ce_ptr->create_object(ce TSRMLS_CC); + retval.handlers = &IntlPartsIterator_handlers; + + return retval; +} + +U_CFUNC zend_function *IntlPartsIterator_get_method(zval **object_ptr, + char *method, int method_len, const zend_literal *key TSRMLS_DC) +{ + zend_literal local_literal = {0}; + zend_function *ret; + ALLOCA_FLAG(use_heap) + + if (key == NULL) { + Z_STRVAL(local_literal.constant) = static_cast( + do_alloca(method_len + 1, use_heap)); + zend_str_tolower_copy(Z_STRVAL(local_literal.constant), + method, method_len); + local_literal.hash_value = zend_hash_func( + Z_STRVAL(local_literal.constant), method_len + 1); + key = &local_literal; + } + + if ((key->hash_value & 0xFFFFFFFF) == 0xA2B486A1 /* hash of getrulestatus\0 */ + && method_len == sizeof("getrulestatus") - 1 + && memcmp("getrulestatus", Z_STRVAL(key->constant), method_len) == 0) { + IntlIterator_object *obj = (IntlIterator_object*) + zend_object_store_get_object(*object_ptr TSRMLS_CC); + if (obj->iterator && obj->iterator->data) { + zval *break_iter_zv = static_cast(obj->iterator->data); + *object_ptr = break_iter_zv; + ret = Z_OBJ_HANDLER_P(break_iter_zv, get_method)(object_ptr, + method, method_len, key TSRMLS_CC); + goto end; + } + } + + ret = std_object_handlers.get_method(object_ptr, + method, method_len, key TSRMLS_CC); + +end: + if (key == &local_literal) { + free_alloca(Z_STRVAL(local_literal.constant), use_heap); + } + + return ret; +} + +U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator) +{ + INTLITERATOR_METHOD_INIT_VARS; + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "IntlPartsIterator::getBreakIterator: bad arguments", 0 TSRMLS_CC); + return; + } + + INTLITERATOR_METHOD_FETCH_OBJECT; + + zval *biter_zval = static_cast(ii->iterator->data); + RETURN_ZVAL(biter_zval, 1, 0); +} + +ZEND_BEGIN_ARG_INFO_EX(ainfo_parts_it_void, 0, 0, 0) +ZEND_END_ARG_INFO() + +static const zend_function_entry IntlPartsIterator_class_functions[] = { + PHP_ME(IntlPartsIterator, getBreakIterator, ainfo_parts_it_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; + +U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) +{ + zend_class_entry ce; + + /* Create and register 'BreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlPartsIterator", IntlPartsIterator_class_functions); + IntlPartsIterator_ce_ptr = zend_register_internal_class_ex(&ce, + IntlIterator_ce_ptr, NULL TSRMLS_CC); + IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create; + + memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers, + sizeof IntlPartsIterator_handlers); + IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; +} \ No newline at end of file diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h index 4ef5a2f4eff..855246ff77e 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.h +++ b/ext/intl/breakiterator/breakiterator_iterators.h @@ -16,24 +16,20 @@ #ifndef INTL_BREAKITERATOR_ITERATORS_H #define INTL_BREAKITERATOR_ITERATORS_H -#ifndef __cplusplus -#error Header for C++ only -#endif - -#include #include -#include "../common/common_enum.h" - -extern "C" { +U_CDECL_BEGIN #include #include -} +U_CDECL_END +#ifdef __cplusplus void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, zval *object TSRMLS_DC); +#endif U_CFUNC zend_object_iterator *_breakiterator_get_iterator( - zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); + zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); +U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D); #endif \ No newline at end of file diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index 6dfacd7e3a7..da47a437a67 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -31,7 +31,7 @@ extern "C" { } zend_class_entry *IntlIterator_ce_ptr; -static zend_object_handlers IntlIterator_handlers; +zend_object_handlers IntlIterator_handlers; void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC) { diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h index bcd9f447968..4c6abdb8f54 100644 --- a/ext/intl/common/common_enum.h +++ b/ext/intl/common/common_enum.h @@ -61,6 +61,7 @@ typedef struct { } zoi_with_current; extern zend_class_entry *IntlIterator_ce_ptr; +extern zend_object_handlers IntlIterator_handlers; U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter TSRMLS_DC); U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter TSRMLS_DC); diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 5d8aa6be957..c023ba93414 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -79,6 +79,7 @@ #include "calendar/gregoriancalendar_methods.h" #include "breakiterator/breakiterator_class.h" +#include "breakiterator/breakiterator_iterators.h" #include "idn/idn.h" @@ -963,6 +964,9 @@ PHP_MINIT_FUNCTION( intl ) /* Register 'BreakIterator' class */ breakiterator_register_BreakIterator_class( TSRMLS_C ); + /* Register 'IntlPartsIterator' class */ + breakiterator_register_IntlPartsIterator_class( TSRMLS_C ); + /* Global error handling. */ intl_error_init( NULL TSRMLS_CC ); diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt index 5c23bfdfa7a..7a8c3162584 100644 --- a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt +++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt @@ -12,18 +12,22 @@ print_r(iterator_to_array($pi)); $bi->setText("foo bar"); $pi = $bi->getPartsIterator(); +var_dump(get_class($pi->getBreakIterator())); print_r(iterator_to_array($pi)); +var_dump($pi->getRuleStatus()); ?> ==DONE== --EXPECT-- -string(12) "IntlIterator" +string(17) "IntlPartsIterator" Array ( ) +string(22) "RuleBasedBreakIterator" Array ( [0] => foo [1] => [2] => bar ) +int(0) ==DONE== \ No newline at end of file From afed66bb9efc0a8838f2061c4a3aa0befec0f98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sat, 9 Jun 2012 23:59:26 +0200 Subject: [PATCH 114/641] BreakIter: Removed getAvailableLocales/getHashCode --- .../breakiterator/breakiterator_class.cpp | 2 -- .../breakiterator/breakiterator_methods.cpp | 21 ------------------- .../breakiterator/breakiterator_methods.h | 2 -- .../rulebasedbreakiterator_methods.cpp | 16 -------------- .../rulebasedbreakiterator_methods.h | 2 -- .../breakiter_getAvailableLocales_basic.phpt | 12 ----------- .../breakiter_getAvailableLocales_error.phpt | 14 ------------- ext/intl/tests/rbbiter_hashCode_basic.phpt | 15 ------------- 8 files changed, 84 deletions(-) delete mode 100644 ext/intl/tests/breakiter_getAvailableLocales_basic.phpt delete mode 100644 ext/intl/tests/breakiter_getAvailableLocales_error.phpt delete mode 100644 ext/intl/tests/rbbiter_hashCode_basic.phpt diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index f273a2f74ae..f9ea794d41f 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -274,7 +274,6 @@ static const zend_function_entry BreakIterator_class_functions[] = { PHP_ME_MAPPING(createCharacterInstance, breakiter_create_character_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(createSentenceInstance, breakiter_create_sentence_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(createTitleInstance, breakiter_create_title_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getAvailableLocales, breakiter_get_available_locales, ainfo_biter_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getText, breakiter_get_text, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setText, breakiter_set_text, ainfo_biter_setText, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(first, breakiter_first, ainfo_biter_void, ZEND_ACC_PUBLIC) @@ -298,7 +297,6 @@ static const zend_function_entry BreakIterator_class_functions[] = { */ static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { PHP_ME(RuleBasedBreakIterator, __construct, ainfo_rbbi___construct, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(hashCode, rbbi_hash_code, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRules, rbbi_get_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatus, rbbi_get_rule_status, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatusVec, rbbi_get_rule_status_vec, ainfo_biter_void, ZEND_ACC_PUBLIC) diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 4aca6ef23f5..28551051c3f 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -107,27 +107,6 @@ U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) INTERNAL_FUNCTION_PARAM_PASSTHRU); } -U_CFUNC PHP_FUNCTION(breakiter_get_available_locales) -{ - intl_error_reset(NULL TSRMLS_CC); - - if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_available_locales: bad arguments", 0 TSRMLS_CC); - RETURN_FALSE; - } - - const Locale *locales; - int32_t count; - - locales = BreakIterator::getAvailableLocales(count); - array_init_size(return_value, (uint)count); - for (int i = 0; i < count; i++) { - Locale locale = locales[i]; - add_next_index_string(return_value, locale.getName(), 1); - } -} - U_CFUNC PHP_FUNCTION(breakiter_get_text) { BREAKITER_METHOD_INIT_VARS; diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h index 42a6f3a1b30..e0d13b0f45e 100644 --- a/ext/intl/breakiterator/breakiterator_methods.h +++ b/ext/intl/breakiterator/breakiterator_methods.h @@ -31,8 +31,6 @@ PHP_FUNCTION(breakiter_create_sentence_instance); PHP_FUNCTION(breakiter_create_title_instance); -PHP_FUNCTION(breakiter_get_available_locales); - PHP_FUNCTION(breakiter_get_text); PHP_FUNCTION(breakiter_set_text); diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 5ccef90707c..85eceb3f307 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -98,22 +98,6 @@ U_CFUNC PHP_METHOD(RuleBasedBreakIterator, __construct) } } -U_CFUNC PHP_FUNCTION(rbbi_hash_code) -{ - BREAKITER_METHOD_INIT_VARS; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_hash_code: bad arguments", 0 TSRMLS_CC); - RETURN_FALSE; - } - - BREAKITER_METHOD_FETCH_OBJECT; - - RETURN_LONG(fetch_rbbi(bio)->hashCode()); -} - U_CFUNC PHP_FUNCTION(rbbi_get_rules) { BREAKITER_METHOD_INIT_VARS; diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h index b645e0c1cc7..29cf3db7d57 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h @@ -21,8 +21,6 @@ PHP_METHOD(RuleBasedBreakIterator, __construct); -PHP_FUNCTION(rbbi_hash_code); - PHP_FUNCTION(rbbi_get_rules); PHP_FUNCTION(rbbi_get_rule_status); diff --git a/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt b/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt deleted file mode 100644 index 5cba4c548f7..00000000000 --- a/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -BreakIterator::getAvailableLocales(): basic test ---SKIPIF-- -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- - 150); ---EXPECT-- -bool(true) diff --git a/ext/intl/tests/breakiter_getAvailableLocales_error.phpt b/ext/intl/tests/breakiter_getAvailableLocales_error.phpt deleted file mode 100644 index 4772e8ae2bf..00000000000 --- a/ext/intl/tests/breakiter_getAvailableLocales_error.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -BreakIterator::getAvailableLocales(): arg errors ---FILE-- -hashCode()); - -?> -==DONE== ---EXPECTF-- -int(%d) -==DONE== \ No newline at end of file From a4925fae9b89dcd7912dce5852b4170a978e1bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 10 Jun 2012 00:23:09 +0200 Subject: [PATCH 115/641] Replaced zend_parse_method_params with plain zpp --- .../breakiterator/breakiterator_methods.cpp | 42 ++++++++++--------- .../rulebasedbreakiterator_methods.cpp | 18 ++++---- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 28551051c3f..6777f9005fe 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -110,9 +110,9 @@ U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) U_CFUNC PHP_FUNCTION(breakiter_get_text) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_text: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -134,9 +134,10 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text) UText *ut = NULL; zval **textzv; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", - &object, BreakIterator_ce_ptr, &text, &text_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", + &text, &text_len) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_set_text: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -178,9 +179,9 @@ static void _breakiter_no_args_ret_int32( { char *msg; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { spprintf(&msg, NULL, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); @@ -202,9 +203,9 @@ static void _breakiter_int32_ret_int32( char *msg; long arg; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", - &object, BreakIterator_ce_ptr, &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { spprintf(&msg, NULL, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); @@ -279,9 +280,9 @@ U_CFUNC PHP_FUNCTION(breakiter_next) U_CFUNC PHP_FUNCTION(breakiter_current) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_current: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -312,9 +313,10 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) { long offset; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", - &object, BreakIterator_ce_ptr, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + &offset) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -338,9 +340,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) { long locale_type; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, BreakIterator_ce_ptr, &locale_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -365,9 +367,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -381,9 +383,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) U_CFUNC PHP_FUNCTION(breakiter_get_error_code) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_error_code: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -401,9 +403,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_message) { const char* message = NULL; BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_error_message: bad arguments", 0 TSRMLS_CC ); RETURN_FALSE; diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 85eceb3f307..4e96450d283 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -101,11 +101,11 @@ U_CFUNC PHP_METHOD(RuleBasedBreakIterator, __construct) U_CFUNC PHP_FUNCTION(rbbi_get_rules) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_hash_code: bad arguments", 0 TSRMLS_CC); + "rbbi_get_rules: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } @@ -127,9 +127,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules) U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "rbbi_get_rule_status: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -143,9 +143,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "rbbi_get_rule_status_vec: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -183,9 +183,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) { BREAKITER_METHOD_INIT_VARS; + object = getThis(); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", - &object, BreakIterator_ce_ptr) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; From 87dd0269ba262649402bf00207f80aede181f1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 10 Jun 2012 13:26:28 +0200 Subject: [PATCH 116/641] Remove trailing space --- .../breakiterator/breakiterator_class.cpp | 16 ++--- ext/intl/breakiterator/breakiterator_class.h | 2 +- .../breakiterator/breakiterator_iterators.cpp | 8 +-- .../breakiterator/breakiterator_methods.cpp | 70 +++++++++---------- .../rulebasedbreakiterator_methods.cpp | 28 ++++---- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index f9ea794d41f..05b876665a6 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -76,11 +76,11 @@ static int BreakIterator_compare_objects(zval *object1, bio1 = (BreakIterator_object*)zend_object_store_get_object(object1 TSRMLS_CC); bio2 = (BreakIterator_object*)zend_object_store_get_object(object2 TSRMLS_CC); - + if (bio1->biter == NULL || bio2->biter == NULL) { return bio1->biter == bio2->biter ? 0 : 1; } - + return *bio1->biter == *bio2->biter ? 0 : 1; } /* }}} */ @@ -136,9 +136,9 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS zval zv = zval_used_for_init; BreakIterator_object *bio; const BreakIterator *biter; - + *is_temp = 1; - + array_init_size(&zv, 8); bio = (BreakIterator_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -149,14 +149,14 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS return Z_ARRVAL(zv); } add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1); - + if (bio->text == NULL) { add_assoc_null_ex(&zv, "text", sizeof("text")); } else { zval_add_ref(&bio->text); add_assoc_zval_ex(&zv, "text", sizeof("text"), bio->text); } - + add_assoc_string_ex(&zv, "type", sizeof("type"), const_cast(typeid(*biter).name()), 1); @@ -210,7 +210,7 @@ static zend_object_value BreakIterator_object_create(zend_class_entry *ce TSRMLS BreakIterator_object* intern; intern = (BreakIterator_object*)ecalloc(1, sizeof(BreakIterator_object)); - + zend_object_std_init(&intern->zo, ce TSRMLS_CC); #if PHP_VERSION_ID < 50399 zend_hash_copy(intern->zo.properties, &(ce->default_properties), @@ -324,7 +324,7 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D) BreakIterator_handlers.compare_objects = BreakIterator_compare_objects; BreakIterator_handlers.clone_obj = BreakIterator_clone_obj; BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info; - + zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h index a3872662832..cc5d51256f9 100644 --- a/ext/intl/breakiterator/breakiterator_class.h +++ b/ext/intl/breakiterator/breakiterator_class.h @@ -36,7 +36,7 @@ typedef struct { // ICU break iterator BreakIterator* biter; - + // current text zval *text; } BreakIterator_object; diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 66f42922596..d3ad050299f 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -226,10 +226,10 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce TSRMLS_DC) { zend_object_value retval; - + retval = IntlIterator_ce_ptr->create_object(ce TSRMLS_CC); retval.handlers = &IntlPartsIterator_handlers; - + return retval; } @@ -263,7 +263,7 @@ U_CFUNC zend_function *IntlPartsIterator_get_method(zval **object_ptr, goto end; } } - + ret = std_object_handlers.get_method(object_ptr, method, method_len, key TSRMLS_CC); @@ -286,7 +286,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator) } INTLITERATOR_METHOD_FETCH_OBJECT; - + zval *biter_zval = static_cast(ii->iterator->data); RETURN_ZVAL(biter_zval, 1, 0); } diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 6777f9005fe..5b8f859d527 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -46,7 +46,7 @@ static void _breakiter_factory(const char *func_name, char *msg; UErrorCode status = UErrorCode(); intl_error_reset(NULL TSRMLS_CC); - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", &locale_str, &dummy) == FAILURE) { spprintf(&msg, NULL, "%s: bad arguments", func_name); @@ -54,11 +54,11 @@ static void _breakiter_factory(const char *func_name, efree(msg); RETURN_NULL(); } - + if (locale_str == NULL) { locale_str = intl_locale_get_default(TSRMLS_C); } - + biter = func(Locale::createFromName(locale_str), status); intl_error_set_code(NULL, status TSRMLS_CC); if (U_FAILURE(status)) { @@ -68,7 +68,7 @@ static void _breakiter_factory(const char *func_name, efree(msg); RETURN_NULL(); } - + breakiterator_object_create(return_value, biter TSRMLS_CC); } @@ -117,9 +117,9 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text) "breakiter_get_text: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + if (bio->text == NULL) { RETURN_NULL(); } else { @@ -135,31 +135,31 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text) zval **textzv; BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &text, &text_len) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_set_text: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + int res = zend_get_parameters_ex(1, &textzv); assert(res == SUCCESS); - + BREAKITER_METHOD_FETCH_OBJECT; - + /* assert it's safe to use text and text_len because zpp changes the * arguments in the stack */ assert(text == Z_STRVAL_PP(textzv)); - + ut = utext_openUTF8(ut, text, text_len, BREAKITER_ERROR_CODE_P(bio)); INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error opening UText"); - + bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio)); utext_close(ut); /* ICU shallow clones the UText */ INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error calling " "BreakIterator::setText()"); - + /* When ICU clones the UText, it does not copy the buffer, so we have to * keep the string buffer around by holding a reference to its zval. This * also allows a faste implementation of getText() */ @@ -168,7 +168,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text) } bio->text = *textzv; zval_add_ref(&bio->text); - + RETURN_TRUE; } @@ -180,18 +180,18 @@ static void _breakiter_no_args_ret_int32( char *msg; BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters_none() == FAILURE) { spprintf(&msg, NULL, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + int32_t res = (bio->biter->*func)(); - + RETURN_LONG((long)res); } @@ -204,16 +204,16 @@ static void _breakiter_int32_ret_int32( long arg; BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { spprintf(&msg, NULL, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + if (arg < INT32_MIN || arg > INT32_MAX) { spprintf(&msg, NULL, "%s: offset argument is outside bounds of " "a 32-bit wide integer", func_name); @@ -221,9 +221,9 @@ static void _breakiter_int32_ret_int32( efree(msg); RETURN_FALSE; } - + int32_t res = (bio->biter->*func)((int32_t)arg); - + RETURN_LONG((long)res); } @@ -251,7 +251,7 @@ U_CFUNC PHP_FUNCTION(breakiter_previous) U_CFUNC PHP_FUNCTION(breakiter_next) { bool no_arg_version = false; - + if (ZEND_NUM_ARGS() == 0) { no_arg_version = true; } else if (ZEND_NUM_ARGS() == 1) { @@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(breakiter_next) no_arg_version = false; } } - + if (no_arg_version) { _breakiter_no_args_ret_int32("breakiter_next", &BreakIterator::next, @@ -281,17 +281,17 @@ U_CFUNC PHP_FUNCTION(breakiter_current) { BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_current: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + int32_t res = bio->biter->current(); - + RETURN_LONG((long)res); } @@ -314,25 +314,25 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) long offset; BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &offset) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + if (offset < INT32_MIN || offset > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: offset argument is outside bounds of " "a 32-bit wide integer", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + UBool res = bio->biter->isBoundary((int32_t)offset); - + RETURN_BOOL((long)res); } @@ -368,7 +368,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { BREAKITER_METHOD_INIT_VARS; object = getThis(); - + if (zend_parse_parameters_none() == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 4e96450d283..f0f680355b8 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -44,7 +44,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) "rbbi_create_instance: bad arguments", 0 TSRMLS_CC); RETURN_NULL(); } - + // instantiation of ICU object RuleBasedBreakIterator *rbbi; @@ -108,11 +108,11 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules) "rbbi_get_rules: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + const UnicodeString rules = fetch_rbbi(bio)->getRules(); - + Z_TYPE_P(return_value) = IS_STRING; if (intl_charFromString(rules, &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), BREAKITER_ERROR_CODE_P(bio)) == FAILURE) @@ -134,9 +134,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) "rbbi_get_rule_status: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); } @@ -150,9 +150,9 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) "rbbi_get_rule_status_vec: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0, BREAKITER_ERROR_CODE(bio)); if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) { @@ -172,7 +172,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) 0 TSRMLS_CC); RETURN_FALSE; } - + array_init_size(return_value, num_rules); for (int32_t i = 0; i < num_rules; i++) { add_next_index_long(return_value, rules[i]); @@ -190,22 +190,22 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) "rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } - + BREAKITER_METHOD_FETCH_OBJECT; - + uint32_t rules_len; const uint8_t *rules = fetch_rbbi(bio)->getBinaryRules(rules_len); - + if (rules_len > INT_MAX - 1) { intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio), "rbbi_get_binary_rules: the rules are too large", 0 TSRMLS_CC); RETURN_FALSE; } - + char *ret_rules = static_cast(emalloc(rules_len + 1)); memcpy(ret_rules, rules, rules_len); ret_rules[rules_len] = '\0'; - + RETURN_STRINGL(ret_rules, rules_len, 0); } From cda14b995c155748f97f6253ff8e2113e3f3e174 Mon Sep 17 00:00:00 2001 From: michelangelo Date: Sat, 9 Jun 2012 16:07:11 +0000 Subject: [PATCH 117/641] Adding a test for ext/posix/tests/posix_getegid_basic.phpt --- ext/posix/tests/posix_getegid_basic.phpt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ext/posix/tests/posix_getegid_basic.phpt diff --git a/ext/posix/tests/posix_getegid_basic.phpt b/ext/posix/tests/posix_getegid_basic.phpt new file mode 100644 index 00000000000..d0016f497f8 --- /dev/null +++ b/ext/posix/tests/posix_getegid_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +Test function posix_getegid() by calling it with its expected arguments +--CREDITS-- +Michelangelo van Dam dragonbe@gmail.com +#PHPTestFest Dutch PHP Conference 2012 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(%d) From f464ffd78046d31eb4bbd6d44dced3cd39d12c69 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sun, 10 Jun 2012 18:15:34 +0400 Subject: [PATCH 118/641] Make travis silent Travis will always build all branches. As we just have a .travis.yml on master, travis will go ahead and checkout PHP-5.3. It fails and then sends mails. We really don't want to get spammed, so we add a .travis.yml that is just silent. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..a375a359dd1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: php + +php: + # We only specify one version so we only get one worker + - 5.4 + +notifications: + email: false + +script: exit 0 From cee31091a960014ce5315008fc64437d04174caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 10 Jun 2012 22:42:38 +0200 Subject: [PATCH 119/641] Add Intl prefix to BreakIterator/RuleBasedBI --- .../breakiterator/breakiterator_class.cpp | 8 ++--- .../rulebasedbreakiterator_methods.cpp | 2 +- .../rulebasedbreakiterator_methods.h | 2 +- ext/intl/tests/breakiter___construct.phpt | 6 ++-- .../tests/breakiter___construct_error.phpt | 28 ++++++++-------- ext/intl/tests/breakiter_clone_basic.phpt | 12 +++---- ext/intl/tests/breakiter_current_basic.phpt | 4 +-- ext/intl/tests/breakiter_factories_basic.phpt | 6 ++-- ext/intl/tests/breakiter_factories_error.phpt | 32 +++++++++---------- ext/intl/tests/breakiter_first_basic.phpt | 4 +-- ...ter_first_last_previous_current_error.phpt | 20 ++++++------ ext/intl/tests/breakiter_following_basic.phpt | 4 +-- ..._following_preceding_isBoundary_error.phpt | 28 ++++++++-------- ext/intl/tests/breakiter_getLocale_basic.phpt | 4 +-- ext/intl/tests/breakiter_getLocale_error.phpt | 16 +++++----- .../breakiter_getPartsIterator_basic.phpt | 6 ++-- ext/intl/tests/breakiter_getText_basic.phpt | 4 +-- ext/intl/tests/breakiter_getText_error.phpt | 8 ++--- .../tests/breakiter_isBoundary_basic.phpt | 4 +-- ext/intl/tests/breakiter_last_basic.phpt | 4 +-- ext/intl/tests/breakiter_next_basic.phpt | 4 +-- ext/intl/tests/breakiter_next_error.phpt | 12 +++---- ext/intl/tests/breakiter_preceding_basic.phpt | 4 +-- ext/intl/tests/breakiter_previous_basic.phpt | 4 +-- ext/intl/tests/breakiter_setText_basic.phpt | 4 +-- ext/intl/tests/breakiter_setText_error.phpt | 16 +++++----- ext/intl/tests/rbbiter___construct_basic.phpt | 6 ++-- .../tests/rbbiter_getBinaryRules_basic.phpt | 6 ++-- .../tests/rbbiter_getRuleStatusVec_basic.phpt | 6 ++-- .../tests/rbbiter_getRuleStatus_basic.phpt | 6 ++-- ext/intl/tests/rbbiter_getRules_basic.phpt | 4 +-- 31 files changed, 137 insertions(+), 137 deletions(-) diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 05b876665a6..8c25314a4a8 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -296,7 +296,7 @@ static const zend_function_entry BreakIterator_class_functions[] = { /* {{{ RuleBasedBreakIterator_class_functions */ static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { - PHP_ME(RuleBasedBreakIterator, __construct, ainfo_rbbi___construct, ZEND_ACC_PUBLIC) + PHP_ME(IntlRuleBasedBreakIterator, __construct, ainfo_rbbi___construct, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRules, rbbi_get_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatus, rbbi_get_rule_status, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatusVec, rbbi_get_rule_status_vec, ainfo_biter_void, ZEND_ACC_PUBLIC) @@ -314,12 +314,12 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_class_entry ce; /* Create and register 'BreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "BreakIterator", BreakIterator_class_functions); + INIT_CLASS_ENTRY(ce, "IntlBreakIterator", BreakIterator_class_functions); ce.create_object = BreakIterator_object_create; ce.get_iterator = _breakiterator_get_iterator; BreakIterator_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); - memcpy( &BreakIterator_handlers, zend_get_std_object_handlers(), + memcpy(&BreakIterator_handlers, zend_get_std_object_handlers(), sizeof BreakIterator_handlers); BreakIterator_handlers.compare_objects = BreakIterator_compare_objects; BreakIterator_handlers.clone_obj = BreakIterator_clone_obj; @@ -361,7 +361,7 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D) /* Create and register 'RuleBasedBreakIterator' class. */ - INIT_CLASS_ENTRY(ce, "RuleBasedBreakIterator", + INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", RuleBasedBreakIterator_class_functions); RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, BreakIterator_ce_ptr, NULL TSRMLS_CC); diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index f0f680355b8..288179a7859 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -84,7 +84,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) breakiterator_object_create(return_value, rbbi TSRMLS_CC); } -U_CFUNC PHP_METHOD(RuleBasedBreakIterator, __construct) +U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct) { zval orig_this = *getThis(); diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h index 29cf3db7d57..edea4ea2a69 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h @@ -19,7 +19,7 @@ #include -PHP_METHOD(RuleBasedBreakIterator, __construct); +PHP_METHOD(IntlRuleBasedBreakIterator, __construct); PHP_FUNCTION(rbbi_get_rules); diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt index a379b19f92e..9ea6a9cf118 100644 --- a/ext/intl/tests/breakiter___construct.phpt +++ b/ext/intl/tests/breakiter___construct.phpt @@ -1,5 +1,5 @@ --TEST-- -BreakIterator::__construct() should not be callable +IntlBreakIterator::__construct() should not be callable --SKIPIF-- if (!extension_loaded('intl')) die('skip intl extension not enabled'); @@ -7,7 +7,7 @@ if (!extension_loaded('intl')) current()); $bi->setText('foo bar trans zoo bee'); diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt index 30fb312cd55..333023a2538 100644 --- a/ext/intl/tests/breakiter_factories_basic.phpt +++ b/ext/intl/tests/breakiter_factories_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -BreakIterator factories: basic tests +IntlBreakIterator factories: basic tests --SKIPIF-- if (!extension_loaded('intl')) die('skip intl extension not enabled'); @@ -16,9 +16,9 @@ $t = 'Frase 1... Frase 2'. $o1 = $o2 = null; foreach ($m as $method) { echo "===== $method =====\n"; - $o1 = call_user_func(array('Breakiterator', $method), 'ja'); + $o1 = call_user_func(array('IntlBreakIterator', $method), 'ja'); var_dump($o1 == $o2); - $o2 = call_user_func(array('Breakiterator', $method), NULL); + $o2 = call_user_func(array('IntlBreakIterator', $method), NULL); var_dump($o1 == $o2); echo "\n"; } diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt index d172143ad1f..6001946ad29 100644 --- a/ext/intl/tests/breakiter_factories_error.phpt +++ b/ext/intl/tests/breakiter_factories_error.phpt @@ -1,39 +1,39 @@ --TEST-- -BreakIterator factory methods: argument errors +IntlBreakIterator factory methods: argument errors --FILE-- setText('foo bar trans'); var_dump($bi->current()); diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt index a56228e284f..9865cdec58f 100644 --- a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt +++ b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt @@ -1,10 +1,10 @@ --TEST-- -BreakIterator::first()/last()/previous()/current(): arg errors +IntlBreakIterator::first()/last()/previous()/current(): arg errors --FILE-- setText("\x80sdfé\x90d888 dfsa9"); var_dump($bi->first(1)); @@ -14,22 +14,22 @@ var_dump($bi->current(1)); --EXPECTF-- -Warning: BreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d +Warning: IntlBreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d -Warning: BreakIterator::first(): breakiter_first: bad arguments in %s on line %d +Warning: IntlBreakIterator::first(): breakiter_first: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d +Warning: IntlBreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d -Warning: BreakIterator::last(): breakiter_last: bad arguments in %s on line %d +Warning: IntlBreakIterator::last(): breakiter_last: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d +Warning: IntlBreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d -Warning: BreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d +Warning: IntlBreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d +Warning: IntlBreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d -Warning: BreakIterator::current(): breakiter_current: bad arguments in %s on line %d +Warning: IntlBreakIterator::current(): breakiter_current: bad arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt index f460ecbf7ad..967ccafb621 100644 --- a/ext/intl/tests/breakiter_following_basic.phpt +++ b/ext/intl/tests/breakiter_following_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::following(): basic test +IntlBreakIterator::following(): basic test --FILE-- setText('foo bar trans zoo bee'); var_dump($bi->following(5)); diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt index 016db6441e3..a4b60857aba 100644 --- a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt +++ b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt @@ -1,10 +1,10 @@ --TEST-- -BreakIterator::following()/preceding()/isBoundary(): arg errors +IntlBreakIterator::following()/preceding()/isBoundary(): arg errors --FILE-- setText("\x80sdfé\x90d888 dfsa9"); var_dump($bi->following(1, 2)); @@ -16,32 +16,32 @@ var_dump($bi->isBoundary(array())); --EXPECTF-- -Warning: BreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d +Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::following() expects parameter 1 to be long, array given in %s on line %d +Warning: IntlBreakIterator::following() expects parameter 1 to be long, array given in %s on line %d -Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d +Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::preceding() expects parameter 1 to be long, array given in %s on line %d +Warning: IntlBreakIterator::preceding() expects parameter 1 to be long, array given in %s on line %d -Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d +Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::isBoundary() expects parameter 1 to be long, array given in %s on line %d +Warning: IntlBreakIterator::isBoundary() expects parameter 1 to be long, array given in %s on line %d -Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d +Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/breakiter_getLocale_basic.phpt b/ext/intl/tests/breakiter_getLocale_basic.phpt index eeed6e802c6..499316c1692 100644 --- a/ext/intl/tests/breakiter_getLocale_basic.phpt +++ b/ext/intl/tests/breakiter_getLocale_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::getLocale(): basic test +IntlBreakIterator::getLocale(): basic test --FILE-- getLocale(0)); var_dump($bi->getLocale(1)); diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt index 7d822ab5630..1dec56db080 100644 --- a/ext/intl/tests/breakiter_getLocale_error.phpt +++ b/ext/intl/tests/breakiter_getLocale_error.phpt @@ -1,10 +1,10 @@ --TEST-- -BreakIterator::getLocale(): arg errors +IntlBreakIterator::getLocale(): arg errors --FILE-- setText("\x80sdfé\x90d888 dfsa9"); var_dump($bi->getLocale(1, 2)); @@ -13,17 +13,17 @@ var_dump($bi->getLocale()); --EXPECTF-- -Warning: BreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::getLocale() expects parameter 1 to be long, array given in %s on line %d +Warning: IntlBreakIterator::getLocale() expects parameter 1 to be long, array given in %s on line %d -Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d +Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d -Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d +Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt index 7a8c3162584..794bab30148 100644 --- a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt +++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::getPartsIterator(): basic test +IntlBreakIterator::getPartsIterator(): basic test --FILE-- getPartsIterator(); var_dump(get_class($pi)); print_r(iterator_to_array($pi)); @@ -22,7 +22,7 @@ string(17) "IntlPartsIterator" Array ( ) -string(22) "RuleBasedBreakIterator" +string(26) "IntlRuleBasedBreakIterator" Array ( [0] => foo diff --git a/ext/intl/tests/breakiter_getText_basic.phpt b/ext/intl/tests/breakiter_getText_basic.phpt index 60801ccc453..57f3e32aa38 100644 --- a/ext/intl/tests/breakiter_getText_basic.phpt +++ b/ext/intl/tests/breakiter_getText_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -BreakIterator::getText(): basic test +IntlBreakIterator::getText(): basic test --SKIPIF-- if (!extension_loaded('intl')) die('skip intl extension not enabled'); @@ -7,7 +7,7 @@ if (!extension_loaded('intl')) getText()); $bi->setText('foo bar'); var_dump($bi->getText()); diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt index 79d152831cf..f222002374b 100644 --- a/ext/intl/tests/breakiter_getText_error.phpt +++ b/ext/intl/tests/breakiter_getText_error.phpt @@ -1,15 +1,15 @@ --TEST-- -BreakIterator::getText(): arg errors +IntlBreakIterator::getText(): arg errors --FILE-- getText(array())); --EXPECTF-- -Warning: BreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d +Warning: IntlBreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d -Warning: BreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d +Warning: IntlBreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt index 5e8a9f04ecd..87d82273520 100644 --- a/ext/intl/tests/breakiter_isBoundary_basic.phpt +++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::isBoundary(): basic test +IntlBreakIterator::isBoundary(): basic test --FILE-- setText('foo bar trans zoo bee'); var_dump($bi->isBoundary(0)); diff --git a/ext/intl/tests/breakiter_last_basic.phpt b/ext/intl/tests/breakiter_last_basic.phpt index 9e260594d9e..0d3aead232f 100644 --- a/ext/intl/tests/breakiter_last_basic.phpt +++ b/ext/intl/tests/breakiter_last_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -BreakIterator::last(): basic test +IntlBreakIterator::last(): basic test --SKIPIF-- if (!extension_loaded('intl')) die('skip intl extension not enabled'); @@ -7,7 +7,7 @@ if (!extension_loaded('intl')) setText('foo bar trans'); var_dump($bi->current()); diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt index 8e4827e2d4d..3d535443b8a 100644 --- a/ext/intl/tests/breakiter_next_basic.phpt +++ b/ext/intl/tests/breakiter_next_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::next(): basic test +IntlBreakIterator::next(): basic test --FILE-- setText('foo bar trans zoo bee'); var_dump($bi->first()); diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt index 08e4aa4c32b..40d8f5813b1 100644 --- a/ext/intl/tests/breakiter_next_error.phpt +++ b/ext/intl/tests/breakiter_next_error.phpt @@ -1,10 +1,10 @@ --TEST-- -BreakIterator::next(): arg errors +IntlBreakIterator::next(): arg errors --FILE-- setText("\x80sdfé\x90d888 dfsa9"); var_dump($bi->next(1, 2)); @@ -12,12 +12,12 @@ var_dump($bi->next(array())); --EXPECTF-- -Warning: BreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d +Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::next() expects parameter 1 to be long, array given in %s on line %d +Warning: IntlBreakIterator::next() expects parameter 1 to be long, array given in %s on line %d -Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d +Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt index 5a321b6f3cc..60695209ccd 100644 --- a/ext/intl/tests/breakiter_preceding_basic.phpt +++ b/ext/intl/tests/breakiter_preceding_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::preceding(): basic test +IntlBreakIterator::preceding(): basic test --FILE-- setText('foo bar trans zoo bee'); var_dump($bi->preceding(5)); diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt index 2d0e71656d0..6d4f3bce5fe 100644 --- a/ext/intl/tests/breakiter_previous_basic.phpt +++ b/ext/intl/tests/breakiter_previous_basic.phpt @@ -1,11 +1,11 @@ --TEST-- -BreakIterator::previous(): basic test +IntlBreakIterator::previous(): basic test --FILE-- setText('foo bar trans'); var_dump($bi->last()); diff --git a/ext/intl/tests/breakiter_setText_basic.phpt b/ext/intl/tests/breakiter_setText_basic.phpt index 72ea48371b4..7b3fa2a6e5e 100644 --- a/ext/intl/tests/breakiter_setText_basic.phpt +++ b/ext/intl/tests/breakiter_setText_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -BreakIterator::setText(): basic test +IntlBreakIterator::setText(): basic test --SKIPIF-- if (!extension_loaded('intl')) die('skip intl extension not enabled'); @@ -11,7 +11,7 @@ class A { function __tostring() { return 'aaa'; } } -$bi = BreakIterator::createWordInstance('pt'); +$bi = IntlBreakIterator::createWordInstance('pt'); var_dump($bi->setText('foo bar')); var_dump($bi->getText()); var_dump($bi->setText(1)); diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt index 08d69070a50..bfcda8ddaab 100644 --- a/ext/intl/tests/breakiter_setText_error.phpt +++ b/ext/intl/tests/breakiter_setText_error.phpt @@ -1,10 +1,10 @@ --TEST-- -BreakIterator::setText(): arg errors +IntlBreakIterator::setText(): arg errors --FILE-- setText()); var_dump($bi->setText(array())); var_dump($bi->setText(1,2)); @@ -22,19 +22,19 @@ var_dump($e->getMessage()); --EXPECTF-- -Warning: BreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d +Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d -Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d +Warning: IntlBreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d -Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d bool(false) -Warning: BreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d +Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d -Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d +Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d bool(false) string(10) "destructed" string(1) "e" diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt index 567a09fa2de..2b14d826e37 100644 --- a/ext/intl/tests/rbbiter___construct_basic.phpt +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -RuleBasedBreakIterator::__construct: basic test +IntlRuleBasedBreakIterator::__construct: basic test --FILE-- ==DONE== --EXPECT-- -string(22) "RuleBasedBreakIterator" +string(26) "IntlRuleBasedBreakIterator" ==DONE== \ No newline at end of file diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt index 815c711cfcb..7bc02188460 100644 --- a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt +++ b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -RuleBasedBreakIterator::getBinaryRules(): basic test +IntlRuleBasedBreakIterator::getBinaryRules(): basic test --FILE-- setText('sdfkjsdf88á.... ,;');; $br = $rbbi->getBinaryRules(); -$rbbi2 = new RuleBasedBreakIterator($br, true); +$rbbi2 = new IntlRuleBasedBreakIterator($br, true); var_dump($rbbi->getRules(), $rbbi2->getRules()); var_dump($rbbi->getRules() == $rbbi2->getRules()); diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt index bbc00e9b48a..a4f3352f9a2 100644 --- a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -RuleBasedBreakIterator::getRuleStatusVec(): basic test +IntlRuleBasedBreakIterator::getRuleStatusVec(): basic test --FILE-- setText('sdfkjsdf88á.... ,;');; do { var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); -} while ($rbbi->next() != BreakIterator::DONE); +} while ($rbbi->next() != IntlBreakIterator::DONE); ?> ==DONE== diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt index 1bce102489f..6199fdee7c2 100644 --- a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -RuleBasedBreakIterator::getRuleStatus(): basic test +IntlRuleBasedBreakIterator::getRuleStatus(): basic test --FILE-- setText('sdfkjsdf88á.... ,;'); do { echo "pos : {$rbbi->current()}\n", "rule status: {$rbbi->getRuleStatus()}\n"; -} while ($rbbi->next() != BreakIterator::DONE); +} while ($rbbi->next() != IntlBreakIterator::DONE); ?> ==DONE== diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt index 7f510484be9..e115e9b9e2a 100644 --- a/ext/intl/tests/rbbiter_getRules_basic.phpt +++ b/ext/intl/tests/rbbiter_getRules_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -RuleBasedBreakIterator::getRules(): basic test +IntlRuleBasedBreakIterator::getRules(): basic test --FILE-- getRules()); ?> From b55e69285bdfa280b94673e8a9434be6c08c65dc Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 10 Jun 2012 20:38:22 -0700 Subject: [PATCH 120/641] typo fix --- main/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index c34f952433a..709c6dd3d9f 100644 --- a/main/main.c +++ b/main/main.c @@ -1080,7 +1080,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR ) { #ifdef PHP_WIN32 - fprintf(stderr, "%s: %s in %s on line%d\n", error_type_str, buffer, error_filename, error_lineno); + fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); fflush(stderr); #else fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); From f4847efc5d58b3375fa0f3269158d5e6ab625c21 Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 11 Jun 2012 00:16:30 -0700 Subject: [PATCH 121/641] Add PBKDF2 support via openssl() Summary: No easy way to put these in the hash extension since we don't really support optional parameters to certain algorithms. Implemented in openssl for now since it has it already and is pretty stable. Only SHA1 is confirmed to work as an algorithm but openssl has a parameter so it can be changed in the future. Will backport to 5.4 potentially with Stas' approval. Test Plan: Ran newly added tests which came from RFC 6070 --- ext/openssl/openssl.c | 57 +++++++++++++++++++ ext/openssl/php_openssl.h | 2 + .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 +++++++++ 3 files changed, 85 insertions(+) create mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7187a9601e6..46f60b2a657 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -242,6 +242,14 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, salt) + ZEND_ARG_INFO(0, key_length) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_INFO(0, digest_algorithm) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, flags) @@ -428,6 +436,8 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_seal, arginfo_openssl_seal) PHP_FE(openssl_open, arginfo_openssl_open) + PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) + /* for S/MIME handling */ PHP_FE(openssl_pkcs7_verify, arginfo_openssl_pkcs7_verify) PHP_FE(openssl_pkcs7_decrypt, arginfo_openssl_pkcs7_decrypt) @@ -3317,6 +3327,53 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ +/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) + Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) +{ + long key_length = 0, iterations = 0; + char *password; int password_len; + char *salt; int salt_len; + char *method; int method_len = 0; + unsigned char *out_buffer; + + const EVP_MD *digest; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", + &password, &password_len, + &salt, &salt_len, + &key_length, &iterations, + &method, &method_len) == FAILURE) { + return; + } + + if (key_length <= 0) { + RETURN_FALSE; + } + + if (method_len) { + digest = EVP_get_digestbyname(method); + } else { + digest = EVP_sha1(); + } + + if (!digest) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm"); + RETURN_FALSE; + } + + out_buffer = emalloc(key_length + 1); + out_buffer[key_length] = '\0'; + + if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, out_buffer) == 1) { + RETVAL_STRINGL((char *)out_buffer, key_length, 0); + } else { + efree(out_buffer); + RETURN_FALSE; + } +} +/* }}} */ + /* {{{ PKCS7 S/MIME functions */ /* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]]) diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index fc118dba1eb..0dbe7d28873 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,6 +52,8 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); + PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); PHP_FUNCTION(openssl_pkcs7_sign); diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt new file mode 100644 index 00000000000..348d3993c2f --- /dev/null +++ b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pkcs5_pbkdf2_hmac() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" From a18cede1c5094d5255daeb99cd6debe09938399d Mon Sep 17 00:00:00 2001 From: Matt Ficken Date: Mon, 11 Jun 2012 17:00:36 +0200 Subject: [PATCH 122/641] Fix bug #62271 test bug - ext/wddx/tests/bug48562.phpt --- ext/wddx/tests/bug48562.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/wddx/tests/bug48562.phpt b/ext/wddx/tests/bug48562.phpt index ebd2004e0a2..ee9f271d916 100644 --- a/ext/wddx/tests/bug48562.phpt +++ b/ext/wddx/tests/bug48562.phpt @@ -16,6 +16,12 @@ $a['x'] = &$a; var_dump(wddx_serialize_vars($a)); +// replace $a - the recursion detection seems to be causing $a to be not an array here, maybe its internally a pointer +// replacing $a with a new array() allows this test to still check for 2 things +// 1. recursion detection in &$a; +// 2. recursion detection in adding $a to itself and then serializing $a +// the one thing the test won't check is using $a as an array after doing &$a; which isn't really a wddx problem. +$a = array(); $a['x'] = 'foo'; $a['x'] = $a; From 733aaf23b1ba58e1a6abb9c0d00aedf67d143167 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 11 Jun 2012 14:08:38 -0300 Subject: [PATCH 123/641] - Fixed build (PKCS5_PBKDF2_HMAC is from 1.0.0) --- ext/openssl/openssl.c | 10 +++++++++- ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 12ecfa47604..1f515c7e56a 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -238,6 +238,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() +#if OPENSSL_VERSION_NUMBER >= 0x10000000L ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, salt) @@ -245,6 +246,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) ZEND_ARG_INFO(0, iterations) ZEND_ARG_INFO(0, digest_algorithm) ZEND_END_ARG_INFO() +#endif ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2) ZEND_ARG_INFO(0, filename) @@ -432,7 +434,9 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_seal, arginfo_openssl_seal) PHP_FE(openssl_open, arginfo_openssl_open) - PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) +#endif /* for S/MIME handling */ PHP_FE(openssl_pkcs7_verify, arginfo_openssl_pkcs7_verify) @@ -3323,6 +3327,8 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + /* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) @@ -3370,6 +3376,8 @@ PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) } /* }}} */ +#endif + /* {{{ PKCS7 S/MIME functions */ /* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]]) diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt index 348d3993c2f..af1fcb1fa80 100644 --- a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt +++ b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt @@ -1,7 +1,7 @@ --TEST-- openssl_pkcs5_pbkdf2_hmac() tests --SKIPIF-- - + --FILE-- Date: Mon, 11 Jun 2012 12:38:54 -0700 Subject: [PATCH 124/641] Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell. Summary: Stas pointed out that this is named pretty poorly. Go for openssl_pbkdf2() --- ext/openssl/CREDITS | 2 +- ext/openssl/openssl.c | 8 +++--- ext/openssl/php_openssl.h | 2 +- ext/openssl/tests/openssl_pbkdf2.phpt | 26 +++++++++++++++++++ .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 ------------------- 5 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 ext/openssl/tests/openssl_pbkdf2.phpt delete mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS index c2f50d63089..b685ce13e5c 100644 --- a/ext/openssl/CREDITS +++ b/ext/openssl/CREDITS @@ -1,2 +1,2 @@ OpenSSL -Stig Venaas, Wez Furlong, Sascha Kettler +Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 1f515c7e56a..938e0e1f751 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -239,7 +239,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_END_ARG_INFO() #if OPENSSL_VERSION_NUMBER >= 0x10000000L -ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, salt) ZEND_ARG_INFO(0, key_length) @@ -435,7 +435,7 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_open, arginfo_openssl_open) #if OPENSSL_VERSION_NUMBER >= 0x10000000L - PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) + PHP_FE(openssl_pbkdf2, arginfo_openssl_pbkdf2) #endif /* for S/MIME handling */ @@ -3329,9 +3329,9 @@ PHP_FUNCTION(openssl_pkey_get_details) #if OPENSSL_VERSION_NUMBER >= 0x10000000L -/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) +/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) +PHP_FUNCTION(openssl_pbkdf2) { long key_length = 0, iterations = 0; char *password; int password_len; diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 0dbe7d28873..2de211a64cf 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,7 +52,7 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); +PHP_FUNCTION(openssl_pbkdf2); PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2.phpt new file mode 100644 index 00000000000..3ec4dce2363 --- /dev/null +++ b/ext/openssl/tests/openssl_pbkdf2.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pbkdf2() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt deleted file mode 100644 index af1fcb1fa80..00000000000 --- a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -openssl_pkcs5_pbkdf2_hmac() tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" -string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" -string(40) "4b007901b765489abead49d926f721d065a429c1" -string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" -string(32) "56fa6aa75548099dcc37d7f03425e0c3" From b5b8ea1050837fba5a6cee55e41b4574ed64158e Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 11 Jun 2012 00:16:30 -0700 Subject: [PATCH 125/641] Add PBKDF2 support via openssl() Summary: No easy way to put these in the hash extension since we don't really support optional parameters to certain algorithms. Implemented in openssl for now since it has it already and is pretty stable. Only SHA1 is confirmed to work as an algorithm but openssl has a parameter so it can be changed in the future. Will backport to 5.4 potentially with Stas' approval. Test Plan: Ran newly added tests which came from RFC 6070 --- ext/openssl/openssl.c | 65 +++++++++++++++++++ ext/openssl/php_openssl.h | 2 + .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 ++++++++ 3 files changed, 93 insertions(+) create mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7187a9601e6..28f76184f49 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -242,6 +242,16 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() +#if OPENSSL_VERSION_NUMBER >= 0x10000000L +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, salt) + ZEND_ARG_INFO(0, key_length) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_INFO(0, digest_algorithm) +ZEND_END_ARG_INFO() +#endif + ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, flags) @@ -428,6 +438,10 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_seal, arginfo_openssl_seal) PHP_FE(openssl_open, arginfo_openssl_open) +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) +#endif + /* for S/MIME handling */ PHP_FE(openssl_pkcs7_verify, arginfo_openssl_pkcs7_verify) PHP_FE(openssl_pkcs7_decrypt, arginfo_openssl_pkcs7_decrypt) @@ -3317,6 +3331,57 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + +/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) + Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) +{ + long key_length = 0, iterations = 0; + char *password; int password_len; + char *salt; int salt_len; + char *method; int method_len = 0; + unsigned char *out_buffer; + + const EVP_MD *digest; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", + &password, &password_len, + &salt, &salt_len, + &key_length, &iterations, + &method, &method_len) == FAILURE) { + return; + } + + if (key_length <= 0) { + RETURN_FALSE; + } + + if (method_len) { + digest = EVP_get_digestbyname(method); + } else { + digest = EVP_sha1(); + } + + if (!digest) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm"); + RETURN_FALSE; + } + + out_buffer = emalloc(key_length + 1); + out_buffer[key_length] = '\0'; + + if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, out_buffer) == 1) { + RETVAL_STRINGL((char *)out_buffer, key_length, 0); + } else { + efree(out_buffer); + RETURN_FALSE; + } +} +/* }}} */ + +#endif + /* {{{ PKCS7 S/MIME functions */ /* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]]) diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index fc118dba1eb..0dbe7d28873 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,6 +52,8 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); + PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); PHP_FUNCTION(openssl_pkcs7_sign); diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt new file mode 100644 index 00000000000..af1fcb1fa80 --- /dev/null +++ b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pkcs5_pbkdf2_hmac() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" From bccd1e672fabc3c788e93075221d47d9f077b167 Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 11 Jun 2012 12:38:54 -0700 Subject: [PATCH 126/641] Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell. Summary: Stas pointed out that this is named pretty poorly. Go for openssl_pbkdf2() --- ext/openssl/CREDITS | 2 +- ext/openssl/openssl.c | 8 +++--- ext/openssl/php_openssl.h | 2 +- ext/openssl/tests/openssl_pbkdf2.phpt | 26 +++++++++++++++++++ .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 ------------------- 5 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 ext/openssl/tests/openssl_pbkdf2.phpt delete mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS index c2f50d63089..b685ce13e5c 100644 --- a/ext/openssl/CREDITS +++ b/ext/openssl/CREDITS @@ -1,2 +1,2 @@ OpenSSL -Stig Venaas, Wez Furlong, Sascha Kettler +Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 28f76184f49..4d482e8a279 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -243,7 +243,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_END_ARG_INFO() #if OPENSSL_VERSION_NUMBER >= 0x10000000L -ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, salt) ZEND_ARG_INFO(0, key_length) @@ -439,7 +439,7 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_open, arginfo_openssl_open) #if OPENSSL_VERSION_NUMBER >= 0x10000000L - PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) + PHP_FE(openssl_pbkdf2, arginfo_openssl_pbkdf2) #endif /* for S/MIME handling */ @@ -3333,9 +3333,9 @@ PHP_FUNCTION(openssl_pkey_get_details) #if OPENSSL_VERSION_NUMBER >= 0x10000000L -/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) +/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) +PHP_FUNCTION(openssl_pbkdf2) { long key_length = 0, iterations = 0; char *password; int password_len; diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 0dbe7d28873..2de211a64cf 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,7 +52,7 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); +PHP_FUNCTION(openssl_pbkdf2); PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2.phpt new file mode 100644 index 00000000000..3ec4dce2363 --- /dev/null +++ b/ext/openssl/tests/openssl_pbkdf2.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pbkdf2() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt deleted file mode 100644 index af1fcb1fa80..00000000000 --- a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -openssl_pkcs5_pbkdf2_hmac() tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" -string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" -string(40) "4b007901b765489abead49d926f721d065a429c1" -string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" -string(32) "56fa6aa75548099dcc37d7f03425e0c3" From aadf59dfa4be09147671de33786dc157716705df Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 11 Jun 2012 00:16:30 -0700 Subject: [PATCH 127/641] Add PBKDF2 support via openssl() Summary: No easy way to put these in the hash extension since we don't really support optional parameters to certain algorithms. Implemented in openssl for now since it has it already and is pretty stable. Only SHA1 is confirmed to work as an algorithm but openssl has a parameter so it can be changed in the future. Will backport to 5.4 potentially with Stas' approval. Test Plan: Ran newly added tests which came from RFC 6070 --- ext/openssl/openssl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 938e0e1f751..f7db37b065d 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -3328,7 +3328,6 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ #if OPENSSL_VERSION_NUMBER >= 0x10000000L - /* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ PHP_FUNCTION(openssl_pbkdf2) From 5b3c9f4fd1fbaa251beea37ff7870f6523320672 Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Mon, 11 Jun 2012 16:23:27 -0700 Subject: [PATCH 128/641] One more time --- ext/openssl/openssl.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index d0ed15e44bb..938e0e1f751 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -3328,10 +3328,7 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ #if OPENSSL_VERSION_NUMBER >= 0x10000000L -<<<<<<< HEAD -======= ->>>>>>> 5.4 /* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ PHP_FUNCTION(openssl_pbkdf2) From 6387498823c85e07a549c189ba0ec33cb6e0d90c Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 09:57:11 -0400 Subject: [PATCH 129/641] Create hash_pbkdf2 function addition --- NEWS | 3 + ext/hash/hash.c | 206 ++++++++++++++++++++++---- ext/hash/php_hash.h | 1 + ext/hash/tests/hash_pbkdf2_basic.phpt | 37 +++++ ext/hash/tests/hash_pbkdf2_error.phpt | 78 ++++++++++ 5 files changed, 293 insertions(+), 32 deletions(-) create mode 100644 ext/hash/tests/hash_pbkdf2_basic.phpt create mode 100644 ext/hash/tests/hash_pbkdf2_error.phpt diff --git a/NEWS b/NEWS index e9e70e9039a..dc4265050ab 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,9 @@ PHP NEWS still exists for backward compatibility but is doing nothing). (Pierrick) . Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick) +- Hash + . Added support for PBKDF2 via hash_pbkdf2()F + - MySQLi . Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql. Known for stability problems. (Andrey) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 895d64da33f..7f0d36f6ada 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -23,6 +23,7 @@ #include "config.h" #endif +#include #include "php_hash.h" #include "ext/standard/info.h" #include "ext/standard/file.h" @@ -202,10 +203,45 @@ PHP_FUNCTION(hash_file) } /* }}} */ +static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const int length) { + int i; + for(i=0; i < length; i++) { + out[i] = in[i] ^ xor_with; + } +} + +static inline void php_hash_string_xor(unsigned char *out, const unsigned char *in, const unsigned char *xor_with, const int length) { + int i; + for(i=0; i < length; i++) { + out[i] = in[i] ^ xor_with[i]; + } +} + +static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *ops, void *context, const unsigned char *key, const int key_len) { + memset(K, 0, ops->block_size); + if (key_len > ops->block_size) { + /* Reduce the key first */ + ops->hash_init(context); + ops->hash_update(context, (unsigned char *) key, key_len); + ops->hash_final((unsigned char *) K, context); + } else { + memcpy(K, key, key_len); + } + /* XOR the key with 0x36 to get the ipad) */ + php_hash_string_xor_char(K, K, 0x36, ops->block_size); +} + +static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const long data_size) { + ops->hash_init(context); + ops->hash_update(context, key, ops->block_size); + ops->hash_update(context, data, data_size); + ops->hash_final(final, context); +} + static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_bool raw_output_default) /* {{{ */ { char *algo, *data, *digest, *key, *K; - int algo_len, data_len, key_len, i; + int algo_len, data_len, key_len; zend_bool raw_output = raw_output_default; const php_hash_ops *ops; void *context; @@ -230,52 +266,29 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, } context = emalloc(ops->context_size); - ops->hash_init(context); K = emalloc(ops->block_size); - memset(K, 0, ops->block_size); + digest = emalloc(ops->digest_size + 1); - if (key_len > ops->block_size) { - /* Reduce the key first */ - ops->hash_update(context, (unsigned char *) key, key_len); - ops->hash_final((unsigned char *) K, context); - /* Make the context ready to start over */ - ops->hash_init(context); - } else { - memcpy(K, key, key_len); - } - - /* XOR ipad */ - for(i=0; i < ops->block_size; i++) { - K[i] ^= 0x36; - } - ops->hash_update(context, (unsigned char *) K, ops->block_size); + php_hash_hmac_prep_key((unsigned char *) K, ops, context, (unsigned char *) key, key_len); if (isfilename) { char buf[1024]; int n; - + ops->hash_init(context); + ops->hash_update(context, (unsigned char *) K, ops->block_size); while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) { ops->hash_update(context, (unsigned char *) buf, n); } php_stream_close(stream); + ops->hash_final((unsigned char *) digest, context); } else { - ops->hash_update(context, (unsigned char *) data, data_len); + php_hash_hmac_round((unsigned char *) digest, ops, context, (unsigned char *) K, (unsigned char *) data, data_len); } - digest = emalloc(ops->digest_size + 1); - ops->hash_final((unsigned char *) digest, context); + php_hash_string_xor_char((unsigned char *) K, (unsigned char *) K, 0x6A, ops->block_size); - /* Convert K to opad -- 0x6A = 0x36 ^ 0x5C */ - for(i=0; i < ops->block_size; i++) { - K[i] ^= 0x6A; - } - - /* Feed this result into the outter hash */ - ops->hash_init(context); - ops->hash_update(context, (unsigned char *) K, ops->block_size); - ops->hash_update(context, (unsigned char *) digest, ops->digest_size); - ops->hash_final((unsigned char *) digest, context); + php_hash_hmac_round((unsigned char *) digest, ops, context, (unsigned char *) K, (unsigned char *) digest, ops->digest_size); /* Zero the key */ memset(K, 0, ops->block_size); @@ -591,6 +604,124 @@ PHP_FUNCTION(hash_algos) } /* }}} */ +/* {{{ proto string hash_pbkdf2(string algo, string password, string salt, int iterations [, int length = 0, bool raw_output = false]) +Generate a PBKDF2 hash of the given password and salt +Returns lowercase hexits by default */ +PHP_FUNCTION(hash_pbkdf2) +{ + char *returnval, *algo, *salt, *pass = NULL; + unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL; + long loops, i, j, algo_len, pass_len, iterations, length, digest_length = 0; + int argc, salt_len = 0; + zend_bool raw_output = 0; + const php_hash_ops *ops; + void *context; + + argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(argc TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { + return; + } + + ops = php_hash_fetch_ops(algo, algo_len); + if (!ops) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo); + RETURN_FALSE; + } + + if (iterations <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations Must Be A Positive Integer: %ld", iterations); + RETURN_FALSE; + } + + if (length < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length Must Be Greater Than Or Equal To 0: %ld", length); + RETURN_FALSE; + } + + if (salt_len > INT_MAX - 4) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %d supplied", salt_len); + RETURN_FALSE; + } + + context = emalloc(ops->context_size); + ops->hash_init(context); + + K1 = emalloc(ops->block_size); + K2 = emalloc(ops->block_size); + digest = emalloc(ops->digest_size); + temp = emalloc(ops->digest_size); + + /* Setup Keys that will be used for all hmac rounds */ + memset(K2, 0, ops->block_size); + php_hash_hmac_prep_key(K1, ops, context, (unsigned char *) pass, pass_len); + /* Convert K1 to opad -- 0x6A = 0x36 ^ 0x5C */ + php_hash_string_xor_char(K2, K1, 0x6A, ops->block_size); + + /* Setup Main Loop to build a long enough result */ + if (length == 0) { + length = ops->digest_size; + } + digest_length = length; + if (!raw_output) { + digest_length = (long) ceil((float) length / 2.0); + } + + loops = (long) ceil((float) digest_length / (float) ops->digest_size); + + result = safe_emalloc(loops, ops->digest_size, 0); + + computed_salt = safe_emalloc(salt_len, 1, 4); + memcpy(computed_salt, (unsigned char *) salt, salt_len); + + for (i = 1; i <= loops; i++) { + /* digest = hash_hmac(salt + pack('N', i), password) { */ + + /* pack("N", i) */ + computed_salt[salt_len] = (unsigned char) (i >> 24); + computed_salt[salt_len + 1] = (unsigned char) ((i & 0xFF0000) >> 16); + computed_salt[salt_len + 2] = (unsigned char) ((i & 0xFF00) >> 8); + computed_salt[salt_len + 3] = (unsigned char) (i & 0xFF); + + php_hash_hmac_round(digest, ops, context, K1, computed_salt, (long) salt_len + 4); + php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); + /* } */ + + /* temp = digest */ + memcpy(temp, digest, ops->digest_size); + for (j = 1; j < iterations; j++) { + /* digest = hash_hmac(digest, password) { */ + php_hash_hmac_round(digest, ops, context, K1, digest, ops->digest_size); + php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); + /* } */ + /* temp ^= digest */ + php_hash_string_xor(temp, temp, digest, ops->digest_size); + } + /* result += temp */ + memcpy(result + ((i - 1) * ops->digest_size), temp, ops->digest_size); + } + /* Zero potentiall sensitive variables */ + memset(K1, 0, ops->block_size); + memset(K2, 0, ops->block_size); + memset(computed_salt, 0, salt_len + 4); + efree(K1); + efree(K2); + efree(computed_salt); + efree(context); + efree(digest); + efree(temp); + + returnval = safe_emalloc(length, 1, 1); + if (raw_output) { + memcpy(returnval, result, length); + } else { + php_hash_bin2hex(returnval, result, digest_length); + } + returnval[length] = 0; + efree(result); + RETURN_STRINGL(returnval, length, 0); +} +/* }}} */ + /* Module Housekeeping */ static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ @@ -1003,6 +1134,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_hash_algos, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_pbkdf2, 0, 0, 4) + ZEND_ARG_INFO(0, algo) + ZEND_ARG_INFO(0, password) + ZEND_ARG_INFO(0, salt) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_INFO(0, length) + ZEND_ARG_INFO(0, raw_output) +ZEND_END_ARG_INFO() + /* BC Land */ #ifdef PHP_MHASH_BC ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_block_size, 0) @@ -1049,6 +1189,7 @@ const zend_function_entry hash_functions[] = { PHP_FE(hash_copy, arginfo_hash_copy) PHP_FE(hash_algos, arginfo_hash_algos) + PHP_FE(hash_pbkdf2, arginfo_hash_pbkdf2) /* BC Land */ #ifdef PHP_HASH_MD5_NOT_IN_CORE @@ -1105,3 +1246,4 @@ ZEND_GET_MODULE(hash) * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ + diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 87050cb8e52..7bc72a2bcb1 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -127,6 +127,7 @@ PHP_FUNCTION(hash_update_stream); PHP_FUNCTION(hash_update_file); PHP_FUNCTION(hash_final); PHP_FUNCTION(hash_algos); +PHP_FUNCTION(hash_pbkdf2); PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len); PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops); diff --git a/ext/hash/tests/hash_pbkdf2_basic.phpt b/ext/hash/tests/hash_pbkdf2_basic.phpt new file mode 100644 index 00000000000..fdccc4b6ea4 --- /dev/null +++ b/ext/hash/tests/hash_pbkdf2_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test hash_pbkdf2() function : basic functionality +--SKIPIF-- + +--FILE-- + +===Done=== +--EXPECT-- +*** Testing hash_pbkdf2() : basic functionality *** +sha1: 0c60c80f961f0e71f3a9 +sha1(raw): 0c60c80f961f0e71f3a9b524af6012062fe037a6 +sha1(rounds): 3d2eec4fe41c849b80c8d8366 +sha1(rounds)(raw): 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038 +sha256: 120fb6cffcf8b32c43e7 +sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9 +sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e +sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9 +===Done=== diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt new file mode 100644 index 00000000000..6b827da30d2 --- /dev/null +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test hash_pbkdf2() function : error functionality +--SKIPIF-- + +--FILE-- + +===Done=== +--EXPECT-- +*** Testing hash_pbkdf2() : error conditions *** + +-- Testing hash_pbkdf2() function with less than expected no. of arguments -- +NULL +hash_pbkdf2() expects at least 4 parameters, 0 given +NULL +hash_pbkdf2() expects at least 4 parameters, 1 given +NULL +hash_pbkdf2() expects at least 4 parameters, 2 given +NULL +hash_pbkdf2() expects at least 4 parameters, 3 given + +-- Testing hash_pbkdf2() function with more than expected no. of arguments -- +NULL +hash_pbkdf2() expects at most 6 parameters, 7 given + +-- Testing hash_pbkdf2() function with invalid hash algorithm -- +bool(false) +hash_pbkdf2(): Unknown hashing algorithm: foo + +-- Testing hash_pbkdf2() function with invalid iterations -- +bool(false) +hash_pbkdf2(): Iterations Must Be A Positive Integer: 0 +bool(false) +hash_pbkdf2(): Iterations Must Be A Positive Integer: -1 + +-- Testing hash_pbkdf2() function with invalid length -- +bool(false) +hash_pbkdf2(): Length Must Be Greater Than Or Equal To 0: -1 + +===Done=== From 550253f6529bfa56e494505e6517500f98c7223a Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 13:51:18 -0400 Subject: [PATCH 130/641] Update NEWS to fix typo, add name --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index dc4265050ab..37e443d25e9 100644 --- a/NEWS +++ b/NEWS @@ -43,7 +43,7 @@ PHP NEWS . Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick) - Hash - . Added support for PBKDF2 via hash_pbkdf2()F + . Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara) - MySQLi . Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql. From 4918acccc6bd23f907b6712bdd04fcd265a411b0 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 14:09:16 -0400 Subject: [PATCH 131/641] refactor away un-necessary casts in hashing routines --- ext/hash/hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 7f0d36f6ada..71f3753dab5 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -222,8 +222,8 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops * if (key_len > ops->block_size) { /* Reduce the key first */ ops->hash_init(context); - ops->hash_update(context, (unsigned char *) key, key_len); - ops->hash_final((unsigned char *) K, context); + ops->hash_update(context, key, key_len); + ops->hash_final(K, context); } else { memcpy(K, key, key_len); } From df3d351cad7ecc2b6087e7f26edf6fa8b22cd960 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 14:10:35 -0400 Subject: [PATCH 132/641] Update error messages to be more inline with PHP standards --- ext/hash/hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 71f3753dab5..40023f75b8a 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -629,12 +629,12 @@ PHP_FUNCTION(hash_pbkdf2) } if (iterations <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations Must Be A Positive Integer: %ld", iterations); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: %ld", iterations); RETURN_FALSE; } if (length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length Must Be Greater Than Or Equal To 0: %ld", length); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: %ld", length); RETURN_FALSE; } From f8cc363841ecd126c0c43f2773e4d85a54b8484c Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Jun 2012 11:18:43 -0700 Subject: [PATCH 133/641] add CVE --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b91b5d78a92..49507634bfe 100644 --- a/NEWS +++ b/NEWS @@ -7,8 +7,8 @@ PHP NEWS crash during execution). (Dmitry) . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includes a semi-colon). (Pierrick) - . Fixed potential overflow in _php_stream_scandir. (Jason Powell, - Stas) + . Fixed potential overflow in _php_stream_scandir (CVE-2012-2688). + (Jason Powell, Stas) - EXIF: . Fixed information leak in ext exif (discovered by Martin Noga, From a2bfad051df022058f19afc5f09fd835cbbcf145 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Jun 2012 11:21:54 -0700 Subject: [PATCH 134/641] Revert "Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell." This reverts commit bccd1e672fabc3c788e93075221d47d9f077b167. Looks like we don't have agreement yet on this for 5.4. Let's keep it in 5.5 for now. --- ext/openssl/CREDITS | 2 +- ext/openssl/openssl.c | 8 +++--- ext/openssl/php_openssl.h | 2 +- ext/openssl/tests/openssl_pbkdf2.phpt | 26 ------------------- .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 +++++++++++++++++++ 5 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 ext/openssl/tests/openssl_pbkdf2.phpt create mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS index b685ce13e5c..c2f50d63089 100644 --- a/ext/openssl/CREDITS +++ b/ext/openssl/CREDITS @@ -1,2 +1,2 @@ OpenSSL -Stig Venaas, Wez Furlong, Sascha Kettler, Scott MacVicar +Stig Venaas, Wez Furlong, Sascha Kettler diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 4d482e8a279..28f76184f49 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -243,7 +243,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_END_ARG_INFO() #if OPENSSL_VERSION_NUMBER >= 0x10000000L -ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4) +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, salt) ZEND_ARG_INFO(0, key_length) @@ -439,7 +439,7 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_open, arginfo_openssl_open) #if OPENSSL_VERSION_NUMBER >= 0x10000000L - PHP_FE(openssl_pbkdf2, arginfo_openssl_pbkdf2) + PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) #endif /* for S/MIME handling */ @@ -3333,9 +3333,9 @@ PHP_FUNCTION(openssl_pkey_get_details) #if OPENSSL_VERSION_NUMBER >= 0x10000000L -/* {{{ proto string openssl_pbkdf2(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) +/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ -PHP_FUNCTION(openssl_pbkdf2) +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) { long key_length = 0, iterations = 0; char *password; int password_len; diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 2de211a64cf..0dbe7d28873 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,7 +52,7 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); -PHP_FUNCTION(openssl_pbkdf2); +PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2.phpt deleted file mode 100644 index 3ec4dce2363..00000000000 --- a/ext/openssl/tests/openssl_pbkdf2.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -openssl_pbkdf2() tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" -string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" -string(40) "4b007901b765489abead49d926f721d065a429c1" -string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" -string(32) "56fa6aa75548099dcc37d7f03425e0c3" diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt new file mode 100644 index 00000000000..af1fcb1fa80 --- /dev/null +++ b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt @@ -0,0 +1,26 @@ +--TEST-- +openssl_pkcs5_pbkdf2_hmac() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" +string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" +string(40) "4b007901b765489abead49d926f721d065a429c1" +string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" +string(32) "56fa6aa75548099dcc37d7f03425e0c3" From c7be96b08fb457f8a2b4e2a64f59437b230886c1 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Jun 2012 11:22:49 -0700 Subject: [PATCH 135/641] Revert "Add PBKDF2 support via openssl()" This reverts commit b5b8ea1050837fba5a6cee55e41b4574ed64158e. Looks like we don't have agreement yet on this for 5.4. Let's keep it in 5.5 for now. --- ext/openssl/openssl.c | 65 ------------------- ext/openssl/php_openssl.h | 2 - .../tests/openssl_pkcs5_pbkdf2_hmac.phpt | 26 -------- 3 files changed, 93 deletions(-) delete mode 100644 ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 28f76184f49..7187a9601e6 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -242,16 +242,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0) ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() -#if OPENSSL_VERSION_NUMBER >= 0x10000000L -ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs5_pbkdf2_hmac, 0, 0, 4) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, salt) - ZEND_ARG_INFO(0, key_length) - ZEND_ARG_INFO(0, iterations) - ZEND_ARG_INFO(0, digest_algorithm) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, flags) @@ -438,10 +428,6 @@ const zend_function_entry openssl_functions[] = { PHP_FE(openssl_seal, arginfo_openssl_seal) PHP_FE(openssl_open, arginfo_openssl_open) -#if OPENSSL_VERSION_NUMBER >= 0x10000000L - PHP_FE(openssl_pkcs5_pbkdf2_hmac, arginfo_openssl_pkcs5_pbkdf2_hmac) -#endif - /* for S/MIME handling */ PHP_FE(openssl_pkcs7_verify, arginfo_openssl_pkcs7_verify) PHP_FE(openssl_pkcs7_decrypt, arginfo_openssl_pkcs7_decrypt) @@ -3331,57 +3317,6 @@ PHP_FUNCTION(openssl_pkey_get_details) /* }}} */ -#if OPENSSL_VERSION_NUMBER >= 0x10000000L - -/* {{{ proto string openssl_pkcs5_pbkdf2_hmac(string password, string salt, long key_length, long iterations [, string digest_method = "sha1"]) - Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac) -{ - long key_length = 0, iterations = 0; - char *password; int password_len; - char *salt; int salt_len; - char *method; int method_len = 0; - unsigned char *out_buffer; - - const EVP_MD *digest; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", - &password, &password_len, - &salt, &salt_len, - &key_length, &iterations, - &method, &method_len) == FAILURE) { - return; - } - - if (key_length <= 0) { - RETURN_FALSE; - } - - if (method_len) { - digest = EVP_get_digestbyname(method); - } else { - digest = EVP_sha1(); - } - - if (!digest) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm"); - RETURN_FALSE; - } - - out_buffer = emalloc(key_length + 1); - out_buffer[key_length] = '\0'; - - if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, out_buffer) == 1) { - RETVAL_STRINGL((char *)out_buffer, key_length, 0); - } else { - efree(out_buffer); - RETURN_FALSE; - } -} -/* }}} */ - -#endif - /* {{{ PKCS7 S/MIME functions */ /* {{{ proto bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]]) diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 0dbe7d28873..fc118dba1eb 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -52,8 +52,6 @@ PHP_FUNCTION(openssl_private_decrypt); PHP_FUNCTION(openssl_public_encrypt); PHP_FUNCTION(openssl_public_decrypt); -PHP_FUNCTION(openssl_pkcs5_pbkdf2_hmac); - PHP_FUNCTION(openssl_pkcs7_verify); PHP_FUNCTION(openssl_pkcs7_decrypt); PHP_FUNCTION(openssl_pkcs7_sign); diff --git a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt b/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt deleted file mode 100644 index af1fcb1fa80..00000000000 --- a/ext/openssl/tests/openssl_pkcs5_pbkdf2_hmac.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -openssl_pkcs5_pbkdf2_hmac() tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6" -string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" -string(40) "4b007901b765489abead49d926f721d065a429c1" -string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" -string(32) "56fa6aa75548099dcc37d7f03425e0c3" From 43eb8dc04af1480b3caa62d252ede28dcb059c7b Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 14:32:21 -0400 Subject: [PATCH 136/641] Remove un-needed memset, and replacing stray spaces --- ext/hash/hash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 40023f75b8a..74c86a8714e 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -652,7 +652,6 @@ PHP_FUNCTION(hash_pbkdf2) temp = emalloc(ops->digest_size); /* Setup Keys that will be used for all hmac rounds */ - memset(K2, 0, ops->block_size); php_hash_hmac_prep_key(K1, ops, context, (unsigned char *) pass, pass_len); /* Convert K1 to opad -- 0x6A = 0x36 ^ 0x5C */ php_hash_string_xor_char(K2, K1, 0x6A, ops->block_size); @@ -661,7 +660,7 @@ PHP_FUNCTION(hash_pbkdf2) if (length == 0) { length = ops->digest_size; } - digest_length = length; + digest_length = length; if (!raw_output) { digest_length = (long) ceil((float) length / 2.0); } From f0d6059389c0d00e6fa4a890b69d422aab8c3b0d Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Jun 2012 11:49:35 -0700 Subject: [PATCH 137/641] re-add 61755 to NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 380979b14b4..0541499fc69 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,10 @@ PHP NEWS pattern). (Gustavo) . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) +- PDO: + . Fixed bug #61755 (A parsing bug in the prepared statements can lead to + access violations). (Johannes) + - Phar: . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) From 2f1cd2cb1377bac9093ab539d936dd6c4a913916 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 14:52:43 -0400 Subject: [PATCH 138/641] Fix tests to use proper casing --- ext/hash/tests/hash_pbkdf2_error.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index 6b827da30d2..fd70cca581e 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -67,12 +67,12 @@ hash_pbkdf2(): Unknown hashing algorithm: foo -- Testing hash_pbkdf2() function with invalid iterations -- bool(false) -hash_pbkdf2(): Iterations Must Be A Positive Integer: 0 +hash_pbkdf2(): Iterations must be a positive integer: 0 bool(false) -hash_pbkdf2(): Iterations Must Be A Positive Integer: -1 +hash_pbkdf2(): Iterations must be a positive integer: -1 -- Testing hash_pbkdf2() function with invalid length -- bool(false) -hash_pbkdf2(): Length Must Be Greater Than Or Equal To 0: -1 +hash_pbkdf2(): Length must be greater than or equal to 0: -1 ===Done=== From 79e44c394fe34c4c902b8a25ffac27a178ab5211 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 12 Jun 2012 11:53:24 -0700 Subject: [PATCH 139/641] re-add 61755 to NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 49507634bfe..dfad253f5a2 100644 --- a/NEWS +++ b/NEWS @@ -112,6 +112,10 @@ PHP NEWS set to null). (Anatoliy) . Changed php://fd to be available only for CLI. +- PDO: + . Fixed bug #61755 (A parsing bug in the prepared statements can lead to + access violations). (Johannes) + - Phar: . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) From 03536e889ad29ed3b6153aafa77b647bdcfe2592 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 12 Jun 2012 15:05:44 -0400 Subject: [PATCH 140/641] More cleanup of documentation and comments, as well as code formatting --- ext/hash/hash.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 74c86a8714e..957575d4727 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -205,14 +205,14 @@ PHP_FUNCTION(hash_file) static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const int length) { int i; - for(i=0; i < length; i++) { + for (i=0; i < length; i++) { out[i] = in[i] ^ xor_with; } } static inline void php_hash_string_xor(unsigned char *out, const unsigned char *in, const unsigned char *xor_with, const int length) { int i; - for(i=0; i < length; i++) { + for (i=0; i < length; i++) { out[i] = in[i] ^ xor_with[i]; } } @@ -687,6 +687,11 @@ PHP_FUNCTION(hash_pbkdf2) /* temp = digest */ memcpy(temp, digest, ops->digest_size); + + /* + * Note that the loop starting at 1 is intentional, since we've already done + * the first round of the algorithm. + */ for (j = 1; j < iterations; j++) { /* digest = hash_hmac(digest, password) { */ php_hash_hmac_round(digest, ops, context, K1, digest, ops->digest_size); @@ -698,7 +703,7 @@ PHP_FUNCTION(hash_pbkdf2) /* result += temp */ memcpy(result + ((i - 1) * ops->digest_size), temp, ops->digest_size); } - /* Zero potentiall sensitive variables */ + /* Zero potentially sensitive variables */ memset(K1, 0, ops->block_size); memset(K2, 0, ops->block_size); memset(computed_salt, 0, salt_len + 4); From 26cb5706155347815cec5b2fb5af968e31fd55e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 13 Jun 2012 10:35:58 +0200 Subject: [PATCH 141/641] Merge PHP 5.3.14 NEWS --- NEWS | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 0541499fc69..0f2dc7e6283 100644 --- a/NEWS +++ b/NEWS @@ -59,9 +59,62 @@ PHP NEWS - Zip: . Upgraded libzip to 0.10.1 (Anatoliy) -?? ??? 2012, PHP 5.3.14 +14 Jun 2012, PHP 5.3.14 -(merge after release) +- CLI SAPI: + . Fixed bug #61546 (functions related to current script failed when chdir() + in cli sapi). (Laruence, reeze.xia@gmail.com) + +- CURL: + . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction). + (Laruence) + +- COM: + . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) + +- Core: + . Fixed CVE-2012-2143. (Solar Designer) + . Fixed bug #62005 (unexpected behavior when incrementally assigning to a + member of a null object). (Laruence) + . Fixed bug #61730 (Segfault from array_walk modifying an array passed by + reference). (Laruence) + . Fixed missing bound check in iptcparse(). (chris at chiappa.net) + . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo) + . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename + set to null). (Anatoliy) + . Fixed bug #61713 (Logic error in charset detection for htmlentities). + (Anatoliy) + . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) + . Changed php://fd to be available only for CLI. + +- Fileinfo: + . Fixed bug #61812 (Uninitialised value used in libmagic). + (Laruence, Gustavo) + +- Iconv extension: + . Fixed a bug that iconv extension fails to link to the correct library + when another extension makes use of a library that links to the iconv + library. See https://bugs.gentoo.org/show_bug.cgi?id=364139 for detail. + (Moriyoshi) + +- Intl: + . Fixed bug #62082 (Memory corruption in internal function + get_icu_disp_value_src_php()). (Gustavo) + +- JSON + . Fixed bug #61537 (json_encode() incorrectly truncates/discards + information). (Adam) + +- PDO: + . Fixed bug #61755 (A parsing bug in the prepared statements can lead to + access violations). (Johannes) + +- Phar: + . Fix bug #61065 (Secunia SA44335). (Rasmus) + +- Streams: + . Fixed bug #61961 (file_get_contents leaks when access empty file with + maxlen set). (Reeze) 08 May 2012, PHP 5.3.13 - CGI From 784b4cddc6fc8170c7992d66f70438d2d4353acf Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 13 Jun 2012 12:01:26 -0700 Subject: [PATCH 142/641] simplify boolval() --- ext/standard/type.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/standard/type.c b/ext/standard/type.c index 59d7314bba7..f53107eb7aa 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -186,8 +186,7 @@ PHP_FUNCTION(boolval) return; } - RETVAL_ZVAL(*val, 1, 0); - convert_to_boolean(return_value); + RETURN_BOOL(zend_is_true(*val)); } /* }}} */ From 3faebe2becdbdf0de134ca4e19542b0014fce162 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 14 Jun 2012 17:59:39 +0200 Subject: [PATCH 143/641] Fix bug #62270 Test bug - ext/fileinfo/tests/finfo_open_error-win32 --- .../tests/finfo_open_error-win32.phpt | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ext/fileinfo/tests/finfo_open_error-win32.phpt b/ext/fileinfo/tests/finfo_open_error-win32.phpt index bd50327b2d6..e168b7f7d4c 100644 --- a/ext/fileinfo/tests/finfo_open_error-win32.phpt +++ b/ext/fileinfo/tests/finfo_open_error-win32.phpt @@ -17,6 +17,7 @@ $magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic'; echo "*** Testing finfo_open() : error functionality ***\n"; +// on 5_4, this line generates additional warning messages that 5_3 does not. functionally, it should be fine (should pass) var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) ); var_dump( finfo_open( array(), $magicFile ) ); var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) ); @@ -29,18 +30,30 @@ var_dump( new finfo('foobar') ); ===DONE=== --EXPECTF-- *** Testing finfo_open() : error functionality *** + +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error-win32.php on line %d bool(false) -Warning: finfo_open() expects parameter 1 to be long, array given in %s on line %d +Warning: finfo_open() expects parameter 1 to be long, array given in %sfinfo_open_error-win32.php on line %d bool(false) -Warning: finfo_open() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -resource(%d) of type (file_info) - -Warning: finfo_open() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d +Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error-win32.php on line %d bool(false) -Warning: finfo::finfo() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d +Warning: finfo_open(%smagic): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(%smagic): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d + +Warning: finfo_open(): Failed to load magic database at '%smagic'. in %sfinfo_open_error-win32.php on line %d +bool(false) + +Warning: finfo_open() expects parameter 1 to be long, string given in %sfinfo_open_error-win32.php on line %d +bool(false) + +Warning: finfo::finfo() expects parameter 1 to be long, string given in %sfinfo_open_error-win32.php on line %d NULL ===DONE=== From 280e3a4ec8616f4a32a5186463d475592d1eebda Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 14 Jun 2012 18:02:53 +0200 Subject: [PATCH 144/641] Fixed bug #62312 ext\sockets\tests\socket_import_stream-4.phpt fails --- .../tests/socket_import_stream-4-win.phpt | 106 ++++++++++++++++++ ext/sockets/tests/socket_import_stream-4.phpt | 4 +- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 ext/sockets/tests/socket_import_stream-4-win.phpt diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt new file mode 100644 index 00000000000..68b6582b839 --- /dev/null +++ b/ext/sockets/tests/socket_import_stream-4-win.phpt @@ -0,0 +1,106 @@ +--TEST-- +socket_import_stream: effects of closing +--SKIPIF-- + Date: Sat, 16 Jun 2012 00:56:54 +0300 Subject: [PATCH 145/641] Fix potential leak in cli server --- sapi/cli/php_cli_server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 87ab7b48f49..876c57a34d4 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1826,6 +1826,9 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server return SUCCESS; fail: + if (errstr) { + pefree(errstr, 1); + } efree(escaped_request_uri); return FAILURE; } /* }}} */ From d3780f1f903e6cee4bb2ff723aa36a5cd1824c08 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Sun, 17 Jun 2012 16:04:36 +0200 Subject: [PATCH 146/641] Reverted the BC fix regarding to #57905, test adopted New 0.10.1 has a stronger archive integrity check. Restoring the old behaviour of libzip < 0.10.1 makes no sense at this place. --- ext/zip/lib/zip_open.c | 12 ++---------- ext/zip/tests/pecl12414.phpt | 3 +-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index a348d9800dd..2f56881b0a9 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -206,9 +206,7 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc cd->comment = NULL; cd->comment_len = _zip_read2(&cdp); - /* without checking the ZIP_CHECKCONS flag we'll not able even to open inconsistent - archives at this place, which would break bc in PHP */ - if ((ZIP_CHECKCONS == (flags & ZIP_CHECKCONS)) && ((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { + if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { /* cdir spans past EOCD record */ _zip_error_set(error, ZIP_ER_INCONS, 0); cd->nentry = 0; @@ -239,13 +237,7 @@ _zip_readcdir(FILE *fp, off_t buf_offset, unsigned char *buf, unsigned char *eoc } } - /* the first if branch goes the old way of libzip 0.9 so we don't loose - the bc for reading inconsistent files */ - if ((ZIP_CHECKCONS != (flags & ZIP_CHECKCONS)) && cd->size < (unsigned int)(eocd-buf)) { - cdp = eocd - cd->size; - bufp = &cdp; - } - else if (cd->offset >= buf_offset) { + if (cd->offset >= buf_offset) { /* if buffer already read in, use it */ cdp = buf + (cd->offset - buf_offset); bufp = &cdp; diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt index ab11d21a637..61546386ab7 100644 --- a/ext/zip/tests/pecl12414.phpt +++ b/ext/zip/tests/pecl12414.phpt @@ -35,5 +35,4 @@ if ($res === TRUE) { ?> --DONE-- --EXPECTF-- -ZIP contents size: %d -zip_readfile recorded data does not match unpacked size: %specl12414.zip : MYLOGOV2.GFX +zip_readfile could not read from %specl12414.zip : MYLOGOV2.GFX From 6176b96a230ac76827242256b1c92e0ac7871f14 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 18 Jun 2012 21:56:17 +0200 Subject: [PATCH 147/641] com ext upgrading info --- UPGRADING | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPGRADING b/UPGRADING index fce04afa491..7b82383c0e0 100755 --- a/UPGRADING +++ b/UPGRADING @@ -479,6 +479,10 @@ UPGRADE NOTES - PHP 5.3 - Firebird and SNMP support are no longer available on Windows. Firebird support may be reintroduced in the future. +- As of PHP 5.3.15 and above the COM extension isn't compiled into PHP anymore. + It'll still be delivered with the standard PHP release but must be enclosed + with the "extension = php_com_dotnet.dll". + ===================== 11.1 New in PHP 5.3.4 ===================== From 1c4e48650cb9471805b0fa2801c9d4bc7bbbb465 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 18 Jun 2012 22:04:40 +0200 Subject: [PATCH 148/641] com ext upgrading infos --- UPGRADING | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPGRADING b/UPGRADING index 15da46e7651..97e3297e9c7 100755 --- a/UPGRADING +++ b/UPGRADING @@ -512,6 +512,10 @@ b. Extensions with changed behavior - is_link now works properly for symbolic links on Windows Vista or later. Earlier systems do not support symbolic links. + + - As of PHP 5.4.5 and above the COM extension isn't compiled into PHP anymore. + It'll still be delivered with the standard PHP release but must be enclosed + with the "extension = php_com_dotnet.dll" directive in php.ini. ================== 12. New in PHP 5.4 From 592917f91fce25a7b0245d34d024595dacc4e06f Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 18 Jun 2012 22:07:19 +0200 Subject: [PATCH 149/641] com ext upgrading correction --- UPGRADING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index 7b82383c0e0..e2ab3e7aa1c 100755 --- a/UPGRADING +++ b/UPGRADING @@ -481,7 +481,7 @@ UPGRADE NOTES - PHP 5.3 - As of PHP 5.3.15 and above the COM extension isn't compiled into PHP anymore. It'll still be delivered with the standard PHP release but must be enclosed - with the "extension = php_com_dotnet.dll". + with the "extension = php_com_dotnet.dll" directive in php.ini. ===================== 11.1 New in PHP 5.3.4 From d939d2dee58bf894ae9af631bdee173243157068 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 11 Jun 2012 23:59:46 +0200 Subject: [PATCH 150/641] Add sceleton for yield* expression This does not yet actually implement any delegation. --- .../yield_in_normal_function_error.phpt | 2 +- .../errors/yield_outside_function_error.phpt | 2 +- Zend/zend_compile.c | 23 +++++++++- Zend/zend_compile.h | 1 + Zend/zend_generators.c | 3 +- Zend/zend_language_parser.y | 1 + Zend/zend_language_scanner.c | 2 +- Zend/zend_language_scanner_defs.h | 2 +- Zend/zend_vm_def.h | 5 +++ Zend/zend_vm_execute.h | 45 +++++++++++++++++++ Zend/zend_vm_opcodes.h | 1 + 11 files changed, 80 insertions(+), 7 deletions(-) diff --git a/Zend/tests/generators/errors/yield_in_normal_function_error.phpt b/Zend/tests/generators/errors/yield_in_normal_function_error.phpt index 802510d29cc..4670a415428 100644 --- a/Zend/tests/generators/errors/yield_in_normal_function_error.phpt +++ b/Zend/tests/generators/errors/yield_in_normal_function_error.phpt @@ -9,4 +9,4 @@ function foo() { ?> --EXPECTF-- -Fatal error: The "yield" statement can only be used inside a generator function in %s on line %d +Fatal error: The "yield" expression can only be used inside a generator function in %s on line %d diff --git a/Zend/tests/generators/errors/yield_outside_function_error.phpt b/Zend/tests/generators/errors/yield_outside_function_error.phpt index fd7169d5f2e..5f47e753665 100644 --- a/Zend/tests/generators/errors/yield_outside_function_error.phpt +++ b/Zend/tests/generators/errors/yield_outside_function_error.phpt @@ -7,4 +7,4 @@ yield "Test"; ?> --EXPECTF-- -Fatal error: The "yield" statement can only be used inside a generator function in %s on line %d +Fatal error: The "yield" expression can only be used inside a generator function in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index da61b766622..35ff2bbf522 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2667,7 +2667,7 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC zend_op *opline; if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { - zend_error(E_COMPILE_ERROR, "The \"yield\" statement can only be used inside a generator function"); + zend_error(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a generator function"); } opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2692,6 +2692,27 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC } /* }}} */ +void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC) /* {{{ */ +{ + zend_op *opline; + + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { + zend_error(E_COMPILE_ERROR, "The \"yield*\" expression can only be used inside a generator function"); + } + + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_DELEGATE_YIELD; + + SET_NODE(opline->op1, value); + SET_UNUSED(opline->op2); + + opline->result_type = IS_VAR; + opline->result.var = get_temporary_variable(CG(active_op_array)); + GET_NODE(result, opline->result); +} +/* }}} */ + void zend_do_suspend_if_generator(TSRMLS_D) /* {{{ */ { zend_op *opline; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index ec86ed86de0..d0587d1faa4 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -491,6 +491,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC); +void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC); void zend_do_suspend_if_generator(TSRMLS_D); void zend_do_handle_exception(TSRMLS_D); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 6efa7106609..f8374b8a65e 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -245,7 +245,7 @@ static void zend_generator_clone_storage(zend_generator *orig, zend_generator ** } /* Update the send_target to use the temporary variable with the same - * offset as the original generator, but in out temporary variable + * offset as the original generator, but in our temporary variable * memory segment. */ if (orig->send_target) { size_t offset = (char *) orig->send_target - (char *) execute_data->Ts; @@ -536,7 +536,6 @@ ZEND_METHOD(Generator, send) /* The sent value was initialized to NULL, so dtor that */ zval_ptr_dtor(&generator->send_target->var.ptr); - /* Set new sent value */ Z_ADDREF_P(value); generator->send_target->var.ptr = value; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 16c0ea2b2c3..02aa694c6eb 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -804,6 +804,7 @@ expr_without_variable: | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } | T_YIELD { zend_do_yield(&$$, NULL, NULL TSRMLS_CC); } | T_YIELD expr { zend_do_yield(&$$, &$2, NULL TSRMLS_CC); } + | T_YIELD '*' expr { zend_do_delegate_yield(&$$, &$3 TSRMLS_CC); } | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index a388e96a262..e20fc19581a 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue May 15 13:07:23 2012 */ +/* Generated by re2c 0.13.5 on Sat Jun 16 12:57:03 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 981c342e19c..869d54349d9 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue May 15 13:07:23 2012 */ +/* Generated by re2c 0.13.5 on Sat Jun 16 12:57:03 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 27afc49fa38..e5d8a7624a9 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5406,4 +5406,9 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE ZEND_VM_RETURN(); } +ZEND_VM_HANDLER(161, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) +{ + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 987e4ceee03..6f1a885bb65 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3079,6 +3079,11 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -8182,6 +8187,11 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -13362,6 +13372,11 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -30224,6 +30239,11 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -43545,6 +43565,31 @@ void zend_init_opcodes_handlers(void) ZEND_YIELD_SPEC_CV_VAR_HANDLER, ZEND_YIELD_SPEC_CV_UNUSED_HANDLER, ZEND_YIELD_SPEC_CV_CV_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, + ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 53e00a1743c..46a711d1793 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -161,3 +161,4 @@ #define ZEND_JMP_SET_VAR 158 #define ZEND_SUSPEND_AND_RETURN_GENERATOR 159 #define ZEND_YIELD 160 +#define ZEND_DELEGATE_YIELD 161 From a8948d08083bf59d437ac21abe5929f5668f41d7 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 19 Jun 2012 14:08:34 +0200 Subject: [PATCH 151/641] split gzgetc_basic.phpt for zlib 1.2.7 --- ext/zlib/tests/func.inc | 17 ++++++++++++ ext/zlib/tests/gzgetc_basic.phpt | 8 ++++-- ext/zlib/tests/gzgetc_basic_1.phpt | 43 ++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 ext/zlib/tests/func.inc create mode 100644 ext/zlib/tests/gzgetc_basic_1.phpt diff --git a/ext/zlib/tests/func.inc b/ext/zlib/tests/func.inc new file mode 100644 index 00000000000..0a422cab780 --- /dev/null +++ b/ext/zlib/tests/func.inc @@ -0,0 +1,17 @@ + (\d+\.\d+\.\d+),s', $info, $match)) { + $version = $match[1]; + } + + return $version; +} + diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt index ca2e38c0ecf..5c814e0d1a5 100644 --- a/ext/zlib/tests/gzgetc_basic.phpt +++ b/ext/zlib/tests/gzgetc_basic.phpt @@ -1,10 +1,14 @@ --TEST-- -Test function gzgetc() by calling it with its expected arguments +Test function gzgetc() by calling it with its expected arguments zlib 1.2.5 --SKIPIF-- 0) { + die('skip - only for zlib <= 1.2.5'); +} ?> --FILE-- = 1.2.7'); +} +?> +--FILE-- + +===DONE=== +--EXPECT-- +When you're taught through feelings +Destiny flying high above +all I know is that you can realize it +Destiny who cares +as it turns around +and I know that it descends down on me + +characters counted=176 +===DONE=== From f0726626210d6a1785c4a171c3576a7566aaeae5 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 19 Jun 2012 14:42:59 +0200 Subject: [PATCH 152/641] one more correction for COM upgrading notes --- UPGRADING | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/UPGRADING b/UPGRADING index e2ab3e7aa1c..9d62054bd63 100755 --- a/UPGRADING +++ b/UPGRADING @@ -479,9 +479,10 @@ UPGRADE NOTES - PHP 5.3 - Firebird and SNMP support are no longer available on Windows. Firebird support may be reintroduced in the future. -- As of PHP 5.3.15 and above the COM extension isn't compiled into PHP anymore. - It'll still be delivered with the standard PHP release but must be enclosed - with the "extension = php_com_dotnet.dll" directive in php.ini. +- As of PHP 5.3.15 and above the COM extension isn't compiled statically in PHP + anymore but shared. It'll still be delivered with the standard PHP release but + must be activated manually with the "extension = php_com_dotnet.dll" directive + in php.ini. ===================== 11.1 New in PHP 5.3.4 From 5c001d42d415eb376413e76d0b69efd1ef28e138 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 19 Jun 2012 14:58:06 +0200 Subject: [PATCH 153/641] one more correction for COM upgrading notes --- UPGRADING | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/UPGRADING b/UPGRADING index 97e3297e9c7..a10dca991c4 100755 --- a/UPGRADING +++ b/UPGRADING @@ -512,10 +512,11 @@ b. Extensions with changed behavior - is_link now works properly for symbolic links on Windows Vista or later. Earlier systems do not support symbolic links. - - - As of PHP 5.4.5 and above the COM extension isn't compiled into PHP anymore. - It'll still be delivered with the standard PHP release but must be enclosed - with the "extension = php_com_dotnet.dll" directive in php.ini. + +- As of PHP 5.4.5 and above the COM extension isn't compiled statically in PHP + anymore but shared. It'll still be delivered with the standard PHP release but + must be activated manually with the "extension = php_com_dotnet.dll" directive + in php.ini. ================== 12. New in PHP 5.4 From e793539678caf3ae1999602de0b3dcdbb9ae9cd2 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 19 Jun 2012 17:15:56 +0200 Subject: [PATCH 154/641] sync zip ext version with pecl --- ext/zip/php_zip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h index c9e88d652a6..f848ade8bc5 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -30,7 +30,7 @@ extern zend_module_entry zip_module_entry; #include "lib/zip.h" -#define PHP_ZIP_VERSION_STRING "1.9.2" +#define PHP_ZIP_VERSION_STRING "1.11.0" #if ((PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6) # define PHP_ZIP_USE_OO 1 From 4cba4c61931caf4abb1599493fdcbb2b492072f0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 19 Jun 2012 17:45:04 +0200 Subject: [PATCH 155/641] Fixed bug RecursiveArrayIterator does not implement Countable ArrayIterator implemented Countable only after it was already inherited by RecursiveArrayIterator. Thus the interface was missing in RAI. --- ext/spl/spl_array.c | 5 ++--- ext/spl/tests/bug62262.phpt | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 ext/spl/tests/bug62262.phpt diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 6e9525e5ced..5bbab907e46 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -2005,6 +2005,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); spl_ce_ArrayObject->serialize = spl_array_serialize; spl_ce_ArrayObject->unserialize = spl_array_unserialize; memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -2031,6 +2032,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); spl_ce_ArrayIterator->serialize = spl_array_serialize; spl_ce_ArrayIterator->unserialize = spl_array_unserialize; memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); @@ -2040,9 +2042,6 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); diff --git a/ext/spl/tests/bug62262.phpt b/ext/spl/tests/bug62262.phpt new file mode 100644 index 00000000000..0e006ec2c25 --- /dev/null +++ b/ext/spl/tests/bug62262.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #62262: RecursiveArrayIterator does not implement Countable +--FILE-- + +--EXPECT-- +bool(true) From fed1f2d12447227947bb8c6ba27eca45f244f498 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 19 Jun 2012 17:45:04 +0200 Subject: [PATCH 156/641] Fixed bug RecursiveArrayIterator does not implement Countable ArrayIterator implemented Countable only after it was already inherited by RecursiveArrayIterator. Thus the interface was missing in RAI. --- ext/spl/spl_array.c | 5 ++--- ext/spl/tests/bug62262.phpt | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 ext/spl/tests/bug62262.phpt diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 6e9525e5ced..5bbab907e46 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -2005,6 +2005,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); spl_ce_ArrayObject->serialize = spl_array_serialize; spl_ce_ArrayObject->unserialize = spl_array_unserialize; memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -2031,6 +2032,7 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable); + REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); spl_ce_ArrayIterator->serialize = spl_array_serialize; spl_ce_ArrayIterator->unserialize = spl_array_unserialize; memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); @@ -2040,9 +2042,6 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); - REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); diff --git a/ext/spl/tests/bug62262.phpt b/ext/spl/tests/bug62262.phpt new file mode 100644 index 00000000000..0e006ec2c25 --- /dev/null +++ b/ext/spl/tests/bug62262.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #62262: RecursiveArrayIterator does not implement Countable +--FILE-- + +--EXPECT-- +bool(true) From 5d81fe6f12eaa35a9dd9b968bd778ce24d50fffa Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 19 Jun 2012 18:40:46 +0200 Subject: [PATCH 157/641] Add NEWS for bug #62262 --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 0f2dc7e6283..79b7325626f 100644 --- a/NEWS +++ b/NEWS @@ -53,6 +53,10 @@ PHP NEWS . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant). (Laruence) +- SPL: + . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). + (Nikita Popov) + - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) From 40af974c7355e8c3ea6744874f470c63bb556c9b Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 20 Jun 2012 15:02:49 +0200 Subject: [PATCH 158/641] fix windows build --- ext/mysqlnd/mysqlnd_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index aa5a9e51629..5d2d1d2867c 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -117,7 +117,7 @@ PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); if ((dbg_obj)) { \ dbg_skip_trace = !(dbg_obj)->m->func_enter((dbg_obj), __LINE__, __FILE__, func_name, strlen(func_name)); \ } \ - if (dbg_skip_trace); /* shut compiler's mouth */\ + if (dbg_skip_trace); /* shut compiler's mouth */ \ do { \ if ((dbg_obj) && (dbg_obj)->flags & MYSQLND_DEBUG_PROFILE_CALLS) { \ DBG_PROFILE_START_TIME(); \ From d93892de7a56ef6312d923d63757c792e3acf522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 20 Jun 2012 19:46:32 +0200 Subject: [PATCH 159/641] Remove outdated and user-specific files --- ext/phar/cgidebug | 11 ---- ext/phar/package.php | 139 ------------------------------------------- ext/phar/package.xml | 1 - 3 files changed, 151 deletions(-) delete mode 100755 ext/phar/cgidebug delete mode 100644 ext/phar/package.php diff --git a/ext/phar/cgidebug b/ext/phar/cgidebug deleted file mode 100755 index 1907581900e..00000000000 --- a/ext/phar/cgidebug +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -export SCRIPT_NAME=/front.phar.php -export PATH_INFO=/index.php -export SCRIPT_FILENAME=/home/cellog/workspace/php5/ext/phar/tests/front.phar.php -export PATH_TRANSLATED=/home/cellog/workspace/php5/ext/phar/tests/front.phar.php -export REDIRECT_STATUS=1 -export REQUEST_METHOD=GET -export REQUEST_URI=/front.phar.php/index.php -cd /home/cellog/workspace/php5 -ddd sapi/cgi/php-cgi & -cd /home/cellog/workspace/php5/ext/phar diff --git a/ext/phar/package.php b/ext/phar/package.php deleted file mode 100644 index 181c7c45ffd..00000000000 --- a/ext/phar/package.php +++ /dev/null @@ -1,139 +0,0 @@ -compress()/decompress(). - * phar.extract_list and Phar::getExtractList() are removed - -Major feature functionality release - * phar.cache_list allows web-based phar applications to run at equal or faster than - their on-disk equivalent [Greg] - * new default stub allows running of phar-based phars without phar extension [Greg/Steph] - * add support for tar-based and zip-based phar archives [Greg] - * add support for OpenSSL-based true signatures [Greg] - * add support for signatures to tar-based phar archives [Greg] - * add Phar::isFileFormat() [Greg] - * add Phar::convertToExecutable(), Phar::convertToData() [Greg] - * add Phar::compress() [Greg] - * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to - decompressFiles() [Greg] - * conversion to compressed or to other file formats automatically copies the archive - to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph] - * add Phar::webPhar() for running a web-based application unmodified - directly from a phar archive [Greg] - * file functions (fopen-based and stat-based) can be instructed to only look for - relative paths within a phar via Phar::interceptFileFuncs() - * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] - non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] - * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg] - * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] - * add option to compress the entire phar file for phar/tar file format [Greg] - * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] - * implement Phar::copy(string $from, string $to) [Greg] - * implement Phar::running(), returns path or URL to currently executed phar - * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] - * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] - * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] - * add Phar::delete() [Greg] - * implement Phar::unlinkArchive() [Greg] - -Security addition - * aliases are validated so that they contain no directory separators as intended - * on conversion to other formats, user-supplied aliases are validated - -Changes since 2.0.0RC2: - fixed PHP Bug #49021: phar tar signature algorithm reports as Unknown (0) in - getSignature() call - fixed PHP Bug #49020: phar misinterprets ustar long filename standard - fixed PHP Bug #49018: phar tar stores long filenames with prefix/name reversed - fixed PHP Bug #48791: open office files always reported as corrupted - fixed PHP Bug #48783: make install will fail saying phar file exists - fixed PHP Bug #48740: PHAR install fails when INSTALL_ROOT is not the final install location - fixed PHP Bug #48681: openssl signature verification for tar archives broken - fixed PHP Bug #48377: error message unclear on converting phar with existing file - fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists) - - make phar work in PHP 6 -Changes since 2.0.0RC1: - security vulnerability in handling of long tar filenames fixed - fixed PECL Bug #14646: phar error message unclear with php stream wrappers - fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}() - fixed PHP Bug #48257: PharData throws an exception with non-phar tar - fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist - fixed PHP Bug #46032: PharData::__construct() - wrong memory read - fixed PHP Bug #46060: Phar::addEmptyDir() breaks - fixed PHP Bug #45907: undefined reference to \'PHP_SHA512Init\' - fixed PHP Bug #45726: PHP_Archive / Archive.php missing -Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, - conversion API refactored -Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes - implement OpenSSL asynchronous true package signing - add support for package signing to tar-based archives - require PHP 5.2.1+ -'; - -if (!class_exists("Phar") && !extension_loaded("Phar")) { - die("Extension phar not present"); -} -error_reporting(E_ALL & ~E_DEPRECATED); - -require_once 'PEAR/PackageFileManager2.php'; - -PEAR::setErrorHandling(PEAR_ERROR_DIE); - -$options = array( - 'filelistgenerator' => 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => dirname(__FILE__), - 'packagefile' => 'package.xml', - 'clearcontents' => true, - 'ignore' => array('package*.php', 'package*.xml'), - 'dir_roles' => array( - 'docs' => 'doc', - 'examples' => 'doc', - 'tests' => 'test', - 'phar' => 'src', - ), - 'exceptions' => array( - 'CREDITS' => 'doc', - 'EXPERIMENTAL' => 'doc', - 'LICENSE' => 'doc', - 'Makefile.frag' => 'src', - 'phar_path_check.re' => 'src', - 'TODO' => 'doc', - 'phar.phar' => 'script', - ), -); - -$package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options); - -$package->clearDeps(); -$package->setPhpDep('5.2.1'); -$package->setPearInstallerDep('1.4.3'); -$package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2'); -// all this false business sets the tag that allows us to have hash built -// in statically -$package->addPackageDepWithChannel('optional', 'hash', 'pecl.php.net', false, false, false, false, 'hash'); -$package->addExtensionDep('optional', 'spl'); -$package->addExtensionDep('optional', 'zlib'); -$package->setPackageType('extsrc'); -$package->addRelease(); -$package->setReleaseVersion(phpversion('phar')); -$package->setAPIVersion(Phar::apiVersion()); -$package->setReleaseStability('stable'); -$package->setAPIStability('stable'); -$package->setNotes("\n$notes\n"); -//$package->addGlobalReplacement('package-info', '@package_version@', 'version'); -$package->generateContents(); - -if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writePackageFile(); -} else { - $package->debugPackageFile(); -} - -?> diff --git a/ext/phar/package.xml b/ext/phar/package.xml index 45bdb9edcbb..4a9798e252c 100644 --- a/ext/phar/package.xml +++ b/ext/phar/package.xml @@ -941,7 +941,6 @@ Changes since 2.0.0b1: addition of phar.cache_list, many performance improvement - From 6233408a2a51389a2bbd250c5900d395648e897f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 20 Jun 2012 21:31:23 +0200 Subject: [PATCH 160/641] Fix thread safe build --- Zend/zend_execute.c | 2 +- Zend/zend_execute.h | 2 +- Zend/zend_generators.c | 4 ++-- Zend/zend_vm_def.h | 6 +++--- Zend/zend_vm_execute.h | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index c7ef212887e..0e40650fb5e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1538,7 +1538,7 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t return get_zval_ptr_ptr(op_type, node, Ts, should_free, type); } -void zend_clean_and_cache_symbol_table(HashTable *symbol_table) /* {{{ */ +void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC) /* {{{ */ { if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) { zend_hash_destroy(symbol_table); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 48f46bb8a44..92160b54eb0 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -432,7 +432,7 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const t ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); -void zend_clean_and_cache_symbol_table(HashTable *symbol_table); +void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC); void zend_free_compiled_variables(zval ***CVs, int num); void **zend_copy_arguments(void **arguments_end); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index f8374b8a65e..b7538e7c9ef 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -34,7 +34,7 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio if (!execute_data->symbol_table) { zend_free_compiled_variables(execute_data->CVs, execute_data->op_array->last_var); } else { - zend_clean_and_cache_symbol_table(execute_data->symbol_table); + zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC); } if (execute_data->current_this) { @@ -560,7 +560,7 @@ ZEND_METHOD(Generator, close) generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_close(generator, 0); + zend_generator_close(generator, 0 TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e5d8a7624a9..fea1f404e14 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2572,7 +2572,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } EG(active_symbol_table) = EX(symbol_table); @@ -2717,7 +2717,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ @@ -5265,7 +5265,7 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) if (!EG(active_symbol_table)) { zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); } else { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } efree(execute_data); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6f1a885bb65..0f965c5eef7 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -556,7 +556,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } EG(active_symbol_table) = EX(symbol_table); @@ -701,7 +701,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR EG(active_op_array) = EX(op_array); EG(return_value_ptr_ptr) = EX(original_return_value); if (EG(active_symbol_table)) { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } EG(active_symbol_table) = EX(symbol_table); } else { /* ZEND_OVERLOADED_FUNCTION */ @@ -1248,7 +1248,7 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP if (!EG(active_symbol_table)) { zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); } else { - zend_clean_and_cache_symbol_table(EG(active_symbol_table)); + zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); } efree(execute_data); } From f1ef8b327f44d05015ea3b67c2a354572b782c08 Mon Sep 17 00:00:00 2001 From: Lonny Kapelushnik Date: Thu, 21 Jun 2012 22:34:46 -0400 Subject: [PATCH 161/641] Implements feature 55218 Allows you to recursively check namespaces under a child node instead of from the root of the XML doc --- ext/simplexml/simplexml.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 455280fc74f..7236b8a1b3c 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1513,22 +1513,28 @@ static void sxe_add_registered_namespaces(php_sxe_object *sxe, xmlNodePtr node, } /* }}} */ -/* {{{ proto string SimpleXMLElement::getDocNamespaces([bool recursive]) +/* {{{ proto string SimpleXMLElement::getDocNamespaces([bool recursive [, bool from_root]) Return all namespaces registered with document */ SXE_METHOD(getDocNamespaces) { - zend_bool recursive = 0; + zend_bool recursive = 0, from_root = 1; php_sxe_object *sxe; + xmlNodePtr node; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &recursive) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bb", &recursive, &from_root) == FAILURE) { return; } array_init(return_value); sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); + if(from_root){ + node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr); + }else{ + GET_NODE(sxe, node); + } - sxe_add_registered_namespaces(sxe, xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr), recursive, return_value TSRMLS_CC); + sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC); } /* }}} */ @@ -2518,6 +2524,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getnamespaces, 0, 0, 0) ZEND_ARG_INFO(0, recursve) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getdocnamespaces, 0, 0, 0) + ZEND_ARG_INFO(0, recursve) + ZEND_ARG_INFO(0, from_root) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_children, 0, 0, 0) ZEND_ARG_INFO(0, ns) ZEND_ARG_INFO(0, is_prefix) @@ -2586,7 +2597,7 @@ static const zend_function_entry sxe_functions[] = { /* {{{ */ SXE_ME(attributes, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC) SXE_ME(children, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC) SXE_ME(getNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC) - SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC) + SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getdocnamespaces, ZEND_ACC_PUBLIC) SXE_ME(getName, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC) SXE_ME(addChild, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC) SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC) From 2178b1d02d93fbfb8f018bcf151ececadbff719f Mon Sep 17 00:00:00 2001 From: Lonny Kapelushnik Date: Thu, 21 Jun 2012 23:21:17 -0400 Subject: [PATCH 162/641] Adding in test for feature 55218 --- ext/simplexml/tests/feature55218.phpt | 117 ++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 ext/simplexml/tests/feature55218.phpt diff --git a/ext/simplexml/tests/feature55218.phpt b/ext/simplexml/tests/feature55218.phpt new file mode 100644 index 00000000000..25ea5343768 --- /dev/null +++ b/ext/simplexml/tests/feature55218.phpt @@ -0,0 +1,117 @@ +--TEST-- +Bug #55218 getDocNamespaces from current element and not root +--SKIPIF-- + +--FILE-- + + + + John Doe + + Susie Q. Public + + jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk + +'); + +echo "getDocNamespaces\n"; +echo "\nBackwards Compatibility:\n"; +echo "recursion:\n"; + +var_dump ( $x->getDocNamespaces(true) ) ; +var_dump( $x->person[0]->getDocNamespaces(true) ); +var_dump( $x->person[1]->getDocNamespaces(true) ); + +echo "\nnon recursive:\n"; + +var_dump( $x->getDocNamespaces(false) ); +var_dump( $x->person[0]->getDocNamespaces(false) ); +var_dump( $x->person[1]->getDocNamespaces(false) ); + +echo "\n\nUsing new 'from_root' bool set to false:\n"; +echo "recursion:\n"; + +var_dump ( $x->getDocNamespaces(true, false) ) ; +var_dump( $x->person[0]->getDocNamespaces(true, false) ); +var_dump( $x->person[1]->getDocNamespaces(true, false) ); + +echo "\nnon recursive:\n"; + +var_dump( $x->getDocNamespaces(false, false) ); +var_dump( $x->person[0]->getDocNamespaces(false, false) ); +var_dump( $x->person[1]->getDocNamespaces(false, false) ); + +?> +===DONE=== +--EXPECTF-- +getDocNamespaces + +Backwards Compatibility: +recursion: +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} + +non recursive: +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} + + +Using new 'from_root' bool set to false: +recursion: +array(2) { + ["p"]=> + string(20) "http://example.org/p" + ["t"]=> + string(20) "http://example.org/t" +} +array(1) { + ["t"]=> + string(20) "http://example.org/t" +} +array(0) { +} + +non recursive: +array(1) { + ["p"]=> + string(20) "http://example.org/p" +} +array(1) { + ["t"]=> + string(20) "http://example.org/t" +} +array(0) { +} +===DONE=== \ No newline at end of file From 055ecbc62878e86287d742c7246c21606cee8183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Fri, 22 Jun 2012 12:48:39 +0200 Subject: [PATCH 163/641] Improve check for :memory: pseudo-filename in SQlite --- ext/pdo_sqlite/sqlite_driver.c | 2 +- ext/sqlite3/sqlite3.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 115b3e2da2f..6d469d90c55 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -760,7 +760,7 @@ static struct pdo_dbh_methods sqlite_methods = { static char *make_filename_safe(const char *filename TSRMLS_DC) { - if (*filename && strncmp(filename, ":memory:", sizeof(":memory:")-1)) { + if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) { char *fullpath = expand_filepath(filename, NULL TSRMLS_CC); if (!fullpath) { diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 529f3f7f082..e793206624c 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -117,7 +117,7 @@ PHP_METHOD(sqlite3, open) if (strlen(filename) != filename_len) { return; } - if (strncmp(filename, ":memory:", 8) != 0) { + if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) { if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC); return; @@ -1962,7 +1962,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar switch (access_type) { case SQLITE_ATTACH: { - if (strncmp(arg3, ":memory:", sizeof(":memory:")-1) && *arg3) { + if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) { TSRMLS_FETCH(); #if PHP_API_VERSION < 20100412 From b8e946b02eac53f46cbfc8eefb5c91fb5b075c9d Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 22 Jun 2012 12:05:29 -0300 Subject: [PATCH 164/641] - Fixed bug #62384 (Attempting to invoke a Closure more than once causes segfaul) --- ext/reflection/php_reflection.c | 10 ++++++++++ ext/reflection/tests/bug62384.phpt | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 ext/reflection/tests/bug62384.phpt diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index ca90269fcde..966c9a5448e 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2747,6 +2747,16 @@ ZEND_METHOD(reflection_method, invokeArgs) fcc.calling_scope = obj_ce; fcc.called_scope = intern->ce; fcc.object_ptr = object; + + /* + * Closure::__invoke() actually expects a copy of zend_function, so that it + * frees it after the invoking. + */ + if (obj_ce == zend_ce_closure && object && + strlen(mptr->common.function_name) == sizeof(ZEND_INVOKE_FUNC_NAME)-1 && + memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) { + fcc.function_handler = _copy_function(mptr TSRMLS_CC); + } result = zend_call_function(&fci, &fcc TSRMLS_CC); diff --git a/ext/reflection/tests/bug62384.phpt b/ext/reflection/tests/bug62384.phpt new file mode 100644 index 00000000000..90a871fa2a7 --- /dev/null +++ b/ext/reflection/tests/bug62384.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62384 (Attempting to invoke a Closure more than once causes segfaul) +--FILE-- +getMethod('__invoke'); + +$arguments1 = array('hello'); +$arguments2 = array('world'); + +var_dump($reflection_method->invokeArgs($closure1, $arguments1)); +var_dump($reflection_method->invokeArgs($closure2, $arguments2)); + +?> +--EXPECT-- +string(5) "hello" +string(5) "world" From a62d4e2c43a41a2864e9b38836170e2d4f34033f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Fri, 22 Jun 2012 17:32:46 +0200 Subject: [PATCH 165/641] Remove extra ; --- ext/odbc/php_odbc.c | 2 +- ext/pdo_mysql/pdo_mysql.c | 2 +- ext/recode/recode.c | 2 +- ext/session/session.c | 2 +- ext/standard/browscap.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index dc62631d690..4044117c41f 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -387,7 +387,7 @@ const zend_function_entry odbc_functions[] = { }; /* }}} */ -ZEND_DECLARE_MODULE_GLOBALS(odbc); +ZEND_DECLARE_MODULE_GLOBALS(odbc) static PHP_GINIT_FUNCTION(odbc); /* {{{ odbc_module_entry diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 36bbf9d6e49..e8e215fa392 100755 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -35,7 +35,7 @@ ZEND_GET_MODULE(pdo_mysql) #endif -ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql); +ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql) /* The default socket location is sometimes defined by configure. diff --git a/ext/recode/recode.c b/ext/recode/recode.c index e17429b238e..a1a74deff32 100644 --- a/ext/recode/recode.c +++ b/ext/recode/recode.c @@ -63,7 +63,7 @@ ZEND_END_MODULE_GLOBALS(recode) # define ReSG(v) (recode_globals.v) #endif -ZEND_DECLARE_MODULE_GLOBALS(recode); +ZEND_DECLARE_MODULE_GLOBALS(recode) static PHP_GINIT_FUNCTION(recode); /* {{{ arginfo */ diff --git a/ext/session/session.c b/ext/session/session.c index 6d5acb9d6e5..47c1e35e498 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -56,7 +56,7 @@ #include "mod_mm.h" #endif -PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps); +PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps) /* *********** * Helpers * diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index f0a2eac6f0f..b0f8d642c03 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -43,7 +43,7 @@ ZEND_BEGIN_MODULE_GLOBALS(browscap) browser_data activation_bdata; ZEND_END_MODULE_GLOBALS(browscap) -ZEND_DECLARE_MODULE_GLOBALS(browscap); +ZEND_DECLARE_MODULE_GLOBALS(browscap) #ifdef ZTS #define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v) From 0a7ae87e91368fe17c52767cfb31dabf3a94e38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 22 Jun 2012 18:19:54 +0200 Subject: [PATCH 166/641] Added IntlCodePointBreakIterator. Objects of this class can be instantiated with IntlBreakIterator::createCodePointInstance() The method does not take a locale, as it would not make sense in this context. This class has one additional method: long IntlCodePointIterator::getLastCodePoint() which returns either -1 or the last code point we moved over, if any (and discounting any movement before the last call to IntlBreakIterator::first() or IntlBreakIterator::last()). --- .../breakiterator/breakiterator_class.cpp | 24 +- .../breakiterator/breakiterator_methods.cpp | 18 ++ .../breakiterator/breakiterator_methods.h | 2 + .../codepointiterator_internal.cpp | 286 ++++++++++++++++++ .../codepointiterator_internal.h | 98 ++++++ .../codepointiterator_methods.cpp | 44 +++ .../breakiterator/codepointiterator_methods.h | 24 ++ ext/intl/config.m4 | 3 + ext/intl/config.w32 | 4 +- ...eakiter_createCodePointInstance_basic.phpt | 43 +++ ...eakiter_createCodePointInstance_error.phpt | 18 ++ ext/intl/tests/cpbi_clone_equality.phpt | 33 ++ .../tests/cpbi_getLastCodePoint_basic.phpt | 82 +++++ .../tests/cpbi_getLastCodePoint_error.phpt | 19 ++ ext/intl/tests/cpbi_parts_iterator.phpt | 40 +++ 15 files changed, 736 insertions(+), 2 deletions(-) create mode 100644 ext/intl/breakiterator/codepointiterator_internal.cpp create mode 100644 ext/intl/breakiterator/codepointiterator_internal.h create mode 100644 ext/intl/breakiterator/codepointiterator_methods.cpp create mode 100644 ext/intl/breakiterator/codepointiterator_methods.h create mode 100644 ext/intl/tests/breakiter_createCodePointInstance_basic.phpt create mode 100644 ext/intl/tests/breakiter_createCodePointInstance_error.phpt create mode 100644 ext/intl/tests/cpbi_clone_equality.phpt create mode 100644 ext/intl/tests/cpbi_getLastCodePoint_basic.phpt create mode 100644 ext/intl/tests/cpbi_getLastCodePoint_error.phpt create mode 100644 ext/intl/tests/cpbi_parts_iterator.phpt diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 8c25314a4a8..633550203b8 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -20,6 +20,7 @@ #include #include +#include "codepointiterator_internal.h" #include "breakiterator_iterators.h" @@ -30,14 +31,18 @@ extern "C" { #include "breakiterator_class.h" #include "breakiterator_methods.h" #include "rulebasedbreakiterator_methods.h" +#include "codepointiterator_methods.h" #include #include #include } +using PHP::CodePointBreakIterator; + /* {{{ Global variables */ zend_class_entry *BreakIterator_ce_ptr; zend_class_entry *RuleBasedBreakIterator_ce_ptr; +zend_class_entry *CodePointBreakIterator_ce_ptr; zend_object_handlers BreakIterator_handlers; /* }}} */ @@ -49,6 +54,8 @@ U_CFUNC void breakiterator_object_create(zval *object, if (classId == RuleBasedBreakIterator::getStaticClassID()) { ce = RuleBasedBreakIterator_ce_ptr; + } else if (classId == CodePointBreakIterator::getStaticClassID()) { + ce = CodePointBreakIterator_ce_ptr; } else { ce = BreakIterator_ce_ptr; } @@ -274,6 +281,7 @@ static const zend_function_entry BreakIterator_class_functions[] = { PHP_ME_MAPPING(createCharacterInstance, breakiter_create_character_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(createSentenceInstance, breakiter_create_sentence_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(createTitleInstance, breakiter_create_title_instance, ainfo_biter_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(createCodePointInstance, breakiter_create_code_point_instance, ainfo_biter_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getText, breakiter_get_text, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setText, breakiter_set_text, ainfo_biter_setText, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(first, breakiter_first, ainfo_biter_void, ZEND_ACC_PUBLIC) @@ -305,6 +313,14 @@ static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { }; /* }}} */ +/* {{{ CodePointBreakIterator_class_functions + */ +static const zend_function_entry CodePointBreakIterator_class_functions[] = { + PHP_ME_MAPPING(getLastCodePoint, cpbi_get_last_code_point, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_FE_END +}; +/* }}} */ + /* {{{ breakiterator_register_BreakIterator_class * Initialize 'BreakIterator' class @@ -364,6 +380,12 @@ void breakiterator_register_BreakIterator_class(TSRMLS_D) INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", RuleBasedBreakIterator_class_functions); RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, - BreakIterator_ce_ptr, NULL TSRMLS_CC); + BreakIterator_ce_ptr, NULL TSRMLS_CC); + + /* Create and register 'CodePointBreakIterator' class. */ + INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator", + CodePointBreakIterator_class_functions); + CodePointBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce, + BreakIterator_ce_ptr, NULL TSRMLS_CC); } /* }}} */ diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 5b8f859d527..e9e6b19ba3b 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -19,6 +19,7 @@ #endif #include +#include "codepointiterator_internal.h" #include "breakiterator_iterators.h" @@ -29,6 +30,8 @@ extern "C" { #include } +using PHP::CodePointBreakIterator; + U_CFUNC PHP_METHOD(BreakIterator, __construct) { zend_throw_exception( NULL, @@ -107,6 +110,21 @@ U_CFUNC PHP_FUNCTION(breakiter_create_title_instance) INTERNAL_FUNCTION_PARAM_PASSTHRU); } +U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance) +{ + UErrorCode status = UErrorCode(); + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_create_code_point_instance: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + CodePointBreakIterator *cpbi = new CodePointBreakIterator(); + breakiterator_object_create(return_value, cpbi TSRMLS_CC); +} + U_CFUNC PHP_FUNCTION(breakiter_get_text) { BREAKITER_METHOD_INIT_VARS; diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h index e0d13b0f45e..a479ac92e85 100644 --- a/ext/intl/breakiterator/breakiterator_methods.h +++ b/ext/intl/breakiterator/breakiterator_methods.h @@ -31,6 +31,8 @@ PHP_FUNCTION(breakiter_create_sentence_instance); PHP_FUNCTION(breakiter_create_title_instance); +PHP_FUNCTION(breakiter_create_code_point_instance); + PHP_FUNCTION(breakiter_get_text); PHP_FUNCTION(breakiter_set_text); diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp new file mode 100644 index 00000000000..2dfae1aa4ff --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -0,0 +1,286 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include "codepointiterator_internal.h" +#include + +//copied from cmemory.h, which is not public +typedef union { + long t1; + double t2; + void *t3; +} UAlignedMemory; + +#define U_POINTER_MASK_LSB(ptr, mask) (((ptrdiff_t)(char *)(ptr)) & (mask)) +#define U_ALIGNMENT_OFFSET(ptr) U_POINTER_MASK_LSB(ptr, sizeof(UAlignedMemory) - 1) +#define U_ALIGNMENT_OFFSET_UP(ptr) (sizeof(UAlignedMemory) - U_ALIGNMENT_OFFSET(ptr)) + +using namespace PHP; + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator); + +CodePointBreakIterator::CodePointBreakIterator() +: BreakIterator(), fCharIter(NULL), lastCodePoint(U_SENTINEL) +{ + UErrorCode uec = UErrorCode(); + this->fText = utext_openUChars(NULL, NULL, 0, &uec); +} + +CodePointBreakIterator::CodePointBreakIterator(const PHP::CodePointBreakIterator &other) +: BreakIterator(other), fText(NULL), fCharIter(NULL), lastCodePoint(U_SENTINEL) +{ + *this = other; +} + +CodePointBreakIterator& CodePointBreakIterator::operator=(const CodePointBreakIterator& that) +{ + UErrorCode uec = UErrorCode(); + UText *ut_clone = NULL; + + if (this == &that) { + return *this; + } + + this->fText = utext_clone(this->fText, that.fText, FALSE, TRUE, &uec); + + //don't bother copying the character iterator, getText() is deprecated + clearCurrentCharIter(); + + this->lastCodePoint = that.lastCodePoint; + return *this; +} + +CodePointBreakIterator::~CodePointBreakIterator() +{ + if (this->fText) { + utext_close(this->fText); + } + clearCurrentCharIter(); +} + +UBool CodePointBreakIterator::operator==(const BreakIterator& that) const +{ + if (typeid(*this) != typeid(that)) { + return FALSE; + } + + const CodePointBreakIterator& that2 = + static_cast(that); + + if (!utext_equals(this->fText, that2.fText)) { + return FALSE; + } + + return TRUE; +} + +CodePointBreakIterator* CodePointBreakIterator::clone(void) const +{ + return new CodePointBreakIterator(*this); +} + +CharacterIterator& CodePointBreakIterator::getText(void) const +{ + if (this->fCharIter == NULL) { + //this method is deprecated anyway; setup bogus iterator + static const UChar c = 0; + this->fCharIter = new UCharCharacterIterator(&c, 0); + } + + return *this->fCharIter; +} + +UText *CodePointBreakIterator::getUText(UText *fillIn, UErrorCode &status) const +{ + return utext_clone(fillIn, this->fText, FALSE, TRUE, &status); +} + +void CodePointBreakIterator::setText(const UnicodeString &text) +{ + UErrorCode uec = UErrorCode(); + + //this closes the previous utext, if any + this->fText = utext_openConstUnicodeString(this->fText, &text, &uec); + + clearCurrentCharIter(); +} + +void CodePointBreakIterator::setText(UText *text, UErrorCode &status) +{ + if (U_FAILURE(status)) { + return; + } + + this->fText = utext_clone(this->fText, text, FALSE, TRUE, &status); + + clearCurrentCharIter(); +} + +void CodePointBreakIterator::adoptText(CharacterIterator* it) +{ + UErrorCode uec = UErrorCode(); + clearCurrentCharIter(); + + this->fCharIter = it; + this->fText = utext_openCharacterIterator(this->fText, it, &uec); +} + +int32_t CodePointBreakIterator::first(void) +{ + UTEXT_SETNATIVEINDEX(this->fText, 0); + this->lastCodePoint = U_SENTINEL; + + return 0; +} + +int32_t CodePointBreakIterator::last(void) +{ + int32_t pos = (int32_t)utext_nativeLength(this->fText); + UTEXT_SETNATIVEINDEX(this->fText, pos); + this->lastCodePoint = U_SENTINEL; + + return pos; +} + +int32_t CodePointBreakIterator::previous(void) +{ + this->lastCodePoint = UTEXT_PREVIOUS32(this->fText); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::next(void) +{ + this->lastCodePoint = UTEXT_NEXT32(this->fText); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::current(void) const +{ + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::following(int32_t offset) +{ + this->lastCodePoint = utext_next32From(this->fText, offset); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +int32_t CodePointBreakIterator::preceding(int32_t offset) +{ + this->lastCodePoint = utext_previous32From(this->fText, offset); + if (this->lastCodePoint == U_SENTINEL) { + return BreakIterator::DONE; + } + + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); +} + +UBool CodePointBreakIterator::isBoundary(int32_t offset) +{ + //this function has side effects, and it's supposed to + utext_setNativeIndex(this->fText, offset); + return (offset == utext_getNativeIndex(this->fText)); +} + +int32_t CodePointBreakIterator::next(int32_t n) +{ + UBool res = utext_moveIndex32(this->fText, n); + + if (res) { + this->lastCodePoint = UTEXT_CURRENT32(this->fText); + return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); + } else { + this->lastCodePoint = U_SENTINEL; + return BreakIterator::DONE; + } +} + +CodePointBreakIterator *CodePointBreakIterator::createBufferClone( + void *stackBuffer, int32_t &bufferSize, UErrorCode &status) +{ + //see implementation of RuleBasedBreakIterator::createBufferClone() + if (U_FAILURE(status)) { + return NULL; + } + + if (bufferSize <= 0) { + bufferSize = sizeof(CodePointBreakIterator) + U_ALIGNMENT_OFFSET_UP(0); + return NULL; + } + + char *buf = (char*)stackBuffer; + uint32_t s = bufferSize; + + if (stackBuffer == NULL) { + s = 0; + } + + if (U_ALIGNMENT_OFFSET(stackBuffer) != 0) { + uint32_t offsetUp = (uint32_t)U_ALIGNMENT_OFFSET_UP(buf); + s -= offsetUp; + buf += offsetUp; + } + + if (s < sizeof(CodePointBreakIterator)) { + CodePointBreakIterator *clonedBI = new CodePointBreakIterator(*this); + if (clonedBI == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + } else { + status = U_SAFECLONE_ALLOCATED_WARNING; + } + + return clonedBI; + } + + return new(buf) CodePointBreakIterator(*this); +} + +CodePointBreakIterator &CodePointBreakIterator::refreshInputText(UText *input, UErrorCode &status) +{ + //see implementation of RuleBasedBreakIterator::createBufferClone() + if (U_FAILURE(status)) { + return *this; + } + if (input == NULL) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return *this; + } + + int64_t pos = utext_getNativeIndex(this->fText); + this->fText = utext_clone(this->fText, input, FALSE, TRUE, &status); + if (U_FAILURE(status)) { + return *this; + } + + utext_setNativeIndex(this->fText, pos); + if (utext_getNativeIndex(fText) != pos) { + status = U_ILLEGAL_ARGUMENT_ERROR; + } + + return *this; +} \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h new file mode 100644 index 00000000000..988b91c2009 --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_internal.h @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef CODEPOINTITERATOR_INTERNAL_H +#define CODEPOINTITERATOR_INTERNAL_H + +#include + +using U_ICU_NAMESPACE::BreakIterator; + +namespace PHP { + + class CodePointBreakIterator : public BreakIterator { + + public: + static UClassID getStaticClassID(); + + CodePointBreakIterator(); + + CodePointBreakIterator(const CodePointBreakIterator &other); + + CodePointBreakIterator& operator=(const CodePointBreakIterator& that); + + virtual ~CodePointBreakIterator(); + + virtual UBool operator==(const BreakIterator& that) const; + + virtual CodePointBreakIterator* clone(void) const; + + virtual UClassID getDynamicClassID(void) const; + + virtual CharacterIterator& getText(void) const; + + virtual UText *getUText(UText *fillIn, UErrorCode &status) const; + + virtual void setText(const UnicodeString &text); + + virtual void setText(UText *text, UErrorCode &status); + + virtual void adoptText(CharacterIterator* it); + + virtual int32_t first(void); + + virtual int32_t last(void); + + virtual int32_t previous(void); + + virtual int32_t next(void); + + virtual int32_t current(void) const; + + virtual int32_t following(int32_t offset); + + virtual int32_t preceding(int32_t offset); + + virtual UBool isBoundary(int32_t offset); + + virtual int32_t next(int32_t n); + + virtual CodePointBreakIterator *createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status); + + virtual CodePointBreakIterator &refreshInputText(UText *input, UErrorCode &status); + + inline UChar32 getLastCodePoint() + { + return this->lastCodePoint; + } + + private: + UText *fText; + UChar32 lastCodePoint; + mutable CharacterIterator *fCharIter; + + inline void clearCurrentCharIter() + { + delete this->fCharIter; + this->fCharIter = NULL; + this->lastCodePoint = U_SENTINEL; + } + }; +} + +#endif \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp new file mode 100644 index 00000000000..ae7e526eada --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include "codepointiterator_internal.h" + +extern "C" { +#define USE_BREAKITERATOR_POINTER 1 +#include "breakiterator_class.h" +} + +using PHP::CodePointBreakIterator; + +static inline CodePointBreakIterator *fetch_cpbi(BreakIterator_object *bio) { + return (CodePointBreakIterator*)bio->biter; +} + +U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) +{ + BREAKITER_METHOD_INIT_VARS; + object = getThis(); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "cpbi_get_last_code_point: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + BREAKITER_METHOD_FETCH_OBJECT; + + RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); +} \ No newline at end of file diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h new file mode 100644 index 00000000000..d34e5b61e22 --- /dev/null +++ b/ext/intl/breakiterator/codepointiterator_methods.h @@ -0,0 +1,24 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#ifndef CODEPOINTITERATOR_METHODS_H +#define CODEPOINTITERATOR_METHODS_H + +#include + +PHP_FUNCTION(cpbi_get_last_code_point); + +#endif \ No newline at end of file diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 227368334df..d7eacbc0b41 100755 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -79,6 +79,8 @@ if test "$PHP_INTL" != "no"; then breakiterator/breakiterator_iterators.cpp \ breakiterator/breakiterator_methods.cpp \ breakiterator/rulebasedbreakiterator_methods.cpp \ + breakiterator/codepointiterator_internal.cpp \ + breakiterator/codepointiterator_methods.cpp \ idn/idn.c \ $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) PHP_ADD_BUILD_DIR($ext_builddir/collator) @@ -95,4 +97,5 @@ if test "$PHP_INTL" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/calendar) PHP_ADD_BUILD_DIR($ext_builddir/idn) PHP_ADD_BUILD_DIR($ext_builddir/spoofchecker) + PHP_ADD_BUILD_DIR($ext_builddir/breakiterator) fi diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 index 6b7d15d56d8..a223505f8c9 100755 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -107,7 +107,9 @@ if (PHP_INTL != "no") { breakiterator_class.cpp \ breakiterator_methods.cpp \ breakiterator_iterators.cpp \ - rulebasedbreakiterator_methods.cpp", + rulebasedbreakiterator_methods.cpp \ + codepointiterator_internal.cpp \ + codepointiterator_methods.cpp ", "intl"); ADD_FLAG("LIBS_INTL", "icudt.lib icuin.lib icuio.lib icule.lib iculx.lib"); diff --git a/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt new file mode 100644 index 00000000000..a43e82760cc --- /dev/null +++ b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt @@ -0,0 +1,43 @@ +--TEST-- +IntlBreakIterator::createCodePointInstance(): basic test +--SKIPIF-- +setText($text); + +print_r(iterator_to_array($codepoint_it)); + +?> +==DONE== +--EXPECT-- +string(26) "IntlCodePointBreakIterator" +Array +( + [0] => 0 + [1] => 3 + [2] => 6 + [3] => 9 + [4] => 12 + [5] => 15 + [6] => 18 + [7] => 21 + [8] => 24 + [9] => 27 + [10] => 30 + [11] => 33 + [12] => 36 + [13] => 39 + [14] => 42 + [15] => 45 +) +==DONE== diff --git a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt new file mode 100644 index 00000000000..90228e128f6 --- /dev/null +++ b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt @@ -0,0 +1,18 @@ +--TEST-- +IntlBreakIterator::createCodePointInstance(): bad arguments +--SKIPIF-- +setText($text); + +$it_clone = clone $it; +var_dump($it == $it_clone); + +$it->setText($text2 ); +var_dump($it == $it_clone); + +$it_clone->setText($text2); +var_dump($it == $it_clone); + +?> +==DONE== +--EXPECT-- +bool(true) +bool(false) +bool(true) +==DONE== diff --git a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt new file mode 100644 index 00000000000..74a07a62922 --- /dev/null +++ b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt @@ -0,0 +1,82 @@ +--TEST-- +IntlCodepointBreakIterator::getLastCodePoint(): basic test +--SKIPIF-- +setText($text); + +var_dump($codepoint_it->getLastCodePoint()); +//first() and last() don't read codepoint and set the last code point var to -1 +//The pointer is after the last read codepoint if moving forward and +//before the last read codepoint is moving backwards +$p = $codepoint_it->first(); +while ($p != IntlBreakIterator::DONE) { + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint + //starting at the initial position and only then moves the pointer forward + $p = $codepoint_it->next(); +} + +echo "Now backwards\n"; +$p = $codepoint_it->last(); +while ($p != IntlBreakIterator::DONE) { + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + $p = $codepoint_it->previous(); +} + + +?> +==DONE== +--EXPECT-- +int(-1) +int(-1) +string(6) "U+0E15" +string(6) "U+0E31" +string(6) "U+0E27" +string(6) "U+0E2D" +string(6) "U+0E22" +string(6) "U+0E48" +string(6) "U+0E32" +string(6) "U+0E07" +string(6) "U+0E02" +string(6) "U+0E49" +string(6) "U+0E2D" +string(6) "U+0E04" +string(6) "U+0E27" +string(6) "U+0E32" +string(6) "U+0E21" +Now backwards +int(-1) +string(6) "U+0E21" +string(6) "U+0E32" +string(6) "U+0E27" +string(6) "U+0E04" +string(6) "U+0E2D" +string(6) "U+0E49" +string(6) "U+0E02" +string(6) "U+0E07" +string(6) "U+0E32" +string(6) "U+0E48" +string(6) "U+0E22" +string(6) "U+0E2D" +string(6) "U+0E27" +string(6) "U+0E31" +string(6) "U+0E15" +==DONE== diff --git a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt new file mode 100644 index 00000000000..78bd216629b --- /dev/null +++ b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +IntlBreakIterator::getLastCodePoint(): bad args +--SKIPIF-- +getLastCodePoint(array())); +--EXPECTF-- + +Warning: IntlCodePointBreakIterator::getLastCodePoint() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: IntlCodePointBreakIterator::getLastCodePoint(): cpbi_get_last_code_point: bad arguments in %s on line %d +bool(false) + diff --git a/ext/intl/tests/cpbi_parts_iterator.phpt b/ext/intl/tests/cpbi_parts_iterator.phpt new file mode 100644 index 00000000000..4754c123710 --- /dev/null +++ b/ext/intl/tests/cpbi_parts_iterator.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlCodepointBreakIterator's part iterator +--SKIPIF-- +getPartsIterator(); +$it->getBreakIterator()->setText($text); + +foreach ($it as $k => $v) { + echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . + ") at {$it->getBreakIterator()->current()}\r\n"; +} + +?> +==DONE== +--EXPECT-- +0. ต (U+0E15) at 3 +1. ั (U+0E31) at 6 +2. ว (U+0E27) at 9 +3. อ (U+0E2D) at 12 +4. ย (U+0E22) at 15 +5. ่ (U+0E48) at 18 +6. า (U+0E32) at 21 +7. ง (U+0E07) at 24 +8. ข (U+0E02) at 27 +9. ้ (U+0E49) at 30 +10. อ (U+0E2D) at 33 +11. ค (U+0E04) at 36 +12. ว (U+0E27) at 39 +13. า (U+0E32) at 42 +14. ม (U+0E21) at 45 +==DONE== From 77daa3482d5592181560e0e6076c1e3291620e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 22 Jun 2012 18:28:19 +0200 Subject: [PATCH 167/641] BreakIterator::getPartsIterator: new optional arg Can take one of: * IntlPartsIterator::KEY_SEQUENTIAL (keys are 0, 1, ...) * IntlPartsIterator::KEY_LEFT (keys are left boundaries) * IntlPartsIterator::KEY_LEFT (keys are right boundaries) The default is IntlPartsIterator::KEY_SEQUENTIAL (the previous behavior). --- .../breakiterator/breakiterator_class.cpp | 6 +- .../breakiterator/breakiterator_iterators.cpp | 35 ++++++++++- .../breakiterator/breakiterator_iterators.h | 9 ++- .../breakiterator/breakiterator_methods.cpp | 16 ++++- .../breakiter_getPartsIterator_error.phpt | 33 ++++++++++ .../breakiter_getPartsIterator_var1.phpt | 60 +++++++++++++++++++ 6 files changed, 152 insertions(+), 7 deletions(-) create mode 100644 ext/intl/tests/breakiter_getPartsIterator_error.phpt create mode 100644 ext/intl/tests/breakiter_getPartsIterator_var1.phpt diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 633550203b8..d193fc44577 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -264,6 +264,10 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_get_locale, 0, 0, 1) ZEND_ARG_INFO(0, "locale_type") ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_getPartsIterator, 0, 0, 0) + ZEND_ARG_INFO(0, "key_type") +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ainfo_rbbi___construct, 0, 0, 1) ZEND_ARG_INFO(0, "rules") ZEND_ARG_INFO(0, "areCompiled") @@ -293,7 +297,7 @@ static const zend_function_entry BreakIterator_class_functions[] = { PHP_ME_MAPPING(preceding, breakiter_preceding, ainfo_biter_offset, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(isBoundary, breakiter_is_boundary, ainfo_biter_offset, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getLocale, breakiter_get_locale, ainfo_biter_void, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getPartsIterator, breakiter_get_parts_iterator, ainfo_biter_void, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(getPartsIterator, breakiter_get_parts_iterator, ainfo_biter_getPartsIterator, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorCode, breakiter_get_error_code, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getErrorMessage, breakiter_get_error_message, ainfo_biter_void, ZEND_ACC_PUBLIC) diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index d3ad050299f..d88ad8a712d 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -130,6 +130,7 @@ U_CFUNC zend_object_iterator *_breakiterator_get_iterator( typedef struct zoi_break_iter_parts { zoi_with_current zoi_cur; + parts_iter_key_type key_type; BreakIterator_object *bio; /* so we don't have to fetch it all the time */ } zoi_break_iter_parts; @@ -138,6 +139,16 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC zval_ptr_dtor(reinterpret_cast(&iter->data)); } +static int _breakiterator_parts_get_current_key(zend_object_iterator *iter, + char **str_key, + uint *str_key_len, + ulong *int_key TSRMLS_DC) +{ + /* the actual work is done in move_forward and rewind */ + *int_key = iter->index; + return HASH_KEY_IS_LONG; +} + static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) { zoi_break_iter_parts *zoi_bit = (zoi_break_iter_parts*)iter; @@ -157,6 +168,14 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_ return; } + if (zoi_bit->key_type == PARTS_ITERATOR_KEY_LEFT) { + iter->index = cur; + } else if (zoi_bit->key_type == PARTS_ITERATOR_KEY_RIGHT) { + iter->index = next; + } + /* else zoi_bit->key_type == PARTS_ITERATOR_KEY_SEQUENTIAL + * No need to do anything, the engine increments ->index */ + const char *s = Z_STRVAL_P(bio->text); int32_t slen = Z_STRLEN_P(bio->text), len; @@ -194,14 +213,15 @@ static zend_object_iterator_funcs breakiterator_parts_it_funcs = { zoi_with_current_dtor, zoi_with_current_valid, zoi_with_current_get_current_data, - NULL, + _breakiterator_parts_get_current_key, _breakiterator_parts_move_forward, _breakiterator_parts_rewind, zoi_with_current_invalidate_current }; void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, - zval *object TSRMLS_DC) + zval *object, + parts_iter_key_type key_type TSRMLS_DC) { IntlIterator_object *ii; @@ -221,6 +241,7 @@ void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, ((zoi_break_iter_parts*)ii->iterator)->bio = (BreakIterator_object*) zend_object_store_get_object(break_iter_zv TSRMLS_CC); assert(((zoi_break_iter_parts*)ii->iterator)->bio->biter != NULL); + ((zoi_break_iter_parts*)ii->iterator)->key_type = key_type; } U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce TSRMLS_DC) @@ -312,4 +333,14 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers, sizeof IntlPartsIterator_handlers); IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; + +#define PARTSITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ + sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) + + PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); + PARTSITER_DECL_LONG_CONST(KEY_LEFT); + PARTSITER_DECL_LONG_CONST(KEY_RIGHT); + +#undef PARTSITER_DECL_LONG_CONST } \ No newline at end of file diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h index 855246ff77e..71620724147 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.h +++ b/ext/intl/breakiterator/breakiterator_iterators.h @@ -23,9 +23,16 @@ U_CDECL_BEGIN #include U_CDECL_END +typedef enum { + PARTS_ITERATOR_KEY_SEQUENTIAL, + PARTS_ITERATOR_KEY_LEFT, + PARTS_ITERATOR_KEY_RIGHT, +} parts_iter_key_type; + #ifdef __cplusplus void IntlIterator_from_BreakIterator_parts(zval *break_iter_zv, - zval *object TSRMLS_DC); + zval *object, + parts_iter_key_type key_type TSRMLS_DC); #endif U_CFUNC zend_object_iterator *_breakiterator_get_iterator( diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index e9e6b19ba3b..7b502528f3e 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -384,18 +384,28 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { + long key_type = 0; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters_none() == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); + "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (key_type != PARTS_ITERATOR_KEY_SEQUENTIAL + && key_type != PARTS_ITERATOR_KEY_LEFT + && key_type != PARTS_ITERATOR_KEY_RIGHT) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "breakiter_get_parts_iterator: bad key type", 0 TSRMLS_CC); RETURN_FALSE; } BREAKITER_METHOD_FETCH_OBJECT; - IntlIterator_from_BreakIterator_parts(object, return_value TSRMLS_CC); + IntlIterator_from_BreakIterator_parts( + object, return_value, (parts_iter_key_type)key_type TSRMLS_CC); } U_CFUNC PHP_FUNCTION(breakiter_get_error_code) diff --git a/ext/intl/tests/breakiter_getPartsIterator_error.phpt b/ext/intl/tests/breakiter_getPartsIterator_error.phpt new file mode 100644 index 00000000000..97376180338 --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +IntlBreakIterator::getPartsIterator(): bad args +--SKIPIF-- +getPartsIterator(array())); +var_dump($it->getPartsIterator(1, 2)); +var_dump($it->getPartsIterator(-1)); + +?> +==DONE== +--EXPECTF-- + +Warning: IntlBreakIterator::getPartsIterator() expects parameter 1 to be long, array given in %s on line %d + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getPartsIterator() expects at most 1 parameter, 2 given in %s on line %d + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d +bool(false) + +Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad key type in %s on line %d +bool(false) +==DONE== diff --git a/ext/intl/tests/breakiter_getPartsIterator_var1.phpt b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt new file mode 100644 index 00000000000..7bbd27ea451 --- /dev/null +++ b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt @@ -0,0 +1,60 @@ +--TEST-- +IntlBreakIterator::getPartsIterator(): argument variations +--SKIPIF-- +setText($text); + +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_SEQUENTIAL))); +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_LEFT))); +var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_RIGHT))); + +?> +==DONE== +--EXPECT-- +array(5) { + [0]=> + string(3) "foo" + [1]=> + string(1) " " + [2]=> + string(3) "bar" + [3]=> + string(1) " " + [4]=> + string(3) "tao" +} +array(5) { + [0]=> + string(3) "foo" + [4]=> + string(1) " " + [5]=> + string(3) "bar" + [8]=> + string(1) " " + [9]=> + string(3) "tao" +} +array(5) { + [3]=> + string(3) "foo" + [5]=> + string(1) " " + [8]=> + string(3) "bar" + [9]=> + string(1) " " + [12]=> + string(3) "tao" +} +==DONE== From 84b1c568f4d593c2f415b05f3b1b8bd0465eec27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Fri, 22 Jun 2012 20:00:20 +0200 Subject: [PATCH 168/641] Remove unneeded and outdated ChangeLog file --- Zend/ChangeLog | 22097 ----------------------------------------------- makedist | 3 - 2 files changed, 22100 deletions(-) delete mode 100644 Zend/ChangeLog diff --git a/Zend/ChangeLog b/Zend/ChangeLog deleted file mode 100644 index ef4e71c87a0..00000000000 --- a/Zend/ChangeLog +++ /dev/null @@ -1,22097 +0,0 @@ -2005-08-05 Dmitry Stogov - - * zend_execute.c - tests/array_type_hint_001.phpt - tests/bug33996.phpt: - Fixed bug #33996 (No information given for fatal error on passing invalid - value to typed argument) - - * zend_operators.c - tests/bug33999.phpt: - Fixed bug #33999 (object remains object when cast to int) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed memory leak in foreach() on undefined variable - (Zend/tests/foreach_undefined.php) - -2005-08-04 Antony Dovgal - - * tests/foreach_undefined.phpt: - add test for the last Dmitry's fix - -2005-08-04 Dmitry Stogov - - * zend_compile.c: - Fixed possible memory corryption during compilation of - - * (PHP_5_0) - zend_objects.c: - Fixed clone bug in ze1_compatibility mode - - * zend_objects.c: - Fixed clone bug in ze1_compatibilty mode - -2005-08-03 Jani Taskinen - - * LICENSE: - - Bumber up year - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_exceptions.c - zend_exceptions.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_interfaces.c - zend_interfaces.h - zend_istdiostream.h - zend_iterators.c - zend_iterators.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multibyte.c - zend_multibyte.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_reflection_api.c - zend_reflection_api.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_strtod.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h - zend_vm.h: - Bump up the year - - * README.ZEND_VM: - Nuked DOS EOLs - -2005-08-02 Dmitry Stogov - - * zend_execute_API.c - zend_execute_API.c: - Fixed bug #33942 (the patch to #33156 crash cygwin except cli) - -2005-08-02 Jani Taskinen - - * zend_exceptions.c: - - Fixed bug #33967 (misuse of Exception constructor doesn\'t display - errorfile) - -2005-08-02 Dmitry Stogov - - * bench.php: - Removed warnings - -2005-07-29 Ilia Alshanetsky - - * zend_vm_def.h - zend_vm_execute.h: - Fixed warning message generated when isset() or empty() are given invalid - offset type. - -2005-07-29 Anantha Kesari H Y - - * acconfig.h - acconfig.h: - In NetWare few of the programs like apache2 and ldap use winsock inclusinf - sys/socket.h is not desirable. - --Kamesh - -2005-07-29 Jani Taskinen - - * zend_vm_execute.h: - update generated file - -2005-07-28 Andi Gutmans - - * zend_vm_def.h: - - Tiny fixlet - -2005-07-28 Marcus Boerger - - * zend_API.c - zend_API.h: - - Add convenience function zend_is_callable_ex() and base zend_is_callable - and zend_make_callable on it. This functions allows to check if a php - variable is a callable function and returns its function pointer as well - as object if possible. - -2005-07-26 Jani Taskinen - - * zend_execute_API.c: - bug #33865 - -2005-07-25 Marcus Boerger - - * zend_API.c: - - Fix #33853 - -2005-07-22 Dmitry Stogov - - * zend.c - zend.c - tests/bug33802.phpt - tests/bug33802.phpt - tests/bug33802.phpt: - Fixed bug #33802 (throw Exception in error handler causes crash) - -2005-07-21 Marcus Boerger - - * zend_execute_API.c: - - Fix error generation logic (found by johannes) - -2005-07-21 Dmitry Stogov - - * zend_vm_def.h: - Fixed bug with returning from internal function by reference - -2005-07-19 Marcus Boerger - - * zend_interfaces.c: - - Dont't warn in case an exception is pending - in this case it'd - superflous - -2005-07-19 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_execute.c - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug #33710 (ArrayAccess objects doen't initialize $this) - -2005-07-18 Rasmus Lerdorf - - * zend_language_scanner.l: - Valgrind is unhappy that this is not initialized - -2005-07-18 Dmitry Stogov - - * zend_API.c - zend_API.h: - Fixed bug in new module statrup mechanism - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33558.phpt: - Fixed bug #33558 (warning with nested calls to functions returning by - reference) - - * tests/bug33558.phpt - tests/bug33558.phpt: - - Fixed bug #33558 (warning with nested calls to functions returning by - reference) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Removed some compilation warnings. - -2005-07-18 Jani Taskinen - - * tests/bug33710.phpt: - typo - -2005-07-17 Marcus Boerger - - * tests/bug33710.phpt: - - Add new test - -2005-07-17 Ilia Alshanetsky - - * zend_compile.c: - Added missing init. - -2005-07-14 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b3) - zend.h: - - Beta 3 - -2005-07-12 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b3) - zend.h: - - Beta 3 - -2005-07-12 Dmitry Stogov - - * (php_5_1_0b3) - zend_execute_API.c - zend_execute_API.c: - Fixed bug #33156 (cygwin version of setitimer doesn't accept ITIMER_PROF). - (Nuno) - -2005-07-11 Ilia Alshanetsky - - * zend_vm_def.h - zend_vm_execute.h: - Make references misuse emit E_NOTICE rather E_STRICT to be compatible with - PHP 4.4.0 - -2005-07-08 Jani Taskinen - - * tests/unset_cv05.phpt - tests/unset_cv06.phpt: - fix test when session.save_handler is "user" - -2005-07-07 Dmitry Stogov - - * zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_objects.c - zend_reflection_api.c: - Fixed bug #33512 (Add missing support for isset()/unset() overloading to - complement the property get/set methods) - -2005-07-07 Anantha Kesari H Y - - * zend_stream.c - zend_stream.c: - zend_stream_getc uses fread internally. NetWare LibC fread reads 4(Which I - believe EOT) for EOF(^D) character. This happens when fread is asked to - read one and only character as is the case with cl interactive mode. - -- Kamesh - -2005-07-07 Dmitry Stogov - - * zend_execute_API.c - zend_hash.c - zend_hash.h - tests/bug28072.phpt: - Fixed bug #28072 (static array with some constant keys will be incorrectly - ordered). - -2005-07-04 Dmitry Stogov - - * zend_compile.h - zend_execute.c - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed SIGSEGV on 'global ${"{$blah}_ID"};' - - * zend_API.h - zend_execute_API.c: - Fixed bug #31158 (array_splice on $GLOBALS crashes) - -2005-07-03 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed memory leak - -2005-06-30 Dmitry Stogov - - * zend_API.c - zend_API.h: - Restored old behavior of zend_statup_module() - -2005-06-29 Stanislav Malyshev - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h: - fix conditions for freeing - - * zend_API.c - zend_API.c: - add comment - - * (PHP_5_0) - zend_execute.c: - fix conditions - -2005-06-28 Antony Dovgal - - * zend_execute.c: - fix leak: when dup was ful zend_std_object_get_class_name() - returns SUCCESS aka 0 - -2005-06-28 Stanislav Malyshev - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h: - fix previous patch - - * zend_vm_execute.h: - update - - * zend_execute.c - zend_vm_def.h: - fixes for non-php objects - - * (PHP_5_0) - zend_execute.c: - fixes fo rnon-php objects (John Coggeshall) - -2005-06-27 Jani Taskinen - - * zend.c: - - Fixed bug #31358 (Older GCC versions do not provide portable va_copy()). - -2005-06-27 Stanislav Malyshev - - * zend_API.c - zend_API.c - zend_API.h - zend_API.h - zend_builtin_functions.c - zend_builtin_functions.c - zend_exceptions.c - zend_exceptions.c: - fix various "Class entry requested for an object without PHP class" - messages - when working with non-PHP objects. - -2005-06-27 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed SIGSEGV on assigment string offset by reference - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed wrong include/requre occurrences in debug backtrace. - -2005-06-24 Dmitry Stogov - - * zend_execute.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Export zend_do_fcall() helper from executor - - * zend_compile.c - zend_compile.c: - Partial fix for bug #26584 (Class member - array key overflow) - It doesn't fix integer overflow problem, but allows null, boolean and - double keys in array constants in the same way as in runtime. - - * tests/bug30519.phpt - tests/bug30519.phpt: - - Fixed bug #30519 (Interface not existing says Class not found) - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_execute_API.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30519.phpt: - Fixed bug #30519 (Interface not existing says Class not found) - -2005-06-23 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug28377.phpt: - Fixed bug #28377 (debug_backtrace is intermittently passing args) - - * tests/bug28377.phpt - tests/bug28377.phpt: - - file bug28377.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32660.phpt: - Fixed bug #32660 (Assignment by reference causes crash when field access is - overloaded (__get)) - - * tests/bug32660.phpt - tests/bug32660.phpt: - - Fixed bug #32660 (Assignment by reference causes crash when field access - is overloaded (__get)) - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug30828.phpt: - Fixed bug #30828 (debug_backtrace() reports incorrect class in overridden - methods) - - * tests/bug30828.phpt - tests/bug30828.phpt: - - file bug30828.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - tests/bug27268.phpt: - Test for bug #27268. It is fixed in HEAD but not in PHP_5_0. - - * zend_execute.c - tests/bug27268.phpt - tests/bug27268.phpt: - Fixed bug #27268 (Bad references accentuated by clone). - -2005-06-23 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - Beta 2 - -2005-06-22 Dmitry Stogov - - * (php_5_1_0b2) - zend_builtin_functions.c - zend_builtin_functions.c - zend_execute_API.c - zend_execute_API.c - tests/bug29896.phpt: - Fixed bug #29896 (Backtrace argument list out of sync) - - * tests/bug29896.phpt - tests/bug29896.phpt: - - file bug29896.phpt was initially added on branch PHP_5_0. - -2005-06-22 Stanislav Malyshev - - * (php_5_1_0b2) - zend_vm.h - zend_vm_execute.h - zend_vm_gen.php: - export zend_vm_set_opcode_handler - -2005-06-22 Antony Dovgal - - * (php_5_1_0b2) - zend_ini.c: - - allow to use "yes" and "true" with ini_set() and in commandline (through - -d flag) - - fix #15854 that was caused by wrong consideration that - zend_ini_boolean_displayer_cb() - always recieves converted to "0"/"1" values. - -2005-06-22 Dmitry Stogov - - * (php_5_1_0b2) - zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33257.phpt: - Fixed bug #33257 (array_splice() inconsistent when passed function instead - of variable) - - * tests/bug33257.phpt - tests/bug33257.phpt: - - file bug33257.phpt was initially added on branch PHP_5_0. - -2005-06-22 Jani Taskinen - - * (php_5_1_0b2) - tests/unset_cv05.phpt - tests/unset_cv06.phpt: - fix tests - -2005-06-21 Dmitry Stogov - - * tests/unset_cv07.phpt: - Fixed test file - -2005-06-21 Andi Gutmans - - * zend.h: - - Back to -dev. Guys (n' Girls), give at least 1 hour before you start - - complaining about not going back to -dev. I like checking the tarball - - before I change it back. - - * (php_5_1_0b2) - zend.h: - - Take #3 :) - -2005-06-21 Ilia Alshanetsky - - * (php_5_1_0b2) - zend_reflection_api.c: - Fixed memory leak. - - -2005-06-21 Dmitry Stogov - - * (PHP_5_0) - zend_compile.c: - Remove unnecessary ZEND_FETCH_CLASS together with - ZEND_DECLARE_INHERITED_CLASS - in case of early binding - - * (php_5_1_0b2) - zend_compile.c: - Remove unnecessary ZEND_FETCH_CLASS together with - ZEND_DECLARE_INHERITED_CLASS in case of early binding - -2005-06-20 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - Beta 2 - -2005-06-20 Dmitry Stogov - - * (php_5_1_0b2) - zend_object_handlers.c - zend_object_handlers.c: - Fixed possible crash on $x = $obj->$non_string - -2005-06-20 Marcus Boerger - - * (php_5_1_0b2) - zend_reflection_api.c: - - Fix bug #33389 by fixing copying - - * zend_reflection_api.c: - - Show true/flase - -2005-06-19 Derick Rethans - - * tests/bug32226.phpt: - - Fixed layout of test description. - -2005-06-17 Jani Taskinen - - * tests/bug29368.phpt - tests/bug30856.phpt - tests/bug30961.phpt - tests/bug31720.phpt - tests/bug32226.phpt - tests/bug33277.phpt: - No short-tags! - -2005-06-17 Dmitry Stogov - - * zend_compile.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Removed EX(fbc_constructor) (it is no longer needed) - -2005-06-17 Antony Dovgal - - * (PHP_5_0) - zend_API.c - zend_list.c: - MFH: improve error messages in internal classes - - * zend_API.c - zend_list.c: - improve error messages when error raised from an internal class (do not - hide class name) - -2005-06-17 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c: - Fixed bug #33277 (private method accessed by child class) - -2005-06-17 Antony Dovgal - - * zend_hash.c: - fix bug #33382 (array_reverse() fails after *sort()) - no need to MFH - the bug existed only in HEAD - -2005-06-17 Dmitry Stogov - - * zend_API.c - zend_API.h - zend_extensions.h - zend_modules.h: - Improved PHP extension loading mechanism with support for module - dependencies and conflicts. - -2005-06-16 Marcus Boerger - - * zend_reflection_api.c: - - Internal functions/methods can now return by reference - - * zend_execute.c: - - Fix TSRM build - -2005-06-16 Dmitry Stogov - - * bench.php: - typo - - * zend.h - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_extensions.h - zend_modules.h - zend_object_handlers.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Allowed return by refrence from internal functions - -2005-06-16 Stanislav Malyshev - - * zend_execute.c - zend_execute.h: - rename to zend_ - -2005-06-16 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug33318.phpt: - Fixed bug #33318 (throw 1; results in Invalid opcode 108/1/8) - -2005-06-16 Zeev Suraski - - * zend_language_scanner.l: - Fixlet - -2005-06-16 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Compilation warnings - - * zend_compile.c - zend_compile.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - ZEND_UNSET_DIM_OBJ is splitted to ZEND_UNSET_DIM and ZEND_UNSET_OBJ. - -2005-06-16 Stanislav Malyshev - - * zend_execute.c - zend_execute.h: - export zval getters - -2005-06-16 Dmitry Stogov - - * zend_execute.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - USER_OPCODE API is improvet. - Implemented ability to dispatch from user handler to internal handler of - another opcode. - -2005-06-15 Dmitry Stogov - - * zend.c - zend.h: - Fixed OS X compatibility - -2005-06-15 Jani Taskinen - - * tests/bug32428.phpt: - typofix - -2005-06-14 Ilia Alshanetsky - - * bench.php: - more accurate timing function. - -2005-06-14 Dmitry Stogov - - * zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Removed old executor - -2005-06-14 Jani Taskinen - - * Zend.m4: - reordered + added msg to configure output for PHP_ZEND_VM - - * Zend.m4: - typofix - - * Zend.m4 - acinclude.m4: - fix standalone build - -2005-06-13 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Specializer optimization - - * zend.c - zend.h - zend_execute.c: - Fixed bug #33212 ([GCC 4]: 'zend_error_noreturn' aliased to external symbol - 'zend_error'). - The fix is not tested on Solaris and DARWIN! - - * zend_reflection_api.c - tests/bug33312.phpt: - Fixed bug #33312 (ReflectionParameter methods do not work correctly) - -2005-06-11 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b2) - zend.h: - - b2 (will post it to internals@) - -2005-06-10 Andi Gutmans - - * zend.h: - - Back to -dev - - * (php_5_1_0b1) - zend.h: - - Go with 5.1.0b1 - -2005-06-10 Dmitry Stogov - - * (php_5_1_0b1) - tests/bug30162.phpt: - Added test for bug #30162 (it is already fixed but test file was forgotten) - - * (php_5_1_0b1) - tests/bug31177.phpt: - Added test file for bug #31177 (not fixed yet) - - * tests/bug31177.phpt - tests/bug31177.phpt: - - file bug31177.phpt was initially added on branch PHP_5_0. - - * (php_5_1_0b1) - tests/bug29689.phpt: - typos - - * (php_5_1_0b1) - zend_reflection_api.c - zend_reflection_api.c: - Fixed support for ZEND_ACC_SHADOW in ReflectionProperty constructor - - * (php_5_1_0b1) - zend_execute.c - zend_execute.h - zend_extensions.h - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - Fix so that extensions like xdebug, can overload opcodes in all execution - modes including goto/switch - - * (php_5_1_0b1) - zend_compile.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Merge three opcodes (ZEND_NEW, ZEND_JMP_NO_CTOR, ZEND_INIT_CTOR) into one - (ZEND_NEW). There was no real reason for this anymore and API should be - changed before 5.1 - -2005-06-09 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_reflection_api.c - tests/bug29689.phpt: - MF50: fix #29689 and more private property problems - - * tests/bug33277.phpt: - add test for this TBF bug - - * zend_compile.c: - disallow abstrace private methods - - * (PHP_5_0) - zend_compile.c: - Disallow abstract privae methods - - * (PHP_5_0) - zend_compile.c - zend_compile.h - zend_object_handlers.c - zend_reflection_api.c - tests/bug29689.phpt: - fix #29689 and more private property problems - -2005-06-09 Dmitry Stogov - - * zend.c - zend.c - zend_execute_API.c - zend_execute_API.c: - Fixed double call to php_stream_close() on compiler errors - -2005-06-09 Stanislav Malyshev - - * tests/bug33277.phpt - tests/bug33277.phpt: - - file bug33277.phpt was initially added on branch PHP_5_0. - -2005-06-09 Dmitry Stogov - - * zend.c - zend.c: - Fixed bug #25922 (In error handler, modifying 5th arg (errcontext) may - result in seg fault) - - * zend_language_scanner.l - zend_language_scanner.l: - Fixed bug (Crash on Windows and ZTS) that was introduced with fix for bug - #26456 - -2005-06-08 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed exception handling in getIterator() callback (bugs #26229 & #30725) - - * zend_compile.c - zend_compile.c: - Fixed valgrind errors - - * zend_reflection_api.c: - Fixed ReflectionClass::setStaticPropertyValue() - -2005-06-08 Jani Taskinen - - * zend_config.w32.h: - Hopefully fixes win32 builds - -2005-06-08 Dmitry Stogov - - * zend_compile.c: - Fixed lookups for previos opcodes - - * zend_execute_API.c - zend_execute_API.c - tests/bug30140.phpt: - Fixed bug #30140 (Problem with array in static properties) - - * tests/bug30140.phpt - tests/bug30140.phpt: - - file bug30140.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - tests/bug32322.phpt: - Added test for bug #32322 (Return values by reference broken( using - self::),example singleton instance) - - * tests/bug32322.phpt - tests/bug32322.phpt: - - Added test for bug #32322 (Return values by reference broken( using - self::),example singleton instance) - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug30820.phpt: - Fixed bug #30820 (static member conflict with $this->member silently - ignored) - - * tests/bug30820.phpt - tests/bug30820.phpt: - - file bug30820.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - zend_compile.c - zend_language_parser.y - zend_language_parser.y - tests/bug30961.phpt: - Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) - - * tests/bug30961.phpt - tests/bug30961.phpt: - - file bug30961.phpt was initially added on branch PHP_5_0. - -2005-06-07 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_language_scanner.l - zend_language_scanner.l: - Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when - called via STDIN) - -2005-06-07 Jani Taskinen - - * Zend.m4: - -Moved --disable-zend-memory-manager where it belongs - - * acinclude.m4: - - Show "none" when nothing is found - -2005-06-07 Ilia Alshanetsky - - * zend_objects.c: - Fixed ZTS build. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Added the --disable-zend-memory-manager switch to disable the Zend - memory manager. - - * zend_alloc.h: - - Added the --disable-zend-memory-manager switch to disable the Zend memory - manager. - -2005-06-07 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed memory leak in debug_print_backtrace() - - * zend_execute.c - zend_execute.c: - fixed memory leak in bug #28972 ([] operator overflow treatment is - incorrect), not the bug itself. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - MF44: Problems with user defined error handler and references - -2005-06-07 Dmitry Stogov - - * zend_objects.c - zend_objects.c - tests/bug33243.phpt: - Fixed bug #33243 (ze1_compatibility_mode does not work as expected) - - * tests/bug33243.phpt - tests/bug33243.phpt: - - file bug33243.phpt was initially added on branch PHP_5_0. - -2005-06-07 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_compile.h - zend_compile.h - zend_language_scanner.l - zend_language_scanner.l: - Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when - called via STDIN) - -2005-06-07 Jani Taskinen - - * Zend.m4: - -Moved --disable-zend-memory-manager where it belongs - - * acinclude.m4: - - Show "none" when nothing is found - -2005-06-07 Ilia Alshanetsky - - * zend_objects.c: - Fixed ZTS build. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Added the --disable-zend-memory-manager switch to disable the Zend - memory manager. - - * zend_alloc.h: - - Added the --disable-zend-memory-manager switch to disable the Zend memory - manager. - -2005-06-07 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fixed memory leak in debug_print_backtrace() - - * zend_execute.c - zend_execute.c: - fixed memory leak in bug #28972 ([] operator overflow treatment is - incorrect), not the bug itself. - -2005-06-07 Derick Rethans - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - MF44: Problems with user defined error handler and references - -2005-06-07 Dmitry Stogov - - * zend_objects.c - zend_objects.c - tests/bug33243.phpt: - Fixed bug #33243 (ze1_compatibility_mode does not work as expected) - - * tests/bug33243.phpt - tests/bug33243.phpt: - - file bug33243.phpt was initially added on branch PHP_5_0. - -2005-06-06 Derick Rethans - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - Regenerate VM files and add warning about regeneration - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h: - - MH44: Problems with user defined error handler and wrong usage of - references - -2005-06-06 Dmitry Stogov - - * zend_compile.c - tests/bug32428.phpt: - Fixed bug #32428 (The @ warning error supression operator is broken) - - * zend_objects_API.c - zend_objects_API.c - tests/bug32799.phpt: - Fixed bug #32799 (crash: calling the corresponding global var during the - destruct) - - * tests/bug32799.phpt - tests/bug32799.phpt: - - file bug32799.phpt was initially added on branch PHP_5_0. - - * tests/bug32596.phpt: - Added test for bug #32596 (Segfault/Memory Leak by getClass (etc) in - __destruct) - - * tests/bug32596.phpt - tests/bug32596.phpt: - - file bug32596.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute_API.c: - Fixed bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct) - - * (PHP_5_0) - tests/bug32993.phpt: - Added test for bug #32993 (implemented Iterator function current() don't - throw - exception) - - * tests/bug32993.phpt - tests/bug32993.phpt: - - Fixed bug #32993 (implemented Iterator function current() don't throw - exception) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug #32993 (implemented Iterator function current() don't throw - exception) - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug33171.phpt: - Fixed bug #33171 (foreach enumerates private fields declared in base - classes) - - * tests/bug33171.phpt - tests/bug33171.phpt: - - file bug33171.phpt was initially added on branch PHP_5_0. - -2005-06-06 Wez Furlong - - * zend_language_scanner.l: - Avoid double-freeing streams. - This can happen because all streams are registered as resources; - the engine also tracks them in the open_files global. - - Avoid the potential for double-freeing by simply making streams exposed to - the - engine have no closer for the engine to call; they will already be in the - resource list, and thus will be shut down properly at request end. - -2005-06-04 Zeev Suraski - - * zend_compile.h - zend_language_parser.y - zend_language_scanner.l - zend_stream.c - zend_stream.h - tests/halt01.phpt - tests/halt02.phpt - tests/halt03.phpt: - Thought I committed it ages ago... Anyway, without further delays, the - final - __halt_compiler() patch - -2005-06-03 Dmitry Stogov - - * tests/bug30394.phpt: - Added test for 5.0 specific bug #30394 (Assignment operators yield wrong - result with __get/__set) - - * (PHP_5_0) - zend.c - zend_execute_API.c - tests/bug30394.phpt - tests/bug30394.phpt: - Fixed bug #30394 (Assignment operators yield wrong result with __get/__set) - - * zend_compile.c - zend_compile.c - tests/bug30080.phpt: - Fixed bug #30080 (Passing array or non array of objects) - - * tests/bug30080.phpt - tests/bug30080.phpt: - - file bug30080.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - zend_compile.c - zend_execute.c - tests/bug27598.phpt: - Fixed bug #27598 (list() array key assignment causes HUGE memory leak) - - * tests/bug27598.phpt - tests/bug27598.phpt: - - file bug27598.phpt was initially added on branch PHP_5_0. - - * zend_execute.c - zend_object_handlers.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/object_handlers.phpt: - Fixed memory allocation bugs related to magic object handlers (__get(), - __set(), - ...) - - * tests/object_handlers.phpt - tests/object_handlers.phpt: - - file object_handlers.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_object_handlers.c: - Fixed memory allocation bugs related to magic object handlers (__get(), - __set(), ...) - -2005-06-01 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug30791.phpt: - Fixed bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call - if object is overloaded) - - * tests/bug30791.phpt - tests/bug30791.phpt: - - file bug30791.phpt was initially added on branch PHP_5_0. - -2005-05-31 Magnus Määttä - - * tests/bug27304.phpt: - Fix test - -2005-05-31 Dmitry Stogov - - * zend_operators.c: - Reverted wrong fix for bug #30572. - Seems the bug was already fixed in other way. - But reverted patch produced a lot of valgrind errors, because IS_TMP_VAR - operands don't initialize refcount. - -2005-05-31 Marcus Boerger - - * zend_compile.c: - - Only allow changing return ref agnostic when a script method overrides an - internal method (found by dmitry) - -2005-05-29 Jani Taskinen - - * Zend.m4: - - Unify the "configure --help" texts - -2005-05-29 Hartmut Holzgraefe - - * acinclude.m4: - forgot to re-add 1.875 as a valid bison version after testing - - * acinclude.m4: - bison may be installed under a different executable name, e.g. - - YACC="bison-1.75" configure ... - - removing the check for "bison -y" allows for this - the check was redundant anyway as the following one filters - for "GNU Bison" in the --version output - - * Zend.m4 - acinclude.m4: - avoid code duplication in bison version test - -2005-05-28 Marcus Boerger - - * zend_compile.c - zend_compile.h: - - Make zend_do_inheritance ZEND_API - -2005-05-27 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug22836.phpt - tests/bug22836.phpt: - Fixed bug #22836 (returning reference to uninitialized variable) - -2005-05-26 Dmitry Stogov - - * (PHP_5_0) - zend_execute_API.c - tests/bug33116.phpt: - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload) - - * tests/bug33116.phpt - tests/bug33116.phpt: - - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload). - - * zend_execute_API.c: - Fixed bug #33116 (crash when assigning class name to global variable in - __autoload). - - * zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_reflection_api.c - tests/array_type_hint_001.phpt: - Added array type hinting. (This patch requires full re-make) - -2005-05-26 Marcus Boerger - - * (PHP_5_0) - tests/bug27304.phpt - tests/bug32981.phpt: - - Add new tests - - * tests/bug27304.phpt - tests/bug27304.phpt - tests/bug32981.phpt - tests/bug32981.phpt: - - - Add new tests - -2005-05-22 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #29338 (unencoded spaces get ignored after certain tags). - - * zend_highlight.c: - Fixed bug #29338 (unencoded spaces get ignored after certain tags). - -2005-05-22 Stanislav Malyshev - - * zend.c - zend.c: - fix leak - -2005-05-19 Dmitry Stogov - - * (PHP_5_0) - zend_object_handlers.c: - Backported fix for bug #30451 - - * tests/bug31828.phpt - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32080.phpt: - Strict warnings - -2005-05-18 Stanislav Malyshev - - * zend.c - zend.c: - fix for #29890 - part 2 - - * (PHP_5_0) - tests/bug29890.phpt: - test - - * tests/bug29890.phpt - tests/bug29890.phpt: - - test - - * zend_execute_API.c - zend_execute_API.c: - fix #29890 - crash when function call fails - - * zend_object_handlers.c: - revert - seems to be fixed elsewhere - - * zend_object_handlers.c: - fix #30451 static properties don't work properly - - * tests/bug29689.phpt - tests/bug30451.phpt: - tests - - * tests/bug29689.phpt - tests/bug29689.phpt - tests/bug30451.phpt - tests/bug30451.phpt: - - file bug29689.phpt was initially added on branch PHP_5_0. - -2005-05-17 Magnus Määttä - - * tests/bug31828.phpt - tests/bug32080.phpt: - Fix tests. - -2005-05-13 Antony Dovgal - - * (PHP_5_0) - zend.c: - MFH: fix bug #29975 (memory leaks when set_error_handler() is used inside - error handler) - - * zend.c: - fix bug #29975 (memory leaks when set_error_handler() is used inside error - handler) - -2005-05-12 Marcus Boerger - - * zend_reflection_api.c: - - Make ReflectionObject::hasProperty() recognize dynamically added props - -2005-05-06 Jani Taskinen - - * zend_object_handlers.h: - typofix :) - -2005-05-05 Dmitry Stogov - - * zend_compile.c - zend_compile.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31525.phpt: - Fixed bug #31525 (object reference being dropped. $this getting lost) - - * tests/bug31525.phpt - tests/bug31525.phpt: - - file bug31525.phpt was initially added on branch PHP_5_0. - -2005-05-04 Stanislav Malyshev - - * zend.c: - fix bug #32924: prepend does not add file to included files - - * (PHP_5_0) - zend_execute.c: - clarify some magic - -2005-05-04 Dmitry Stogov - - * zend_execute.c: - Fixed bug #30641 (Compile error: error: symbol "zend_error" is used but not - defined) - - * tests/bug30707.phpt - tests/bug30707.phpt: - - file bug30707.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30707.phpt: - Fixed bug #30707 (Segmentation fault on exception in method) - - * (PHP_5_0) - zend_execute.c: - ws - - * tests/bug30162.phpt - tests/bug30162.phpt: - - file bug30162.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30161.phpt: - Fixed bug #30162 (Catching exception in constructor couses lose of $this) - -2005-05-03 Dmitry Stogov - - * tests/unset_cv07.phpt: - Fixed notice message - -2005-05-03 Marcus Boerger - - * (PHP_5_0) - tests/bug32252.phpt: - - Add test - -2005-05-03 Dmitry Stogov - - * zend_object_handlers.c: - Fixed destruction of zval after returning from __call() - - * zend_builtin_functions.c - zend_builtin_functions.c - tests/bug32296.phpt: - Fixed bug #32296 (get_class_methods output has changed between 5.0.2 and - 5.0.3) - Now get_class_methods() shows accessible private and protected methods if - it is called from class scope. - - * tests/bug32296.phpt - tests/bug32296.phpt: - - file bug32296.phpt was initially added on branch PHP_5_0. - -2005-05-02 Marcus Boerger - - * zend_builtin_functions.c - zend_object_handlers.c - zend_object_handlers.h: - - Extend API to support real existance test without the need to add any new - functions or change any behavior - - * zend_execute_API.c: - - Part 2 of #30126: Enhancement for error message for abstract classes - - * zend_execute_API.c: - - Part 1 of #30126: Enhancement for error message for abstract classes - -2005-04-29 Jani Taskinen - - * zend_object_handlers.c: - compile fix - - * tests/bug30332.phpt - tests/bug32852.phpt: - Make sure E_STRICT is set always - -2005-04-29 Dmitry Stogov - - * zend_API.c - zend_API.c - tests/bug30332.phpt: - Fixed bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with - array_push()) - - * tests/bug30332.phpt - tests/bug30332.phpt: - - file bug30332.phpt was initially added on branch PHP_5_0. - - * zend_execute.c - zend_execute.c - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32852.phpt: - Fixed bug #32852 (Crash with singleton and __destruct when - zend.ze1_compatibility_mode = On) - Fixed bug #31828 (Crash with zend.ze1_compatibility_mode=On) - Fixed bug #32080 (segfault when assigning object to itself with - zend.ze1_compatibility_mode=On) - - * tests/bug31828.phpt - tests/bug31828.phpt - tests/bug32080.phpt - tests/bug32080.phpt - tests/bug32852.phpt - tests/bug32852.phpt: - - file bug31828.phpt was initially added on branch PHP_5_0. - -2005-04-29 Jani Taskinen - - * tests/bug22836.phpt - tests/bug27641.phpt: - - Unify error_reporting setting + make sure E_STRICT is set when wanted - -2005-04-28 Dmitry Stogov - - * zend_object_handlers.c - zend_object_handlers.c - tests/bug29015.phpt: - Fixed bug #29015 (Incorrect behavior of member vars(non string - ones)-numeric mem vars und others) - - * tests/bug29015.phpt - tests/bug29015.phpt: - - file bug29015.phpt was initially added on branch PHP_5_0. - -2005-04-27 Dmitry Stogov - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h - tests/bug29210.phpt: - Fixed bug #29210 (Function: is_callable - no support for private and - protected classes) - - * (PHP_5_0) - zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h - tests/bug29210.phpt - tests/bug29210.phpt: - Fixed bug #29210 (Function: is_callable - no support for private and - protected classes). - - * zend_compile.c - zend_compile.c - tests/bug29104.phpt - tests/bug29104.phpt - tests/bug29104.phpt: - Fixed bug #29104 (Function declaration in method doesn't work) - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32833.phpt: - Fixed bug #32833 (Invalid opcode) - - * tests/bug32674.phpt - tests/bug32674.phpt: - - file bug32674.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug32674.phpt: - Fixed bug #32674 (exception in iterator causes crash) - -2005-04-26 Dmitry Stogov - - * tests/bug30889.phpt - tests/bug30889.phpt: - - file bug30889.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30889.phpt: - Fixed bug #30889 (Conflict between __get/__set and ++ operator) - - * tests/bug32429.phpt: - fix - - * zend_API.c - zend_API.c - tests/bug30702.phpt: - Fixed bug #30702 (cannot initialize class variable from class constant) - - * tests/bug30702.phpt - tests/bug30702.phpt: - - file bug30702.phpt was initially added on branch PHP_5_0. - - * zend_compile.c - tests/bug32427.phpt: - Fixed bug #32427 (Interfaces are not allowed 'static' access modifier). - - * zend_builtin_functions.c - tests/bug32429.phpt: - Fixed bug #32429 (method_exists() always return TRUE if __call method - exists) - -2005-04-25 Andrei Zmievski - - * zend_object_handlers.c: - Reverting. Let's not introduce major BC breakage like this without a - good reason. - -2005-04-25 Dmitry Stogov - - * tests/bug29944.phpt - tests/bug29944.phpt: - - Fixed bug #29944 (Function defined in switch, crashes). - - * zend_compile.c - zend_compile.c - tests/bug29944.phpt: - Fixed bug #29944 (Function defined in switch, crashes). - -2005-04-25 Jani Taskinen - - * zend_hash.c: - ws - -2005-04-25 Dmitry Stogov - - * zend_hash.c: - Fixed call to estrndup() with invalid length - - * (PHP_5_0) - zend_hash.c: - Fixed call to estrndup() with invalid lengt - -2005-04-25 Sebastian Bergmann - - * zend_reflection_api.c: - Correct grammar. - -2005-04-24 Marcus Boerger - - * zend_compile.c: - - Need to copy doc comments correct for properties - -2005-04-23 Marcus Boerger - - * tests/bug29674.phpt - tests/bug30161.phpt - tests/bug30346.phpt: - - Add new tests - -2005-04-21 Jani Taskinen - - * tests/unset_cv05.phpt: - Fix test when register_long_arrays is off in your php.ini - -2005-04-19 Marcus Boerger - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_reflection_api.c: - - Add ReflectionProperty::getDocComment() - -2005-04-19 Jani Taskinen - - * zend_compile.c - zend_exceptions.c: - No c++ comments in C code - -2005-04-18 Dmitry Stogov - - * zend_builtin_functions.c - zend_builtin_functions.c - zend_execute.c: - Fixed memory leak in debug_backtrace() - -2005-04-17 Marcus Boerger - - * zend_builtin_functions.c: - - Fix special cases of property_exists() - - * zend_object_handlers.c: - - Fix logic - -2005-04-16 Sara Golemon - - * tests/method_exists.phpt: - method_exists() regression test - - * zend_builtin_functions.c: - Fix method_exists(), pce is fetched, but ce is used - -2005-04-15 Marcus Boerger - - * zend_builtin_functions.c: - - Fix even though we already know that the function will be renamed - -2005-04-15 Andrei Zmievski - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fix certain operations to stop relying on presence of read_property and - write_property handlers. They may be NULL'ed out by certain objects - pretending to be pure arrays, for example. Do checks first. - -2005-04-12 Stanislav Malyshev - - * zend_ini.c: - fix memory corruption if one on the on_modify handlers errors out - - * (PHP_5_0) - zend_ini.c: - fi memory corruption if one on the on_modify handlers errors out - -2005-04-08 Marcus Boerger - - * zend_operators.c: - - Fix memory corruption found by rob - - * tests/bug22836.phpt: - - Ensure we see all errors. No need for () in return - - * zend_builtin_functions.c: - - Add property_exits() - - * zend_object_handlers.c: - - No E_ERROR when we just check (where did my 0->1 change go on first - commit?) - - * zend_object_handlers.c: - - No E_ERROR when we just check, here visibility simply means there is none - - * zend_object_handlers.c - zend_object_handlers.h: - - Simplify getting property info and make it an api function - -2005-04-07 Jani Taskinen - - * zend_alloc.c - zend_alloc.h: - - Nuke the code duplication - - * zend_alloc.h: - Fix build when USE_ZEND_ALLOC is 0 - -2005-04-07 Zeev Suraski - - * (PHP_5_0) - zend_alloc.c - zend_alloc.h: - MFH (Fix strdup() bug when USE_ZEND_ALLOC was disabled) - - * zend_alloc.c - zend_alloc.h: - Fix strdup() bug when USE_ZEND_ALLOC is disabled - -2005-04-05 Marcus Boerger - - * zend_interfaces.c: - - Just return FAILURE & allow NULL without emmidiate error - -2005-04-04 Stanislav Malyshev - - * zend_builtin_functions.c: - MF50: fix backtraces - non-Zend classes have names too - - * (PHP_5_0) - zend_builtin_functions.c: - fix backtraces - non-Zend classes have names too - -2005-04-03 Jani Taskinen - - * (PHP_5_0) - zend_execute_API.c: - MFH: - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)). - MFH: (kameshj at fastmail dot fm) - -2005-03-31 Derick Rethans - - * (PHP_5_0) - zend_API.c: - - MFH: internal_function->fn_flags is not initialized at this point - -2005-03-26 Jani Taskinen - - * zend_execute_API.c: - - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)) - (kameshj at fastmail dot fm) - -2005-03-24 Marcus Boerger - - * zend_vm_execute.h: - - Second part of removing temp solution - - * zend_vm_def.h: - - Remove potential bad solution for now - -2005-03-23 Andrei Zmievski - - * zend_execute.c: - Consolidate: call _get_zval_ptr_var() for IS_VAR case in - _get_zval_ptr(). - -2005-03-21 Andi Gutmans - - * (PHP_5_0) - zend_execute.c: - - Fix memset() bug (Joe Orton) - -2005-03-21 Andrei Zmievski - - * zend_API.c: - internal_function->fn_flags is not initialized at this point - -2005-03-20 Marcus Boerger - - * tests/bug31102.phpt: - - Added missing description (thanks jani) - - * tests/bug31102.phpt: - - Add new test - -2005-03-19 Marcus Boerger - - * zend_object_handlers.c: - - More fixes to gracefully act on exception thrown in overload methods - - * zend_object_handlers.c: - - Fix #31185 - - * zend_execute_API.c: - - Fix all incarnations of bug #30266 - -2005-03-19 Andi Gutmans - - * zend_interfaces.c - zend_interfaces.h: - - Fix typos - -2005-03-16 Wez Furlong - - * (PHP_5_0) - zend_API.c: - MFH: don't call rshutdown twice for dl()'d modules. - - * zend_API.c: - don't call rshutdown twice for dl()'d modules. - Spotted by Andrei. - -2005-03-15 Wez Furlong - - * zend.c - zend_API.c - zend_modules.h: - fix shutdown so that dl()'d modules are unloaded after all the dtors have - been called. - -2005-03-14 Zeev Suraski - - * zend_ini.c: - Clarify logic - -2005-03-14 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - ws - -2005-03-13 Stanislav Malyshev - - * zend_stream.c - zend_stream.c: - Do not convert ZEND_HANDLE_FP to ZEND_HANDLE_STREAM but allow using - reader/closer - on it - -2005-03-13 Marcus Boerger - - * zend_interfaces.c: - - More exact signatures (even though complete correct not possible atm) - -2005-03-13 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fix get_extension_funcs() - extension names are now lowercased, so should - be function arguments. - -2005-03-13 Marcus Boerger - - * zend_execute_API.c: - - Actually this is a much better error decription - - * zend_execute_API.c - tests/bug32290.phpt - tests/bug32290.phpt: - - Bugfix #32290 - -2005-03-12 Marcus Boerger - - * zend_vm_def.h - zend_vm_execute.h: - - If an exception is pending we don't bail out but show the unhandled - exception - -2005-03-11 Anantha Kesari H Y - - * (PHP_5_0) - acconfig.h: - NetWare LibC's sys/types.h does not include sys/select.h implicitly as it - is the case with Linux LibC - -2005-03-11 Marcus Boerger - - * tests/bug32252.phpt: - - Add new test - - * tests/bug27145.phpt - tests/bug27145.phpt: - - Irrelevant - - * zend_object_handlers.c: - - Don't touch refcount/is_ref - -2005-03-10 Marcus Boerger - - * tests/bug28442.phpt - tests/bug28442.phpt: - - - Bugfix #28442 - - * zend_compile.c: - - Bugfix #28442 - -2005-03-10 Anantha Kesari H Y - - * (PHP_5_0) - acconfig.h: - Autoconf based build can be used for NetWare - - * (PHP_5_0) - zend.h: - NetWare can make use of ./configure generated zend_config.h - - * (PHP_5_0) - Zend.m4: - This patch is needed for cross compilation to go through - -2005-03-10 Marcus Boerger - - * zend_vm_execute.h: - - #31562 2nd part - - * zend_vm_def.h: - - Fix #31562 - -2005-03-07 Marcus Boerger - - * zend.h - zend_compile.c - zend_interfaces.c - zend_interfaces.h: - - New Interface Serializeable - - Change signature of unserialize() callback to ease inheritance and - support code reuse of handlers - - * tests/bug32226.phpt - tests/bug32226.phpt: - - - Add updated description - - * zend_builtin_functions.c - tests/bug32226.phpt: - - Fix #32226 - -2005-03-07 Zeev Suraski - - * zend_language_scanner.l - zend_language_scanner.l: - Revert // patch - -2005-03-06 Marcus Boerger - - * zend_reflection_api.c: - - Fix by Tim - -2005-03-06 Jani Taskinen - - * zend_compile.c - zend_compile.c: - Fixed compile warning (bug #32046) - - * zend_mm.c: - Fix compile warning (bug #32047) - -2005-03-01 Marcus Boerger - - * zend_interfaces.c: - - Support statuc methods/functions - -2005-03-01 Jani Taskinen - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fixed bug #31672 ( not considered closing tag if - MFH: preceded by one-line comment) - - * zend_language_scanner.l: - Fix the fix for one line comments with tags - -2005-02-28 Marcus Boerger - - * zend_builtin_functions.c: - - Add support for methods dynamically added through object handlers - -2005-02-27 Marcus Boerger - - * zend_object_handlers.c: - - If silence if wanted we do not error out - - * zend_reflection_api.c: - - Add two new methods - - Fix signature, no need to cast it - - * zend_API.h: - - These must be initailized - - * zend_builtin_functions.c: - - Update method_exists to new handlers and allow first parameter as string - -2005-02-27 Jani Taskinen - - * Zend.m4: - - Cache the version check results - -2005-02-24 Andi Gutmans - - * zend_language_scanner.l: - - Make one line comments work the same with as with - - other tags. This will break scripts that have whitespace at the end - - of the closing tag but this is barely used as it is - - and I doubt ppl used whitespace. (patch by Jani) - - * zend_objects_API.h: - - This part of the patch was right - -2005-02-24 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - Fixed bug in ZEND_POST_INC/ZEND_POST_DEC handlers. - These opcodes assume IS_TMP_VAR as result. - -2005-02-24 Andi Gutmans - - * zend_modules.h: - - Need zend_Compile.h for struct _zend_arg_info definiton (thanks to Joe - Orton) - - * zend_objects.c - zend_objects.h - zend_objects_API.h: - - Revert following patch until we decide what is the right way to handle - - this: - - Fix signatures they are all meant to be able to deal with any type in - any - object storage (though we are still missing several parts) - -2005-02-23 Derick Rethans - - * (PHP_5_0) - zend_reflection_api.c: - - MFH: fixed bug #32076 (ReflectionMethod :: isDestructor() always return - true). - - * zend_reflection_api.c: - - Fixed bug #32076 (ReflectionMethod :: isDestructor() always return true) - (Patch by Antony Dogval) - -2005-02-23 Stanislav Malyshev - - * zend.h - zend_compile.c: - Custom object serializer infrastructure - -2005-02-23 Jani Taskinen - - * Zend.m4: - Hack the planet - -2005-02-23 Marcus Boerger - - * zend_interfaces.c: - - Allow to convert Traversable into Aggregate - -2005-02-22 Marcus Boerger - - * zend_objects_API.c: - - We cannot provide this fallback becuase it requires zend_object ptr's. - -2005-02-22 Jani Taskinen - - * Zend.m4: - Fix cross-compile - - * acconfig.h: - Fix build (it was #ifNdef NETWARE..) - -2005-02-22 Marcus Boerger - - * zend_objects.c - zend_objects.h - zend_objects_API.h: - - Fix signatures they are all meant to be able to deal with any type in any - object storage (though we are still missing several parts) - - * zend_objects_API.c: - - Force calling of dtors unless otherwise specified (fixes several - __destruct bugs) - -2005-02-22 Anantha Kesari H Y - - * zend.h: - NetWare can include autoconf generated config headers - - * acconfig.h: - NetWare can make use of the configure script generated header file. - -2005-02-21 Moriyoshi Koizumi - - * Makefile.am: - - Add missing entry. - -2005-02-20 Dmitry Stogov - - * zend_compile.c: - Fixed possible memory corruption - -2005-02-19 Rui Hirokawa - - * (PHP_5_0) - zend_language_scanner.l: - MFH: fixed #31987 zend-multibyte in ZTS. - - * zend_language_scanner.l: - fixed #31987 zend-multibyte in ZTS. - -2005-02-17 Marcus Boerger - - * zend_API.c: - - A little optimization to prevent problems when trying to reimplement an - interface inherited from an interfaces that was just implemented...... - - * zend_API.c: - - No C++ ruleZ here - - * zend_API.c: - - Actually we must do this in two steps: 1st resize the table and set all - interfaces, 2nd implement the interfaces - - * zend_API.c: - - Incrementation is done elsewhere - - * zend_API.c: - - Fix windows build (funny MS compiler) - -2005-02-17 Jani Taskinen - - * (PHP_5_0) - Zend.m4 - zend_strtod.c: - MFH: - Compile fix for systems without int32_t typedef - - * Zend.m4 - zend_strtod.c: - - Compile fix for systems without int32_t typedef - -2005-02-13 Marcus Boerger - - * zend_execute_API.c - zend_reflection_api.c: - - Be more gracious in reflection API - - * zend_language_scanner.l: - - Fix doc comment handling - -2005-02-12 Marcus Boerger - - * zend_execute_API.c: - - Bugfix #30682 (autoconversion from false/true to 0/1 missing in case of - static property default value) - -2005-02-11 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Cleanup foreach handling - -2005-02-10 Jani Taskinen - - * zend_strtod.c - zend_strtod.c: - - Fixed bug #31920 (zend_strtod.c error: conflicting types for 'int8_t') - -2005-02-10 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug30407.phpt: - Fixed bug #30407 (Strange behaviour of default arguments) - -2005-02-07 Dmitry Stogov - - * zend_compile.c: - Fixed bug introduced with foreach() optimization patch - - * zend_compile.c: - Fixed FE_RESET/FE_FETCH bug. - Now FE_RESET instruction takes jump-address from itself, not from the - following FE_FETCH instruction. - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - foreash($a as $key => $val) optimization - Removed temorary array creation on each iteration. - -2005-02-07 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Remove part of the cleanup which causes a problem with unnormal code - like tests/lang/040.phpt - -2005-02-06 Zeev Suraski - - * (PHP_5_0) - zend_ini_scanner.l: - Correct fix for #28803 - - * zend_ini_scanner.l: - Correct fix for #28804 - -2005-02-05 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h: - - Cleanup foreach statement - -2005-02-04 Hartmut Holzgraefe - - * zend_API.c - zend_API.h: - added some missing zend_[declare|update]_property_...() convenience - functions for bool, double and binary safe string data - -2005-02-03 Jani Taskinen - - * (PHP_5_0) - zend_ini_scanner.l: - MFH: Fixed bug #28804 (ini-file section parsing pattern is buggy). - - * zend_ini_scanner.l: - - Fixed bug #28804 (ini-file section parsing pattern is buggy). - - * zend_ini_scanner.l - zend_ini_scanner.l: - ws fix - -2005-02-02 Stanislav Malyshev - - * zend_execute_API.c: - Fix #31720 Invalid object callbacks not caught in array_walk() (patch - from Antony Dovgal) - - * tests/bug31720.phpt: - test for Bug #31720 - - * tests/bug31720.phpt - tests/bug31720.phpt: - - file bug31720.phpt was initially added on branch PHP_5_0. - - * (PHP_5_0) - zend_execute_API.c: - Fix #31720 Invalid object callbacks not caught in array_walk() (patch - from Antony Dovgal) - -2005-02-02 Dmitry Stogov - - * zend.h - zend.h - zend_object_handlers.c - zend_object_handlers.c - tests/bug31683.phpt: - Fixed bugs #29767 and #31683 (__get and __set methods must not modify - property name). - - * tests/bug31683.phpt - tests/bug31683.phpt: - - file bug31683.phpt was initially added on branch PHP_5_0. - -2005-02-01 Stanislav Malyshev - - * zend_builtin_functions.c - zend_builtin_functions.c: - Fix debug_trace with eval (patch from Antony Dovgal) - - * tests/bug_debug_backtrace.phpt: - test for eval debug_backtrace bug - - * tests/bug_debug_backtrace.phpt - tests/bug_debug_backtrace.phpt: - - file bug_debug_backtrace.phpt was initially added on branch PHP_5_0. - -2005-01-31 Marcus Boerger - - * zend_reflection_api.c: - - Add ReclectionClass:hasProperty(), ReflectionClass::hasConstant() - to complete api (johannes@php.net) - -2005-01-28 Marcus Boerger - - * zend_execute_API.c: - - Fix severity (found by johannes) - -2005-01-25 Jani Taskinen - - * zend.h: - New versions of glibc support a RTLD_DEEPBIND flag to dlopen. The - effect of this flag when loading a "foo.so" with undefined symbols is - that the search that symbol starts at foo.so and its dependencies - *before* the loading process' global symbol table. - - This is an effective workaround for symbol namespace collisions between - various modules and the libraries on which they depend (where fixing the - respective modules or libraries is not possible e.g. due to API - constraints). - - (By: Joe Orton) - -2005-01-25 Marcus Boerger - - * (PHP_5_0) - zend_execute.c - zend_interfaces.c - tests/bug26229.phpt: - - MFH #26229 (getIterator() segfaults when it returns arrays or scalars) - - * zend_interfaces.c - zend_vm_def.h - zend_vm_execute.h - tests/bug26229.phpt: - - Bugfix #26229 (getIterator() segfaults when it returns arrays or scalars) - - * Makefile.frag: - - Fix dependency - - * zend_vm_def.h - zend_vm_execute.h: - - Use correct freeing (thx Dmitry) - -2005-01-24 Marcus Boerger - - * zend_vm_def.h - zend_vm_execute.h - tests/bug30725.phpt: - - Second and last part of #30725 fix - - * zend_interfaces.c: - - Allow getIterator() to fail - - * tests/bug30725.phpt: - - - Add new test - -2005-01-22 Jani Taskinen - - * (PHP_5_0) - Zend.m4 - configure.in - zend_strtod.c: - MFH: Compile fix for systems without uint32_t typedef - - * Zend.m4 - configure.in - zend_strtod.c: - - Compile fix for systems without uint32_t typedef - -2005-01-22 Marcus Boerger - - * zend_API.c - zend_API.h - zend_reflection_api.c: - - Fix #31651 (ReflectionClass::getDefaultProperties segfaults with arrays.) - -2005-01-22 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: - - Two new API calls for Derick (retreive CV name and value) by Dmitry - -2005-01-20 Jani Taskinen - - * zend.h - zend_constants.c: - - Revert the weird change of ZEND_STRS() macro and use the correct - ZEND_STRL() macro. - -2005-01-19 Jani Taskinen - - * zend_object_handlers.c: - - Fixed bug #29183 (Undefined symbol zend_check_private with Solaris CC) - -2005-01-19 Marcus Boerger - - * zend_ini_parser.y: - - Fix memleak - -2005-01-18 Dmitry Stogov - - * zend_compile.c: - Fixed patch for bug #31478 (SegFault/Memory Leak with empty()) - - * zend_execute.c: - Fixed bug #28444 (Cannot access undefined property for object with - overloaded property access). - - * (PHP_5_0) - zend_execute.c: - Fixed bug #28444 (Cannot access undefined property for object with - overloaded property access). (Dmitry) - -2005-01-18 Ilia Alshanetsky - - * (PHP_5_0) - zend_operators.h: - MFH: Fixed bug #30726 (-.1 like numbers are not being handled correctly). - - * zend_operators.h: - Fixed bug #30726 (-.1 like numbers are not being handled correctly). - -2005-01-17 Jani Taskinen - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fixed bug #31444 (Memory leak in zend_language_scanner.c) - - * zend_language_scanner.l: - - Fixed bug #31444 (Memory leak in zend_language_scanner.c) - -2005-01-15 Andi Gutmans - - * (PHP_5_0) - zend_API.c: - - Fix WS - - * (PHP_5_0) - zend_API.c: - - Change to using DL_UNLOAD macro. - - * zend_API.c: - - Unload on MAC OS X (shouldn't be a reason not to) - -2005-01-14 Dmitry Stogov - - * zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31098.phpt: - Restore behavior of $str["str"]. (Now $str["str"] is equivalent to $str[0] - again) - - * (PHP_5_0) - tests/bug31098.phpt: - Path -> pattern - - * (PHP_5_0) - zend_execute.c - tests/bug31098.phpt: - Revert to old behavior of $str["str"]. ($str["str"] is equivalent of - $str[0]) - -2005-01-13 Dmitry Stogov - - * zend_execute.c - zend_execute.c: - Additional fix for fix of bug #29883 - -2005-01-12 Dmitry Stogov - - * zend_execute.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_opcodes.h - tests/bug31098.phpt - tests/bug31098.phpt: - Fixed bug #31098 (isset false positive) - -2005-01-11 Moriyoshi Koizumi - - * (PHP_5_0) - zend_execute.c - tests/bug31098.phpt: - - MFH: fix for bug #31098. - - * tests/bug31098.phpt - tests/bug31436.phpt: - - - Test renaming - - * zend_vm_execute.h - tests/bug31436.phpt: - - Fix bug #31436 (isset() incorrectly returns true in dereference of a - wrong type) - - * zend_compile.c: - - Fix bug #31478 (segfault with empty()) - -2005-01-10 Rasmus Lerdorf - - * zend.h - zend_API.c: - Fix OSX DL_UNLOAD macro and actually use it to make shared extensions - work on OSX. - -2005-01-10 Jani Taskinen - - * header - zend_arg_defs.c - zend_strtod.c - zend_vm_def.h - zend_vm_execute.h - zend_vm_gen.php - zend_vm_opcodes.h: - - Added missing header sections. - - * acinclude.m4 - configure.in: - - Added AC_ZEND_C_BIGENDIAN macro (as requested by Andi) - -2005-01-09 Jani Taskinen - - * (PHP_5_0) - zend.h: - MFH: - Fix outside-source-tree builds. Always include generated header - files - with #include to make sure the correct file is - used. - - * zend.h: - - Fix outside-source-tree builds. Always include generated header files - with #include to make sure the correct file is used. - - * zend.c: - MFB: - Rationalize code a bit - -2005-01-03 Stanislav Malyshev - - * (PHP_5_0) - zend_language_scanner.l: - MFH: - Fix the following nasty bug: - - if compile bails out from the middle of compiling, current_buffer is not - restored - - if current_buffer is not null, yy_switch_to_buffer will do: *yy_c_buf_p - = yy_hold_char; on - the next request - - which would lead to memory corruption on next request - - * zend_language_scanner.l: - Fix the following nasty bug: - - if compile bails out from the middle of compiling, current_buffer is not - restored - - if current_buffer is not null, yy_switch_to_buffer will do: *yy_c_buf_p - = yy_hold_char; on - the next request - - which would lead to memory corruption on next request - -2005-01-02 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #31371 (highlight_file() trims new line after heredoc). - - * zend_highlight.c: - Fixed bug #31371 (highlight_file() trims new line after heredoc). - -2004-12-30 Jani Taskinen - - * (PHP_5_0) - zend_compile.c - zend_highlight.c - zend_indent.c - zend_ini_scanner.l - zend_language_scanner.l: - MFH: - Fixed bug #28930 (PHP sources pick wrong header files generated by - bison). - - * zend_compile.c - zend_highlight.c - zend_indent.c - zend_ini_scanner.l - zend_language_scanner.l: - - Fixed bug #28930 (PHP sources pick wrong header files generated by bison) - - * Zend.m4 - acinclude.m4: - MFB_4_3: Quote macro names in AC_DEFUN() - -2004-12-27 Zeev Suraski - - * zend_builtin_functions.c: - MFB - - * (PHP_5_0) - zend_builtin_functions.c: - Fix desc - -2004-12-27 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - - MFH: Need to unmangle the class name here - - * zend_reflection_api.c: - - Need to unmangle the class name here - -2004-12-27 Zeev Suraski - - * (PHP_5_0) - zend_exceptions.c: - Add descriptions - -2004-12-27 Dmitry Stogov - - * zend_execute.c - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - tests/bug22836.phpt - tests/bug22836.phpt - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv06.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - "Undefined variable: %s" noticies were fixed to use one space - -2004-12-27 Marcus Boerger - - * zend_reflection_api.c: - - More proto/error message fixes - - * zend_reflection_api.c: - - Small fixlet (by Tony) - -2004-12-24 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h: - New sarbage collector's bug was fixed (the behavior should be the same as - in PHP_5_0) - - * zend_execute.c - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv06.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - "Undefined variable: %s" noticies were fixed to be compatible with PHP_5_0 - -2004-12-21 Jani Taskinen - - * (PHP_5_0) - zend_strtod.c: - MFH: - Use correct header files (in c99 compliant way). uint32_t is - preferred. - - * zend_strtod.c: - - Use correct header files (in c99 compliant way). uint32_t is preferred. - -2004-12-20 Jani Taskinen - - * zend_strtod.c: - Better fix for endian compile problems. - -2004-12-17 Andi Gutmans - - * zend_object_handlers.c: - - Fixed Bug #30562 Segmentation fault with __call() - -2004-12-17 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MF43: Fixed strtod for Irix and some other strange platform - -2004-12-16 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MF43: Make it compile on HPUX on Itanium 2 - - * zend_strtod.c - zend_strtod.c: - - MF43: Fixed bug #31107 (strtod on solaris9/intel) - -2004-12-16 Jani Taskinen - - * (PHP_5_0) - ChangeLog: - - MFH: Fix typo (avaliable -> available). (bug #28725) - - * ChangeLog: - - Fix typo (avaliable -> available). (bug #28725) - -2004-12-16 Derick Rethans - - * zend_strtod.c: - - MF43: Fixed bug #31110 and #31111 (Zend/zend_strtod.c problems) - - * (PHP_5_0) - zend_strtod.c: - - Fixed bug #31110 and #31111 (Zend/zend_strtod.c problems) - -2004-12-15 Andi Gutmans - - * (PHP_5_0) - zend.h: - - 5.0.4-dev - - * (PHP_5_0) - zend.h: - - Redo 5.0.3 - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - Roll PHP 5.0.3 - -2004-12-14 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - MFH: Fixed compile error related to bug #28605. - -2004-12-13 Derick Rethans - - * zend_operators.c: - - Added "G" modifier to ini setting number format. - -2004-12-10 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.3RC2 - -2004-12-07 Dmitry Stogov - - * zend_exceptions.c - zend_exceptions.c: - Fixed bug #30904 (segfault when recording soapclient into session). - -2004-12-06 Stanislav Malyshev - - * tests/bug30998.phpt: - add test - - * zend.c - zend.c: - port fix for #30998: Crash when user error handler returns false on amd64 - -2004-12-06 Dmitry Stogov - - * zend_compile.c - zend_compile.c - tests/bug30922.phpt: - Fixed bug #30922 (reflective functions crash PHP when interfaces extend - themselves) - - * tests/bug30922.phpt - tests/bug30922.phpt: - - file bug30922.phpt was initially added on branch PHP_5_0. - -2004-12-06 Stanislav Malyshev - - * (PHP_5_0) - zend_builtin_functions.c: - if fetch called not from PHP function, ptr can be NULL - -2004-12-01 Ilia Alshanetsky - - * zend_strtod.c: - MFB: Removed extra space that causes problems for some compilers. - - * (PHP_5_0) - zend_strtod.c: - Removed extra space that causes problems for some compilers. - -2004-12-01 Derick Rethans - - * (PHP_5_0) - zend_strtod.c: - - revert unwanted change - - * zend_strtod.c - zend_strtod.c: - - Fixed MacOSX compilation (Patch by Christian) - - * (PHP_5_0) - zend.h: - - And in Zend/ too. - -2004-12-01 Dmitry Stogov - - * (PHP_5_0) - zend_execute.c - zend_vm_def.h - zend_vm_execute.h - tests/bug29883.phpt - tests/bug29883.phpt - tests/bug29883.phpt: - Fixed bug #29883 (isset gives invalid values on strings). - -2004-11-30 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Go with 5.0.3RC1 - -2004-11-29 Derick Rethans - - * (PHP_5_0) - zend_operators.c: - - MF43: Revert Joe's work around a bug in GCC patch as it breaks too many - things. - - * zend_operators.c: - - MFH: Revert Joe's work around a bug in GCC patch as it breaks too many - things. - -2004-11-25 Zeev Suraski - - * (PHP_5_0) - zend_execute.c - zend_execute_API.c - zend_extensions.h - zend_object_handlers.c - zend_object_handlers.h: - Reverting get_method() signature change - -2004-11-24 Marcus Boerger - - * zend_reflection_api.c: - - Fix Bug #30856 (ReflectionClass::getStaticProperties segfaults) - - * tests/bug30856.phpt: - - - Add new test - -2004-11-17 Stanislav Malyshev - - * (PHP_5_0) - zend_execute_API.c: - fix #30543 - - * zend_execute_API.c: - fix crash - -2004-11-16 Derick Rethans - - * zend_strtod.c - zend_strtod.c: - - Make this compile for the Mac again - -2004-11-15 Derick Rethans - - * (PHP_5_0) - zend_strtod.c: - - MFH: Fixed bug #30779 (Compile of Zend/zend_strtod.c fails on Sparc) - - * zend_strtod.c: - - Fixed bug #30779 (Compile of Zend/zend_strtod.c fails on Sparc) - -2004-11-14 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH #30783 Apache crash when using ReflectionFunction::getStaticVariables() - MFH proto fixes - - * zend_reflection_api.c: - - Bugix #30783: Apache crash when using - ReflectionFunction::getStaticVariables() - -2004-11-09 Andrei Zmievski - - * zend_ini_parser.y: - Revert inadvertent commit. - - * zend_ini_parser.y: - .dylib extension are Mach-O shared libraries that meant for linking - against. Loadable modules (aka bundles) can have any extension, so we - should probably stick with .so - - http://fink.sourceforge.net/doc/porting/shared.php?phpLang=en#lib-and-mod - -2004-11-05 Derick Rethans - - * (PHP_5_0) - zend_execute_API.c: - - Fix for bug #30367, #30490 and possibly #30011. - -2004-11-04 Edin Kadribasic - - * Zend.dsp - ZendTS.dsp: - Added zend_strtod.* to the build - - * zend_strtod.c - zend_strtod.h: - Make zend_strtod compile on windows - -2004-11-04 Moriyoshi Koizumi - - * (PHP_5_0) - Makefile.am: - - MFH: Add entry for zend_strtod.c in belief that this is still active. - - * Makefile.am: - - Add entry for zend_strtod.c in belief that this is still active. - -2004-11-03 Moriyoshi Koizumi - - * Zend.m4: - - Don't show grep outputs - -2004-11-03 Derick Rethans - - * (PHP_5_0) - zend_execute_API.c - zend_globals.h - zend_ini.c - zend_language_scanner.l - zend_operators.c - zend_operators.h - zend_strtod.c - zend_strtod.h: - - MFH: Fixed bug #30630: Added a BSD based strtod function that is - locale-independent. - - * zend_execute_API.c - zend_globals.h - zend_ini.c - zend_language_scanner.l - zend_operators.c - zend_operators.h - zend_strtod.c - zend_strtod.h: - - Fixed bug #30630: Added a BSD based strtod function that is - locale-independent. - -2004-11-03 Moriyoshi Koizumi - - * Zend.m4 - zend.h - zend_execute.c: - - Checks for Darwin'ish systems that uses Mach-O, which apparently doesn't - support weak symbol aliasing at this time. - -2004-11-03 Marcus Boerger - - * zend_reflection_api.c: - - Trying to invoke function not methot here - - * zend_reflection_api.c: - - Fix invokeargs() with static methods - -2004-11-03 Dmitry Stogov - - * zend_vm_def.h - zend_vm_execute.h: - Fixed "isset() and the new VM" bug. - -2004-11-02 Sebastian Bergmann - - * (PHP_5_0) - zend_API.c: - MFH: Patch by Joe Orton . - - * zend_API.c: - Patch by Joe Orton . - -2004-10-31 Marcus Boerger - - * zend_reflection_api.c: - - Add ReflectionFunction::invokeArgs(array) - - Add ReflectionMethod::invokeArgs(obj, array) - -2004-10-31 Sebastian Bergmann - - * zend_reflection_api.c: - Invokation -> Invocation - -2004-10-30 Marcus Boerger - - * zend.h: - Bump version (as discussed with Andi) - - * (PHP_5_0) - zend_execute.c: - - Fix (readd function name which got lost during earlier comit) - - * zend_reflection_api.c: - - Be consistent and use names as keys (found by johannes) - - * zend_extensions.h - zend_modules.h: - - Bump API version - - * (PHP_5_0) - zend_extensions.h - zend_modules.h: - Bump api after latest changes - - * (PHP_5_0) - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - MFH change zend_object_handlers->get_method() - - * zend_execute_API.c - zend_object_handlers.c - zend_object_handlers.h - zend_vm_def.h - zend_vm_execute.h: - - Change zend_object_handlers->get_method() to allow aggregation for - internal classes - - * Makefile.frag: - - New architecture needs one more dependency - - * zend_exceptions.c - zend_reflection_api.c: - - Fix protos - -2004-10-29 Andi Gutmans - - * zend_operators.c: - - For Ilia: - - MFH: Fixed bug #30572 (crash when comparing SimpleXML attribute to a - boolean). - - Hope this works well. I will MFH tomorrow if no one complains. - -2004-10-28 Dmitry Stogov - - * README.ZEND_VM - zend_vm_gen.php: - --without-lines changed to --with-lines - -2004-10-28 Andi Gutmans - - * zend_vm_execute.skl - zend_vm_gen.php: - - Fix typo - -2004-10-27 Andi Gutmans - - * zend_vm_opcodes.h: - - Oops missed this one - - * zend_operators.c: - - Revert Fixed bug #30228 (crash when comparing SimpleXML attribute to a - boolean). - - Need to discuss where the real problem is. - - * README.ZEND_VM: - - Tiny fixes - - * README.ZEND_VM - zend_compile.h - zend_vm_execute.h - zend_vm_gen.php: - - Improve comments, docs, code... - -2004-10-26 Andi Gutmans - - * zend_builtin_functions.c: - - Patch from Andrey Hristov: - I have cooked a small patch which allows is_subclass_of() the accept - not only an object as first parameter but a string as well. When string - is passed the function checks whether the class specified is subclass of - the second parameter - class a{} - class b{} extends a{} - is_subclass_of("a", "a") //false - is_subclass_of("b", "a") //true - currently only objects are allowed as first parameter - -2004-10-26 Ilia Alshanetsky - - * (PHP_5_0) - zend_operators.c: - MFH: Fixed bug #30572 (crash when comparing SimpleXML attribute to a - boolean). - - * zend_operators.c: - Fixed bug #30228 (crash when comparing SimpleXML attribute to a boolean). - -2004-10-23 Andi Gutmans - - * zend_vm_execute.h: - - Add missing file - -2004-10-22 Andi Gutmans - - * zend_vm_handlers.h - zend_vm_spec.h: - - Nuke another two files - - * Makefile.frag - zend_execute.c - zend_vm.h - zend_vm_def.h - zend_vm_execute.skl - zend_vm_gen.php: - - Commit new VM - - Old one is tagged as PRE_NEW_VM_GEN_PATCH - - Still doing work so more commits to come. Don't complain (yet) :) - - * (PRE_NEW_VM_GEN_PATCH) - zend_execute.c: - - Fix crash (MFB PHP5_0) - -2004-10-21 Andi Gutmans - - * (PHP_5_0) - zend_execute.c: - - Fix bug #30395 (Apache Child Segmentation fault in specific PHP-Code) - -2004-10-20 Andi Gutmans - - * zend_operators.c: - - If object handles are equal then save the comparison of properties in - - the == operator. - -2004-10-18 Anantha Kesari H Y - - * zend_modules.h: - including zend_compile.h for NetWare as NetWare uses MetroWerks Code - warrior compiler which does not allow declarations of following kind - before defining the types. - extern struct _zend_arg_info first_arg_force_ref[2]; - -2004-10-16 Andi Gutmans - - * zend_compile.c: - - One more test (WS) - - * zend_compile.c: - - WS fix to test commit - -2004-10-16 Anantha Kesari H Y - - * zend_compile.c - zend_compile.c: - Fix for 30457 - -2004-10-14 Marcus Boerger - - * zend_builtin_functions.c: - - Allow to omit object/classname in get_parent_class() which makes it - compatible with the signature and behavior of get_class() - -2004-10-13 Andi Gutmans - - * zend_compile.c: - - Don't allow access modifiers in interfaces. Explicitly stating public - - should also be disallowed but we don't have a way to detect it today. - -2004-10-12 Marcus Boerger - - * zend_builtin_functions.c: - Bug #30381 Strange results with get_class_vars() - - * (PHP_5_0) - zend_builtin_functions.c: - MFH Fix visibility of get_class_vars() and get_class_methods() - - * zend_builtin_functions.c: - - Fix visibility in get_class_vars() and get_class_methods() - - * zend_builtin_functions.c: - - Fix set_exception_handler - -2004-10-10 Sebastian Bergmann - - * .cvsignore - tests/.cvsignore: - Add *.gcda and *.gcno (from gcc -fprofile-{use|generate}) to .cvsignore. - -2004-10-08 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_vm_handlers.h: - - Revert automatic pass arg_info - -2004-10-08 Andi Gutmans - - * zend_compile.c: - - Fix BC break with default in switch() having to be at the end. - -2004-10-08 Anantha Kesari H Y - - * acconfig.h - zend_config.nw.h: - explicitly including sys/select.h as NetWare LibC sys/types.h does not - include sys/select.h implicitly as other LibC - -2004-10-06 Marcus Boerger - - * zend_reflection_api.c: - - Fix Bug #30344 - -2004-10-05 Marcus Boerger - - * zend_compile.c - zend_compile.h - zend_vm_handlers.h: - - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically - determine whether pass by ref is possible or pass by value is needed. - -2004-10-05 Dmitry Stogov - - * tests/unset_cv06.phpt - tests/unset_cv07.phpt - tests/unset_cv07.phpt: - Test files are fixed. - - * zend_execute.c - zend_vm_handlers.h - tests/unset_cv11.phpt: - Fixed unset() bug that was introduced with CV optimization patch - - * zend_execute_API.c - zend_vm_handlers.h - tests/unset.inc - tests/unset_cv01.phpt - tests/unset_cv02.phpt - tests/unset_cv03.phpt - tests/unset_cv04.phpt - tests/unset_cv05.phpt - tests/unset_cv06.phpt - tests/unset_cv07.phpt - tests/unset_cv08.phpt - tests/unset_cv09.phpt - tests/unset_cv10.phpt: - Added test cases for CV optimization patch - -2004-10-04 Andi Gutmans - - * zend_API.h - zend_execute_API.c: - - Rename delete_global_variable() to zend_delete_global_variable() - - * Zend.m4 - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c - zend_vm.h - zend_vm_handlers.h - zend_vm_spec.h: - - Commit the variable fetch optimization. - - Extensions which delete global variables need to use new special - function - - delete_global_variable() (I'm about to rename it) to remove them. - - Will post to internals@ or via commit messages if there's anything else. - -2004-10-04 Marcus Boerger - - * zend_builtin_functions.c: - - Bugfix #27798 - - * tests/bug27798.phpt: - - - Add new test - -2004-10-02 Marcus Boerger - - * (PHP_5_0) - tests/bug28444.phpt - tests/bug29368.phpt: - - Add new tests - - * tests/bug28444.phpt - tests/bug29368.phpt: - - - Add new test - -2004-10-01 Marcus Boerger - - * Makefile.frag: - - Add makefile fragment which simplifies working on the executer - -2004-09-30 Andi Gutmans - - * zend_operators.c: - - Small improvement to DVAL_TO_ZVAL macro - -2004-09-29 Marcus Boerger - - * zend_API.c: - - MFB (synch correctly not only for one problem) - - * zend_API.c: - - Refix the fix - -2004-09-29 Andi Gutmans - - * bench.php - tests/bench.php: - - Move bench.php to Zend/ - -2004-09-28 Marcus Boerger - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_objects.c: - Simplify/Optmize magic method calls (__get/__set/__call/__clone/__destruct) - -2004-09-28 Andi Gutmans - - * zend_execute_API.c: - - Return the warning until we check if we can change the type of str.len - -2004-09-28 Marcus Boerger - - * zend_reflection_api.c - zend_reflection_api.h: - - publish reflection_class_factory() as zend_reflection_class_factory() - -2004-09-27 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH fix several property handling issues - - * zend_reflection_api.c: - - Make internally used properties read-only and fix default properties - - * zend_exceptions.c: - - Fix memeleak - - * zend_reflection_api.c: - - Declare properties - -2004-09-27 Andi Gutmans - - * README.ZEND_VM: - - Document zend_vm_use_old_executor() for Derick. - -2004-09-27 Marcus Boerger - - * zend_reflection_api.c: - Fix Reflection_Class to ReflectionClass in docu/messages - - * zend_execute_API.c: - - Fix warning - - * zend_compile.c - zend_stream.c: - - Fix warning - - * zend_builtin_functions.c - zend_reflection_api.c: - - Fix warnings - - * zend_interfaces.c: - Fix warnign - -2004-09-27 Andi Gutmans - - * zend_variables.c - zend_variables.h: - - Use zval_ctor_func() for wrapper and update the prototype to void - - * zend_variables.c - zend_variables.h: - - Make zval_copy_ctor() return void like dtor(). No one ever checks the - - return value which is SUCCESS always. - -2004-09-26 Marcus Boerger - - * zend.h - zend_variables.h: - - Fix build - -2004-09-26 Andi Gutmans - - * zend.h - zend_variables.c - zend_variables.h: - - Apply Thies and Sterling's patch which doesn't call ctor/dtor functions - - for types which don't require it (BOOL/NULL/LONG/DOUBLE) - - Breaks serialization!!! - -2004-09-24 Anantha Kesari H Y - - * zend_API.c: - selectively avoiding module cleanup code for apache 1 build and removing a - duplicate code - -2004-09-24 Dmitry Stogov - - * zend_vm_spec.h: - Fixed specializer bug. - -2004-09-23 Andi Gutmans - - * (PHP_5_0) - zend.h: - - PHP 5.0.3-dev - - * zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_opcode.c - zend_vm.h: - - Commit new VM architecture. This one allows people (aka Derick) to - - ask the engine to use function handler mode. Will update the README - - about that. - - * (PHP_5_0) - zend.h: - - Roll 5.0.2 - -2004-09-23 Ilia Alshanetsky - - * tests/bug20240.phpt: - Fixed test. - -2004-09-23 Marcus Boerger - - * zend_reflection_api.c: - Bugfix # 30209 - -2004-09-23 Andi Gutmans - - * tests/bench.php: - - Commit synthetic benchmark - -2004-09-23 Anantha Kesari H Y - - * zend_execute.c - zend_execute_API.c - zend_globals.h: - Reverted the NetWare Specific Stack limit related patches as asked by Andi - -2004-09-22 Anantha Kesari H Y - - * zend_execute_API.c - zend_globals.h: - NetWare specific stack limit checks - - * zend_API.c: - Aligned the ifdef NETWARE blocks to first column. - - * zend_execute.c: - Stack limit will be checked while executing the script - - * zend_config.nw.h: - To avoid redefinition (of free, alloca etc.) compilation errors in Zend. - - * zend_API.c: - When Apache is unloaded, it calls dlclose on all the PHP extensions - that are loaded in memory. In the case of Apache 1.3, this call is - blocking indefinitely. As a work around, this call is bypassed for Apache - 1.3 build on NetWare only. This means that none of the loaded PHP - extensions are unloaded. They will have to be manually unloaded before - re-loading the Apache 1.3 again. - - * zend.h: - defined ZEND_PATHS_SEPERATOR to semicolon for NetWare - - * acconfig.h: - enabled macros to call the proper LibC functions - -2004-09-22 Dmitry Stogov - - * zend_vm_handlers.h - zend_vm_spec.h: - Specializer was updated with executor's fixes. - - * zend_execute.c - zend_execute.c: - Fixed bug #29566 (foreach/string handling strangeness (crash)). - - * zend_execute.c: - Fixed bug in fix for bug #29707 - -2004-09-21 Andi Gutmans - - * zend_execute.c - zend_execute.h: - - Fix for bug #29707 - -2004-09-19 Marcus Boerger - - * zend_reflection_api.c: - Bugfix #30146 (ReflectionProperty->getValue() requires instance for static - property) - - * zend_reflection_api.c: - Bugfix #30148 (ReflectionMethod->isConstructor() fails for inherited - classes) - -2004-09-17 Stanislav Malyshev - - * zend_execute_API.c - zend_objects_API.c - zend_objects_API.h: - fix crash when dtor is fialing on shutdown - -2004-09-16 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Go with PHP 5.0.2RC1 - - * tests/bug27669.phpt: - - Add test for bug #27669 - -2004-09-16 Sebastian Bergmann - - * zend_language_parser.y: - ZTS fix. - -2004-09-16 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Fix bug #27669 (Dmitry). - Fixes: - - -2004-09-15 Ilia Alshanetsky - - * zend_operators.h: - MFH: Fixed a bug causing ".123" * "90" and alike to return a 0. - - * (PHP_5_0) - zend_operators.h: - Fixed a bug causing ".123" * "90" and alike to return a 0. - -2004-09-15 Derick Rethans - - * zend_config.w32.h: - - Windows support strcoll too. - -2004-09-13 Stanislav Malyshev - - * zend_execute.c: - Antony Dovgal's error message improvement - #27290 - -2004-09-11 Derick Rethans - - * zend_operators.c - zend_operators.h: - - MFB: Added the sorting flag SORT_LOCALE_STRING to the sort() functions - which - makes them sort based on the current locale. (Derick) - - * (PHP_5_0) - zend_operators.c - zend_operators.h: - - Added the sorting flag SORT_LOCALE_STRING to the sort() functions which - makes - them sort based on the current locale. (Derick) - -2004-09-11 Andi Gutmans - - * zend_operators.c: - - Resolve undefined behavior (joe at redhat) - -2004-09-10 Andi Gutmans - - * zend_compile.c: - - This one fixes rather strange problem - ZE allows multiple declarations - of the same class constant. - - It could be a minor BC break, but I'm sure it's a bug. (Antony Dovgal - aka tony2001) - -2004-09-09 Andi Gutmans - - * zend_extensions.h: - - Revert API bump - - * README.ZEND_VM: - - Commit VM explanation. - - * zend.c: - - Recommit - - * zend_API.c - zend_API.h - zend_compile.c: - - Recommit: - - Check signature of magic methods - - Register __get/__set/__call for internal classes - - * zend_extensions.h: - - Recommit: - - Bump the API number to work around this major breakage. - - * ChangeLog - zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_exceptions.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_opcode.c: - - Roll back VM commit - -2004-09-09 Marcus Boerger - - * zend.c: - - Drop namespace relict - - * (PHP_5_0) - zend_API.c - zend_API.h - zend_compile.c: - MFH signature check/method registration - - * zend_API.c - zend_API.h - zend_compile.c: - - Check signature of magic methods - - Register __get/__set/__call for internal classes - -2004-09-09 Derick Rethans - - * zend_extensions.h: - - Bump the API number to work around this major breakage. - -2004-09-09 Dmitry Stogov - - * zend_vm.h: - We will use CALL dispatch method for compilers other then GCC. It is more - safe. - -2004-09-09 Andi Gutmans - - * zend_API.c: - - Fix the fix. - -2004-09-06 Marcus Boerger - - * zend_objects.c: - - Fix handling of exceptions in dtors - -2004-09-05 Zeev Suraski - - * zend.c - zend.h - zend_ini_parser.y: - Fix reverse dependency - -2004-09-04 Andi Gutmans - - * zend_API.c: - - Don't destroy object when calling overloaded cast method in - - zend_parse_parameters() - -2004-09-02 Sebastian Bergmann - - * zend_compile.c: - Fugbix typo. - -2004-08-30 Marcus Boerger - - * (PHP_5_0) - ZEND_CHANGES: - MFH: Add some information about array overloading - - * ZEND_CHANGES: - Add some information about array overloading - -2004-08-30 Stanislav Malyshev - - * zend_execute.c: - fix crash #29893 - -2004-08-29 Marcus Boerger - - * zend_execute.c: - String offset starts with 0, fix isset($str[$len]) - - * (PHP_5_0) - zend_compile.c: - MFH: Bugfix #29882 isset crashes on arrays - - * zend_compile.c: - Bugfix #29882 isset crashes on arrays - -2004-08-27 Andi Gutmans - - * zend_alloc.c: - - Fix leak report for 0 byte allocations (Dmitry) - -2004-08-26 Marcus Boerger - - * (PHP_5_0) - zend_compile.c: - MFH: Enforce semantics: Classes cannot extend Interfaces - - * zend_compile.c: - Enforce semantics: Classes cannot extend Interfaces - - * tests/bug29828.phpt: - Fix test: Classes cannot extend Interfaces - - * zend_compile.c: - Drop doubled check - - * zend_compile.c: - - Bugfix #29828 Interfaces no longer work - - * tests/bug29828.phpt: - - Add new test - -2004-08-25 Andi Gutmans - - * zend_builtin_functions.c: - - Add interface_exists() and differentiate between classes and interfaces - (Andrey Hristov) - -2004-08-24 Marcus Boerger - - * zend_API.c: - - Add missing brackets - -2004-08-23 Marcus Boerger - - * zend_compile.c: - - Drop unused variable - - * zend_execute_API.c - zend_globals.h: - - Boost up __autoload() calls by caching the lookup - -2004-08-23 Andi Gutmans - - * zend_compile.c: - - Improve performance of switch() - -2004-08-23 Zeev Suraski - - * (PHP_5_0) - zend_reflection_api.c: - Fix names - -2004-08-21 Sara Golemon - - * zend_compile.c: - Bugfix#29777 Some compilers don't like // style comments - -2004-08-20 Sara Golemon - - * zend_ini_parser.y: - Fix compile - -2004-08-19 Andi Gutmans - - * zend_execute.c: - - Cleanup - - * zend.c - zend_execute_API.c - zend_globals.h: - - Second wave of garbage removal. - - * zend_compile.h - zend_execute.c: - - Stop using garbage. Please let me know if you find any bugs resulting - - of this patch (very likely). (Dmitry, Andi) - -2004-08-19 Marcus Boerger - - * zend_reflection_api.c: - - Implement #29728: Reflection API Feature: Default parameter value. - . ReflectionParameter::isDefaultValueAvailable() - . ReflectionParameter::getDefaultValue() - - * zend_reflection_api.c: - - Nedd to work on copy - -2004-08-18 Marcus Boerger - - * zend_reflection_api.c: - - Show default value of optional parameters of user defined functions. - -2004-08-18 Andrei Zmievski - - * zend_ini_parser.y: - Forgot to turn off debugging. - - * zend_ini_parser.y - zend_ini_scanner.l: - Re-add my patch for .ini variable access. - -2004-08-16 Marcus Boerger - - * (PHP_5_0) - zend_reflection_api.c: - MFH: Fix bug #29447: Reflection API issues - - * zend_reflection_api.c: - - Fix bug #29447: Reflection API issues - -2004-08-15 Marcus Boerger - - * zend_compile.c: - Remove unnecessary check - -2004-08-14 Marcus Boerger - - * zend_compile.c: - Add missing check - -2004-08-12 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to 5.0.2-dev - - * (PHP_5_0) - zend.h: - - Roll 5.0.1 - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.1RC2 - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Don't use magic numbers - - * zend_compile.c - zend_execute.c: - - Significantly improve performance of foreach($arr as $data). (Marcus) - -2004-08-11 Ilia Alshanetsky - - * zend_highlight.c: - MFH: Fixed bug #29607 (highlighting code with HEREDOC produces invalid - output). - - * (PHP_5_0) - zend_highlight.c: - Fixed bug #29607 (highlighting code with HEREDOC produces invalid output). - -2004-08-11 Marcus Boerger - - * zend_execute.c: - More meaningfull error message - -2004-08-11 Derick Rethans - - * (PHP_5_0) - zend_alloc.h: - - MFH: Patch to allow the Zend memory allocators to be disabled. - - * zend_alloc.h: - - Added missing defines. - -2004-08-10 Ilia Alshanetsky - - * (PHP_5_0) - zend_highlight.c: - MFH: Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then - returning the value). - - * zend_highlight.c: - Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then - returning the value). - -2004-08-10 Andi Gutmans - - * (PHP_5_0) - zend.h: - - Back to -dev - - * (PHP_5_0) - zend.h: - - 5.0.1RC1 - -2004-08-10 Marcus Boerger - - * zend_execute.c: - - Fix warnings - -2004-08-07 Andi Gutmans - - * zend_alloc.h: - - Commit Derick's patch for allowing Zend to use regular libc memory - - allocation functions. Mainly useful in conjunction with tools such as - - valgrind which enables us to find bugs we might not find with the - - current memory managers boundary protection. - -2004-08-05 Ilia Alshanetsky - - * zend_builtin_functions.c: - Eliminate unneeded variable. - -2004-08-04 Marcus Boerger - - * zend_reflection_api.c - tests/bug29523.phpt: - - Fix bug #29523 (ReflectionParameter::isOptional() is incorrect) - -2004-08-03 Marcus Boerger - - * ZEND_CHANGES: - Update - - * (PHP_5_0) - zend_builtin_functions.c - tests/bug29505.phpt: - - MFH Bug #29505 get_class_vars() severely broken when used with arrays - - * tests/bug29505.phpt: - - Add new test - - * zend_builtin_functions.c: - - Fixed Bug #29505 get_class_vars() severely broken when used with arrays - -2004-08-02 Marcus Boerger - - * zend_reflection_api.c: - - Add methods to check parameter count - - * (PHP_5_0) - zend_compile.c: - MFH Change to use memcmp instead of strcmp - - * zend_compile.c: - - Change to use memcmp instead of strcmp - -2004-08-02 Andi Gutmans - - * zend_compile.c: - - Fix typo - -2004-08-02 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - - Remove all for now - - * zend_compile.c - zend_compile.h - zend_execute_API.c: - MFB: Enforce protocol on magic methods/functions - -2004-08-02 Ilia Alshanetsky - - * (PHP_5_0) - zend_execute.c: - MFH: A gentler (performance wise) allocation of buffer for temp variables. - - * zend_execute.c: - A gentler (performance wise) allocation of buffer for temp variables. - -2004-08-01 Marcus Boerger - - * (PHP_5_0) - zend_compile.c - zend_compile.h - zend_execute_API.c: - - Enforce protocol on magic methods/functions - -2004-07-30 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_ptr_stack.c - zend_ptr_stack.h: - - More ptr_stack optimizations and cleanups - - * zend_alloc.c - zend_alloc.h - zend_execute.c - zend_fast_cache.h - zend_ptr_stack.h: - - Improve performance by inlining zend_ptr_stack_n_push(). var_args can - usually not be inlined by compilers. - -2004-07-29 Marcus Boerger - - * zend_hash.c: - - Increase performance of *sort() and some internal sort operations. - -2004-07-29 Sara Golemon - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Revert goto opcode - - * zend_execute.c: - &tmp and label are the same thing, don't free it till we're done with it. - - * zend_compile.c - zend_execute.c: - Plug some memory leaks and promote unknown label to E_ERROR. - If someone tries to jump to a non-existant label execution really - shouldn't try to carry on. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Add goto operator by popular request. - -2004-07-28 Wez Furlong - - * zend_ini.c: - Fix: ini entries for dl()'d modules now work under ZTS - Side-effect: avoid possible crashes when multiple threads load/unload - modules and mess with the global hash table. - -2004-07-28 Andi Gutmans - - * zend.h - zend.h: - - Fix MAC OSX to always use native DSO loading - -2004-07-27 Marcus Boerger - - * zend_exceptions.c: - - Be specific about visibility - -2004-07-27 Wez Furlong - - * zend_builtin_functions.c: - Fix two possible crashes. Latter is unlikely unless you are doing scary - things, but former looks nasty. - -2004-07-26 Stanislav Malyshev - - * zend_interfaces.c: - quick fix for #29382 - -2004-07-25 Marcus Boerger - - * zend_reflection_api.c: - - Show visibility errors (try to fix #29354) - - * (PHP_5_0) - zend_execute.c - zend_objects_API.c - zend_objects_API.h: - - MFH: Fix bug #29368 : The destructor is called when an exception is - thrown from the constructor - - * zend_execute.c - zend_objects_API.c - zend_objects_API.h: - - Fix bug #29368 : The destructor is called when an exception is thrown - from the constructor - - * zend.c - zend.h - zend_execute.h - zend_execute_API.c: - - Execute destructors earlier (Florian Schaper, fschaper at intux org) - - * zend_reflection_api.c: - - Add ReflectionParameter::isOptional() to test whether a parameter is - optional and also show this information in export. - - * zend_exceptions.c: - - Add optional parameters $filename and $lineno to ErrorException - constructor to allow overwriting automatically retrieved information. - -2004-07-23 Marcus Boerger - - * zend_execute.c: - Fix 0 Byte leak after alloca to emalloc change - -2004-07-22 Zeev Suraski - - * zend_object_handlers.c: - Fix bug in handling of protected properties - -2004-07-21 Edin Kadribasic - - * zend_builtin_functions.c: - Fixed build - -2004-07-21 Marcus Boerger - - * (PHP_5_0) - zend_builtin_functions.c: - MFH: Fixded #29291: get_class_vars() return names with NULLs - - * zend_builtin_functions.c: - - Fixded #29291: get_class_vars() return names with NULLs - -2004-07-20 Moriyoshi Koizumi - - * zend_alloc.c - zend_alloc.h: - - Add safe_pemalloc() - -2004-07-20 Marcus Boerger - - * zend_reflection_api.c: - - Fixed bug 28895 again (long live the dead) - -2004-07-20 Zeev Suraski - - * zend_exceptions.c: - Fix prototypes - - * zend_exceptions.c: - Add descriptions - -2004-07-20 Stanislav Malyshev - - * zend_compile.c: - add todo - - * (PHP_5_0) - zend_ini.h - zend_ini_parser.y: - export ini parser - -2004-07-19 Sebastian Bergmann - - * zend_reflection_api.c: - Fix prototypes: Reflection_* -> Reflection*. - - * zend_reflection_api.c: - Make ReflectionClass::getMethod() and ReflectionClass::getProperty() raise - an ReflectionException instead of returning NULL on failure. - - * zend_reflection_api.c: - Do not use contracted forms. - -2004-07-19 Stanislav Malyshev - - * zend_ini.h - zend_ini_parser.y: - export INI parser - - * zend_object_handlers.c: - __set and __get will be called not only when variable doesn't exist but - also when it's - invisible - -2004-07-19 Andi Gutmans - - * zend_extensions.h - zend_modules.h: - - Bump API number due to empty_string change - - * zend.c - zend.h - zend_API.h - zend_alloc.h - zend_execute.c - zend_object_handlers.c - zend_operators.c - zend_variables.c: - - Nuke empty_string. It is a reminanent from the time where RETURN_FALSE() - used to return "" and not bool(false). It's not worth keeping it because - STR_FREE() and zval_dtor() always have to check for it and it slows down - the general case. In addition, it seems that empty_string has been - abused - quite a lot, and was used not only for setting zval's but generally in - PHP code instead of "", which wasn't the intention. Last but not least, - nuking empty_string should improve stability as I doubt every place - correctly checked if they are not mistakenly erealloc()'ing it or - calling efree() on it. - NOTE: Some code is probably broken. Each extension maintainer should - check and see that my changes are OK. Also, I haven't had time to touch - PECL yet. Will try and do it tomorrow. - -2004-07-18 Wez Furlong - - * zend_execute_API.c: - No point allocating 0 bytes - -2004-07-16 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - - Speed up by making null/false/true reserved word which allows to drop - an opcode (FETCH_CONSTANT) for every usage. - - * zend_execute.c: - Bugfix #28464 catch() does not catch exceptions by interfaces - -2004-07-16 Ilia Alshanetsky - - * zend_operators.h: - MFB: Fixed bug #28800 (strings beginning with "inf" improperly converted). - - * (PHP_5_0) - zend_operators.h: - Fixed bug #28800 (strings beginning with "inf" improperly converted). - -2004-07-15 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: - - Improve performance of zend_alloc by stopping the size from being a bit - - field. - -2004-07-15 Marcus Boerger - - * zend_exceptions.c - zend_exceptions.h: - - Add new class ErrorException to encapsulate errors in exceptions - - * zend_dynamic_array.h: - - Fix prototype - -2004-07-14 Stanislav Malyshev - - * zend_object_handlers.c: - be consistent with write_dimension - - * zend_object_handlers.c: - fix #28957 - -2004-07-13 Andi Gutmans - - * zend.h: - - 5.0.1-dev - -2004-07-13 Marcus Boerger - - * zend_constants.c: - Bugfix #29116 Zend constant warning uses memory after free (jdolecek at - NetBSD dot org) - -2004-07-13 Andi Gutmans - - * (php_5_0_0) - zend.h: - - Roll PHP 5.0.0 - -2004-07-12 Ilia Alshanetsky - - * (php_5_0_0RC4) - zend_execute.c: - Fixed bug #29086 & #28064 (PHP crashes on extremly long scripts). - -2004-07-12 Andi Gutmans - - * (php_5_0_0RC4) - zend.c: - - Convert zend_class_entry -> zend_class_entry * - -2004-07-10 Jon Parise - - * zend.c: - DragonFly BSD is derived from FreeBSD and requires the same floating point - precision fix. - -2004-07-10 Andi Gutmans - - * zend_alloc.c - zend_hash.c - zend_variables.c: - - Better stability during premature shutdown of request startup - -2004-07-05 Andi Gutmans - - * zend_mm.h: - - Disable zend_mm for 5.0.0 - -2004-07-03 Andi Gutmans - - * zend_alloc.c: - - Should fix mem leak with ZEND_MM. I made this change a while ago and - - rolled it back but I don't remember why. Please test! - -2004-07-01 Ilia Alshanetsky - - * zend_constants.c: - Do not use alloca() where it can be easily abused by the users. - - -2004-06-25 Wez Furlong - - * zend_stream.c - zend_stream.h: - export zend stream functions for zend extensions under windows - -2004-06-24 Sara Golemon - - * zend_execute.c: - Ease off on severity of new error (Using Resources as array offsets) - -2004-06-23 Sara Golemon - - * zend_execute.c: - BugFix #28879 Inconsistent behavior between explicit and implicit array - creation. - - Changes: - - Throw E_WARNING "Illegal offset type" when explicitly creating - array elements with objects, arrays, or resorces as indexes. - This matches implicit creation w/ obj/arr indices. - - Throw E_WARNING "Resource ID#%ld used as offset, casting to integer (%ld)" - when implicitly creating array with resource as index. (BC) - -2004-06-19 Sebastian Bergmann - - * zend_reflection_api.c: - Reflection_* -> Reflection*. Patch by Timm Friebe. - -2004-06-18 Sara Golemon - - * zend_execute.c: - Another typo in converting array index doubles to long. - -2004-06-18 George Schlossnagle - - * zend_builtin_functions.c: - fix for 28213. - - class_name and call_type should be reinitialized on every loop iter. - -2004-06-17 Sara Golemon - - * zend_builtin_functions.c: - String length in parse_parameters should be int - -2004-06-15 Marcus Boerger - - * zend_reflection_api.c: - - -2004-06-14 Marcus Boerger - - * zend_language_scanner.l: - Need {} here - -2004-06-10 Marcus Boerger - - * zend_language_scanner.l: - - Require a single white-space char after /** to start a doc comment that - way we prevent /*** from becoming a doc comment (as requested Derick). - - * zend_API.h: - Add missing declaration - - * zend_reflection_api.c: - Small code layout change - - * zend_language_scanner.l: - Do not require NEWLINE at start of doccomment - - * zend_reflection_api.c: - Bugfix #28699: Reflection api bugs - -2004-06-09 Marcus Boerger - - * zend_reflection_api.c: - Fix Bug #28694 ReflectionExtension::getFunctions() crashes PHP - -2004-06-07 Andi Gutmans - - * zend.h: - - Go back to -dev (Shouldn't need another RC) - - * (php_5_0_0RC3) - zend.h: - - Roll RC3 - -2004-06-06 Stefan Esser - - * zend_compile.h - zend_opcode.c: - Fixed Zend Function Destructor to use correct TSRM handle. - -2004-06-05 Marcus Boerger - - * zend_API.c: - Fix #28641: Instance of Interface - -2004-06-03 Andi Gutmans - - * (php_5_0_0RC3RC2) - zend.h: - - Prepare for RC3RC2 - -2004-06-02 Andi Gutmans - - * zend_mm.h: - - Don't use ZEND_MM in Windows - -2004-06-02 Stanislav Malyshev - - * zend_execute.c: - fix incdec - make value's refcount non-zero when passing to - write_property - otherwise __set caller cleanup could kill it. - -2004-06-01 Andi Gutmans - - * zend.c: - - If user error handler returns "false" then we relay to the built in error - handler - -2004-05-31 Marcus Boerger - - * zend_reflection_api.c: - Refcount must not be set separatley again. - - * zend_reflection_api.c - zend_reflection_api.c: - Add missing initialization - - * zend_compile.c: - - -2004-05-28 Andrei Zmievski - - * zend.c: - Allow user-defined error handlers to indicate whether default error - handler should be re-invoked, by returning true or false. - -2004-05-28 Marcus Boerger - - * zend_execute.c: - Prevent possible problems with illegal properties - -2004-05-28 Derick Rethans - - * zend_builtin_functions.c: - - Make the default mask for user defined error handlers include ALL errors, - including E_STRICT. - -2004-05-27 Andi Gutmans - - * zend.h: - - Back to RC3-dev until we roll final - - * (php_5_0_0RC3RC1) - zend_execute.c: - - Fix problem with exceptions returning from include(). (Dmitry) - - * (php_5_0_0RC3RC1) - zend.h: - - RC3RC1 - -2004-05-26 Wez Furlong - - * zend_object_handlers.c: - Fix leak on systems where alloca isn't really alloca. - -2004-05-26 Andrei Zmievski - - * zend_constants.c: - Avoid unnecessary and silly copying of constant name when registering. - -2004-05-26 Andi Gutmans - - * zend_alloc.c: - - Fix memory manager problem - -2004-05-26 Sebastian Bergmann - - * ZEND_CHANGES: - Update Reflection API class names. Whitespace fixes. - -2004-05-25 Andi Gutmans - - * zend_objects_API.h: - - Nuke unused decleration - - * zend_alloc.c - zend_alloc.h: - - More fixes - - * zend_alloc.c - zend_alloc.h: - - Make fix compile. - - * zend_alloc.c - zend_alloc.h: - - Fix memory leak in mem cache in conjunction with Zend MM. How come no one - - noticed this? :) - -2004-05-23 Andi Gutmans - - * zend_objects_API.c: - - Fix problem with object being destroyed more than once - - * zend_builtin_functions.c: - - Fix the following script (it crashed): - - -2004-05-20 Wez Furlong - - * zend_exceptions.c - zend_exceptions.h: - Revert; obviously I missed the function at the bottom of the file... - - * zend_exceptions.c - zend_exceptions.h: - Export this, so extensions may throw their own exception objects that - they have already instantiated. - -2004-05-18 Marcus Boerger - - * zend_API.c: - - Need to operate on module pointer in hash table - -2004-05-18 Wez Furlong - - * zend_execute_API.c: - Fix bug #28438: win32 build fails in non-zts mode - -2004-05-18 Stanislav Malyshev - - * zend_API.c: - Z_TYPE_P is for zvals - -2004-05-18 Wez Furlong - - * zend_API.c: - Register according to the type specified by the module. - (Helps to fix dl() bug) - -2004-05-18 Sara Golemon - - * zend_execute.c: - Bugfix#28404 When type is double we need to access dval, not lval - -2004-05-17 Andrei Zmievski - - * zend_ini_parser.y - zend_ini_scanner.l: - Revert the .ini vars patch. Will have to try again next Christmas - apparently. - - * zend_ini_parser.y: - Fix the apparent bug (; at the end of parse rule block). - -2004-05-17 Wez Furlong - - * zend_objects_API.c - zend_objects_API.h: - As discussed with Andi, add this helper API for setting the object pointer - from - within the constructor. - - Please read the comment for notes about how to use it; in general, you - don't - need it, so don't use it. - -2004-05-14 Andrei Zmievski - - * zend_ini_parser.y - zend_ini_scanner.l: - Adding ability to refer to existing .ini variables from within .ini - files. Example: - - open_basedir = ${open_basedir} ":/new/dir" - -2004-05-12 Marcus Boerger - - * zend_API.c: - - Centralize register and hash operations for startup/register_module - in new zend_register_module_ex(). - - * zend_API.c: - - Revert to 1.249 - -2004-05-11 Andi Gutmans - - * zend_compile.c: - - Don't allow passing NULL to type hinted parameter. - -2004-05-10 Zeev Suraski - - * zend_operators.c: - - Fix comparison of objects - - Clarify convert_object_to_type() - -2004-05-10 Stefan Esser - - * zend_alloc.c: - Checking MEMORY_LIMIT before doing emalloc/erealloc solves several ugly - problems. - -2004-05-04 Wez Furlong - - * zend_iterators.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Add count_elements handler for overloaded objects. - -2004-05-02 Andi Gutmans - - * zend_operators.c: - - Fix comparison of two objects in non-compatibility mode. - -2004-05-01 Marcus Boerger - - * zend_API.c: - Don't load modules twice - -2004-04-29 Stanislav Malyshev - - * zend_execute.c: - Fix bug #27876 - -2004-04-28 Marcus Boerger - - * zend_exceptions.h: - Fix c++ builds - -2004-04-27 Marcus Boerger - - * zend_builtin_functions.c: - - Optional parameter to class_exists() that can be used to bypass - __autoload() which can be helpfull in __autoload() itself. - - * zend_interfaces.c: - - Fix warnings - - * zend_interfaces.c - zend_interfaces.h - zend_iterators.h: - - no unneccessary retval initialization - - new c-level iterator handler invalidate_current that is optionally - used to clear internal caching like in implementation of Iterator - -2004-04-27 Andi Gutmans - - * zend_reflection_api.c: - - Fix prototypes - -2004-04-26 Marcus Boerger - - * zend_reflection_api.c: - Fix prototype - -2004-04-25 Marcus Boerger - - * zend_builtin_functions.c: - Skip correct amount of stack entries - - * zend_interfaces.c: - Capture potential problem by error message - - * zend_reflection_api.c: - Show number of classes - -2004-04-25 Andi Gutmans - - * zend.h: - - RC3-dev - - * (php_5_0_0RC2) - zend.h: - - RC2 - -2004-04-23 Andi Gutmans - - * zend_compile.c: - - Fixed bug #27923. foreach() without a key should not check if the key - - is a reference (Adam) - -2004-04-21 Andi Gutmans - - * zend.h: - - RC2-dev - - * (php_5_0_0RC2RC2) - zend.h: - - Prepare for RC2RC2 (if everything is OK especially Zeev's interface - - patch I'll roll RC2 tomorrow). - -2004-04-21 Zeev Suraski - - * (php_5_0_0RC2RC2) - zend_compile.c: - Restore fatal error in case a method that's supposed to implement an - interface/abstract method, breaks its prototype - -2004-04-20 Andi Gutmans - - * zend_language_parser.y: - - Fix bug #27283 - Exceptions where the last catch() statement was - sometimes - - skipped. - -2004-04-19 Marcus Boerger - - * zend_reflection_api.c: - show ini entries and classes for extensions. - -2004-04-17 Marcus Boerger - - * zend.c: - Retval may not be set when zend_execute() is overloaded - -2004-04-15 Marcus Boerger - - * zend_execute.c: - Handle failure in get_current_data - -2004-04-14 Andi Gutmans - - * zend_extensions.h: - - Add comment - - * zend.h: - - RC2-dev - - * (php_5_0_0RC2RC1) - zend.h: - - RC2RC1 - -2004-04-13 Marcus Boerger - - * zend_exceptions.c: - Classnames shall start with an uppercase character - -2004-04-13 Zeev Suraski - - * zend_builtin_functions.c: - Fix debug_backtrace to show arguments again - We need to merge code from debug_backtrace & debug_print_backtrace at - some point! - -2004-04-13 Andi Gutmans - - * zend_extensions.h: - - Fix API no of Engine 2. The first number is the engine version and the - - rest is the API_NO. This way engine2_api_no is always greater than - - engine1_api_no. - - * zend.c - zend_exceptions.c - zend_exceptions.h: - - Add hook for exception handler (Derick) - -2004-04-12 Marcus Boerger - - * zend_API.h: - Fix order of macro parameter (synch with other macros) - -2004-04-12 Andi Gutmans - - * OBJECTS2_HOWTO - zend_extensions.h - zend_ini.c - zend_ini.h - zend_modules.h: - - modifyable -> modifiable - -2004-04-09 Andi Gutmans - - * zend_object_handlers.c: - - Fix bug #26441 (When __set() returned a value it corrupted it) - -2004-04-08 Marcus Boerger - - * zend_reflection_api.c: - Bugfix #27519 Reflection_Function constructor crashes with non-existant - function's name - -2004-04-07 Andi Gutmans - - * zend_builtin_functions.c: - - Hopefully fix the debug_backtrace() code. - - * zend_builtin_functions.c: - - Fix crash bug in zend_debug_backtrace(). No idea how come this survived - - for so long.... - -2004-04-04 Ilia Alshanetsky - - * zend_objects_API.c: - Removed unused variable. - -2004-04-03 Andi Gutmans - - * zend_builtin_functions.c: - Patch by Timm Friebe: - It changes - set_exception_handler() to accept the pseudo-type "callable" (instead of - a string referring to a global function). - - - Examples: - set_exception_handler('function_name'); - set_exception_handler(array('class_name', 'static_method')); - set_exception_handler(array($instance, 'instance_method')); - - - This also makes set_exception_handler() more consistent with all the - other callback functionality, e.g. set_error_handler(). - - * zend_operators.c: - - Nuke more old junk - - * zend.h - zend_operators.c - zend_operators.h: - - Nuke code which hasn't been in use for ages. - -2004-04-01 Ilia Alshanetsky - - * zend_builtin_functions.c: - MFB: Revert patch for bug #27782. - - * zend_execute.c - tests/bug27731.phpt: - Fixed reversed condition for error reporting. - -2004-03-31 Dmitry Stogov - - * zend_execute.c: - Fixed BUG in zend_post_incdec_property - -2004-03-31 Andi Gutmans - - * zend_reflection_api.c: - - Fix typo - -2004-03-30 Marcus Boerger - - * tests/bug26695.phpt: - Fix test - -2004-03-30 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #27782 (Wrong behaviour of next(), prev() and each()). - -2004-03-30 Marcus Boerger - - * zend_reflection_api.c: - TSRM fix - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_globals.h - zend_reflection_api.c: - - Fix Reflection class names - - Add ability to get the extension an internal class was defined in - -2004-03-29 Marcus Boerger - - * acconfig.h: - NAN==NAN doest work (Ard) - - * zend_builtin_functions.c: - Allow mixed case search for extensions - -2004-03-29 Sebastian Bergmann - - * zend_execute.c: - -clonning+cloning - -2004-03-29 Dmitry Stogov - - * zend_execute.c: - Implicit clonning strict warning was added for ze1_compatibility_mode - -2004-03-29 Ilia Alshanetsky - - * zend_execute.c - tests/bug27731.phpt: - Fixed bug #27731 (error_reporting() inside @ block fails to set - error_reporting level). - -2004-03-28 Marcus Boerger - - * zend_API.c: - Use lowercasing here - - * zend.c: - Initialize the complete struct - -2004-03-28 Stanislav Malyshev - - * zend_language_parser.y: - check writability on =& too - - * zend_execute.c: - - call set handler if assigning to object having this handler - - cleanup: use macros to access object internal vars - - * zend_interfaces.c: - preserve ZEND_API in definition - - * zend_interfaces.h: - declare as extern - -2004-03-28 Marcus Boerger - - * zend_reflection_api.c: - Fix memleak found by Timm - -2004-03-28 Stanislav Malyshev - - * zend_operators.c: - centralize object-to-scalar conversion, make it work with get handler - - * zend.c: - try get handler on printable conversion - - * zend_object_handlers.h: - some more clear comments - - * zend_operators.c: - Use macros for object parts access - -2004-03-28 Dmitry Stogov - - * zend_execute_API.c: - fix of fix related to __autoload. (ext/standard/tests/network/bug20134.phpt - passes again) - -2004-03-27 Marcus Boerger - - * zend.c: - Even though it is uncommented it should be right - -2004-03-26 Marcus Boerger - - * zend_API.c - zend_compile.c: - Force destructors to have empty signatures - -2004-03-26 Andi Gutmans - - * zend_execute.c: - - Fix build (thanks to Timm) - -2004-03-25 Derick Rethans - - * zend_language_scanner.l: - - Remove old and deprecated scanner token. - -2004-03-25 Andi Gutmans - - * zend_compile.c: - - If __construct() is defined then it will always take precedence over - - old style constructors. - -2004-03-25 Stanislav Malyshev - - * zend_execute.c: - no need to use result for RECV's - as in PHP4 - - * zend_execute.c: - Use get/set handlers for increment.decrement ops on objects - -2004-03-25 Andi Gutmans - - * zend_execute_API.c: - /* The compiler is not-reentrant. Make sure we __autoload() only during - run-time - * (doesn't impact fuctionality of __autoload() - */ - -2004-03-25 Dmitry Stogov - - * zend_execute_API.c: - Using ALLOC_HASHTABLE/FREE_HASHTABLE instead of emalloc/free. - -2004-03-24 Dmitry Stogov - - * zend.c - zend_execute_API.c - zend_globals.h: - New autoload protection schema was implemented (Using HashTable instead of - boolean flag) - -2004-03-24 Derick Rethans - - * zend_operators.c: - - Revert bogus commit - - * zend_operators.c: - - Fixed NEWS - -2004-03-24 Dmitry Stogov - - * tests/bug27641.phpt: - Fixed bug #27641 (Object cloning in ze1_compatibility_mode was - reimplemented) - - * zend_execute.c - zend_variables.c: - Object cloning in ze1 compatibility mode (zend.ze1_compatibility_mode) was - reimplemented (Dmitry, Andi) - -2004-03-22 Andi Gutmans - - * zend_compile.c: - - Fix bug - - * zend_execute.c: - - Remove whitespace - -2004-03-21 Andi Gutmans - - * zend_execute.c: - - Improve consistency - -2004-03-21 Stanislav Malyshev - - * zend_objects_API.c - zend_objects_API.h: - return zval *, to make it useful for read_property - - * zend_objects_API.c: - update to new API - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - API change for read_property: - instead of bool silent it now gets fetch type - This can be used for creating proxy objects for write contexts - -2004-03-21 Andi Gutmans - - * zend_execute.c: - - Nuke unused code - -2004-03-18 Andi Gutmans - - * zend.h: - - Back to RC2-dev - -2004-03-18 Zeev Suraski - - * (php_5_0_0RC1) - zend.h: - Prepare to roll RC1 - - * (php_5_0_0RC1) - zend_execute.c: - Fix possible data corruption with __set() - -2004-03-18 Stanislav Malyshev - - * zend_execute.c: - Improve error message - on E_STRICT, method is actually called, - so the error shouldn't say it cannot be called. - -2004-03-18 Andi Gutmans - - * (php_5_0_0RC1) - zend_compile.c: - - Change redefinition of constructor from E_COMPILE_ERROR to E_STRICT. - - * (php_5_0_0RC1) - ZEND_CHANGES: - - Update Changes - -2004-03-17 Sascha Schumann - - * zend_multiply.h: - Readd x86 implementation - -2004-03-17 Andi Gutmans - - * (php_5_0_0RC1RC2) - zend_multiply.h: - - Improved patch for support multiplication on 64bit machines - - * (php_5_0_0RC1RC2) - zend_execute.c: - - Fix tiny bug (one of the reasons we can't support __toString() for - - regular objects). - - * (php_5_0_0RC1RC2) - zend.c: - - Stop make_printable_zval() from calling __toString() - - * zend_execute.c: - - Fixed problem with __toString(). Due to the engine's architecture it is - - currently not possible to call __toString() anywhere besides print & - eval. - - Follow up will be on internals@ - -2004-03-17 Stanislav Malyshev - - * (php_5_0_0RC1RC2) - zend_compile.c: - fix typo - -2004-03-17 Andi Gutmans - - * zend_multiply.h - zend_operators.c: - - Apply Ard's patch to support multiplication & overflow on both 32bit - and 64bit machines - -2004-03-16 Derick Rethans - - * zend.c - zend.h - zend_API.h - zend_modules.h: - - Replaced the exec_finished hook by the zend_post_deactive hook for - extensions. The new hook will be run after the symbol table and - destructors - are run. (Derick) - - * zend_modules.h: - - Bump API number so that it actually differs from PHP 4. This is needed - because we don't want PHP 4 and PHP 5 extensions to be in the same - directory - when doing "make install" for shared, or phpize'd extensions. - -2004-03-16 Marcus Boerger - - * zend_execute_API.c: - Fix SEGV in certain conditions while calling static methods - -2004-03-16 Zeev Suraski - - * zend_compile.c - zend_compile.h: - Add ability to disable JIT for a particular auto global - -2004-03-16 Marcus Boerger - - * zend_execute_API.c: - TSRM fix - -2004-03-16 Sascha Schumann - - * zend.h: - Enable ptr format check for GCC 3.1 and higher - -2004-03-16 Ilia Alshanetsky - - * zend.h: - Do not allow 3.0.4 for __attribute__. - - * zend.h: - Fixed bug #27600 (GCC 3.0.4 does not like __attribute__ directive) - -2004-03-16 Andi Gutmans - - * zend_compile.c: - - Fix problem when using old-style constructors it wasn't being inherited - correctly. - -2004-03-16 Derick Rethans - - * zend_execute_API.c: - - Spaces to tabs - -2004-03-16 Andi Gutmans - - * zend_execute_API.c: - - If the called method is static then don't define $this - - * zend_execute.c - zend_execute_API.c: - - Error out if get_method() isn't defined. - - Use calling scope of internal function callee when calling a method - using static syntax (array("A", "func")); - -2004-03-16 Marcus Boerger - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Improve error message - -2004-03-15 Andi Gutmans - - * zend_operators.c: - - Restore E_NOTICE for longs and doubles. - -2004-03-15 Jani Taskinen - - * zend.h: - - Fixed bug #24582 (extensions can not be loaded dynamically in - Solaris/iPlanet) - -2004-03-15 Andi Gutmans - - * zend_operators.c: - - Nuke E_NOTICE. This caused a notice when doing if ($obj == NULL) - -2004-03-14 Marcus Boerger - - * zend_builtin_functions.c: - Make object parameter optional - -2004-03-14 Ilia Alshanetsky - - * zend.c: - Fixed bug #27590 (crash during shutdown when freeing persistent resources - in ZTS mode). - -2004-03-14 Andi Gutmans - - * zend_execute_API.c: - - Fix windows build - - * zend_execute_API.c: - - Fix for bug #27504 - - * zend_builtin_functions.c: - - Fixing bug #27123 - - * zend_operators.c: - - Improve compatibility mode and compare objects according to property - - comparison (sucky but this is how PHP 4 behaved). - - * zend.c: - - Fix flow of logic - - * zend_operators.c: - - Support old style of converting objects to long/double/bool. - - This is only enabled in compatibility mode, else it calls cast_object() - - and if that is not available we return 1 (true) so that the following - - code would work: - if ($obj) { - } - -2004-03-14 Marcus Boerger - - * zend_operators.c: - Fix: Add return type void - -2004-03-14 Andi Gutmans - - * zend.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - - Support Cast operator in convert_to_* so that we support internal - - extensions such as SimpleXML. This is for Sterling. - - * zend_operators.c: - - Fix memory leak in the following code (Dmitry): - - - * zend_operators.c: - - Initial commit which allows comparing overloaded objects with native - - types (only for internal classes and not for user-land classes). - -2004-03-11 Andi Gutmans - - * zend_objects_API.c: - - Real fix for bug #27535 (Dmitry) - - * zend_objects_API.c: - - Attempt to fix bug #27535 - -2004-03-09 Marcus Boerger - - * ZEND_CHANGES: - Rename hasMore() to valid() as discussed. (Part VI) - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_interfaces.c - zend_language_parser.y - zend_reflection_api.c: - Clearify the different method/class flags (as discussed with Andi). - - * zend.h: - No longer needed - -2004-03-09 Andi Gutmans - - * zend_constants.c: - - Fix crash: - - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Nuke unused code. - -2004-03-08 Marcus Boerger - - * zend_execute.c - zend_interfaces.c - zend_iterators.h: - Rename hasMore() to valid() as discussed. (Part II) - - * zend_interfaces.c: - Rename hasMore() to valid() as discussed. (Part I) - - * zend_execute_API.c: - Check count. - - * zend_reflection_api.c: - Add another missing conversion - -2004-03-05 Andi Gutmans - - * zend_compile.c: - - Fix some small problems I introduce in last patch. - - * zend_compile.c: - - Finally fix the following: - $xml_mem = - simplexml_load_string('1'); - /* The following works fine */ - foreach ($xml_mem->part as $part) { - foreach($part->chapter->page as $page) { - print $page; - } - } - /* The following segfaults */ - foreach ($xml_mem->part as $part) { - foreach($part->chapter as $chapter) { // Difference here from previous - example - print $chapter; - } - } - -2004-03-04 Moriyoshi Koizumi - - * zend_language_scanner.l: - - Fix memleak when scanner is called from within tokenizer extension. - -2004-03-04 Stanislav Malyshev - - * zend_execute.h: - fix the fix - - * zend_execute.h: - oops, fix cut&paste gone bad - - * zend_execute.h: - Fix object true value: if we are in compat mode and it's Zend object - - use PHP4 rules. Otherwise, object is always true. - -2004-03-04 Derick Rethans - - * zend_constants.h - zend_operators.h: - - Fixed a 64bit issue (for zend_builtin_functions.c, module_number is an - int). - - Change the MAX_LENGTH_OF_LONG constant to 20, as LONG_MAX is 20 - characters. - (Patches by Ard Biesheuven) - - * tests/zend_operators.phpt: - - Added instance_of test (patch by Ard Biesheuvel) - -2004-03-04 Stanislav Malyshev - - * zend_compile.c: - Disallow redefining ctors and cleanup - - * zend_mm.c: - Handle out of memory/bad size situation gracefully, without getting into - loop - -2004-03-03 Andi Gutmans - - * zend_objects_API.c: - - Fix crash: - x as $x); - } - } - new foo(); - echo 'OK'; - ?> - -2004-03-02 Marcus Boerger - - * zend_API.c - zend_API.h: - Fix zend_parse_method_parameters_ex() and make it consistant with - zend_parse_method_parameters(). - -2004-03-02 Andi Gutmans - - * zend_compile.c: - - Fix leaks (although there might be still a problem here). - - * zend_execute.c: - - Fix leak (Dmitry) - - * zend_compile.c: - - Fix crash in: - attributes as $name => $attr) { - } - } - } - - $f= new Foo(); - $f->export(); - ?> - - * zend_objects.c: - - Improve fix for protecting destructor's from exceptions. - - I was killing the current exception completely which was wrong. - -2004-03-01 Andi Gutmans - - * zend_objects.c: - - Fix crash in destructors(). You can't throw an exception in destructors - as there is no guaranteed time when the destructor will be called. - - * zend_reflection_api.c: - - Fix leak - - * zend_reflection_api.c: - - Fix crash in reflection API (pierre) - - * zend.c - zend_exceptions.c - zend_execute_API.c: - - Fix crash in exception handling (zend_exception_error(...) and - zend_eval_string_ex() were buggy (Dmitry, Andi) - -2004-03-01 Derick Rethans - - * zend_compile.h: - - Typo fix (by Jan) - - * zend_builtin_functions.c: - - Fixed bug #27443 (defined() returns wrong type). - -2004-02-29 Andi Gutmans - - * zend_reflection_api.c: - - Apply fixes by Timm. - - * zend_compile.c: - - Change prototype isA check not to check the constructor. - - Only give an E_STRICT for non-isA compliant code as opposed to - E_COMPILE_ERROR. - -2004-02-29 Stanislav Malyshev - - * zend_compile.h: - add ZEND_API there too for opcode handlers - -2004-02-29 Derick Rethans - - * zend_execute.c: - - Initialize memory to \0 so that we can reliable detect whether a specific - opcode element is in use. - -2004-02-29 Stanislav Malyshev - - * zend_execute.c: - export opcode table - -2004-02-27 Marcus Boerger - - * zend_API.c - zend_compile.h: - Add some comments - - * zend_API.c - zend_compile.c - zend_execute.c: - Fixes for abstract classes/methods - -2004-02-26 Marcus Boerger - - * zend_language_parser.y - zend_language_scanner.l: - Fix __METHOD__ (noticed by Davey Sahfik) - - * zend_reflection_api.c: - Fix problem with Reflection_Property (patch from Timm slightly modified). - -2004-02-25 Marcus Boerger - - * zend_objects_API.c: - As Andi found out the dtor may increase the refcount. - -2004-02-25 Jani Taskinen - - * zend_builtin_functions.c: - ws + cs - -2004-02-25 Zeev Suraski - - * zend_compile.c - zend_execute.c: - Fix leak in foreach ($o->mthd()->arr) - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - - Improve ARG_INFO() macros to support supplying required_num_args - - Initial fix for foreach($o->mthd()->arr) crash (now leaks) - -2004-02-25 Derick Rethans - - * zend_highlight.c: - - Use instead of in highlight_string(). (Patch by - mg@iceni.pl) - -2004-02-25 Jani Taskinen - - * zend_exceptions.c: - Improve error messages - -2004-02-25 Zeev Suraski - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_variables.c: - - Rename compatiblity mode to zend.ze2_compatibility_mode (it doesn't - only affect auto-clone). - - Perform implementation checks even with simple inheritance (off when - compatibility mode is enabled). - - Restore default arguments in interfaces and handle it correctly. - - Move registration of internal classes later in the startup sequence - in order to have INI options available. - -2004-02-25 Derick Rethans - - * zend_exceptions.c: - - Fixed bug #27391 (typo in Fatal Error message). - -2004-02-25 Zeev Suraski - - * zend_API.c - zend_compile.c - zend_compile.h - zend_opcode.c: - - Abstract methods cannot have defaults for arguments - - Make function foo($a, $b=null) satisfy both foo($a) and foo($a, $b) - prototypes - -2004-02-25 Sebastian Bergmann - - * zend_reflection_api.c: - Proto fixes. - -2004-02-25 Marcus Boerger - - * zend_objects_API.c: - Fix object destruction/free in shutdown - - set destructor_called even when no dtor is given - - use free_storage even when no dtor hat to be called - - * zend_objects_API.c: - Checking once for dtor is enough - -2004-02-24 Marcus Boerger - - * zend_API.c: - Fix class flags when handling abstract methods - -2004-02-23 Andi Gutmans - - * zend_language_parser.y: - - Improve precendence: - - foo = "Blah"; - - if (!$obj instanceof StdClass) { - print "No"; - } else { - print "Yes"; - } - - * zend_language_parser.y: - - Decrease precedence of instanceof so that the following is true: - php -r 'var_export((object)1 instanceof stdClass);'; - Patch by Jan Lehnardt - -2004-02-22 Derick Rethans - - * zend_operators.c: - - Fixed bug #27354 (Modulus operator crashes PHP). - -2004-02-22 Marcus Boerger - - * ZEND_CHANGES: - Add some more obviously needed information - -2004-02-20 Hartmut Holzgraefe - - * zend.h - zend_API.h - zend_iterators.h - zend_operators.h - zend_variables.h: - more EXTERN_C wrapping of ZEND_API prototypes - -2004-02-20 Jani Taskinen - - * zend_opcode.c: - ws fix - -2004-02-18 Hartmut Holzgraefe - - * zend.h - zend_builtin_functions.h - zend_extensions.h - zend_indent.h - zend_interfaces.h - zend_object_handlers.h - zend_objects.h - zend_objects_API.h - zend_ptr_stack.h - zend_stack.h - zend_stream.h: - wrap ZEND_API prototypes into BEGIN_EXTERN_C/END_EXTERN_C - for C++ extension support - -2004-02-18 Zeev Suraski - - * zend.c: - Forward-port fixlet from PHP 4 (thanks to Michael Sisolak) - -2004-02-17 Jani Taskinen - - * zend_list.c: - MFB: - Fix bug #26753 (zend_fetch_list_dtor_id() does not check NULL - strings) - -2004-02-16 Derick Rethans - - * ZEND_CHANGES: - - Clearify clone behavior, fixed clone example (Patch by Jan Lehnardt) - -2004-02-16 Marcus Boerger - - * zend_compile.c: - Bugfix #27227 Mixed case class names causes Fatal Error in Constructor call - -2004-02-14 Marcus Boerger - - * zend_iterators.c: - dtor's may not be called from free_storage handlers - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_execute.c: - - Remove old code - -2004-02-12 Hartmut Holzgraefe - - * (php_5_0_0b4) - ZEND_CHANGES: - making sure that the provided examples actualy work (or at least do not - generate no parse errors) unless they are really expected to fail - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_object_handlers.c: - - This was too strict. - -2004-02-12 Zeev Suraski - - * (php_5_0_0b4) - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_interfaces.c - zend_object_handlers.c: - - Check return-by-reference bit when implementing interface prototypes - - Add infrastructure for built-in functions to hint whether they - return by reference or not. It is NOT currently used for anything, - except for interface prototypes (you can use it to request that the - function that implements your prototype returns by reference or - doesn't return by reference). - For downwards compatibility - by default, interface prototypes are - agnostic as to whether the function that implements them returns - by reference or not. Use ZEND_BEGIN_ARG_INFO_EX() with - ZEND_RETURN_VALUE/ZEND_RETURN_REFERENCE to change that. - - Fix ArrayAccess::getOffset() to conduct additional checks. - If your getOffset() should work with multidimensional arrays - it - must return by reference. - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - zend_object_handlers.h: - - Add comments to read/write property/dimension for extension authors - -2004-02-12 Zeev Suraski - - * zend_default_classes.h: - zend_default_classes.h -> zend_exceptions.h - -2004-02-12 Andi Gutmans - - * (php_5_0_0b4) - Makefile.am: - - Add zend_exceptions.c - -2004-02-12 Zeev Suraski - - * (php_5_0_0b4) - ZendTS.dsp - zend.c - zend_default_classes.c - zend_exceptions.c - zend_exceptions.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_reflection_api.c: - Centralize exceptions code in zend_exceptions.[ch]. - Remove zend_default_classes.h (use zend_exceptions.h instead) - - NOTE: This currently breaks the build, fixes to php-src and pecl coming - soon - -2004-02-12 Andi Gutmans - - * zend_execute.c: - - Use zend_throw_exception_object() in throw_handler to make sure it - - does all the checks - -2004-02-12 Zeev Suraski - - * zend_default_classes.c - zend_default_classes.h - zend_exceptions.c - zend_exceptions.h - zend_execute.h - zend_execute_API.c: - Exceptions updates: - - - Enforce exceptions to be derived from class Exception. This allows - users to perform catch-all. It's not yet complete, so don't get - comfortable with it just yet :) Updates are coming soon. - - Implement zend_throw_exception() using zend_throw_exception_ex() - -2004-02-12 Andi Gutmans - - * zend_execute.h - zend_execute_API.c: - - Add API function to throw exception by using an object - -2004-02-11 Marcus Boerger - - * zend.c: - Must be initialized in ZTS mode - - * ZEND_CHANGES - ZEND_CHANGES: - Update - - * zend_compile.c - zend_language_parser.y: - Fix: [extends [, ]* ] - -2004-02-11 Zeev Suraski - - * zend_execute.c: - Fix leaks in assignments to overloaded objects - - * zend_execute.c: - Fix leak with overloaded objects, when they're used just "for the hell - of it" :) - - * zend_execute.c: - Fixed a bug the caused overloaded array indices to be converted to strings - - * zend_execute.c: - Turn off bogus warnings with overloaded dimensions and += (and friends) - - * zend_execute.c: - Improve the implementation of unset() on array dimensions to be more - consistent with that of regular variables and string offsets - - * zend_execute_API.c: - Fix bug #25038 - - * zend_reflection_api.c: - Fix crash (patch by Rob Richards) - - * zend.c - zend_execute_API.c: - Fix exceptions thrown without a stack frame - Always enable set_exception_handler() - - * zend_list.h: - Change FETCH_RESOURCE to return false on error instead of null, for - consistency with other error situations - - * zend_compile.c: - Fix bug #26802 (the right aspects of it found by Marcus, anyway :) - - * tests/bug26802.phpt: - Fix and clarify the test case - - * zend_execute_API.c: - Complete the fix for handling of exceptions happening during the - argument passing phase of function calls (fixes bug #26866) - - * zend_execute_API.c: - whitespace - -2004-02-10 Zeev Suraski - - * tests/bug26698.phpt: - Ignore the memleak in this test - - * zend_execute.c: - Fix bug #26698 (exceptions handled properly during argument passing to - functions) - - * zend_default_classes.c: - Fix bug #27186 - - * zend_execute_API.c: - Fix bug #26869 - - * zend_execute.c: - Fix refcounting of ++/+= overloading (fix leak in __get()/__set() - based classes) - -2004-02-10 Andi Gutmans - - * zend_compile.c: - - Nuke more unused code - -2004-02-10 Zeev Suraski - - * zend_execute.c: - Fix handling in assignment using multidimensional array syntax to string - offset ($s = "FUBAR"; $s[0][0] = 1;) - -2004-02-10 Andi Gutmans - - * ZEND_CHANGES: - - We will go with PHP 4 behavior. With the new object model assigning by - reference has lost a lot of its importance. - - * zend_compile.c: - - Remove junk - -2004-02-10 Zeev Suraski - - * zend_execute.c: - Fix exception handling in opcodes spanned across multiple oplines (fixes - the crash in __set()) - - * zend_execute.c: - - Fix pre/post increment for overloaded objects - - Fix binary-assign-op for overloaded objects - - NOTE: This requires the implementation of the 'get' callback! - -2004-02-10 Moriyoshi Koizumi - - * tests/bug22836.phpt: - - Correcting test. - -2004-02-08 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Fix write-mode of overloaded objects when using array dimensions - -2004-02-08 Andi Gutmans - - * zend_objects_API.c: - - Check if free_storage exists - -2004-02-05 Sebastian Bergmann - - * ZEND_CHANGES: - Committing for Jan. - -2004-02-05 Ilia Alshanetsky - - * zend_compile.c - tests/bug27145.phpt: - Fixed bug #27145 (Unmangle private/protected property names before printing - then inside error messages). - -2004-02-04 Zeev Suraski - - * zend_execute_API.c: - Fix exceptions happening inside internal functions called through - zend_user_function() - - * zend_execute_API.c: - Remove double initialization - -2004-02-04 Marcus Boerger - - * zend_objects.h: - Add new prototype - - * zend_reflection_api.c: - Fix reflection - - * zend_iterators.c: - Fix warnings - -2004-02-04 Zeev Suraski - - * zend_compile.c: - Fixlet - - * zend_compile.c: - Fix handling of $this in some cases - - * zend_compile.c: - Handle additional cases - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_language_parser.y: - Reinstate early-binding for classes. - - Note that this is available for downwards compatibility only - and it - doesn't - work if you use new features (namely, interfaces). Generally, people - should - declare their classes before using them, but we just didn't want hell to - break - loose (c) - - * zend_opcode.c: - Optimize - - * zend_compile.c: - - Improve $this assignment detection and generalize some code in - zend_compile.c - - * zend_compile.c: - -Error out when trying to re-assign $this - - * zend_objects_API.c - zend_objects_API.h: - The valid bit was necessary after all - restored - - * zend_objects_API.c: - Fixlets - - * zend_compile.c - zend_objects.c: - - Small fixes - - * zend_execute.c: - - Improve wording - - * zend_execute_API.c - zend_iterators.c - zend_objects.c - zend_objects_API.c - zend_objects_API.h - zend_reflection_api.c: - Change destructor implementation (details will follow on internals@) - -2004-02-03 Marcus Boerger - - * tests/bug24884.phpt: - Update tests - - * zend_objects.c: - Nuke unused variable - - * zend_compile.c: - Fix Warning - -2004-02-03 Sebastian Bergmann - - * ZEND_CHANGES: - clone/__clone() related changes. - -2004-02-03 Zeev Suraski - - * zend_compile.c: - Remove unused variable - - * zend_objects_API.c - zend_objects_API.h: - Remove more garbage - valid bit was not really necessary - - * zend_execute_API.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c - zend_objects_API.h: - - Clean garbage (delete was nuked a long time ago) - -2004-02-03 Ilia Alshanetsky - - * zend_execute.c: - More unneeded code removed. - -2004-02-03 Zeev Suraski - - * zend_execute.c - zend_language_scanner.l: - Abort on parse error in an include file (patch by Ilia) - - * zend_compile.c: - Remove redundant code - - * zend_execute.c: - Fix try/catch block logic - - * zend_compile.c - zend_objects.c: - Perform a bitwise copy of the object even when __clone() is defined. - __clone() is back to not requiring any arguments, as $that is no longer - needed ($this already contains a copy of the original object, by the time - we __clone() is executed). - Calling the parent clone is done using parent::__clone() - - * zend_compile.c - zend_compile.h - zend_default_classes.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Rewrote exception support. Fixes a few limitations and bugs in the old - implementation, and allows exceptions to 'fire' much earlier than before. - - Instructions on how to use the new mechanism will follow on internals@ - shortly... - - Note - this (most probably) breaks the current implementation of - set_exception_handler() - -2004-02-02 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_language_scanner.l - zend_objects.c: - Redesign the clone() feature to fix some fundamental flaws in the previous - implementation. - - Using clone directly is now done using - $replica = clone $src; - - Clone methods must now be declared as follows: - function __clone($that) - { - } - - Clone methods in derived classes can call the __clone method of their - parent - classes using parent::__clone($that) - -2004-01-31 Marcus Boerger - - * zend_reflection_api.c: - Throw an exception in case a reflection object cannot be found and do not - override the exception from constructors in static method calls. - -2004-01-30 Ilia Alshanetsky - - * zend_execute.c: - Apply the same parse error handling to (include|require)_once as the one - for - their non-once counterparts. - -2004-01-28 Zeev Suraski - - * zend_compile.c: - Tweak checks to detect some additional cases. - Reorder checks to make more sense. - - * zend_compile.c: - - Error message fix - - Prevent inheritance of the same constant from two interfaces - - * zend_compile.c: - Fixlets - - * zend_compile.c - zend_compile.h: - Prevent classes from implementing interfaces that have the same function - - * zend_execute.c: - Whitespace - - * zend_compile.c: - Code relayout - - * zend_execute_API.c: - Forward-port fix for timeouts under Windows - -2004-01-26 Marcus Boerger - - * zend_interfaces.c - zend_interfaces.h: - - Export struct zend_user_iterator - - Ad 'it' to function prefix to prevent naming clashes - - Export zend_user_it_free_current - -2004-01-25 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #26814 (On parse error include included file, terminate - execution script). - -2004-01-25 Marcus Boerger - - * zend_execute.c - zend_iterators.c - zend_iterators.h: - Respect proeprty visibility in foreach - - * tests/bug26696.phpt: - Update test - -2004-01-24 Marcus Boerger - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling - internal non-static methods statically. - -2004-01-24 Sebastian Bergmann - - * zend_execute.c - zend_execute_API.c: - Change message as proposed by Jon. - -2004-01-23 Marcus Boerger - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Simplify detection of methods that must be called dynamic (with object) - - * zend_execute.c - zend_execute_API.c: - Disallow calling __clone/__construct/__destruct static - Send an E_STRICT when calling a non static method static - - * zend_API.c - zend_compile.c - zend_compile.h: - Disallow static declaration of clone - -2004-01-23 Jani Taskinen - - * zend_constants.h - zend_ini.h: - Silence some compile warnings - -2004-01-22 Marcus Boerger - - * zend_default_classes.c: - Fix internal access to exception properties - -2004-01-19 Andi Gutmans - - * zend_execute.c - zend_execute.h: - - Hopefully fix bug #26696. - - Please let me know if hell-breaks loose - -2004-01-19 Marcus Boerger - - * zend_API.c - zend_API.h: - Add zend_get_module_started() to quickly check whether a module is present - and its MINIT function has been called. - -2004-01-18 Marcus Boerger - - * zend_execute.h - zend_execute_API.c: - Improove debug capabilities - - * zend_reflection_api.c: - Fix some casing issues - -2004-01-17 Marcus Boerger - - * zend_interfaces.c: - - - * zend_interfaces.c: - Fix inheritance rule for interface Traversable - -2004-01-17 Jani Taskinen - - * tests/bug26802.phpt: - - Renamed all *php4* files to *php5*, changed all php4/PHP4 to php5/PHP5 - -2004-01-17 Ilia Alshanetsky - - * zend_object_handlers.c - zend_object_handlers.h: - Expose zend_std_call_user_call(), needed for implementation of things like - __call handlers. - -2004-01-17 Jani Taskinen - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - Nuke compile warning by using the LANG_SCNG macro instead - -2004-01-16 Jani Taskinen - - * zend_reflection_api.c: - - Fixed bug #26640 (__autoload() not invoked by Reflection classes) - - -2004-01-15 Zeev Suraski - - * zend.c: - Nice patch Christian, but it wasn't at all enabled? :) - - Fix bug #26883 - -2004-01-14 Zeev Suraski - - * zend_compile.c: - Don't allow interfaces to implement anything - -2004-01-14 Andi Gutmans - - * zend_operators.h: - - Remove bogus macros - -2004-01-13 Wez Furlong - - * zend_ini_parser.y: - Don't treat strings containing : as potential constant names in - the .ini parser. - This fixes Bug #26893 - -2004-01-12 Andi Gutmans - - * zend_compile.c: - - Return the PHP 4 behavior of not allowing class declerations within - - class declerations. This happened when declaring a class within a - - method. - class A { - function foo() { - class B { - } - } - } - -2004-01-12 Marcus Boerger - - * zend_API.h: - Add missing macro - -2004-01-11 Wez Furlong - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - TSRMLS fix - -2004-01-11 Andi Gutmans - - * zend_language_parser.y: - - Re-allow conditional class declerations. Needless to say that I also - - think it's not great coding.. Use polymorphism instead :) - - * zend_compile.c - zend_language_scanner.h - zend_language_scanner.l: - - This should fix the problem of conditional function decleration on the - - same line of code not to work. You should re-evaluate your coding style - - if you really code this way :) - -2004-01-10 Zeev Suraski - - * zend_operators.c: - Remove conflict - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h - zend_operators.c: - Added error mask to set_error_handler() - Patch by Christian Schneider - -2004-01-09 Wez Furlong - - * acconfig.h: - support for building asm in the unix buildsys. - Also, when ZEND_ACCONFIG_H_NO_C_PROTOS is defined, - omit the C prototypes from the configuration header - so that it can be included into asm files. - -2004-01-09 Marcus Boerger - - * RFCs/002.txt: - this one is declined - -2004-01-09 Wez Furlong - - * zend_object_handlers.h: - must be extern to avoid problems with some compilers - -2004-01-09 Stanislav Malyshev - - * tests/bug26077.phpt: - fix expect - - * zend_compile.c: - Bug #25816 - disallow arrays in class constants - - * tests/bug26077.phpt: - add test - - * zend_compile.c - zend_execute.c: - Fix Bug #26077 - memory leak when new() result is not assigned - and no constructor defined - -2004-01-08 Jani Taskinen - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_default_classes.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_scanner.h - zend_interfaces.c - zend_interfaces.h - zend_istdiostream.h - zend_iterators.c - zend_iterators.h - zend_language_scanner.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multibyte.c - zend_multibyte.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_reflection_api.c - zend_reflection_api.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - - Happy new year and PHP 5 for rest of the files too.. - -2004-01-08 Andi Gutmans - - * zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l: - - - A belated happy holidays (by two years) - -2004-01-07 Marcus Boerger - - * zend_execute.c: - Reimplement part of Bug #24608 that was reverted too - - * zend_execute.c: - Revert patch that allowed to call sttaic methods via $method() - -2004-01-06 Ilia Alshanetsky - - * zend_mm.c: - Check if realloc() succeeds or not. (Noticed by Andrey) - -2004-01-06 Marcus Boerger - - * tests/bug26802.phpt: - Update - -2004-01-05 Marcus Boerger - - * zend_execute.c - tests/bug26802.phpt: - Fixed bug #26802 - - * tests/bug26802.phpt: - Fix test - - * tests/bug26801.phpt - tests/bug26802.phpt: - Add new test - - * tests/bug26696.phpt: - Update test - -2004-01-05 Stanislav Malyshev - - * zend_API.c: - Fix bug #26543 - check parent:: and self:: in class names - - * zend_execute.c - zend_object_handlers.c: - Bug #24608 - fix interaction between __accessors and get_property_ptr - -2004-01-03 Derick Rethans - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_reflection_api.c: - - Fixed var_export() to show public, protected and private modifiers - properly. - - Exported (un)mangle_property_name. - -2004-01-02 Andrei Zmievski - - * zend_default_classes.c: - Do not show exception message if it's empty. - - -2003-12-31 Andrei Zmievski - - * zend_default_classes.c: - Make default message look better. - -2003-12-30 Andi Gutmans - - * ZEND_CHANGES: - - Fix typos - -2003-12-30 Marcus Boerger - - * ZEND_CHANGES: - Update - -2003-12-30 Ilia Alshanetsky - - * tests/bug26696.phpt: - Added test case for bug #26696. - -2003-12-29 Marcus Boerger - - * zend_execute.c: - Fix (string) conversion - - * zend.c: - Add missing notice - - * zend_execute_API.c: - Fix __autoload() with derived classes - -2003-12-28 Marcus Boerger - - * zend_API.c: - WS - - * zend_API.h - zend_compile.c: - Fix order of class_entry member initialization (needed for example for DOM) - -2003-12-27 Marcus Boerger - - * zend_language_parser.y: - Fixed bug #26065 (Crash when nesting classes) - - * tests/bug26698.phpt: - Add new test - - * zend_objects.c: - Simplify - - * zend_object_handlers.c: - Fix __tostring() and concatenation - -2003-12-25 Marcus Boerger - - * zend_execute.c - zend_execute.c: - Fix warning - -2003-12-25 Ilia Alshanetsky - - * zend_highlight.c: - Fixed Bug #26703 (Certain characters inside strings incorrectly treated as - keywords). Original patch by vrana@php.net. - -2003-12-23 Marcus Boerger - - * zend.c - zend_execute_API.c - zend_globals.h - tests/bug26697.phpt: - Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload - results in segfault). - -2003-12-22 Marcus Boerger - - * tests/bug26229.phpt - tests/bug26695.phpt: - Add more tests - - * tests/bug24884.phpt - tests/bug26166.phpt: - Fix tests now that class names are shown in correct casing - - * zend_compile.c: - Preserve class name casing. - - * zend_reflection_api.c: - Fixed bug #26695 (Reflection API does not recognize mixed-case class hints) - - * zend_object_handlers.c: - Fixed bug #26675 (Segfault on ArrayAccess use) - Update NEWS - -2003-12-22 Wez Furlong - - * zend_API.c - zend_API.h - zend_object_handlers.c - zend_object_handlers.h: - export these symbols for use by SPL as a shared extension - -2003-12-19 Andi Gutmans - - * (php_5_0_0b3RC2) - zend_language_parser.y: - - Nuke another rule (thanks to Jan for noticing this) - -2003-12-19 Dmitry Stogov - - * (php_5_0_0b3RC2) - zend.c: - Bug #25547 (error_handler and array index with function call) was fixed - tests/lang/bug25547.phpt - -2003-12-19 Andi Gutmans - - * zend_language_parser.y: - - Nuke unused code - -2003-12-19 Dmitry Stogov - - * (php_5_0_0b3RC2) - zend_execute.c: - Error reporting on unset string offset was added (Bug #24773 - Zend/tests/bug24773.phpt) - - * zend_execute.c: - Assign_op operators (+=) were fixed for elements of overloaded objects - -2003-12-18 Andi Gutmans - - * zend_execute.c: - - Nuke C++ comment - - * zend_execute.c: - - Revert patch 1.566 - -2003-12-18 Marcus Boerger - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Fixed bug #24837 Incorrect behaviour of PPP using foreach. - -2003-12-17 Zeev Suraski - - * (php_5_0_0b3RC1) - zend_execute.c: - This part of the if was necessary after all. - Refix bug #22510 - -2003-12-17 Dmitry Stogov - - * (php_5_0_0b3RC1) - zend_execute_API.c: - -** empty log message *** - - * (php_5_0_0b3RC1) - zend_compile.c: - Dynamic function call from object's property was fixed - (See "tests/lang/bug24926.phpt" and "tests/lang/bug25652.phpt") - - * zend_execute_API.c: - Access to globals/autoglobals from class __destructor was fixed. - (see "tests/lang/bug24908.phpt" and - "tests/classes/destructor_and_globals.phpt") - -2003-12-16 Sebastian Bergmann - - * zend_compile.h - zend_object_handlers.h - zend_stream.h: - Sync: Export externally used functions. - -2003-12-16 Stanislav Malyshev - - * zend_compile.c: - export class initialization function - - * zend_object_handlers.c: - export externally used functions - - * zend_stream.c: - export function - -2003-12-15 Marcus Boerger - - * zend.c - zend_object_handlers.c - zend_object_handlers.h: - Reenable __tostring() magic for print,echo,concatenation,function naming... - but not for other internal things. - -2003-12-15 Jani Taskinen - - * zend_execute.c: - ws + cs (no c++ comments in c code) - -2003-12-15 Dmitry Stogov - - * zend_execute.c: - Bug #24773 was fixed (Zend/tests/bug24773.phpt) - Assign_op operators (+=) were fixed for elements of overloaded objects - Memory leaks during accessing ptoperies/elements of overloaded objects - were fixed - - * zend_execute_API.c - zend_reflection_api.c: - Memory corruptions were fixed in zend_str_tolower_copy() - -2003-12-14 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: - Fix behavior of return-by-reference functions. Remove erroneous warnings, - add E_STRICT warnings in case you return something by reference that - you're - not supposed to (anything that's not a variable, or a return-value of a - function that returned by reference). - - * zend.h - zend_execute.c - zend_execute.h: - Some cleanup - -2003-12-13 Moriyoshi Koizumi - - * zend_operators.c: - Fixes for POSIX compliancy. - -2003-12-12 Marcus Boerger - - * zend.c: - Free is needed in non ZTS too - - * zend.c: - Fix memleaks in ZTS mode - - * zend.c: - Fix memleaks - -2003-12-12 Ilia Alshanetsky - - * zend_constants.c: - Do not copy extra byte. - -2003-12-11 Ilia Alshanetsky - - * zend.h: - Fixed extra byte allocation for TRUE/FALSE/ZEND_THREAD_SAFE/NULL constants. - -2003-12-11 Marcus Boerger - - * zend_execute_API.c: - Bugfix: #26591 [NEW]: "__autoload threw an exception" during an uncaught - Exception - -2003-12-11 Andi Gutmans - - * zend_execute.c: - - Refix bug #24773 - -2003-12-11 Marcus Boerger - - * zend_object_handlers.c: - Handle getter failure and allow to bypass thrown exceptions. - - * zend_execute.c: - read_dimension() handler might return 0, handle this. - -2003-12-10 Marcus Boerger - - * zend_execute_API.c: - Do not double copy the string - -2003-12-09 Jani Taskinen - - * zend_operators.c - zend_operators.h: - - Brought ext/bcmath to the new millennium - -2003-12-09 Andi Gutmans - - * zend_constants.c: - - Fix overallocation (thanks to Ilia) - -2003-12-08 Derick Rethans - - * zend_builtin_functions.c: - - Make it compile again - -2003-12-07 Stanislav Malyshev - - * zend_builtin_functions.c: - Apply Andrey Hristov's patch adding get_declared_interfaces() - -2003-12-06 Marcus Boerger - - * zend_compile.c: - This test is against interfaces not abstract classes. - - * zend_default_classes.c: - Show the exception message again after __toString() magic has been dropped. - -2003-12-05 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Remove two unneeded convert_to_string() (found by Marcus) - - Change illegal use of string offset to E_ERROR - -2003-12-05 Ilia Alshanetsky - - * zend_default_classes.c: - Fixed crash demonstrated with ext/dom/tests/dom003.phpt test case. - -2003-12-04 Moriyoshi Koizumi - - * zend_execute.c: - Revert crap. - - * zend_execute.c: - Raise error in case dereference is performed on a scalar value. - -2003-12-03 Ilia Alshanetsky - - * tests/bug24773.phpt: - Test case for bug #24773. - -2003-12-03 Moriyoshi Koizumi - - * zend_execute.c: - This kind of error should be caught. (suggested by Andi, thanks) - - * zend_execute.c: - Fix bug #24773 (unset()ing string offsets crashes PHP) - -2003-12-03 Derick Rethans - - * zend_execute.c: - - Remove newline from error message - -2003-12-02 Marcus Boerger - - * zend_object_handlers.c: - Remove automatic call to __toString() since it is supposed to cause too - much trouble. See discussion on the mailing list. - -2003-12-02 Andi Gutmans - - * zend_API.c - zend_operators.c: - - Revert the revert of these patches. This overloading can only be used - - by C extensions such as SimpleXML and *NOT* PHP code. Reasons given - - on the mailing list and problem with reentrancy inside the opcodes. - - * zend_compile.c: - - Fix for bug #26182 - - * zend_errors.h: - - Don't include E_STRICT in E_ALL. - -2003-12-02 Marcus Boerger - - * zend_API.h: - Free the zval container only if it should be freed and was not copied. - -2003-12-01 Andi Gutmans - - * zend_execute.c: - - Change to E_STRICT so as not to break existing scripts. - - Thanks Edin - - * zend_builtin_functions.c: - - Nuke property_exists(). We need to fix isset() and this is already - - supported in reflection API. In any case, it's best not to add new - - functions in the general namespace except for keeping engine consistency - (which would have been true in this case) - - * zend_API.c: - - Revert auto-conversion in parameter API - - * zend_operators.c: - - Don't automatically call __toString() in convert_to_string_ex(). - - use __toString() in your code. - - Keep the auto-case in make_printable_zval. - -2003-11-30 Marcus Boerger - - * zend_default_classes.c: - Check return value of exception::__tostring() - - * tests/bug20240.phpt: - Fix test - -2003-11-29 Marcus Boerger - - * zend_compile.c - zend_iterators.c: - Fix memleak - -2003-11-29 Ilia Alshanetsky - - * zend_highlight.c - zend_language_scanner.l: - Fixed bug #26463 (Incorrect handling of semicolons after heredoc) - -2003-11-29 Marcus Boerger - - * zend_API.h: - This takes the address of a zval ptr - - * zend_API.h: - Add macros to return values of other zvals. - This is needed because one cannot use REPLACE_ZVAL_VALUE with - return_value. - -2003-11-29 Ilia Alshanetsky - - * zend_execute.c: - Restore original patch for bug #26281. - - -2003-11-29 Marcus Boerger - - * zend_compile.c: - Revert accidential commit until decision - - * zend_compile.c - zend_default_classes.c: - Make exception code more robust: - - Fix error in calculation of trace-string length - - Allow to overload __strostring() and make it work for uncaught - exceptions - - Show exception thrown while displaying exceptions - -2003-11-28 Ilia Alshanetsky - - * zend_API.c: - Add removed lcname, it is still needed. - -2003-11-27 Marcus Boerger - - * zend_API.c: - Convert objects to string if string is required by newer parameter parsing - since we do this for older parameter parsing does so too. - - * zend_object_handlers.c: - The macro REPLACE_ZVAL_VALUE cannot be used since we only have zval * - writeobj. to allow it the api needs to be changed to zval **writeobj. - - * zend_builtin_functions.c: - Add a support function to check for property existance which is different - from checking a property from being empty/set. - Update test #26182. - -2003-11-24 Marcus Boerger - - * zend_execute.c - zend_interfaces.c - zend_interfaces.h - zend_object_handlers.c - zend_operators.c - zend_operators.h: - Add new interface ArrayAccess to use objects as Arrays - -2003-11-24 Andi Gutmans - - * zend_constants.c: - - Fix newly introduced bug which stopped class constants from working. - - Thanks to Jan Lehnardt for reporting it. - -2003-11-24 Sebastian Bergmann - - * RFCs/004.txt: - No longer needed. - -2003-11-24 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_reflection_api.c: - - Fix __autoload() to preserve class case. - - Heads up, this patch might break stuff so please let me know if you - - bump into any problems. - -2003-11-23 Andi Gutmans - - * zend_reflection_api.c: - - Allocation optimizations by Timm Friebe - -2003-11-21 Ilia Alshanetsky - - * zend_execute.c: - Cleaner patch for bug #26281. - -2003-11-19 Ilia Alshanetsky - - * zend_execute.c - tests/bug26281.phpt: - Possible fix for bug #26281 & test case. - -2003-11-18 Marcus Boerger - - * zend_API.h: - Add method alias macro - -2003-11-18 Andi Gutmans - - * zend.c - zend_builtin_functions.c - zend_constants.c - zend_errors.h - zend_language_parser.y: - - Add E_STRICT, to be used to warn purists (like Jani :) - -2003-11-18 Marcus Boerger - - * zend_compile.c: - Backpatch the correct opcode for list(), property overloading needs more - opcodes (Bugfix #26257). - - * zend_interfaces.c: - Use correct order - - * zend_interfaces.c: - Use correct macro/function - -2003-11-17 Marcus Boerger - - * zend_interfaces.c: - Correct destruction - -2003-11-13 Moriyoshi Koizumi - - * zend_operators.c: - Bugfix #26156 (REPLACE_ZVAL_VALUE works on uninit stack-based zvals) - -2003-11-13 Marcus Boerger - - * ZEND_CHANGES - zend_interfaces.c: - IteratorAggregate::getIterator() cannot return anythingy else than objects - -2003-11-13 Andi Gutmans - - * zend_compile.c: - - Make sure internal clasess are malloced - -2003-11-10 Marcus Boerger - - * zend_iterators.c: - Don't use zend_class_entry indirection - - * zend_builtin_functions.c: - Bugfix #26010 (Bug on get_object_vars() function) - - * zend_object_handlers.c: - Correct default handlers - - * zend_iterators.c: - Need to update iterators handler table too. - - * zend_execute.c - zend_object_handlers.c: - Fix those warnings - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Split isset/isempty for object property and object dimension hooking. - - * zend_interfaces.c: - Little iterator improvement: ability to store index in iterator - -2003-11-08 Marcus Boerger - - * zend_reflection_api.c: - Add method reflection_class::implementsInterface() - Allow string & reflection_class in isSubclassOf() - - * zend_reflection_api.c: - Fix reflection_class::isSubclassOf() - - * zend.c - zend_object_handlers.c - zend_operators.c - tests/bug26166.phpt: - Handle exceptions in casting more gracefully. - This fixes bug #26166 - -2003-11-07 Marcus Boerger - - * zend_execute_API.c: - Make __autoload() faster - - * zend_execute.c - zend_iterators.h: - Update Iterators: Call next at the correct point in time. - - * zend_compile.c: - Add missing initialization. - - * zend_interfaces.h: - Make these class entries available for inheriting classes - -2003-11-06 Ilia Alshanetsky - - * zend_operators.c: - Fixed bug #26148 (Print the notice before modifying variable on type - mismatch). - - - Patch by: morten-bugs dot php dot net at afdelingp dot dk - -2003-11-04 Marcus Boerger - - * zend_execute.c - zend_interfaces.c: - Prevent some SEGV's when Exceptions are thorown inside iterators. - - * zend_builtin_functions.c: - Removedouble efree call - -2003-11-04 Moriyoshi Koizumi - - * zend_object_handlers.c: - __tostring() handler should be binary-safe - - * tests/bug26010.phpt: - Fix one more test - -2003-11-04 Stanislav Malyshev - - * Makefile.am: - add zend_iterators.c zend_interfaces.c to make - -2003-10-31 Moriyoshi Koizumi - - * tests/bug26010.phpt: - Add test case for bug #26010 - -2003-10-30 Stanislav Malyshev - - * zend_compile.c: - make CATCH opcode use "class" T like other opcodes do - via IS_CONST - -2003-10-30 Andi Gutmans - - * (php_5_0_0b2) - ZEND_CHANGES: - - Beta 2 - -2003-10-29 Moriyoshi Koizumi - - * zend_operators.h: - Use pretty macro instead. - -2003-10-28 Andi Gutmans - - * zend_language_parser.y: - - Head up! I'm reverting the patch which allows for expressions in constant - - declerations. Allowing the access of other constants in this code is - - flawed. We are reverting back to PHP 4's static scalars. - - Don't worry if you get the following msg when compiling: - - "zend_language_parser.y contains 3 useless nonterminals and 22 useless - rules" - - I didn't nuke the code in case we have some brilliant ideas after beta 2 - -2003-10-28 Marcus Boerger - - * zend_interfaces.c: - Give some freedon to c iterators but not in userspace. - -2003-10-28 Shane Caraveo - - * zend_compile.c: - fix crash in do_implement_interface when compiling - pear/PHPUnit/Framework/TestCase.php line 63 - while only interface_gets_implemented is the issue in this instance, both - these vars were unitialized, causing potential other issues - -2003-10-25 Marcus Boerger - - * zend_API.c - zend_API.h: - Add zend_make_callable() which allows to make zval's callable zval's. - At the moment this function only converts strings of the form - class::method - to an array(class,method). - - * zend_default_classes.c - zend_reflection_api.c: - This forces a better error message for non working clone calls. - - * zend_default_classes.c: - And use things to throw an exception here - - * zend_default_classes.c: - You shall not clone Exception instances - - * zend_reflection_api.c: - You shall not clone reflection_xx instances - - * ZEND_CHANGES - ZEND_CHANGES: - Update - -2003-10-25 Sebastian Bergmann - - * ZEND_CHANGES: - Fugbix typo. - - * ZEND_CHANGES: - s/Throwable/Printable: Exception has become an internal class since I - initially documented interfaces. - -2003-10-24 Andi Gutmans - - * ZEND_CHANGES: - - Fix typo - -2003-10-24 Marcus Boerger - - * zend_API.c - zend_execute_API.c: - Revert accidental commit - - * ZEND_CHANGES - zend_API.c - zend_execute_API.c: - Zend/ZEND_CHANGES - -2003-10-23 Sebastian Bergmann - - * Zend.dsp - ZendTS.dsp: - Add zend_interfaces.{c|h}. - -2003-10-22 Ilia Alshanetsky - - * zend.c: - Fixed bug #25922 (Crash in error handler when 5th argument is modified). - -2003-10-22 Marcus Boerger - - * zend_default_classes.c - zend_interfaces.c - zend_interfaces.h: - Impement userspace iterator interfaces and tests. See tests for details - on the names. - - * zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - Expand Interface C API. - In short: zend_class_entry->interface_gets_implemented() allows to modify - the class entry of a class when an interface gets implemented. - - * zend_default_classes.c: - The string conversion method should be named __toString() - -2003-10-21 Marcus Boerger - - * ZEND_CHANGES: - Make this clear - -2003-10-20 Andi Gutmans - - * ZEND_CHANGES: - - Add comment from Timm - -2003-10-20 Marcus Boerger - - * ZEND_CHANGES - ZEND_CHANGES: - Update - -2003-10-19 Andi Gutmans - - * zend_language_parser.y: - - Nuke const in function parameters. I just can't remember why this exists - - and it seems no one else remembers either. It has no semantic meaning. - -2003-10-18 Marcus Boerger - - * zend.h - zend_API.h - zend_compile.c - zend_iterators.h: - Fix class/iterator relationship & handling - - * zend_iterators.c: - Fallback to old behavior until we have a default iterator that respects - visibility we do the array trick. - - * zend_iterators.h: - Change order: Optional rewind() to end of structure - -2003-10-17 Marcus Boerger - - * ZendTS.dsp: - WS - - * zend_reflection_api.c: - Show if a class/object is iterateable - - * ZendTS.dsp - zend.h - zend_API.h - zend_default_classes.c - zend_execute.c - zend_iterators.c - zend_iterators.h: - Added c-api for iterators - - * zend_reflection_api.c: - Fix showing final/abstract for classes - -2003-10-17 Ilia Alshanetsky - - * zend_ini_parser.y: - Fixed formatting issue. - - * zend_alloc.c: - Fixed if() condition. - -2003-10-15 Marcus Boerger - - * zend_API.c - zend_API.h: - Add oo support function zend_class_implements() - - * zend_default_classes.c: - Fix cast function - -2003-10-14 Andi Gutmans - - * zend_mm.c: - - Argh, the suffering copy&paste can cause - - * zend_alloc.c: - - Fix compile problem. - - * zend_mm.c: - - Fix the fix by making sure the new block is in the right free list. - -2003-10-14 Stanislav Malyshev - - * zend_execute_API.c: - The freed one is a hashtable - may matter if Hashtables are allocated - differently - -2003-10-14 Andi Gutmans - - * zend_mm.c: - - Support merging free block which was created by reallocing to smaller - - size. This should fix some performance issues. This code is still not - - thoroughly tested. - -2003-10-09 Zeev Suraski - - * zend_compile.c - zend_execute.c - zend_language_parser.y: - Allow foo::$bar() - -2003-10-07 Rasmus Lerdorf - - * Zend.m4: - MFB bison configure test fix - -2003-10-07 Zeev Suraski - - * zend_execute.c: - Fix bug #17997 (Warning when switch & reference are combined) - - * zend_ini_parser.y: - Fix the fix :) - Not thoroughly tested, but appears to work fine - -2003-10-07 Marcus Boerger - - * zend_ini_parser.y: - Bugfix #25770 Segfault with PHP and bison 1.875 - -2003-10-05 Zeev Suraski - - * zend_object_handlers.c: - Remove unused callback - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Remove redundant callback, simplify API - -2003-10-05 Shane Caraveo - - * (BEFORE_HANDLERS_RESHUFFLE) - zend_API.h: - this little piggy broke lots of things...eg. _function_check_flag in - reflection api. - -2003-10-03 Moriyoshi Koizumi - - * zend_API.c: - Fixed bug #24766 (strange result array from unpack()) - - * zend.h: - Bug #25738 (alloca() related problems on the Darwin platform) - - * zend_API.h: - Ensure lval to have a *boolean* value. - -2003-10-03 Jani Taskinen - - * Zend.m4: - Aligned configure help texts. - -2003-09-30 Moriyoshi Koizumi - - * zend_compile.c: - Remove redundant '\n' - -2003-09-26 Hartmut Holzgraefe - - * zend_alloc.c: - signed/unsigned compiler warning fixes - -2003-09-25 Georg Richter - - * zend_alloc.c: - fixed compiler warning - removed dead code - - * zend_hash.h: - changed ulong to long to avoid compiler warnings (comparison between signed - and unsigned) - -2003-09-22 Ilia Alshanetsky - - * zend.c - zend_language_scanner.l: - Added missing format. - -2003-09-20 Marcus Boerger - - * zend_reflection_api.c: - Add public array Reflection_Class::getDefaultProperties() - -2003-09-18 Marcus Boerger - - * zend_builtin_functions.c: - Nuke vars no longer needed - - * zend_builtin_functions.c - zend_reflection_api.c: - Go with studlyCaps - - * zend_reflection_api.c: - Change tostring() into __toString() to match method name used in casting. - - * zend.c - zend_operators.c: - Fallback to default behaviour for unsupported object type conversions - - * zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - - Allow partial type conversion support for objects. - - Add support for object to string conversion from userspace by method - __toString() and add a test. - - * zend_API.c: - Add missing check - -2003-09-17 Marcus Boerger - - * zend_compile.c - zend_execute.c: - Show name of missing function as typed - - * zend_default_classes.c: - Use studlyCaps in exception class - - * zend_compile.c: - Go with studlyCaps in error messages/backtrace/reflection output - -2003-09-16 Marcus Boerger - - * zend_reflection_api.c: - - Make it clear whether it is an interface or a class - - Fix static properties - -2003-09-15 Marcus Boerger - - * zend_execute.c: - Revert - need to look for a better solution - - * zend_execute.c: - Bugfix #25547 - -2003-09-15 Zeev Suraski - - * zend_operators.c: - Simplify / fix - -2003-09-14 Marcus Boerger - - * zend.c: - Bugfix #25335 - -2003-09-14 Zeev Suraski - - * zend_operators.c: - Commit 64-bit fixes to the standard operators - by Ard Biesheuvel (abies@php.net) - -2003-09-14 Marcus Boerger - - * zend.h: - Bugfix #25528 (by Ard Biesheuvel) - -2003-09-13 Marcus Boerger - - * zend_alloc.c: - Fix warnings - -2003-09-11 Stanislav Malyshev - - * tests/dtor_scope.phpt: - add test - - * zend_execute_API.c: - ws - - * zend_execute_API.c: - Use scope from method, not from object - -2003-09-11 Marcus Boerger - - * zend_default_classes.c: - Use type instead of constant - -2003-09-08 Marcus Boerger - - * zend_compile.c: - Fix property inheritance where a derived class inherits a public property - and owns it as an implicit public property already (noticed by Brad). - - * zend.c: - Fix registering/derigistering of stdClass in ZTS and NON ZTS mode - -2003-09-07 Marcus Boerger - - * zend_execute.c: - Fix foreach() called with non array - -2003-09-07 Stanislav Malyshev - - * Zend.m4: - check for mach-o/dyld.h - needed for non-PHP ZE build - -2003-09-06 Marcus Boerger - - * zend_default_classes.c: - Disallow to changing the backtrace - - * zend_reflection_api.c: - Add missing newline if no static methods are available - - * zend_reflection_api.c: - - Internal functions shall be static - - Fix more nesting - - * zend_reflection_api.c: - Fix logic - - * zend_reflection_api.c: - - Fix CS: {{{ / }}} - - Fix static reflection_*::export() - - Add class reflection_object which allows to show dynamic properties - - * zend_reflection_api.c: - Use %s where it makes more sense - -2003-09-05 Marcus Boerger - - * zend_reflection_api.c: - Simplify reflection_property::__constructor() and fix property factory - - * zend_reflection_api.c: - - Don't use resorved words as variable names. - - Improve several exception messages. - - Fix Reflection_Property::_construct() / getDeclaringClass() - - * zend_reflection_api.c: - Fix reflection_api::__construct() (noticed by Andrey) - - * zend_default_classes.c: - Provide string casting for exceptions by calling toString() - -2003-09-04 Marcus Boerger - - * zend_API.c - zend_execute.c - zend_object_handlers.c: - Tests show updating consts must happen once at runtime (revert - optimization). - Add tests for static properties. - - * zend_reflection_api.c: - Add reflection_class::getstaticproerties() - -2003-09-03 Marcus Boerger - - * zend_compile.c: - Partly revert and reintroduce hash table entries for the ctor. - - * zend_compile.c: - Nuke unused variable, too - - * zend_compile.c: - - Inheritance applies to __clone() too. - - No need to add additional functions for the constructor. - The handler uses the pointer as intended and doesn't look the the name. - - * zend_compile.c: - Cannot turn a static property into a non static one and vice versa - - * zend_API.c - zend_API.h - zend_compile.c - zend_default_classes.c: - Fix handling of static properties initialized to arrays - - * zend_compile.c: - Add missing error messages when violating static property inheritance - rules. - - * zend_API.c - zend_compile.c - zend_execute.c - zend_object_handlers.c: - Fix static properties. - - * zend_compile.c: - Allow redeclareing a protected property as public. - -2003-09-03 Zeev Suraski - - * zend_compile.c: - Revert bogus patch - One must *never* use E_CORE_* error levels! - -2003-09-03 Marcus Boerger - - * zend_reflection_api.c: - Clearly distinguish between Const, Static and Other members. - -2003-09-02 Marcus Boerger - - * zend_compile.c: - Fix error messages - - * zend_API.c: - Allow redeclaring of protected properties as public (for internal classes). - - * zend_reflection_api.c: - Use appropriate function for property name unmangling. - - * zend_reflection_api.c: - Make these static as noticed by Andrey - - * zend_execute.c - zend_object_handlers.c - zend_objects.c: - Synch/Unify error messages related to function/method calls - - * zend_compile.c: - Fix error level - - * zend_API.c - zend_compile.c: - Currently we cannot support static ctor/dtor - - * zend_reflection_api.c: - These are implicit properties as denoted by the flag. Dynamic properties - only - exist in one single object and currently reflection api is not capable of - showing those. - -2003-08-31 Marcus Boerger - - * zend_reflection_api.c: - Don't repeat first const count(consts) time - - * zend_reflection_api.c: - Beautify output - - * zend_reflection_api.c: - Add reflection_parameters, patch by Timm Friebe - - * zend_default_classes.c: - Excluded chars < 32 when displaying string parameters that would obliterate - output. - -2003-08-31 Zeev Suraski - - * zend_arg_defs.c - zend_builtin_functions.c - zend_modules.h: - Attempt at fixing the linkage problem in Win32 - -2003-08-31 Marcus Boerger - - * zend_execute.c: - Synch error message with other one to fix tests - - * zend_reflection_api.c: - Check whether we may access tat union - - * zend.c: - Revisited: Replace the non portable code by spprintf - - * zend_reflection_api.c: - Using zend_spprintf should be faster here - - * zend.c - zend.h - zend_default_classes.c: - Make vspprintf available as zend utility function. Use it in exception - output. - -2003-08-30 Marcus Boerger - - * zend_default_classes.c: - Actually fetch the parameter - - * zend_default_classes.c - zend_default_classes.h - zend_execute.c - zend_reflection_api.c: - - Calling abstract methods should be a error for consistency reason. - - So in reflection_api we use the reflection_exception again. - -2003-08-30 Andi Gutmans - - * zend_default_classes.c: - - PLEASE stop commiting ^M's - -2003-08-30 Marcus Boerger - - * zend_default_classes.c: - Even though it is ignored this should be correct - - * zend_default_classes.c: - Add frame numer and finally display stack trace in the message. - - * zend_default_classes.c: - Add exception::traceAsString() and exception::toString() - - * zend_reflection_api.c: - fci.function_table & fci.function_name are not needed since we use - zend_fcall_info_cache - - * zend_reflection_api.c: - Be precise - - * zend_reflection_api.c: - Actually using fcc would be a good idea - - * zend_default_classes.c - zend_default_classes.h - zend_execute.c: - - The compiler can't detect all abstract function calls so we need to - check. - - * zend_default_classes.c: - Make those final (see comment) - -2003-08-29 Marcus Boerger - - * zend_API.c - zend_API.h: - - Add zend_merge_properties() which is designed to serve *_fetch_object(). - - Explain drawbacks of object_and_properties_init and - zend_merge_properties. - - * zend_reflection_api.c: - - Use zend_fcall_info_cache in invoke() to improve speed. - -2003-08-29 Zeev Suraski - - * zend_compile.c: - Fix a problem in implicit public properties and inheritance - -2003-08-29 Sascha Schumann - - * zend_hash.c: - improve a number of zend_debug format strings - -2003-08-29 Marcus Boerger - - * zend_builtin_functions.c - zend_builtin_functions.h - zend_default_classes.c: - Need to tell zend_fetch_debug_backtrace() whether to skip top function or - not. - -2003-08-28 Marcus Boerger - - * zend_default_classes.c: - Add public read access to protected - - * zend_default_classes.c - zend_default_classes.h: - Add zend_throw_exception_ex() which allows to format exception messages. - - * zend.c: - Classe tables work this way - - * zend_builtin_functions.c - zend_builtin_functions.h - zend_default_classes.c: - - Split debug_backtrace() into lowlevel c function and php function wrapper - - Add trace property to default method based on new - zend_fetch_debug_backtrace - -2003-08-28 Sascha Schumann - - * zend.h: - older gccs don't understand attribute((format)) on function pointers - - * zend.h: - ZEND_GCC_VERSION should always be defined to a number so we can use - simple comparisons all the time. - - * zend.h - zend_alloc.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c: - Add format attribute to a number of functions - - Kill a few warnings - - * zend.h - zend_alloc.h: - cleanup & centralize ZEND_GCC_VERSION and ZEND_ATTRIBUTE_MALLOC so that - they can be used by downstream applications - - * zend_alloc.h: - Enable attribute((malloc)) for GCC 2.96 - - * zend_alloc.h: - GCC 2 does not know about malloc yet. - - * zend_alloc.h: - provide attribute((malloc)) where appropiate - -2003-08-27 Marcus Boerger - - * zend_reflection_api.c: - Nuke unused variable - - * zend_reflection_api.c: - Fix reflection_class::newInstance() - -2003-08-25 Jani Taskinen - - * zend.h: - - Fixed bug #25240 (spaces before pre-processor directives) - -2003-08-24 Marcus Boerger - - * zend_API.c: - Add missing check - - * zend_API.c: - Fix memory source of string duplication for non internal properties - - * zend_API.c - zend_API.h - zend_compile.c - zend_default_classes.c - zend_execute_API.c - zend_variables.c - zend_variables.h: - - Provide appropriate way to destroy internal zval's. - - Allow internal zval's of type string and disallow complex types. - - Define the default string for extensions at class level instead of ctor. - - * zend_API.h - zend_compile.h - zend_reflection_api.c: - Don't identify alias'ed functions - -2003-08-24 Zeev Suraski - - * zend_API.c: - Use ""'s if you want empty strings. We want to crash on errors. - - * zend_compile.c: - Use pemalloc() - -2003-08-24 Marcus Boerger - - * zend_API.c: - Allow NULL, too - -2003-08-24 Zeev Suraski - - * zend_API.c: - Get rid of more ^M's - Marcus, please check your CVS client! - - * zend_default_classes.c: - Get rid of more ^M's - - * zend_compile.c: - line endings fix - - * zend_execute.c: - Never, ever, overwrite the refcount element of a connected zval! - -2003-08-24 Marcus Boerger - - * zend_reflection_api.c: - Add dedicated reflection_exception - - * zend_default_classes.c - zend_default_classes.h: - Allow to throw instances of classes derived from exception - - * zend.c - zend_default_classes.c - zend_default_classes.h - zend_execute.h - zend_execute_API.c: - - Provide a unified way to display uncaught exceptions, which shows - file/line/message info if possible. - - Add zend_eval_string_ex() to be able to handle exceptions in eval'd - code. - - Use above function to fix memleaks in CLI. - - * zend_reflection_api.c: - Make invoke() work - - * zend_reflection_api.c: - zend_parse_parameters 'O' works the way we need here - - * zend_reflection_api.c: - Not needed - - * zend_default_classes.c: - Make use method macros - - * zend_API.h: - One of PPP is needed, too - - * zend_reflection_api.c: - - Add Reflection_Function::isAlias - - Use ZEND_ME/ZEND_METHOD - - Fix static entries - - * zend_API.h - zend_compile.h: - - Add fn_flag ZEND_ACC_ALIAS - - Unify way of function_entry generation by new macro ZEND_FENTRY - - * zend_API.c: - Fix fn_flags handling - - * zend_API.c - zend_API.h - zend_default_classes.c: - Add property read code and use that in default exception class - -2003-08-23 Marcus Boerger - - * zend_default_classes.c - zend_default_classes.h - zend_reflection_api.c: - Allow zend_throw_exception() to also set the exception code - - * zend_default_classes.c: - Exception has 4 protected default properties (message,code,file,line). - They are all initialized at c-level constructor correctly. - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Internal classes can now have default properties. - - * zend_reflection_api.c: - Show ctor/dtor information and those don't return anything - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c: - - Flag ctor/dtor methods - - Use this to prevent memleaks when an exception gets thrown in ctors. - - * zend_default_classes.c: - Make exception code more robust - -2003-08-22 Ilia Alshanetsky - - * zend_builtin_functions.c - zend_constants.h: - Replace *magic number* with a much nicer define. - - * zend_builtin_functions.c: - Set 2147483647 as the module number of user defined constants - Fixed a few bugs and cleaned up get_defined_constants(). - -2003-08-21 Marcus Boerger - - * zend_default_classes.c - zend_default_classes.h - zend_reflection_api.c: - Add function 'zend_throw_exception(char *message, int duplicate - TSRMLS_DC);' - to provide an easy way to throw exceptions for extension developers. - - * zend_API.c: - If ce not given than any object would do - - * zend_API.c: - Paramspec 'O' / zend_parse_method_params(): only if given check the class - type - -2003-08-20 Zeev Suraski - - * zend_alloc.c: - adhere to silence - -2003-08-20 Marcus Boerger - - * zend_alloc.c: - Fix counting number of leaks - -2003-08-19 Wez Furlong - - * zend_execute.c: - fix build - -2003-08-18 Wez Furlong - - * zend_ini.h: - linkage for C++ - -2003-08-18 Zeev Suraski - - * ZendTS.dsp - zend_execute.c - zend_execute_locks.h: - Prevent access to internal engine functionality - - * zend.h - zend_alloc.c - zend_compile.h - zend_execute.c: - - Improve tracking - - Fix several overloading issues - - * zend_API.c - zend_alloc.h - zend_hash.c - zend_hash.h - zend_ts_hash.c - zend_ts_hash.c - zend_ts_hash.h - zend_ts_hash.h: - Improve tracking - - * zend_compile.c: - ws - -2003-08-17 Marcus Boerger - - * zend_API.h - zend_builtin_functions.c - zend_execute.c - zend_object_handlers.c - zend_operators.c - zend_reflection_api.c: - Fix warnings - -2003-08-17 Sascha Schumann - - * zend.h: - One bit fields need to be unsigned, otherwise there is no storage for - the sign bit - - "A signed bit field has a length of 1 bit." - - * zend_API.h: - explicitly cast size_t to zend_uint to avoid warnings on 64 bit platforms. - -2003-08-17 Marcus Boerger - - * zend_execute.c: - Remove unnecessary if - - * zend_execute.c: - Put the code where it belongs - fixes a warning and confusion - - * zend_compile.c - zend_execute.c: - Implement a TBD: JMP to the end of foreach - - * zend_compile.c: - WS - - * zend_API.c: - - Show class names in error messages when dealing with methods - - Mark class as abstract if it gets an abstract method - -2003-08-16 Marcus Boerger - - * zend_API.c - zend_API.h - zend_reflection_api.c: - Simplify abstract method declaration - - * zend_object_handlers.h: - WS - -2003-08-15 Sascha Schumann - - * zend_execute.c - zend_object_handlers.c: - Restrict scope of inline functions to compile unit - - Submitted by: Jason Greene - -2003-08-13 Marcus Boerger - - * zend_objects_API.c: - Add missing entry - - * zend_API.c: - - Show classes in case of methods - - Using sprintf here was a bad idea - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-12 Zeev Suraski - - * zend_hash.c: - Remove bogus patch - the number of elements is unrelated - -2003-08-11 Marcus Boerger - - * zend_hash.c - zend_hash.h: - Bugfix 21918 - -2003-08-11 Masaki Fujimoto - - * Zend.m4 - flex.skl - zend_compile.c - zend_globals.h - zend_highlight.c - zend_language_scanner.h - zend_language_scanner.l - zend_multibyte.c - zend_multibyte.h: - - added script encoding support to Zend Engine 2. - this enables ZE2 to gracefully parse scripts written in UTF-8 (with - BOM), - UTF-16, UTF-32, Shift_JIS, ISO-2022-JP etc... (when configured with - '--enable-zend-multibyte' and '--enable-mbstring') - -2003-08-10 Marcus Boerger - - * zend_compile.c: - Bugfix #24637 __destruct not called - -2003-08-09 Moriyoshi Koizumi - - * zend_compile.c: - Fix segfault when a referenced parameter is specified with typehint. - Result of the node will never be used because verify_instanceof handler - has - been eliminated. - -2003-08-09 Marcus Boerger - - * zend_objects.c: - Precise destructor errors - -2003-08-07 Moriyoshi Koizumi - - * tests/bug21478.phpt: - Add missing right parensis - -2003-08-07 Zeev Suraski - - * zend_execute_API.c: - Clarify use of original_function_state_ptr - -2003-08-07 Marcus Boerger - - * zend_execute_API.c: - - Fix warnings - - Fix code - -2003-08-06 Zeev Suraski - - * zend_execute_API.c: - clarify :) - -2003-08-05 Jani Taskinen - - * zend_execute_API.c: - Fix the build - -2003-08-05 Zeev Suraski - - * zend_API.h - zend_execute_API.c - zend_reflection_api.c: - Try to put an end to the endless number of call_user_function variants. - zend_call_function() now takes a structure that should contain all of the - necessary information. If further information is necessary in the future, - then we'll be able to add it without having to introduce a new function. - - As for caching - the 2nd, optional argument is a struct that can hold all - of the information that's necessary to invoke the function, including its - handler, scope and object it operates on (if any). Note that you may only - use a cache if the arguments you provide to zend_call_function() are - identical to the ones of the last call, except for the argument and return - value information. - - - The recently introduced fast_call_user_function() was removed - - I fixed most of the places that used fast_call_user_function() to use - caching - but there are still some that need to be fixed (XML and reflection) - -2003-08-05 Stanislav Malyshev - - * tests/bug24699.phpt: - fix syntax - - * zend_execute_API.c: - remove stack clean - it makes trouble - -2003-08-04 Marcus Boerger - - * zend_execute.c: - Fix ZTS - - * zend_execute_API.c: - Nuke unused variables - - * zend_reflection_api.c: - Add function/method parameter reflection - -2003-08-04 Ilia Alshanetsky - - * zend_execute_API.c - tests/bug23104.phpt: - Fixed bug #23104 (hash position of static arrays not being reset) - -2003-08-04 Stanislav Malyshev - - * zend_execute_API.c: - oops. forgot function - - * zend_execute_API.c: - fix crash #24842 - - * zend_compile.c: - fix leaks: bug #24831 - - * zend_execute.c: - use get_obj_zval_ptr - - * tests/bug24884.phpt: - add test - - * zend_execute.c: - Fix #24884 - clone $this - -2003-08-04 Zeev Suraski - - * zend_compile.c: - Simplify code using XOR - - * zend.h: - Add logical XOR, proves to be quite useful lately - - * zend_opcode.c: - This check shouldn't be necessary - -2003-08-03 Marcus Boerger - - * zend_opcode.c: - Fix crash - - * zend_compile.c: - Fix test and add missing initialization - -2003-08-03 Zeev Suraski - - * zend_API.c: - Ensure functions have a valid access level - - * zend_API.c: - Default to public - -2003-08-03 Marcus Boerger - - * zend_API.c: - Not needed, will be copied from ptr->flags later - - * zend_builtin_functions.c: - Add missing arg info - -2003-08-03 Moriyoshi Koizumi - - * tests/bug24635.phpt - tests/bug24699.phpt: - Style & WS fixes - -2003-08-03 Zeev Suraski - - * (BEFORE_ARG_INFO) - zend_API.c: - No need for this initialization - this function initializes all of the - elements of zend_internal_function - - * (BEFORE_ARG_INFO) - zend_execute.c: - Clean up. extended_value can only contain either ZEND_UNSET_DIM or - ZEND_UNSET_OBJ. - - * (BEFORE_ARG_INFO) - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c: - Generalize fetch_class - -2003-08-02 Marcus Boerger - - * zend_API.c: - Initialize all struct members: Necessary for reflection - - * zend_reflection_api.c: - Show interfaces - -2003-08-02 Wez Furlong - - * zend_API.c: - fix usage of instanceof here too - -2003-08-02 Marcus Boerger - - * zend_execute.c: - Fix warning - -2003-08-01 Wez Furlong - - * zend_API.c: - better fix... - - * zend_API.c: - Fix "O" format for zend_parse_parameters - -2003-07-31 Zeev Suraski - - * zend_API.c: - Use instanceof_function() - - * zend_compile.c - zend_execute.c: - Finish the array overloading patch - - * zend_execute.c: - Cleanup - -2003-07-31 Andi Gutmans - - * zend_hash.c: - - Fix logic. It was the wrong way around. - -2003-07-30 Andi Gutmans - - * zend_execute.c - zend_hash.c: - - Fix problem with hash when updating same bucket with data of different - sizes one after another. - - Fix number of arguments to read_dimension. - -2003-07-30 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Get rid of an opcode - - * zend_compile.c - zend_execute.c: - Support overloading of $foo["bar"] += "baz" - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Improve array overloading - support unset($foo["bar"]) - - * zend_compile.h: - Remove garbage - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_modules.h: - Add exec_finished() callback for modules - this is the last place where the - modules may touch the symbol table reliably - -2003-07-29 Ilia Alshanetsky - - * tests/bug22836.phpt: - Test case for bug #22836. - -2003-07-29 Jani Taskinen - - * zend.c: - Remove the obfuscation caused by the double "#ifdef ZTS" - -2003-07-27 Stanislav Malyshev - - * zend_compile.c: - fix compare - - * zend_compile.c: - use zend_binary_strncasecmp - - * zend_execute_API.c: - change shutdown order so that dtors would coexist with object error - handlers - - * zend_execute.c: - clean the right one - - * zend_execute_API.c: - make shutdown more granular so in case some dtor goes ape we still - can shut down cleanly - - * zend_compile.c - zend_execute.c - zend_objects.c: - make clone and throw coexist peacefully - - * tests/bug24635.phpt - tests/bug24699.phpt: - add test - - * zend_execute.c: - fix #24635: clean hash before putting into cache - - * zend_language_scanner.l: - fix crash #24550 - - * zend_compile.c - zend_constants.c: - fix leaks with class constants (bug #24699) - - * zend_compile.c: - make __clone call case insensitive, just as other calls are - -2003-07-24 Jani Taskinen - - * tests/bug19859.phpt - tests/bug20240.phpt - tests/bug20242.phpt - tests/bug21478.phpt - tests/bug21888.phpt - tests/bug22725.phpt - tests/bug24436.phpt: - cleanup (CS+ws) - -2003-07-24 Zeev Suraski - - * tests/bug24436.phpt: - Fix expectations :) - - * zend_execute.c: - Fix logic and comments in ASSIGN_DIM - - * zend_compile.c: - Fix another HANDLE_NUMERIC bug. Looks like you opened Pandora's box, - Sterling ;) - - * zend_builtin_functions.c: - Fix each() binary safety for keys - - * zend_execute.c: - Fix assignments to numeric array indices - - * zend_compile.c: - Remove useless code - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Support references in foreach() - Syntax: - foreach ($arr as &$val) - foreach ($arr as $key => &$val) - - * zend_execute.c: - Fix binary safety in foreach() keys (fixes bug #24783) - - * zend.c: - Make print_r() binary safe with keys - -2003-07-23 Stanislav Malyshev - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_opcode.c: - Remove namespace leftovers - -2003-07-23 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Go back to ZE1-like code - -2003-07-23 Sebastian Bergmann - - * zend_reflection_api.c: - Fix segfault. Patch by Timm Friebe . - -2003-07-22 Marcus Boerger - - * zend_hash.h: - Fix for the moment - -2003-07-22 Zeev Suraski - - * zend_execute.c - zend_hash.c - zend_hash.h - zend_operators.c - zend_operators.h: - Improve infrastructure of numeric handling of elements in symbol tables. - - When you want to work with a symbol table, and you don't know whether you - have a numeric ("string that looks like a number") or a string element in - your hands, use zend_symtable_*() functions, in place of zend_hash_*() - functions. - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Fix isset()/empty() for non-trivial object elements - (API change - read_property now accepts an extra element) - Fixes bug #24436 - -2003-07-21 Zeev Suraski - - * zend_object_handlers.c: - Fix bug #24499 - - * zend_execute.c: - Revert fix for #24729, and refix - -2003-07-21 Marcus Boerger - - * zend_execute.c: - Go with a better fix for #24729 - -2003-07-21 George Schlossnagle - - * zend_API.h: - reverted at Andi's request. replaced with more generic wrapper. - -2003-07-20 Marcus Boerger - - * zend_execute.c: - Bugfix #24729 = new ; causes crash when is not set - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - should nt here - -2003-07-20 Marcus Boerger - - * zend_reflection_api.c: - Fix warnings and whitespace in output - - * zend_reflection_api.c: - Add support for instances in Reflection_Class. - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - removed references to smart_str, replaced with private string management - function. When snprintf is integrated into the engine, string_printf - should be altered to use that. - -2003-07-20 Marcus Boerger - - * zend_objects_API.c: - More informative errors here and these are real core errors - - * zend_execute.c: - Fix uncloneable objetcs - -2003-07-20 George Schlossnagle - - * zend_reflection_api.c: - more of Timm's implementation. - -2003-07-20 Marcus Boerger - - * zend_hash.c - zend_hash.h: - Make it a macro - -2003-07-19 Marcus Boerger - - * zend_hash.c: - This is meant to be used in for(;has_more;next) - - * zend_hash.c - zend_hash.h: - Add missing function to ease implementations - -2003-07-19 Jani Taskinen - - * zend.h: - Fix the HPUX alloca fix as suggested by Sascha - -2003-07-19 Marcus Boerger - - * zend_objects.c - zend_objects.h: - Shuffle code to ease writing clone handlers - -2003-07-19 Andi Gutmans - - * zend.h: - - Don't use alloca on HP-UX (Moriyoshi Koizumi ) - -2003-07-16 Zeev Suraski - - * zend_compile.c: - Fix bug in the verification of interface-function implementation - - * zend_compile.c - zend_compile.h - zend_execute.c: - More cleanup for assign-op handling of objects - - * zend_alloc.c: - Fix warning - -2003-07-12 Andi Gutmans - - * zend_API.c: - - WS - -2003-07-11 Andi Gutmans - - * zend_API.c: - - Add support for Z in zend_parse_parameters(). It will allow the extension - - to retreive the zval **, thus allowing it to use the convert_to_*_ex() - - family of functions to do type conversions without effecting the value - in - - the engine itself. (Josh Fuhs ) - -2003-07-08 Zeev Suraski - - * zend_execute.c: - initial refactoring for assign-op handling of objects - -2003-07-07 Zeev Suraski - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Rework zend_do_declare_property and related code into one code base - - * zend_API.c: - Fix bug - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - Add get_dim callback - - * zend_execute.c: - Fix naming convention - -2003-07-07 Derick Rethans - - * zend_execute.c: - - Help Zeev fixing ghosts :) - -2003-07-07 Zeev Suraski - - * zend_object_handlers.c - zend_object_handlers.h: - whitespace - - * zend_objects_API.c: - Fix & whitespace - - * zend_object_handlers.c: - fixlet - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Initial support for overloading of array syntax for objects (very initial) - -2003-07-06 George Schlossnagle - - * zend_API.c - zend_API.h: - add convenience functions or adding class properties. Ok'd for commit by - Andi. - -2003-07-04 Andi Gutmans - - * zend_alloc.c - zend_mm.c - zend_mm.h: - - Add heap to memory manager. This should improve performance. - - Enabling it by default so that it gets tested. We should decide before - beta 2 if we want to revert back to malloc or not. - - Thanks to Sebastian for benchmarking it - -2003-07-04 Sebastian Bergmann - - * zend_reflection_api.c: - 2 * TSRMLS_FETCH() -> 1 * TSRMLS_DC - -2003-07-04 George Schlossnagle - - * zend_reflection_api.c: - ws fix - -2003-07-03 Marcus Boerger - - * zend_compile.c: - Allow final private methods - -2003-07-03 George Schlossnagle - - * zend_reflection_api.c: - win build fixes (Rob Richards) - - * zend_reflection_api.c: - can't forget Andrei - -2003-07-03 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: - enable Classname() constructor to be called via parent::__constructor() - - * tests/bug19859.phpt: - add test for Bug #19859 - - * zend_API.c - zend_execute_API.c: - Fix bug #19859 - allow fast_call_user_function to support __call - - * zend_builtin_functions.c: - fix the get_parent_class fix - -2003-07-03 George Schlossnagle - - * zend_reflection_api.c: - more of Timm's patches, and mod authors line to give credit where credit is - due. - -2003-07-02 Marcus Boerger - - * zend_objects.c: - Temporairy solution to overcome shutdown propbelms with objects that have - hidden destructors. - - * zend_objects.c: - Reorganize this a bit to ensure the object memory is destructed before - showing the error. - - * zend_builtin_functions.c: - Bug #24399: is_subclass_of(): fix memleak, too - -2003-07-02 Zeev Suraski - - * zend_execute.c: - Throughly fix scoping change. Fixes, among other things, bug #24403 - -2003-07-02 Andi Gutmans - - * zend_compile.c - zend_globals.h: - - Nuke CG(in_clone_method) - -2003-07-02 Zeev Suraski - - * zend_execute.c: - Fix for bug #22367. - Heads up - this will break syntactical compatiblity, return($foo) will - not work with functions that return references - return $foo should be - used - instead. It never worked well before, and caused all sorts of odd bugs. - It *might* be possible to support this specifically, albeit unlikely - -2003-07-02 Sterling Hughes - - * zend_execute_API.c: - optimize the case where the object is really a class name, as we don't need - to set EX(object) here. - - * zend_execute_API.c: - Timm Friebe points out that object detection should be done regardless of - the function pointer - -2003-07-02 Marcus Boerger - - * zend_objects.c: - Finally fix property cloning and fix the tests accordingly. - - -2003-07-02 Sterling Hughes - - * zend_builtin_functions.c: - Fix bug #24445 - -2003-07-01 Marcus Boerger - - * zend_objects.c: - Fix __clone(). - - - * tests/bug20240.phpt: - Use both destructor and shutdown - - * zend_execute_API.c: - small bugfix - - * tests/bug24436.php - tests/bug24436.phpt: - Rename test to correct extension - - * zend_execute.c: - __clone might not be defined - - * zend_execute.c: - Fix __clone visibility - - * zend_object_handlers.c - zend_object_handlers.h - zend_objects.c: - Fix destructor visibility - -2003-07-01 Derick Rethans - - * tests/bug24436.php: - - Added test for bug #24436 - -2003-07-01 George Schlossnagle - - * zend_reflection_api.c: - Timm Friebe's patches for code celanup and additional functions. - -2003-07-01 Jani Taskinen - - * tests/.cvsignore - tests/bug21478.phpt - tests/zend2.php - tests/zend2.php.txt: - Missing .cvsignore, broken test, renamed zend2.php -> zend2.php.txt - -2003-07-01 Sebastian Bergmann - - * zend_reflection_api.c: - ZTS fixes. - -2003-07-01 George Schlossnagle - - * zend_reflection_api.c: - more incremental changes. add anything that needs a class factory. - - * zend_reflection_api.c: - all the easy parts of Reflection_Class - -2003-06-30 Shane Caraveo - - * zend_operators.h: - this fixes including this header in a c++ file (vs6) - -2003-06-30 Sterling Hughes - - * zend_compile.c: - nuke "main" as a reserved keyword - -2003-06-30 Andi Gutmans - - * zend.c - zend_API.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_mm.c - zend_opcode.c - zend_reflection_api.c: - - ZE coding style requires if ( instead of if( - -2003-06-30 Sebastian Bergmann - - * zend_reflection_api.c: - ZTS fixes. Remove unused local variables. - -2003-06-30 George Schlossnagle - - * Makefile.am - Zend.dsp - ZendTS.dsp - zend_default_classes.c - zend_reflection_api.c - zend_reflection_api.h: - added support for Reflection_Function, the first part of - the reflection api - -2003-06-30 Sterling Hughes - - * zend_builtin_functions.c: - move the check down a little so it catches all cases - - * zend_builtin_functions.c: - Fix bug #24399 from an excellent test case by edin - -2003-06-30 Zeev Suraski - - * zend_execute.c: - Semantically it's a refcount increase, not a lock... - - * zend_execute.c: - Fix 'global' implementation (fixes, at least, bug #24396 - -2003-06-30 Sterling Hughes - - * zend_operators.c: - revert back the optimization for now. - -2003-06-29 Ilia Alshanetsky - - * zend_object_handlers.c: - Fixed bug #24279 (__get() crash when no value is returned) - -2003-06-29 Sebastian Bergmann - - * ZEND_CHANGES: - Remove namespace references. - -2003-06-29 Sterling Hughes - - * zend_operators.c: - Very simple, but very effective optimization. Provides a signifigant speed - improvement to matches done via '=='. This checks that the lengths of two - strings are equal before performing a memcmp() on them. - -2003-06-23 Zeev Suraski - - * zend_execute.c: - Fix crash :) - -2003-06-23 Stanislav Malyshev - - * zend_execute.c: - FIx leak - -2003-06-22 Zeev Suraski - - * zend_execute.c - zend_language_parser.y: - Fix complex expressions for class names in NEW - - * zend_language_parser.y: - Simplify - -2003-06-21 Marcus Boerger - - * zend_language_parser.y: - WS - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Add final classes - -2003-06-16 Stanislav Malyshev - - * zend_execute.c: - no need to init zval - assignment will init - - * zend_execute.c: - Fix bug #22592 - cascading assignments to string offsets - - * zend_constants.c: - support for self:: and parent:: constants - - * zend_builtin_functions.c: - fix lambda function static vars (related to #17115) - -2003-06-15 Sebastian Bergmann - - * zend_constants.c: - Fix ZTS build. - -2003-06-15 Stanislav Malyshev - - * zend.c: - Fix bug #23279 - exception handler exits after first function call - - * zend_execute_API.c: - No need to duplicate code - zend_get_constant() knows to - handle class constants now - - * zend_execute_API.c: - Fix bug #18872 - Improper handling of class constants used as default - function argument values - - * zend_constants.c: - set ending \0 for string - - * zend_compile.c - zend_constants.c - zend_language_parser.y: - Fix bug #23384 - static class::constant constants should now - work in static & array expressions. - - * zend_execute_API.c: - Fix bug #21800 - initialize opcode handlers in interactive mode - -2003-06-14 Marcus Boerger - - * zend_hash.c: - ecalloc doesn't return NULL - - * zend.c: - Bugfix #24182: va_arg macro error in Zend/zend.c - -2003-06-10 Jani Taskinen - - * zend_multiply.h: - - Missing $Id$ tag - -2003-06-10 James Cox - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_default_classes.c - zend_default_classes.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_istdiostream.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_multiply.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_stream.c - zend_stream.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - updating license information in the headers. - -2003-06-09 Wez Furlong - - * zend_execute_API.c: - Fix for Bug #23951 - -2003-06-09 Stanislav Malyshev - - * zend_execute.c: - remove NS leftover - -2003-06-09 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix bogus implicit declarations of properties (squash bug #23671) - -2003-06-09 Stanislav Malyshev - - * zend_API.c - zend_execute_API.c: - Support 'self' and 'parent' in call_user_func() - -2003-06-09 Zeev Suraski - - * zend_execute.c: - Fix indirect reference calls to bogus function names - -2003-06-09 Jani Taskinen - - * zend_builtin_functions.c: - ws - -2003-06-08 Zeev Suraski - - * zend_object_handlers.c: - Fix casing issues in access level checks - - * zend.c - zend_compile.c - zend_compile.h: - Nicer handling of protected/private members in print_r() - - * zend_execute.c: - Fix handling of object property assignments in switch expressions - (bug #23925) - - * zend_builtin_functions.c: - Fix set_error_handler() - -2003-06-06 Sascha Schumann - - * zend_multiply.h: - mfb #24025 fix - -2003-06-04 Stanislav Malyshev - - * zend.c: - fix non-ZTS build - -2003-06-04 Sebastian Bergmann - - * zend.c: - Fix segfault. Again. - -2003-06-04 Stanislav Malyshev - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_object_handlers.c: - rm namespace leftovers - -2003-06-04 Sebastian Bergmann - - * zend.c: - Fix segfault. #Hopefully not a Voodoo Fix[TM]. - -2003-06-02 Sebastian Bergmann - - * zend.c - zend_execute.h: - Leftover. - -2003-06-02 Stanislav Malyshev - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_object_handlers.c - zend_opcode.c: - MEGA-patch: namespaces are R.I.P. - -2003-06-01 Marcus Boerger - - * tests/zend2.php: - No nested classes - - * tests/bug20240.phpt - tests/bug20242.phpt - tests/bug21478.phpt - tests/bug21888.phpt - tests/bug22725.phpt: - Add some ZE2 bug tests - - * zend_opcode.c: - Bugfix #23670: implements and extends cause Apache 2 crash - - * zend_constants.c: - Do it correct always - - * zend_compile.h: - Defining it once is enough - -2003-05-31 Marcus Boerger - - * zend.c: - Fix init shutdown - -2003-05-31 Sterling Hughes - - * zend_compile.c - zend_execute.c: - revert the function call caching patch until a new solution is decided - upon. - -2003-05-31 Marcus Boerger - - * zend_constants.c: - Fix constants (noticed by David Brown ) - - * zend_constants.c: - c->name_len already contains the '\0' - -2003-05-30 Stanislav Malyshev - - * zend_execute.c: - fix crash on exceptions when return value of the inside function is used - -2003-05-29 Marcus Boerger - - * zend_compile.c - zend_language_parser.y: - Fix ~ operator in class constants. - - * zend_compile.c - zend_compile.h - zend_operators.c: - Faster interface inheritance & faster inheritance checks - - * zend_language_scanner.l: - CS - -2003-05-29 Wez Furlong - - * zend_compile.c: - Fix Bug #23285 (Potential Stack Overflow in zendlex). - -2003-05-28 Sterling Hughes - - * zend_alloc.c: - no reason to do this at runtime - - * zend_compile.c - zend_execute.c: - Cache function call lookups with loops (store in a temporary variable on - the - result opline). - Assuming lazy concensus on message that GeorgeS sent to the list last week - -2003-05-27 Sterling Hughes - - * zend.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.c: - Assume lazy consensus regarding the cast_object() patch. *Only* - implemented - from a internals perspective. This callback has been very useful for both - ext/mono and ext/simplexml - -2003-05-26 Marcus Boerger - - * zend_language_scanner.l: - Add pseudo constant __METHOD__ to easily report namespace::class::method. - - -2003-05-23 Marcus Boerger - - * zend_API.h: - Revert to sizeof() - -2003-05-23 Sterling Hughes - - * zend_execute.c - zend_hash.c - zend_operators.c - zend_operators.h: - move HANDLE_NUMERIC() from the hash table implementation upstream to the - places that actually need to use it. - -2003-05-22 Marcus Boerger - - * zend_execute.c: - No need to copy here unless implicit_clone is active (noticed by rob) - -2003-05-21 Marcus Boerger - - * zend_API.c - zend_builtin_functions.c - zend_constants.c - zend_object_handlers.c: - Make use optimized string lowering - - * zend_operators.c - zend_operators.h: - Use same parameter order as strcpy() - - * zend_API.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_operators.h: - Make zend_str_tolower_copy() a copy function (like stccpy). - Supply a dup version (like estrdup). - Fix tolower() handling. - -2003-05-21 Jani Taskinen - - * zend_builtin_functions.c: - Fixed bug #23619 (set_error_handler() registered handler not called for - object instances). (Jani, waboring@qualys.com) - -2003-05-21 Sterling Hughes - - * zend_operators.c: - optimize loops. The check only exists for integers because that's the more - common optimization, and you actually lose performance if you check for - a double too (wierd but true). - - * zend_mm.h: - add some logic to detect zend_mm, which is really only useful when thread - safety support is enabled. - - * zend_mm.h: - leave this off until its more ready/stable - php5 actually beats php4.3.* in my benchmarks now - - - * zend_API.c: - use zend_str_tolower_copy() - - * zend_execute.c: - Bottom drawer optimization to avoid this comparison, but this OP is - executed - quite often (all of the fetch_* ops) - -2003-05-20 Sterling Hughes - - * zend_operators.c: - bah humbug, use the pointer based version, which turns out to be an - instruction - faster - - * zend_operators.c: - use pointer arithmetic for the normal zend_str_tolower() - -2003-05-20 Marcus Boerger - - * zend_execute.c: - No need to copy the zval unless __clone() is called - -2003-05-20 Sterling Hughes - - * zend_operators.c: - make this faster and sexier - - * zend_execute.c: - use the new zend_str_tolower_copy() function - - * zend_operators.c: - doesn't need to be register - - * zend_execute_API.c - zend_operators.c - zend_operators.h: - optimize the lookups by avoiding a copy and then another pass - - Naked Dancing Girls should be given to: Myself, Zeev, Marcus, - and George Schlossnagle (in no particular order) - - * zend_API.h - zend_execute_API.c: - add fast_call_user_function() - -2003-05-20 Hartmut Holzgraefe - - * zend_API.h - zend_constants.h - zend_operators.h: - C++ compile fixes - -2003-05-19 Marcus Boerger - - * zend_execute.c: - Fix exception memleak - -2003-05-19 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: - fix __clone - -2003-05-12 Marcus Boerger - - * zend_execute_API.c: - One function call is enough - -2003-05-08 Marcus Boerger - - * zend_compile.c: - Inheritance fix - -2003-05-07 Edin Kadribasic - - * zend_compile.c: - Reverting Marcus' incomplete patch which broke the build. - -2003-05-07 Marcus Boerger - - * zend_compile.c: - Inheritance fixes - -2003-05-04 Marcus Boerger - - * zend_API.c: - Fix namespace issue: Only CG is needed here - - * zend_API.c - zend_API.h: - Allow functions in internal namespaces (for example factories) - - * zend_execute.c: - Modify the abstract error message so that it shows up to three methods not - implemented. - - * zend_execute.c: - Fix warnings - - * zend_compile.c: - Don't inherit twice what is needed only once - - * zend.c: - Fix bug #23162 user_error() crashs if > 1024 bytes (Marcus, Moriyoshi) - -2003-05-04 Sterling Hughes - - * zend_default_classes.h: - semicolon - -2003-05-03 Sterling Hughes - - * zend_default_classes.h: - proto - - * zend_default_classes.c: - add an accessor for the default exception - -2003-04-29 Sascha Schumann - - * zend_multiply.h: - Fix the *= operator - - Slightly modified patch by Wez Furlong - -2003-04-25 Jani Taskinen - - * zend_language_scanner.l: - Fixed bug #21820 ("$arr[foo]" generates bogus E_NOTICE, should be E_PARSE) - -2003-04-24 Sascha Schumann - - * zend_alloc.c - zend_alloc.h - zend_multiply.h: - add safe_emalloc - -2003-04-21 Stanislav Malyshev - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_object_handlers.c: - Change get_class() so that it returns qualified names for namespaced - classes. - - *HEADS UP*: get_class_name() handler interface is changed, now it should - allocate the space it returns with emalloc, and the users free it. If - anyone has problems with it or has suggestions how to do it without this - - please tell. - - Also: make function_exists() understand namespaces. - - * zend_execute.c: - make import * fail if such classes or functions already there - -2003-04-20 Sterling Hughes - - * zend_compile.c: - Add check for final properties - -2003-04-20 Stanislav Malyshev - - * zend_execute_API.c: - Check name before '::' so that it would be a namespace in - zend_lookup_ns_class - - * zend_builtin_functions.c: - refine the set_error_handler fix - - * zend_builtin_functions.c: - Fix for bug #21094 (set_error_handler can not accept methods), - by Timm Friebe - -2003-04-19 Sebastian Bergmann - - * zend.c: - Corrected patch by Marcus Börger . - -2003-04-18 Sterling Hughes - - * zend.c - zend_opcode.c: - Patch by Marcus Börger to fix some memleaks - -2003-04-18 Derick Rethans - - * zend.h - zend_extensions.c: - - Revert my symbol fix patch, and merge in Stas' fixes to Zend Engine 1. - - * zend.h: - - MacOSX also prepends the _ before symbols in bundles - -2003-04-17 Sebastian Bergmann - - * zend.c: - Patch by Marcus Börger . - -2003-04-11 Sebastian Bergmann - - * zend_compile.c - zend_compile.h: - Fix warnings. - -2003-04-10 Sterling Hughes - - * zend_compile.c: - satisfy andi's switch fetish ;-) - -2003-04-10 Sebastian Bergmann - - * zend_compile.c: - Fix ZTS build. Fix warning. - - * ZEND_CHANGES: - Document 'const' keyword. - -2003-04-10 Sterling Hughes - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - allow expressions within constants, so the following is possible - - class foo { - const a = 1<<0; - const b = 1<<1; - const c = a | b; - } - - this makes const a compile-time expression. all other operators are - unaffected. - -2003-04-10 Zeev Suraski - - * zend_language_parser.y - zend_language_scanner.l: - Revert Harald's commit - -2003-04-10 George Schlossnagle - - * zend_language_parser.y: - One line fix so that it will compile - -2003-04-09 Harald Radi - - * zend_language_parser.y - zend_language_scanner.l: - removing the *syntactical sugar* again - - -2003-04-08 Andrei Zmievski - - * zend_builtin_functions.c: - Switch some functions to use new zend_lookup_ns_class() methods. This - means that they will accept both simple and fully qualified class names. - - * zend_API.c - zend_API.h: - Rename zend_register_internal_class_in_ns() to a better, less filling, - but with the same great taste zend_register_internal_ns_class(). - - * zend_execute.h - zend_execute_API.c: - Add zend_lookup_ns_class() function. - - * zend_operators.h: - Move memnstr into Zend and make an alias for BC in PHP. - -2003-04-07 Jani Taskinen - - * zend_language_scanner.l: - Fixed bug #23093 (highlight_string() crashed with __FUNCTION__) - -2003-04-07 Sterling Hughes - - * zend_compile.h: - add markers that make this file easy to parse for external sources - -2003-04-04 Andrei Zmievski - - * zend_API.h: - Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring - class methods to avoid name collisions. - -2003-04-04 Stanislav Malyshev - - * zend_API.c - zend_API.h: - Fix namespace issues - -2003-04-03 Andrei Zmievski - - * zend_API.c: - Patch from Timm Friede for when EG(active_namespace) is NULL initially. - - * zend.c - zend_API.c - zend_compile.c: - Initialize all relevant zend_class_entry fields to avoid accidental - crashes. - -2003-04-03 Sebastian Bergmann - - * zend_list.c: - Leftover. - -2003-04-03 Sterling Hughes - - * zend_list.c - zend_list.h: - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - -2003-04-02 Andrei Zmievski - - * zend_API.c - zend_API.h: - - Add zend_register_internal_namespace() API function. - - Add zend_register_internal_class_in_ns() API function. - - * zend_compile.h: - Simplify. - -2003-04-02 Derick Rethans - - * zend_list.c: - - Fix whitespace - -2003-04-02 Sterling Hughes - - * zend_list.c - zend_list.h: - add the ability for curl_multi_info to introspect the handles. - - -2003-04-02 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Implement a different way to catch documentation comments. - - * zend_compile.c - zend_compile.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - Revert portions of the doc comment patch. There should be no parser - errors now. - -2003-04-02 Stanislav Malyshev - - * zend_builtin_functions.c - zend_compile.h - zend_execute.c: - allow class_exists() to work with namespaces too. - add CLASS_IS_NAMESPACE macro - - * zend_builtin_functions.c: - fix typo - - * zend_builtin_functions.c: - fix parameterless get_declared_classes call - -2003-04-01 Andrei Zmievski - - * zend_execute.c: - Stas's patch on zend_execute.c (1.448 -> 1.449) resulted in a bug where - the namespaced member accesses didn't work. This should hopefully - correct it. - - * zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_opcode.c: - Split ZEND_NAMESPACE into user and internal namespaces. Hope this is - okay with engine folks. - -2003-04-01 Stanislav Malyshev - - * zend_builtin_functions.c: - improve namespace name hanfling - - * zend_builtin_functions.c: - fix get_declared_classes() - - * zend_language_parser.y - zend_language_scanner.l: - Add __NAMESPACE__ auto-constant. - - * zend_builtin_functions.c: - make get_declared_classes() work with namespaces (based on Tal Peer's - patch) - -2003-03-31 Andrei Zmievski - - * zend.h - zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Multi-purpose patch: - - The fields of zend_namespace were not completely initialized which - led to a variety of problems. - - The occurrence of class/interface/namespace definition is now - captured. - - Functions/classes/interfaces/namespaces can be preceded by doc - comments which are stored for use by extensions. - -2003-03-31 Stanislav Malyshev - - * zend.c: - Use strncpy instead of sprintf - -2003-03-30 Andrei Zmievski - - * zend_language_parser.y: - Since zend_do_begin_class_member_function_call assumes the previous - opcode is FETCH_CONSTANT, swap the calls around. - -2003-03-30 Sebastian Bergmann - - * zend_execute.c: - ZTS fix. - -2003-03-30 Stanislav Malyshev - - * zend.c: - Try to report class name of the exception - - * zend_execute.c: - Fix namespace switch - -2003-03-29 Zeev Suraski - - * zend_compile.c: - Add missing initialization - - * zend_compile.c: - Fix crash - - * zend_API.c - zend_compile.c - zend_compile.h: - Initial support for enforcing prototype of abstract/interface method - implementations - -2003-03-29 Sterling Hughes - - * zend.c: - remove unused variable - -2003-03-27 Stanislav Malyshev - - * zend_execute.c: - fix fetch_class buglet - -2003-03-26 Stanislav Malyshev - - * zend_execute.c - zend_language_parser.y: - Un-nest namespaces - now namespace X { namespace Y {} } is a parse error - Also refine namespaced includes - -2003-03-26 Ilia Alshanetsky - - * zend_compile.c: - Fixed bug #22900 (declaration of namespaces with same name results in - leaks). - -2003-03-26 Sebastian Bergmann - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - Eliminate TSRMLS_FETCH() calls in destroy_op_array() and - zend_get_class_entry(). - - * zend_API.c - zend_object_handlers.c - zend_objects.c - zend_objects.h: - Eliminate TSRMLS_FETCH() calls in zend_objects_new() and - zend_objects_get_address(). - -2003-03-25 Andi Gutmans - - * zend_compile.c: - - Temporarily fix problem with inheriting from an internal class. This - might - - need some rework in the future (thanks to Marcus) - -2003-03-24 Stanislav Malyshev - - * zend_execute.c: - Fix {include|require}_once error message - if open - fails, don't use tream, use original name. - -2003-03-23 Andi Gutmans - - * zend.c: - - Fix win32 build - -2003-03-23 Stanislav Malyshev - - * zend.c: - resore namespace on shutdown - since some functions use - EG() and CG() pointers - -2003-03-23 Sebastian Bergmann - - * zend_default_classes.c: - ZTS fix. - -2003-03-23 Zeev Suraski - - * zend_compile.c: - Another fix for implicit public, perhaps it was not such a good idea :I - -2003-03-23 Sebastian Bergmann - - * Zend.dsp - ZendTS.dsp - zend_default_classes.c: - Add new files to ZendTS.dsp. Sync list of files in Zend.dsp with - ZendTS.dsp. ZTS fixes. - -2003-03-23 Sterling Hughes - - * zend_default_classes.h: - DEFAULT_CLASSES_H not DEFAULT_INTERFACES_H - - * Makefile.am - zend.c - zend_default_classes.c - zend_default_classes.h: - add a standard Exception class. - -2003-03-22 Shane Caraveo - - * zend_compile.h: - export functions needed by cli - - * zend_language_scanner.l: - fix crash in win32 debug build - -2003-03-20 Stanislav Malyshev - - * Zend.m4: - Add stdlib.h too - it is needed fot strto{ld} - -2003-03-19 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - - Keep track of starting/ending line numbers for user functions. - - Store last parsed doc comment in a compiler global for future use. - - * zend_API.c: - Lowercase the function name when used as key in the function name. The - original case is still preserved in zend_function structure. - -2003-03-18 Zeev Suraski - - * zend_compile.c - zend_object_handlers.c: - - Fix situation where a derived class declares a public (or implicit - public) - with the same name as a private in the parent - - Optimize 'static binding' of private properties a bit - -2003-03-18 Stig Bakken - - * RFCs/002.txt: - - email address change - -2003-03-17 Stanislav Malyshev - - * zend_extensions.c: - MFZE1 - -2003-03-17 Jani Taskinen - - * Makefile.am: - Added missing zend_mm.c file and renamed zend_object_API.c -> - zend_objects_API.c - -2003-03-13 Andrei Zmievski - - * zend_API.c: - Fix warning in va_start(). - -2003-03-12 Andrei Zmievski - - * zend_API.c: - Initialize the namespace when registering functions. - -2003-03-12 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in the implicit public declaration - -2003-03-11 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix handling of ::func() - -2003-03-10 Zeev Suraski - - * zend_compile.c: - Clean redundant code - -2003-03-10 Jani Taskinen - - * zend_compile.c: - Fixed some leaks. Patch by Moriyoshi - -2003-03-10 Shane Caraveo - - * zend_config.w32.h: - fix isinf for win32 - -2003-03-09 Zeev Suraski - - * zend_language_parser.y: - Optimize - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix handling of ::foo - - * zend_compile.c: - Cleanup - -2003-03-09 Andi Gutmans - - * zend_language_scanner.l: - - Nuke junk - -2003-03-09 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix parsing rules of namespaces/classes - - * zend_language_parser.y: - Add ability to use ::interface_name in implements - - * zend_compile.c: - Fix :: handling - -2003-03-07 Sebastian Bergmann - - * ZEND_CHANGES: - Dedicated to Greg Beaver . - - * ZEND_CHANGES: - Document 'final'. - - * ZEND_CHANGES: - Fix class type hints example. - - * ZEND_CHANGES: - Update 'abstract' section. - -2003-03-07 Jani Taskinen - - * zend_ini.c - zend_ini.h: - Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings. - - * zend_execute.c: - Better fix for the memleaks (bug 19943) by Moriyoshi - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_execute.c: - Fix warnings - - * zend_execute.c: - Fix error message - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Require abstract classes to be explicitly declared 'abstract', in order to - avoid making developers traverse the entire class/interface hierarchy - before they can figure out whether a class is instantiable - (ok, so it makes sense :) - -2003-03-06 Sebastian Bergmann - - * ZEND_CHANGES: - -german+english+. - - * ZEND_CHANGES: - D some TBDs - -2003-03-06 Jani Taskinen - - * zend_execute.c: - Fixed bug #19943 (the memleaks) - -2003-03-06 Ilia Alshanetsky - - * zend_highlight.c: - More cleanup of the zend_strip() function. - No longer strip __LINE__, since while it may become useless it could break - code where __LINE__ is passed as a function parameter. - - * zend_highlight.c: - Fixed in zend_strip() that corrupted heredoc. - Optimized the writing routine by moving from putchar() to fwrite(). - Changed hardcoded opcode # to it's defined name. - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Change opcode name - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Add class type hints - -2003-03-05 Zeev Suraski - - * zend_compile.c: - Fix auto globals - - * zend_compile.c - zend_execute.c - zend_language_parser.y: - Implement $obj::static_func() - - * zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c - zend_operators.c - zend_operators.h: - Add support for interfaces - -2003-03-04 Zeev Suraski - - * zend_compile.c - zend_language_parser.y: - Remove legacy code - - * zend_compile.c: - Remove redundant code - -2003-03-03 Harald Radi - - * zend_API.c: - add missing strtolower - - * zend_API.c - zend_API.h: - commiting zend_disable_class patch for George: - disabled classes will be replaced by dummy classes - that print a warning upon instanciation - -2003-03-02 Zeev Suraski - - * zend_execute_API.c: - Fix destructors some more - - * zend_compile.c - zend_compile.h: - Improve infrastructure - - * zend.c - zend_compile.c - zend_compile.h: - Add infrastructure for JIT initialization of auto globals - -2003-03-01 Zeev Suraski - - * zend_compile.c: - Fix mem leak - -2003-03-01 Andi Gutmans - - * zend_compile.c: - - Make __construct() have higher priority than class name functions - - for constructors. - - Fix problem with the engine allowing final/abstract for the same method. - - Both patches are by Marcus Börger. - -2003-02-27 Rasmus Lerdorf - - * zend_ini_scanner.l: - MFB: We know ini file scanning will never be interactive, so speed it up a - bit. Need a dynamic check for the language scanner. - -2003-02-26 Sebastian Bergmann - - * ZEND_CHANGES: - Syntactic sugar is sweet. - -2003-02-25 Zeev Suraski - - * zend_compile.c: - Get the bits right - final/private fix - -2003-02-25 Jani Taskinen - - * acconfig.h: - Do not redefine zend_isnan if it is already defined. - - * Zend.m4: - - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). - -2003-02-24 Stanislav Malyshev - - * zend_compile.c: - fix exception handling - -2003-02-24 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_language_scanner.l: - Add 'final' - -2003-02-24 Sebastian Bergmann - - * ZEND_CHANGES: - Remove obsolete not on redeclaring protected members. - - * ZEND_CHANGES: - Leftover. - - * ZEND_CHANGES: - Initial documentation of namespace {}. - -2003-02-23 Zeev Suraski - - * zend_compile.c: - Move abstract inheritance logic to the right spot - - * zend_compile.c: - Fixed abstract handling in inheritence - -2003-02-20 Wez Furlong - - * zend_stream.c: - -cough* - Fix another stupid mistake. - -2003-02-20 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Allow namespaces to have a number of parts. I.e., now you can do: - namespace foo { - function abc() {} - } - ... - namespace foo { - functio def() {} - } - -2003-02-19 Wez Furlong - - * zend_stream.c: - Fix stupid mistake that only affected interactive mode. - -2003-02-18 Rasmus Lerdorf - - * zend_stream.c: - fileno() needs a FILE * here, and at least on FreeBSD with gcc-2.95.3 - it is unable to figure out that this is indeed a FILE * and hence it - won't compile without this cast. - -2003-02-18 Zeev Suraski - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_scanner.l - zend_opcode.c: - Avoid using a C++ reserved word - -2003-02-18 Wez Furlong - - * ZendTS.dsp - flex.skl: - Fixup build for win32 - - * Makefile.am - flex.skl - zend.c - zend.h - zend_compile.h - zend_execute.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l - zend_stream.c - zend_stream.h: - Implement simple stream support in the ZE scanners. - -2003-02-17 Zeev Suraski - - * zend_language_parser.y: - Whitespace & minor renames - - * zend_language_parser.y: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Improve handling of static member variables - - * zend_config.w32.h - zend_ini_parser.y: - Improve Win32 build performance - -2003-02-16 Zeev Suraski - - * zend_execute.c: - Fix complex cases of self-assignments (bugs #21600, #22231) - - * zend_execute.c: - Make EG(This) and EG(scope) available to internal methods - - * zend_execute.c: - Revert patches - they weren't ready yet! - - * zend.c: - Fix initialization - -2003-02-16 Georg Richter - - * zend_execute.c: - fixed compiler warning - - * zend_execute.c: - tested patch from Zeev (fixes oo-bug in ext/mysqli) - -2003-02-16 Stanislav Malyshev - - * zend_compile.c - zend_language_parser.y: - add support for ::foo syntax meaning "global one" - - * zend_compile.c: - remove debug prints - -2003-02-16 Sebastian Bergmann - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - ZTS fixes - -2003-02-16 Stanislav Malyshev - - * zend_object_handlers.c: - namespace patch - static variable access - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Namespace patch. Big changes: - 1. Nested classes are gone. - 2. New syntax for namespaces: - namespace foo { - class X { ... } - function bar { ... } - var x = 1; - const ZZ = 2; - } - 3. Namespaced symbol access: $x = new foo::X; - etc. - For now, namespaces are case insensitive, just like classes. - Also, there can be no global class and namespace with the same name - (to avoid ambiguities in :: resolution). - -2003-02-15 Ilia Alshanetsky - - * zend_ini_scanner.l: - Added feature #19645 (ini parser can now handle quoted multi-line values). - -2003-02-14 Thies C. Arntzen - - * zend_execute_API.c: - init current_execute_data befor we start executing - - * Makefile.am: - ups - - * Makefile.am: - add really nice dump_bt function for debugging in gdb - -2003-02-13 Zeev Suraski - - * zend_object_handlers.c: - Fix error handling in illegal property access - -2003-02-13 Harald Radi - - * zend_language_scanner.l: - MFB PHP_4_3 - -2003-02-12 Ilia Alshanetsky - - * zend_API.c - zend_API.h: - Removed zend_get_module(), this function is not used by anything and more - importantly. it does not work. It tries to find data based on numeric keys - in hash table using string keys. - -2003-02-12 Zeev Suraski - - * zend_compile.c: - Fix declaration of class members that don't have an explicit access - modifier - -2003-02-11 Zeev Suraski - - * zend_compile.c: - Fix require() handling - that's an old bug! - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Improve parser handling of 'abstract' - -2003-02-10 Zeev Suraski - - * zend_compile.c: - Fix zend_initialize_class_data() - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h: - Centralize class initialization - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Treat $this->foo inside class X as an implicit 'public $foo' if X::$foo - is not explicitly declared - - Forbid multiple declaration of the same variable - - * zend_execute.c: - whitespace - - * zend_API.c - zend_compile.c: - Add missing destructors - -2003-02-10 Stanislav Malyshev - - * zend_object_handlers.c: - update static constants too - -2003-02-10 Zeev Suraski - - * zend_builtin_functions.c: - Fix get_parent_class() - - * zend_object_handlers.c: - Restore missing check - - * zend_execute.c - zend_execute_API.c: - Add ability to reference self:: and parent:: in constant initializers - (bug #21849) - - * zend_execute.c: - Remove redundant code - -2003-02-09 Zeev Suraski - - * zend_execute.c: - Fix the array() problem (and probably some other problems too) - -2003-02-08 Georg Richter - - * zend_API.c - zend_API.h: - fixed zend_parse_method_param - -2003-02-08 Sebastian Bergmann - - * zend_builtin_functions.c: - zend_config.h (and its Win32 version) is already included by zend.h - -2003-02-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - The string.h is already available through zend.h, so the manual inclusion - is not necessary. - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Added a check to ensure that string.h is available before trying to use it. - - Thanks Andi. - - * zend_builtin_functions.c: - Added missing header. - -2003-02-07 Zeev Suraski - - * zend_globals.h - zend_object_handlers.c: - Improve PPP handling of properties - - * zend_config.w32.h: - Better fix - - * zend_config.w32.h: - Fix Windows build - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #15734 (Added an optional parameter to get_defined_constants(), - which if passed, will include information regarding who created the - constant). - -2003-02-06 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #19506 (get_extension_funcs() can now retrieve a list of built-in - Zend Engine functions, if "zend" is specified as the module name). - Made get_extension_funcs() on failure. - -2003-02-06 Zeev Suraski - - * zend_compile.c: - Fix the 2nd buglet in the error message :) - - * zend_object_handlers.c: - Fix check - - * zend_hash.c - zend_hash.h: - Fix prototype (may have caused stack corruption) - -2003-02-05 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - - read_property cleanup - - Implement unset/isset/empty for PPP - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_opcode.c: - Rework static class properties - now supports access restrictions - - * zend_hash.c - zend_hash.h: - Add quick_exists() - - * zend_object_handlers.c: - Add PPP support for arrays - - * zend_compile.c: - Fix buglet in error message - -2003-02-04 Zeev Suraski - - * zend_object_handlers.c: - Missing update - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_object_handlers.c - zend_opcode.c - zend_ts_hash.c - zend_ts_hash.h: - Reimplement PPP properties - -2003-02-03 Sebastian Bergmann - - * zend_API.h: - Build fix. - -2003-02-02 Harald Radi - - * zend_API.c - zend_API.h: - extend the parameter parsing API by two functions - for parsing method parameters with automatic - detection if the function was called as such or as - a class method (with a valid this ptr). - if called as a function the first parameter has to be - the object it is operating on, if called as a method - this is used. - - -2003-02-02 Zeev Suraski - - * zend.h - zend_operators.h: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Core rearrangements - move Zend Objects specific code to their - specific implementation file - -2003-02-02 Andi Gutmans - - * zend_compile.c: - - Fix warning - -2003-02-01 Sebastian Bergmann - - * zend_ini_scanner.l - zend_language_scanner.l: - Fix build. - -2003-02-01 Jani Taskinen - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_istdiostream.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - - Added some missing CVS $Id$ tags, headers and footers. - -2003-01-30 Ilia Alshanetsky - - * zend_operators.c: - Fixed compiler warning regarding signed/unsigned int comparisons. - -2003-01-30 Harald Radi - - * zend_ts_hash.c - zend_ts_hash.h: - fix non-zts build for wez - -2003-01-30 Ilia Alshanetsky - - * zend_execute_API.c: - Fix ZTS build. - -2003-01-29 Stanislav Malyshev - - * zend_compile.h - zend_execute_API.c - zend_opcode.c: - Add additional stage to post-session cleanup. - We need separate cleanup stage because of the following problem: - Suppose we destroy class X, which destroys function table, - and in function table we have function foo() that has static $bar. Now if - object of class X was assigned to $bar, its destructor will be called and - will - fail since X's function table is in mid-destruction. - So we want first of all to clean up all data and then move to tables - destruction. - Note that only run-time accessed data need to be cleaned up, pre-defined - data can not contain objects and thus are not probelmatic. - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Code rearrangements - -2003-01-29 Stanislav Malyshev - - * zend_execute_API.c: - Fix object destructors: - zend_objects_store_call_destructors is not used anymore, we rely on - symbol tables cleaners to destroy all objects. - - * zend_objects_API.c: - extra safety - - * zend_compile.c: - fix memory leak - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix assignments to $this. - Fixes the 'make install' problem reported on php-dev - -2003-01-28 Zeev Suraski - - * zend_compile.c: - Fix a ticks related crash - - * (PHP_5_0_dev_before_13561_fix) - zend_execute.c: - Allow methods in parent classes to call protected methods in derived - classes - -2003-01-27 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c: - Replace MAKE_VAR opcode with special 'data' opcode - This opcode is not executeable but only holds data for opcodes - that need more than two arguments (presently only ASSIGN_OBJ and the ilk - but - in the future also ASSIGN_DIM) - -2003-01-26 Sascha Schumann - - * zend_API.c: - Replace snprintf() call using zend_error's capabilities - -2003-01-23 Zeev Suraski - - * zend_execute.c: - Let the scope propagate to internal functions - -2003-01-23 Jani Taskinen - - * zend_execute_API.c: - Fixed bug: #14542, register_shutdown_function() timeout problem - -2003-01-22 Stanislav Malyshev - - * OBJECTS2_HOWTO: - some small refinements for get_class_* - -2003-01-22 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #21814 (Allow booleans to be used as array keys). - -2003-01-21 Sterling Hughes - - * zend_objects_API.c: - fix by phanto to the cloning - -2003-01-19 Zeev Suraski - - * Zend.m4: - relabel - -2003-01-19 Stanislav Malyshev - - * zend_compile.c: - Restore for now old statics behaviour (so that indirect $$var references - would work again). Comprehensive fix will follow later. - -2003-01-19 Harald Radi - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: - ini patch to allow 'entry[] = value' entries - -2003-01-17 Harald Radi - - * zend_objects.c - zend_objects.h: - export zend_objects_destroy_object() - static inline was meaningless anyways as the function - was only used as a callback handler and was never - called directly - - * zend_objects_API.c - zend_objects_API.h: - make std_object_handlers struct available for shared modules - -2003-01-16 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #20933 (isset/empty didn't work when used on string offsets). - -2003-01-15 Andi Gutmans - - * zend_compile.c: - - Revert int -> unsigned int change for str.len - -2003-01-15 Sascha Schumann - - * zend.h: - Revert commit which turned the lengths of strings into zend_uint. - -2003-01-14 Andi Gutmans - - * ZEND_CHANGES - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Change "is" to "instanceof" as it explains better what the operator - means. - - "is_a" was also appropriate but ugly. - -2003-01-14 Stanislav Malyshev - - * zend_API.c: - fix memory leaks and key size - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-14 Stanislav Malyshev - - * zend_compile.c: - fix warning - - * zend_API.c - zend_API.h: - Make add_property_ functions work via write_property handler - - * zend.c - zend_object_handlers.c: - ws - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - Reverting previous patch. - -2003-01-13 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-13 Andi Gutmans - - * zend_objects_API.c: - - Don't check if the handle is bogus. We should crash. - -2003-01-12 Harald Radi - - * zend_modules.h: - fix wrong dereferenciation - -2003-01-12 Stanislav Malyshev - - * zend_compile.c: - fix inheritance - - * zend_API.h: - Remove handle_property from here too - - * zend.c - zend.h - zend_compile.c: - RIP handle_* functions. ZE2 will use __ handlers instead. - - * zend_object_handlers.c: - Move Z_OBJ_P here. - - * zend_operators.h: - Remove Z_OBJ - it's internal to Zend objects, no generic function except - those in zend_object_handlers.c should use it. - Add Z_OBJ_HANDLER macro for easy access to handlers - -2003-01-12 Sebastian Bergmann - - * zend.c - zend.h - zend_builtin_functions.c: - ZTS fixes. - -2003-01-12 Stanislav Malyshev - - * zend_object_handlers.c: - add get_class_name handler - - * zend.c: - Use generic handlers instead of Z_OBJ - -2003-01-12 Harald Radi - - * zend_modules.h: - - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - partially revert previous commit and - change zend_modules.h to include - a forward declaration to zend_ini_entry - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - added zend_ini_entry to zend_modules_entry as - discussed with zeev - - * zend_builtin_functions.c: - fix 'use of uninitialized variable' warning - -2003-01-12 Stanislav Malyshev - - * zend_objects_API.c: - validate handle - -2003-01-12 Zeev Suraski - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_ini.c - zend_ini.h - zend_variables.c: - Implemented compatibility mode - To enable - zend2.implicit_clone = on in php.ini or using ini_set() - -2003-01-11 Andi Gutmans - - * zend_execute.c: - - Fix typo and whitespace - -2003-01-11 Derick Rethans - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c: - - Ported the zend_execute_internal hook to ZendEngine2. - -2003-01-11 Harald Radi - - * zend_ts_hash.c: - freed reader twice instead of writer and reader - -2003-01-10 Ilia Alshanetsky - - * zend_alloc.c: - MFZE2 - -2003-01-10 Andrei Zmievski - - * zend_API.c: - Automatically register constructor, destructor, and clone function when - class methods are registered. - -2003-01-09 Zeev Suraski - - * zend_compile.c: - Found some more occurences of that elusive bug... - - * zend_compile.c: - Fix one lousy, annoying lurking bug (memory corruption) - Sebastian - try coWiki again please... - - * zend_API.h: - Unify and make it easy to add code into the broken-string error handler - - * zend_language_parser.y: - Fix writability checks - - * zend.c: - Fix leak - -2003-01-08 James Cox - - * zend.h: - cvs is dev not alpha. - -2003-01-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - MFZE2 - -2003-01-05 Zeev Suraski - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - MFZE1 - lineno fix - -2003-01-02 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix incorrect linkage of access-levels, when using private methods - -2003-01-01 Zeev Suraski - - * zend_API.c - zend_operators.h: - Win32 build fix - -2003-01-01 Stanislav Malyshev - - * zend_operators.h: - use handler for Z_OBJPROP - -2003-01-01 Zeev Suraski - - * zend_API.c: - Fix Wez's problem - -2002-12-31 Sebastian Bergmann - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_language_scanner.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - Bump year. - -2002-12-31 Stanislav Malyshev - - * zend_object_handlers.h: - fix level of indirection - -2002-12-30 Andrei Zmievski - - * zend_execute_API.c: - Adjust the error message. - -2002-12-30 Stanislav Malyshev - - * zend_object_handlers.h: - Oops, fix it indeed - - * zend_object_handlers.h: - Better check - -2002-12-26 Andrei Zmievski - - * zend_compile.c: - do_inherit_method_check() is supposed to return 0 or 1, not SUCCESS or - FAILURE. - -2002-12-14 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE2 - -2002-12-10 Zeev Suraski - - * zend_compile.c: - Fix check to allow for static+access level modifiers - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Allow variables to have both 'static' modifier and an access level. - NOTE: This only works at the syntax level right now (parser). It - doesn't actually work as of yet - all statics are considered - public for now - - Prevent users from putting more restrictions on methods in derived - classes - (i.e., you cannot make a public method private in a derived class, etc.) - -2002-12-09 Andi Gutmans - - * zend_mm.c: - - Fix a bug which I just introduced. - - * zend_mm.c: - - Fix typo - - * zend_mm.c: - - Improvements - - * zend_mm.c - zend_mm.h: - - First attempt to improve memory manager during realloc()'s - -2002-12-08 Zeev Suraski - - * zend_compile.c: - Remove comment - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Treat the absence of an access type just as if 'public' was supplied - - * zend_compile.c: - Simplify/fix inheritance checks - - * zend_execute.c: - Support private/protected constructors - -2002-12-07 Sebastian Bergmann - - * ZEND_CHANGES: - Update. - -2002-12-07 Zeev Suraski - - * zend_execute.c: - Fix error messages - - * zend_language_parser.y - zend_language_scanner.l: - Remove unintentional code - -2002-12-07 Andi Gutmans - - * zend_compile.c: - - Dissallow using parent, self and main as class names - -2002-12-06 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_hash.h - zend_language_parser.y - zend_language_scanner.l: - - Implement public/protected/private methods. - - Prevent instantiation of classes with abstract methods. - Based in part on Marcus's patch. - -2002-12-01 Andi Gutmans - - * zend_alloc.c: - - Allow enabling of memory cache with zend_mm - - * zend.c - zend.c - zend.h - zend.h - zend_builtin_functions.c - zend_builtin_functions.c: - - MFZE1 - - * zend.c - zend.h - zend_builtin_functions.c: - - Revert as the patch doesn't compile - - * zend.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_indent.c - zend_object_handlers.c - zend_opcode.c - zend_operators.c - zend_operators.h - zend_variables.c: - h WHitespace - - * zend.c: - - Initialize constants_updated (by Marcus) - - * zend_builtin_functions.c: - - Nuke use of deprecated macro - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - FN_IS_STATIC -> FN_STATIC - - * zend.c: - - Fix crash - - * zend_compile.c - zend_compile.h: - - My personal cleanups - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_language_parser.y - zend_object_handlers.c: - - Commit Marcus' cleanup of abstract and static inheritance and improve - - error messages - -2002-11-22 Derick Rethans - - * zend_API.c: - - Initialize all functions to non-static (patch by Marcus Börger - . - -2002-11-22 Sebastian Bergmann - - * zend_execute.c: - Show class name as well. Patch by Marcus Börger. - - * zend_execute.c: - Show the name of the abstract method in the error. - - * zend_compile.h: - Fix prototype. - -2002-11-20 Derick Rethans - - * zend_builtin_functions.c: - - MFZE1: Disable leak() and crash() when not using debug mode - -2002-11-20 Andi Gutmans - - * ZEND_CHANGES: - - Add abstract methods - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l: - - Fix build (thanks Marcus) - - Implement abstract methods, syntax: - - abstract function foo($vars); - - I don't see any reason why modifiers such as static/public need to be - - used with abstract. PHP is weakly typed and there would be no meaning to - - this anyway. People who want a strictly typed compiled language are - - looking in the wrong place. - -2002-11-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: - MFZE1 - error_reporting fix - -2002-11-18 Andi Gutmans - - * zend_language_scanner.l: - - MFZE1 - -2002-11-17 Stanislav Malyshev - - * zend_execute.c: - fix the leak - -2002-11-16 Andi Gutmans - - * zend_language_scanner.l - zend_language_scanner.l: - - MFZE1 - - * Zend.m4 - configure.in: - - MFZE1 - - * zend_hash.c: - - Commit fix for bug #19566 (I think it's by Marcus :) - -2002-11-14 Andrei Zmievski - - * zend_llist.h: - MFZE1 - -2002-11-13 Stanislav Malyshev - - * zend_execute.c: - semi-fix string offsets crash - now it doesn't crash, but still leaks - - * zend_object_handlers.c: - fix static - -2002-11-11 Andi Gutmans - - * ZEND_CHANGES: - - Update with statics - -2002-11-11 Sebastian Bergmann - - * zend_execute.c: - Fugbix typo. - -2002-11-11 Ilia Alshanetsky - - * zend.h: - MFZE1 - -2002-11-10 Andi Gutmans - - * zend_compile.c: - - MFZE1 - -2002-11-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - fix statics - make it behave like $this (fetch type "static") - Side effect: indirect references to statics won't work. - -2002-11-06 Sebastian Bergmann - - * zend_execute.c: - Fix ZTS build. - -2002-11-06 Stanislav Malyshev - - * zend_execute.c: - fix zend_assign_to_object_op - -2002-11-05 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 - -2002-11-05 Andi Gutmans - - * zend_compile.h: - - Shift around zend_op members - - * ZEND_CHANGES: - - A couple of updates - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Add support for static methods. Basically methods which are defined as - - static don't have $this. That's the whole difference. - - * tests/zend2.php: - - $clone -> $that - - * zend_execute_API.c: - - Fix bug introduced with type change of free_op1/2 - - * zend_language_parser.y - zend_language_scanner.l: - - ATTENTION: Finally nuke old_function and cfunction. I think it is time - - to get rid of these BC notations. This is from the days of the move from - - PHP/FI 2 -> PHP 3 - -2002-11-05 Ilia Alshanetsky - - * zend_hash.c: - Revert of previous patch. - -2002-11-05 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Change the automatically created variable $clone in __clone() to - - $that as discussed at the PHP Conference. If there are any objections - - alternative names please let me know. The reason for changing it from - - $clone is because $clone sounds as if it's the newly cloned object and - - not the old one. - -2002-11-05 Stanislav Malyshev - - * zend_compile.c - zend_compile.h: - avoid using 'class' in exported functions - it annoys c++ - -2002-11-05 Stig Bakken - - * zend.c: - Fixed some special cases that were crashing for the exception default - handler. - -2002-11-04 Ilia Alshanetsky - - * zend_compile.c: - Silence compiler warnings. - - * zend_hash.c: - If ordered is not set a random compiler assigned value of *p2 would be - used, - this patch fixes the problem by initializing *p2 to NULL. - - * zend_operators.c: - Silence compile warning, ctype.h is needed for tolower() function. - - * zend_language_scanner.l: - MFZE1 - -2002-11-02 Derick Rethans - - * zend_language_scanner.l: - - Fix segfault when __CLASS__ was used outside a class definition - - * zend.c: - - MFZE1 - -2002-11-02 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 (20214). - -2002-11-01 Andi Gutmans - - * zend_execute.c: - Fix unset($this->foo) - -2002-10-24 Andi Gutmans - - * zend_execute.c - zend_opcode.c: - Also tune jmpz_ex - - * zend_execute.c - zend_opcode.c - zend_compile.h: - - Improve performance of part of the jmps. More to follow. - -2002-10-23 Andi Gutmans - - * zend_execute.c - zend_compile.c: - - This might improve performance. Commiting it so that I can check it on - - Linux - - * zend_execute.c: - - Make Ts access a macro. I need this for my next patch which should - - improve performance but not sure yet if it will. - -2002-10-22 Andi Gutmans - - * zend_execute.c: - Nuke unused get_incdec_op() - - Nuke old comment - - * zend_compile.h - zend_execute.c - zend_globals.h: - Improve overall engine performance - - * zend_execute.c: - Fix bug reported by Daniel T. Gorski - -2002-10-21 Thies C. Arntzen - - * zend_builtin_functions.c: MFZE1 - -2002-10-20 Stanislav Malyshev - - * zend_object_handlers.c: looks like this message should go - - * zend_compile.c: Fix private handling - -2002-10-20 Sebastian Bergmann - - * zend_highlight.c - zend_highlight.h: Sync zend_html_puts parameter list with Zend Engine 1. - -2002-10-19 Andi Gutmans - - * zend_compile.h: - Fix compile warning. - - * zend_opcode.c - zend_compile.h - zend_execute.c: - Improve opcode dispatching - -2002-10-18 Andi Gutmans - - * zend.c - zend_compile.c - zend_execute.c: - - Change opcode dispatch mechanism to use a function per opcode and use - - a lookup table using the opcode # to call the correct function. - - Still have lots of tuning to do. - - * zend_execute.c: - Cleanup - -2002-10-16 Sebastian Bergmann - - * zend_execute.c: Fix ZTS build. - -2002-10-16 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: Fix class static members: now the following code works: - - and returns "Hello" (class statics are not copied anymore, but looked up in - runtime) - - * zend_compile.c - zend_compile.h - zend_execute.c: Fix and generalize $this handling. - ZEND_FETCH_FROM_THIS is removed, IS_UNUSED type on class variables will be - used instead as the sign that it's a fetch from $this - -2002-10-14 Ilia Alshanetsky - - * zend_ini_parser.y - zend_ini_scanner.l - zend_globals.h: MFZE1 - -2002-10-14 Andi Gutmans - - * zend_execute.c - zend_language_parser.y: - Support new classname::$class_name, e.g.: - hello; - ?> - -2002-10-13 Ilia Alshanetsky - - * zend_extensions.h: Increased the API number. (re: floats patch) - -2002-10-12 Ilia Alshanetsky - - * zend_operators.c - zend_operators.h - zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (floats & locale issue) - -2002-10-10 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-10-10 Stanislav Malyshev - - * zend_object_handlers.c: add comment - - * zend_object_handlers.c: fix memory leaks - -2002-10-09 Stanislav Malyshev - - * zend_object_handlers.c: Fix object write handler behaviour: - * If this value is already set to given value, don't try to set it again. - * If we have reference, we should not move it. - * If we are assigning referenced variable, we should separate it. - -2002-10-09 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 zend_str_tolower issue. - -2002-10-07 Andi Gutmans - - * tests/zend2.php: - Fix test - - * zend_execute.c: - - Require $this-> when calling a methods. This whole automatic lookup - - first in the class and then in the global scope is confusing, slow and - - not quite BC compatible. - - * zend.c - zend_compile.c - zend_globals.h: - - Allow access to private/protected variables of $clone inside the __clone() - - method - -2002-10-06 Andi Gutmans - - * zend_execute.c: - Fix problem with unsetting object members. - -2002-10-01 Andi Gutmans - - * zend_language_parser.y: - - Fix problem when crashing on illegal tokens in class name during class - - definition. - -2002-09-30 Derick Rethans - - * ZEND_CHANGES: - No tabs :) - -2002-09-28 Derick Rethans - - * zend_builtin_functions.c: - Fix for defines... - - * zend_builtin_functions.c: - Fix build in non-ZTS mode - -2002-09-26 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 - -2002-09-25 Stanislav Malyshev - - * zend_extensions.h: - Propmote API NO year, so that it will never be the same as ZE1 API NO - -2002-09-24 Andi Gutmans - - * zend_compile.c: - Fix leak - - * zend_language_parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Megapatch to try and support inheritance from sub-classes. Things might - - be *very* buggy now so don't get too upset if that happens. - - I still need to improve some stuff but it's a good step (hopefully). - -2002-09-23 Andi Gutmans - - * zend_globals.h - zend_ini.c - zend_language_parser.y: - MFZE1. - -2002-09-21 Andi Gutmans - - * zend_extensions.h: - Someone screwed this up. - -2002-09-19 Derick Rethans - - * zend_ini.c: - Make Colin happy - -2002-09-19 Zeev Suraski - - * zend.c - zend.h - zend_execute_API.c: MFZE1 - connection_status() fix - - * zend.c: Fix non ZTS build - - * zend.c: Fix that obscure crash in Debug_TS mode - -2002-09-18 Zeev Suraski - - * zend.c: - Fix the thread-safe initialization of the ZE2. This should solve some - sporadic crashes, as well as the problem with the built-in constants. - - * zend_constants.c: Remove dead code - - * zend_builtin_functions.c: Add useful debugging function - -2002-09-17 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add tracking for hashtable allocation - - * zend.c: ZE2 fix - - * zend_compile.c: whitespace - - * zend.c - zend.h: MFZE1 - threading fix - -2002-09-16 Andrei Zmievski - - * zend_API.h - zend_builtin_functions.c - zend_API.c - zend_execute_API.c: MFZE1 - -2002-09-15 Ilia Alshanetsky - - * zend_highlight.c: Make zend actually strip comments. Bug #18151 - - * zend.c: - Make zend return a proper exit error code when it encounters a parse error. - -2002-09-15 Andi Gutmans - - * zend_compile.c: - - Hopefully fix problem with __autoload not working well with inherited classes. - - There might still be some weird situations I haven't thought of. - - * zend_list.c - zend_execute.c: - WS fix - "while (" instead of "while(" - - * zend_execute_API.c - zend_ini.c - zend_list.c - zend_object_handlers.c - zend_objects_API.c - zend_operators.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c: - WS - Always use "if (" and not "if(" - - * zend_execute_API.c: - WS - -2002-09-10 Stanislav Malyshev - - * zend_execute_API.c - zend_variables.c: MFZE1 - -2002-09-09 Stanislav Malyshev - - * zend_object_handlers.c: remove comment - -2002-09-08 Andi Gutmans - - * zend.h: - Prepare for alpha 3 - -2002-09-05 Stanislav Malyshev - - * zend_compile.c: quick-n-dirty inheritance support for __handlers - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Whitespace fixes. - -2002-09-04 Stanislav Malyshev - - * zend_object_handlers.c: remove dead code - - * ZEND_CHANGES - zend_object_handlers.c: Fix __call and add some docs - -2002-09-04 Sebastian Bergmann - - * zend_object_handlers.c: Fix ZTS build. - - * ZEND_CHANGES: TBD: __call(), __get(), __set(). - -2002-09-04 Stanislav Malyshev - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_extensions.h - zend_object_handlers.c - zend_objects.c: Support for __get, __set and __call in classes. - This should work as follows: if class hasn't member with given name, - __get/__set is called. If class has no method with given name, __call is called. - __get/__set are not recursive, __call can be. - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Workaround for superfluous comma in var_export() result. - - * ZEND_CHANGES: - Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments. - -2002-09-03 Thies C. Arntzen - - * zend_builtin_functions.c: nuke warning - - * zend_builtin_functions.c: nuke unneeded stuff - -2002-09-03 Zeev Suraski - - * zend.c - zend.h - zend_ini.c: MFZE1 - -2002-09-03 Derick Rethans - - * zend_ini.c: - Revert - - * zend_ini.c: - - MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt ) - -2002-09-03 Sebastian Bergmann - - * zend.h: - Add html_errors to zend_utility_values. Patch by Jan Lehnardt . - -2002-09-03 Andi Gutmans - - * zend_builtin_functions.c: - Fix typo - -2002-09-02 Thies C. Arntzen - - * zend_builtin_functions.c: - refine last patch. if the argument-stack is not consistent don't try to show - arguments. no call to zend_error is made as we might end up in an infinite - recursion if called from an error_handler. - so: if the arguments to functions aren't shown in debug_backtrace this is 'cause - the arument stack was not consistent when debug_backtrace was called. - - * zend_builtin_functions.c: - debug_backtrace() now checks the complete argument-stack for consistency. - -2002-09-02 Stanislav Malyshev - - * zend_execute.c: MFZE1 - -2002-09-01 Andi Gutmans - - * zend_llist.c: - Fix leak reported by "l0t3k" - -2002-09-01 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2002-08-28 Thies Arntzen - - * zend_builtin_functions.c - zend_execute_API.c: debug_backtrace() - - make args passed to functions called vy call_user_function available again. - - * zend_builtin_functions.c: debug_backtrace(): - - make args work if called from the error_handler - - fix refcount for args - - * zend.c: - clear current_execute_data on bailout as it would point into some freed area - on the stack. - -2002-08-28 derick - - * zend.c: - MFZE1 - -2002-08-26 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace(): show name of included file for include and require calls - plus some small fixes suggested by andi. - -2002-08-24 Andi Gutmans - - * zend_builtin_functions.c: - Whitespace - - * zend_builtin_functions.c: - Whitespace and better variable name - -2002-08-24 Thies Arntzen - - * zend_builtin_functions.c: fix warning - -2002-08-23 Andi Gutmans - - * Zend.m4: - Add \n to configure fprintf - - * zend_extensions.c: - dlerror -> DL_ERROR - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace: show include/require/eval as normal functions on the stack - -2002-08-23 derick - - * zend_builtin_functions.c: - No spaces :) - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - - debug_backtrace now also returns an array containing the arguments of the - called function. - - zeev, andi - is knowing the structure of the stack considered a bad thing in - zend_builtin_function? if yes i would have to create a new function in - zend_ptr_stack.c (but i think we are save this way) - - * zend_builtin_functions.c - zend_execute_API.c: - debug_backtrace: - added "type" ('->' or '::') for object calls. - made calls done thru call_user_func show-up correct in backtraces. - - andi, - does this look correct to you? - - * zend_execute.c: those are set by RETURN_FROM_EXECUTE - -2002-08-21 Thies Arntzen - - * zend_execute.c: - zend_execute: make sure that current_execute_data points to the right thing - after coming back from recursion. - -2002-08-19 Zeev Suraski - - * zend_operators.c: MFZE1 - -2002-08-17 Andi Gutmans - - * zend_execute.c: MFZE1 - -2002-08-17 Zeev Suraski - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-08-16 Stig Bakken - - * zend.c: * append emacs footer - - * zend.c: * remove builtin exception class - -2002-08-16 Andi Gutmans - - * zend.c: - Fix whitespace - -2002-08-16 Stig Bakken - - * zend_execute_API.c - zend_globals.h - zend.c - zend_builtin_functions.c: - - Added set_exception_handler() function for registering a global, - catch-all exception handling function - - Added set_exception_handler() function for registering a global, - catch-all exception handling function (Stig) - -2002-08-15 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_language_scanner.l: MFZE1 - -2002-08-14 jason - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y: - MFZE1 (use token instead of global for opcode counting) - -2002-08-13 Andi Gutmans - - * zend_execute_API.c: - - Fix crash when exception is raised in __autoload function - -2002-08-13 Zeev Suraski - - * zend.h: MFZE1 - -2002-08-08 sebastian - - * zend_objects.c: Fix warning. - -2002-08-08 stas - - * zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Add ZEND_API to functions - -2002-08-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Make new 'is' operator work with classes only and return false when - - the object isn't of the said class or the value isn't an object. - - * zend_static_allocator.c: - Bad Harald! :) - -2002-08-08 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2002-08-07 phanto - - * zend_static_allocator.c - zend_alloc.c - zend_config.w32.h - zend_hash.c - zend_ini.c - zend_llist.h - zend_mm.c - zend_operators.c: make win32 debug output more verbose - -2002-08-03 Andi Gutmans - - * tests/zend2.php: - Small fix - -2002-08-03 Zeev Suraski - - * zend_execute.c: MFZE1 - -2002-08-01 stas - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-07-30 jason - - * zend_compile.c - zend_execute.c - zend_globals.h: MFZE1 global declare - - * zend_compile.c: Fix segfault - -2002-07-30 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Adding 'is' operator that can be used to check the type of a variable, - or its class. - -2002-07-28 phanto - - * OBJECTS2_HOWTO: update the handlers struct - -2002-07-27 Andi Gutmans - - * zend_compile.c - zend_execute_API.c: - - Make sure classes are first looked for in the current scope. - - Make sure that during inheritance the global scope is searched if the - - current one doesn't work. - -2002-07-26 Andi Gutmans - - * zend_execute.c - zend.c - zend_builtin_functions.c - zend_compile.h: - - Fix problem with debug_backtrace() reported by Stig. We weren't reporting - - global function information because it wasn't available. We have to do - - an additional assignment per-function call so that it'll be available. - - Also don't define the global scope as function name _main_ but leave it - - empty so that frameworks like Pear can decide what they want to do. - -2002-07-25 sniper - - * Zend.m4: Fixed 3 major failures in this test: - - 1. Tests work better when they are actually run.. - 2. When file is opened, it should be closed sometime too. - 3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's - good idea to read the values while the file still exists. - - -2002-07-24 Andi Gutmans - - * zend_mm.c: - Fix some compile problems with the new configure checks. - -2002-07-24 James Cox - - * Zend.m4 - zend_mm.c: move testing for the alignment values into configure. - - * Zend.m4: ws fixes. - -2002-07-23 Andi Gutmans - - * zend_hash.c: - Fix WS. - -2002-07-21 Andi Gutmans - - * zend_compile.c: - - Fix bug reported by Sebastian where old constructors didn't work in - - nested classes. - -2002-07-18 derick - - * zend.h - zend_extensions.c: - MFZE1 - MacOSX fixes by Marko Karppinen - -2002-07-17 Andi Gutmans - - * zend_compile.c: - - Remove code which wasn't supposed to go into the patch. - - * zend_compile.c - zend_language_parser.y: - Rejuggle some code. - -2002-07-17 sniper - - * ZEND_CHANGES: This was mentioned already above (with an example too :) - -2002-07-16 Andi Gutmans - - * ZEND_CHANGES: - Before I forget to list it, this was also added. - - * zend_language_scanner.l: - - Syntactic sugar - Add "public" as a synonym for "var". - - Now we have the three P's. - You can do: - - - -2002-07-15 derick - - * zend_operators.c: - MFH of the crap removal - -2002-07-15 Andi Gutmans - - * ZEND_CHANGES - zend.c - zend.h - zend_API.c - zend_compile.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - - Commit patch to support protected member variables (by Timm Friebe w/ - - some fixes by me). - - You can't access protected variables from outside the object. If you want - - to see a protected member from your ancestors you need to declare the - - member as protected in the class you want to use it in. You can't - - redeclare a protected variable as private nor the other way around. - - * zend_operators.c: - - Really implement bool increment/decrement as flip-flop. - -2002-07-14 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - ZEND_CHANGES: - - Nuke delete(). It was a big mistake to introduce it and I finally - - understand why Java didn't do so. - - If you still want to control destruction of your object then either make - - sure you kill all references or create a destruction method which you - - call yourself. - - * zend_execute.c: - Nuke some unused code - -2002-07-14 derick - - * zend_operators.c: MFZE1 - - * zend_operators.c: - MFZE1 - -2002-07-07 Andi Gutmans - - * zend_objects_API.c: - Path which should improve previous fix. - - * zend_objects_API.c: - - First try at solving problem with different objects being allocated the - - same id. - -2002-07-07 Stanislav Malyshev - - * zend_object_handlers.c: name length should be strlen+1 - -2002-07-07 Sebastian Bergmann - - * zend_language_parser.y: - Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe . - -2002-07-06 Andi Gutmans - - * zend_execute.c: - - Fix problem where scope was lost in nested function calls. - - Thanks to Timm Friebe for diving into this one. - -2002-07-06 Zeev Suraski - - * zend_language_parser.y: spelling fix - -2002-07-05 Stig Bakken - - * zend_builtin_functions.c: * folding fixes - -2002-07-01 Andi Gutmans - - * zend_compile.c: - Fix bug when acccessing $this not in class scope. - - * zend_objects.h - zend_objects.c: - Export zend_object_get_address() - -2002-06-30 Andi Gutmans - - * ZEND_CHANGES: - Remember to document autoload when I have time. - -2002-06-30 Derick Rethans - - * zend_modules.h: - MFZE1 - -2002-06-29 Andi Gutmans - - * zend.h: - Get ready for alpha2 - - * zend_execute_API.c: - Invalid -> Undefined - - * zend_language_parser.y: - Add missing semi-colon. - - * zend_execute_API.c - zend_execute.c: - Improve some error messages. - - * zend_compile.c: - Revert previous fix. - - * zend_compile.c: - Change E_ERROR -> E_COMPILE_ERROR where needed. - - * zend_compile.c: - - Fix for bug #17882. We complain if the same method is declared twice. - - * zend.h - zend_operators.c: - Fix bug 15037 - - Bump version to alpha2-dev - -2002-06-28 Andi Gutmans - - * zend_operators.c: - WS fix - -2002-06-26 Andi Gutmans - - * zend_execute_API.c: - - Autoloading support based on patch from Ivan Ristic. - - Again I hope this feature ends up working well because if it doesn't we - - might need to nuke it. This only works for global scoped classes and it - - will never work for sub-classes so don't even ask!!!!! - - Just define an __autoload() function in the global scope and it will be - - called with the class name as the parameter if it doesn't manage to find - - the class. - - * zend_API.c - zend_builtin_functions.c - zend_mm.h: - Centralize global class fetch - - * zend_alloc.c - zend_execute.c: - - Fix problem with scope's not changing correctly during method calls. - - Reapply a tiny optimization to the allocator so that in non-debug mode - - we clean memory without detecting leaks. - -2002-06-24 Andi Gutmans - - * zend_fast_cache.h: - - MFZE1 (Turn off fast cache until we make sure it performs well.) - - * zend_alloc.c: - More fixes (warnings, bug fixes etc.) - - * zend_execute.c: - - Revert patch which checks at run-time if you're allowed to assign - - certain values by reference. - - We still need to find a solution for cases when this shouldn't be allowed - - as it might cause leaks. - - * zend_alloc.c: - Fix crash bug and clean up a bit. - -2002-06-24 Sebastian Bergmann - - * Zend.m4: IMHO, ZTS should no longer be labeled experimental. - -2002-06-24 Andi Gutmans - - * zend_alloc.c: - MFZE1 - - * zend_alloc.c: - Don't use cache if we're using ZEND_MM - - * zend_mm.c: - - Hardcode alignment to 8. We might need a configure check for this. - - * zend_mm.c - zend_mm.h: - Improve memory manager to allocate small blocks quickly. - - * zend_alloc.h - zend_mm.h - zend_alloc.c: - - Don't keep allocated blocks in a linked list if we're in non-debug mode - - as now the memory manager takes care to nuke all leaking blocks. - - * zend.h - zend_types.h: - MFZE1 - -2002-06-23 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Fix problem with constructor not being inherited and called correctly. - - * zend_mm.c: - Fix small bug - - * zend_mm.c: - - Almost completely implement realloc(). It now resizes in place when - - possible. - -2002-06-22 Andi Gutmans - - * zend_alloc.c - zend_mm.c: - Fix crash when zend_mm_shutdown is called more than once. - - * zend_alloc.c - zend_alloc.h - zend_globals.h - zend_language_parser.y: - MFZE1 - - * zend_constants.h - zend_objects.c - zend_variables.c - zend_variables.h - zend_constants.c - zend_alloc.c - zend_alloc.h: - Nuke persist_alloc(). - -2002-06-19 Andi Gutmans - - * zend_globals.h: - - This was also supposed to be part of the previous ZEND_MM commit :) - - * zend_alloc.c: - - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change - - * zend_mm.h: - Use #ifdef for ZEND_MM - - * zend_mm.c: - Make sure MAX is defined - - * zend_constants.c: - - Fix problem where you couldn't define constants with different cases but - - the same name. - -2002-06-18 Derick Rethans - - * zend.c: - MFZE1 - -2002-06-17 Andi Gutmans - - * zend_mm.c: - Improve speed of alignment calculation - - * zend_mm.c - zend_mm.h - zend_alloc.c: - - Fix a bug and add code which frees actual allocated segments at the end - - of execution (this still doesn't work because some blocks remain - - referenced after the memory manager is killed. - - * zend_mm.c - zend_mm.h: - Save space per-allocated block. - -2002-06-16 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Fix bug in class constants - - Start centralizing main class lookups. This will help implement - - __autload() - - * zend_mm.c - zend_mm.h: - - Remove debug code which doesn't work anymore and add headers. - - * zend_globals.h - zend_mm.c - zend_mm.h - zend_alloc.c - ZendTS.dsp: - Commit an initial version of a home made memory manager. - - It's just for seeing if this would be an advantage to PHP in MT - - environments. If this is to become production material there is still - - a long way to go. - -2002-06-15 Andi Gutmans - - * zend_objects.h - zend_objects_API.c: - - Fix copy&paste problem where we allocated according to an old structure - - decleration and not the new one. - -2002-06-11 Andi Gutmans - - * zend_builtin_functions.c: - - Don't show debug_backtrace() in the trace itself. - - This patch is a bit ugly because the whole code itself is pretty complex - - and hard to re-order. - - * zend_execute.c - zend_language_parser.y: - - Fix problem with assigning functions by reference. - -2002-06-11 Sebastian Bergmann - - * RFCs/004.txt: Add __delegate(). - -2002-06-10 Harald Radi - - * zend_ts_hash.h - zend_ts_hash.c: added TS_HASH macro - -2002-06-10 Stanislav Malyshev - - * zend_execute.c: Fix leak - -2002-06-09 Harald Radi - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.h: - only check for an available class entry instead of - the std_object_handlers on some places - - -2002-06-08 Andi Gutmans - - * zend_hash.h - zend.h: - This should improve performance on Windows - - * zend_hash.h: - - Add a loop unrolled version of the hash function and a bit of an - - explanation about our hash function (Ralf S. Engelschall) - -2002-06-06 Sebastian Bergmann - - * RFCs/004.txt: Add RFC on delegation. - -2002-06-05 Sebastian Bergmann - - * zend_execute.c: Remove unused local variable. - -2002-06-05 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_object_handlers.c: - - Allow overloaded objects to receive the method name in its original - - case. - -2002-06-05 Derick Rethans - - * zend_llist.c: - Fix memleak (patch by Stefan Sesser) - -2002-06-04 Derick Rethans - - * zend_ini_scanner.l: - Fix for bug #17462 (Patch by Edin Kadribasic) - -2002-05-31 Andi Gutmans - - * ZendTS.dsp: - Add zend_objects_API.* to dsp - - * zend_objects_API.c: - Fix build (one more coming up) - - * zend_objects.c: - Fix build - -2002-05-31 Sebastian Bergmann - - * Zend.dsp: Add zend_objects_API.c to project. - -2002-05-31 Stanislav Malyshev - - * Makefile.am - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Generalize object storage and reference bookkeeping - -2002-05-30 Venkat Raghavan S - - * zend.h - zend_config.nw.h - acconfig.h: NetWare changes - -2002-05-26 Andi Gutmans - - * zend_multibyte.c: - - Add empty zend_multibyte.c to allow build with 4.3.0-dev. - -2002-05-24 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-05-24 Andi Gutmans - - * ZEND_CHANGES: - Add a bit of information. - -2002-05-20 Zeev Suraski - - * zend_API.h - zend_execute.h - zend_list.h: MFZE1 (Expose more C++ APIs) - -2002-05-14 Andi Gutmans - - * zend_objects.c - zend_objects.h: - constructor_called is supposed to be destructor_called - -2002-05-13 Sterling Hughes - - * zend_qsort.c: MFZE1 - -2002-05-13 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-12 Zeev Suraski - - * zend_highlight.c: MFZE1 - -2002-05-12 Sebastian Bergmann - - * ZEND_CHANGES: Rephrase. - - * ZEND_CHANGES: Beautify. - - * ZEND_CHANGES: Start documenting the debug backtracing. - - * ZEND_CHANGES: Whitespace fixes. - -2002-05-11 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: MFZE1 - -2002-05-10 Andi Gutmans - - * zend_builtin_functions.c: - Nuke C++ comment - - * zend_builtin_functions.c: - - Make debug_backtrace() return an array. Still not finished because I - might want to differentiate between method calls and static methods. - - Example: - $bt = debug_backtrace(); - foreach ($bt as $frame) { - if (isset($frame['class'])) { - print $frame['class']; - print "::"; - } - print $frame['function']; - print " ["; - print $frame['file']; - print ":"; - print $frame['line']; - print "]\n"; - } - -2002-05-08 Andi Gutmans - - * zend_execute.c - zend_builtin_functions.c: - - Hopefully fix problems with debug_backtrace() - -2002-05-08 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-07 Andi Gutmans - - * zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c: - - More debug backtrace work. It still doesn't work very well... - -2002-05-02 Andi Gutmans - - * zend.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: Initial support for built-in backtracing. - There are still a few problems such as includes and calling other functions - from internal functions which aren't seen (will have to think if and how to - fix this). - Also the main scripts filename isn't available. Need to think about that. - -2002-04-30 Stanislav Malyshev - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.h - zend_API.c: Make OBJCE return zend_class_entry*, also some cleanups - -2002-04-28 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: Revert. - -2002-04-27 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: - MFZE1: If the size-operands of memset are constants, the compiler can turn them into fast inline code. So, instead of using ecalloc, we use emalloc + memset in macro form now. emalloc will not return NULL, so the chosen macro form is safe. This is not true for malloc(3). An inline function accomodates our needs here. Suggested by: http://www.mail-archive.com/dev%40httpd.apache.org/msg02492.html (Sascha) - -2002-04-25 Harald Radi - - * zend_config.w32.h: unbreak the win32 build - -2002-04-24 Harald Radi - - * zend_API.c: MFZE1 saschas 'Avoid exceeding buffer limits' patch - -2002-04-23 Harald Radi - - * zend_hash.c - zend_hash.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ts_hash.c - zend_ts_hash.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_API.c - zend_API.h - zend.h: some type cleanup work - -2002-04-22 Harald Radi - - * zend_object_handlers.c - zend_object_handlers.h - zend_objects.h - zend_operators.h - zend_API.c - zend_API.h - zend_builtin_functions.c: added get_class_entry callback handler to the - object handlers structure - -2002-04-22 Sebastian Bergmann - - * Zend.m4: MFZE1: Change default value of inline-opt to yes (Sascha). - -2002-04-22 Harald Radi - - * zend_config.w32.h - acconfig.h - flex.skl: fixed linkage warning under win32 - -2002-04-20 Zeev Suraski - - * zend_execute_API.c: MFZE1 - -2002-04-19 Sebastian Bergmann - - * zend_list.c - zend_hash.c - zend_hash.h: - MFZE1: make sure the resource-list is always consistent during shutdown (Thies). - - * zend_hash.c: MFZE1: Fix imbalance bug (Zeev). - -2002-04-10 Jani Taskinen - - * zend_language_scanner.l - zend_language_parser.y: MFZE1 - -2002-04-07 Stanislav Malyshev - - * zend.h: make compatible with current PHP - - * zend_compile.c: sync - -2002-03-29 Derick Rethans - - * zend_compile.c: - revert patch - -2002-03-25 Derick Rethans - - * zend_compile.c: - MFZE1 - -2002-03-23 Andi Gutmans - - * zend_ts_hash.c - zend_ts_hash.h: - - Fix build without ZTS. If someone has a nicer fix let me know. - -2002-03-21 Andi Gutmans - - * zend_language_parser.y: - - No idea how this slipped in. Fix delete $obj statement. - -2002-03-20 Harald Radi - - * ZendTS.dsp - zend.h - zend_ts_hash.c - zend_ts_hash.h: added thread safe hashtable which allows concurrent - reads but only exclusive writes - -2002-03-19 Andi Gutmans - - * zend_language_parser.y - zend.h: - - Finish covering all parsed methods to check for validity in parser. - - Change zval's refcount to zend_uint (If it doesn't slow down the Engine - - too much it should probably stay this way). If anyone has time to test - - the difference in speed between zend_ushort & zend_uint in zend.h of - - the struct _zval_struct (one line change) I'd be glad to get some - - figures. - -2002-03-18 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - More fixes to check for member/function call legality. - -2002-03-17 Andi Gutmans - - * zend_language_parser.y - zend_compile.c: - - Start putting error handling where method calls are being used in a - - context where only writable variables should be used. - -2002-03-15 Andi Gutmans - - * zend_execute.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_variables.c: - Pass TSRMLS to callbacks. - - * zend_execute.c: - - Scope fix. When calling an imported function the scope will change - - correctly to the scope of the functions class. - - - * zend_opcode.c - zend_execute.c - zend_compile.h - zend_compile.c: - - Fix issues with $this when using it by itself without indirection such as - - $this->foo. - -2002-03-14 Stanislav Malyshev - - * OBJECTS2_HOWTO: more cleanup - - * OBJECTS2_HOWTO: Update howto - - * zend_execute.c: fix for delete $this and unset $this - - * zend_execute_API.c: Fix call_user_function - -2002-03-12 Andi Gutmans - - * zend.h: - Forgot to close comment. - - * zend.h: - Macro for duality between Engine 1 and 2 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_opcode.c - zend_operators.c: - Another couple of indirection fixes. - - Make class_entry->refcount be part of the structure and not allocated. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - Fix bug introduced with latest class hash table change. - -2002-03-12 Stanislav Malyshev - - * zend_API.c: Fix standard object creation - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend.c - zend.h: - make class tables contain class_entry *, not class_entry - - fix isset($this) - -2002-03-10 Andi Gutmans - - * zend_execute.c: - Fix build in ZTS mode. - -2002-03-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: New stuff for objects API: - - Better assignment handling - - More flexible operations with zval-containing objects - -2002-03-09 Andi Gutmans - - * tests/zend2.php: - - Add the original example script to the CVS so that it's always available. - -2002-03-08 Sebastian Bergmann - - * ZEND_CHANGES: Add 'import const' example. - -2002-03-08 Andi Gutmans - - * zend_execute.c: - Support importing constants. e.g.: - - - * ZEND_CHANGES: - Add another 'import' example and merge 'import' section into 'Namespaces' section. - -2002-03-06 Andi Gutmans - - * zend_execute.c: - - Add function * and class * functionality. Only constants are left. - - - * ZEND_CHANGES: Consistency. - - * ZEND_CHANGES: Add 'import statement' section. - -2002-03-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Initial patch to support importing from class scopes (for Stig). - - It isn't complete yet but I want to work on it from another machine. It - - shouldn't break anything else so just don't try and use it. - - The following is a teaser of something that already works: - - -2002-03-02 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-03-01 Andrei Zmievski - - * zend_API.c: MFZE1 - -2002-03-01 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Remove use of C++ reserved words namespace/this - - * zend_opcode.c - zend_language_parser.y - zend_compile.h - zend_compile.c - zend_API.c: - Fix bug in nested try/catch's - - Infrastructure for implementing imports of methods. - - * zend_objects.c: - - Fix crash reported by Sebastian when destructor function causes a fatal - - error. I hope this does it and we don't find any other problems. - -2002-02-26 Andi Gutmans - - * zend_alloc.h - zend_alloc.c - zend.c: - MFZE1 - -2002-02-21 Sebastian Bergmann - - * ZEND_CHANGES: - Maintain ZEND_CHANGES to account for the addition of private member variables. - -2002-02-21 Andi Gutmans - - * zend_object_handlers.c - zend_opcode.c - zend_language_parser.y - zend_language_scanner.l - zend_compile.c - zend.c - zend.h - zend_API.c: - Experimental support for private members. - Hello; - } - } - - class MyClass2 extends MyClass { - function printHello() - { - MyClass::printHello(); /* Should print */ - print $this->Hello; /* Shouldn't print out anything */ - } - } - - $obj = new MyClass(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); /* Should print */ - - $obj = new MyClass2(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); - ?> - -2002-02-14 Stanislav Malyshev - - * zend.h - zend_API.c: Pass TSRM to create_object - -2002-02-14 Andrei Zmievski - - * zend_compile.c: - Fix the bug where the declared properties without init values were not - entered into the table. - -2002-02-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - * zend_compile.h: - Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A. - -2002-02-08 Andi Gutmans - - * zend_objects.c: - Remove object debug messages. - -2002-02-07 Stanislav Malyshev - - * Makefile.am - OBJECTS2_HOWTO - ZendTS.dsp - configure.in - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: Mega-commit: Enter the new object model - Note: only standard Zend objects are working now. This is definitely going to - break custom objects like COM, Java, etc. - this will be fixed later. - Also, this may break other things that access objects' internals directly. - -2002-02-04 Andi Gutmans - - * zend_execute.c: - - This small patch should also take care of allowing unseting of $this->foo - - and static members. The unset() opcode was luckily already suitable for - - object overloading. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_objects.c: - - Fix problem with the objects_destructor called during shutdown. It was - - freeing objects from id 0 instead of id 1. id 0 is not used. - - Change isset/empty opcodes to support static members and the new way of - - doing $this->foobar. Also the opcodes operate now on the hash table - - combined with the variable names so that they can be overloaded by the - - soon to be added overloading patch. - -2002-02-03 Adam Dickmeiss - - * Makefile.am - configure.in: - Zend config sets ZEND_EXTRA_LIBS. Bugs 14452, 14602, 14616, 14824 - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Revert per Andi's request. Sorry :-( - - * zend_builtin_functions.c: Fix warning. Again :-) - -2002-02-02 Andi Gutmans - - * zend_builtin_functions.c: - - Please don't use strcmp() and friends in Zend but only the mem* - - functions. I didn't check this patch so please check that it works. - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Fix a warning. - -2002-02-02 Andi Gutmans - - * zend_modules.h: - Nice catch by Derick. GINIT is dead. - -2002-02-01 Sebastian Bergmann - - * zend_builtin_functions.c: MFZE1: is_a() - -2002-01-27 Sebastian Bergmann - - * zend_config.w32.h: - MFZE1: define a couple of macros under win32. (Patch By: Jon Parise ) - -2002-01-25 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_objects.c - zend_objects.h - zend_opcode.c: - - First destructor hell fix. There was a situation where an object's - - destructor could be run after its class was already dead. Right now - - object destructors is the first thing whic happens during shutdown in - - order to prevent this problem. It's very likely that destructors will - - cause more grief and we'll have to outline exactly when you should use - - them and what kind of logic you're allowed to do inside of them. - - This bug was reported by sebastian. - -2002-01-22 Andi Gutmans - - * zend_execute.c: - - Fix a bug reported by Sebastian with indirect class names not working. - -2002-01-20 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - Improve performance of functions that use $GLOBALS[] - - Please check this and make sure it doesn't break anything. - -2002-01-19 Thies C. Arntzen - - * zend_language_parser.y: MFZE1 - -2002-01-14 Andi Gutmans - - * zend_execute_API.c: - - Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the - - very nice and short reproducing script. - - -2002-01-14 Sebastian Bergmann - - * ZEND_CHANGES: Update Exceptions example. - -2002-01-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Change exception handling to use the Java-like catch(MyException $exception) - - semantics. Example: - exception = $exception; - } - - function Display() - { - print "MyException: $this->exception\n"; - } - - } - class MyExceptionFoo extends MyException { - function __construct($exception) - { - $this->exception = $exception; - } - function Display() - { - print "MyException: $this->exception\n"; - } - } - - try { - throw new MyExceptionFoo("Hello"); - } catch (MyException $exception) { - $exception->Display(); - } - ?> - - * zend_ini_scanner.l: - MFZE1 - -2002-01-06 Andi Gutmans - - * zend.c: - - Output error when there's an uncaught exception (by Timm Friebe) - - * zend_execute.c: - Make sure $this is passed on to methods - -2002-01-06 Sebastian Bergmann - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c: Happy New Year. - -2002-01-05 Andi Gutmans - - * zend_compile.c: - Small fix - - * zend_compile.c - zend_compile.h - zend_execute.c: - Allow passing of $this as function arguments. - - Fix a bug which I introduced a couple of months ago - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Significantly improve the performance of method calls and $this->member - - lookups. - -2002-01-04 Andi Gutmans - - * zend_execute.c: - - Improve performance of indirect-referenced function calls - - * zend_compile.c: - Nuke C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c: - Separate other kinds of function calls too. - - Significantly improve performance of function calls by moving lowercasing - - the function name to compile-time when possible. - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Start splitting up different kinds of function calls into different - - opcodes. - -2002-01-03 Derick Rethans - - * zend_API.c - zend_API.h - zend_execute.c - zend_list.c: - - MFZE1 for exit fix, exposing current function name in error messages and - exposing zend_zval_type_name(). - -2001-12-31 Sebastian Bergmann - - * ZEND_CHANGES: Consistency. - -2001-12-31 Andi Gutmans - - * ZEND_CHANGES: - - Add example of default argument for argument passed by-ref - -2001-12-30 Sebastian Bergmann - - * ZEND_CHANGES: Typo. - -2001-12-29 Andi Gutmans - - * zend.h: - - #define to help #ifdef stuff in PHP sources to make them work w/ ZE1 and - - 2 - - * ZEND_CHANGES: - A few clarifications - -2001-12-29 Sebastian Bergmann - - * ZEND_CHANGES: Integrate Andi's examples and some notes by Stig. - - * ZEND_CHANGES: Update Exceptions example. - -2001-12-28 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Fix some case insensitivity stuff in respect to classes - - * zend_execute.c - zend_language_parser.y: - - Support default arguments for reference parameters - - Fix two compile warnings - - * zend_compile.c: - - Wasn't adding the lower case version of the class name to the hash - -2001-12-27 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Use two underscores for __construct(), __clone and friends... - - * zend_objects.c: - - Only check refcount of object if the destructor was called. - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c - zend_objects.h: - - Experimental support for destructors. We need to see if destructors - - will actually work well in the context of PHP so we should consider this - - as experimental. Possible problems might be that when the constructor is - - run PHP might not be in a stable state. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Support parent:: again - - * zend_compile.c: - Support unified constructor name _construct() - -2001-12-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c: - Fix scoping issue. The following works now: - id = self::$id++; - } - - function _clone() - { - $this->name = $clone->name; - $this->address = "New York"; - $this->id = self::$id++; - } - } - - - - $obj = new MyClass(); - - $obj->name = "Hello"; - $obj->address = "Tel-Aviv"; - - print $obj->id; - print "\n"; - - $obj = $obj->_clone(); - - print $obj->id; - print "\n"; - print $obj->name; - print "\n"; - print $obj->address; - print "\n"; - - * zend.c: - Print out object id for easier debugging - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c: - Pretty much finish _clone() support - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Initial support for _clone() - - * zend_compile.c - zend_language_parser.y: - - Start fixing the parsing rules so that function and method calls - - can't be used in a write context. - - * zend.c: - Fix crash correctly. - -2001-12-25 Andi Gutmans - - * zend_language_parser.y: - Revert delete syntax patch - - * zend.c - zend_execute.c: - Fix a crash (not a thorough fix). - - Commented old code - -2001-12-24 Andi Gutmans - - * zend_execute.c: - - Fixed bug where global functions weren't called if they didn't exist - - in the class scope - -2001-12-23 Andi Gutmans - - * zend.c: - - Fix a bug where function's didn't work anymore in multi-threaded - - servers after the latest startup changes. - -2001-12-22 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_language_parser.y: - - Add initial capability of defining nested classes as class foo::bar - -2001-12-18 Zeev Suraski - - * zend_language_scanner.h - zend_language_scanner.l: MFZE1 - -2001-12-16 Sebastian Bergmann - - * ZEND_CHANGES: I'm too trigger-happy. - - * ZEND_CHANGES: delete is now function - -2001-12-16 Andi Gutmans - - * zend_language_parser.y: - - Seems like most people prefer delete($obj) over delete $obj. - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Start adding parsed variable checks. - - * zend_compile.h - zend_language_parser.y: - - Framework for knowing what kind of variable we just parsed. - - This will be used in compile-time error checking which couldn't be done - - at the level of the grammar. - -2001-12-13 Andi Gutmans - - * zend_language_parser.y: - - Rearrange grammar to allow dereferencing of objects returned from - - functions. It still crashes though. - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Fix crash bug in startup code. - - Start work on being able to reference global and local scope - -2001-12-12 Andi Gutmans - - * Zend.dsp - zend.c - zend_constants.c - zend_globals.h: - - Infrastructure changes for allowing to access the global scope from - - within a class scope. - - Fix the Zend.dsp project a bit. It seems someone pretty much killed it - - when commiting their own personal configuration. Please be careful in - - future. - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Make classes have scope and function/constant lookups default to the class - -2001-12-11 Andi Gutmans - - * zend.c: - Merge from ZE1 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: - - Rename zend_class_entry.constants -> zend_class_entry.constants_table - - * zend_execute.c: - - Start making scope change correctly when calling namespace functions. - - When inside a namespace fallback to global namespace when function - - or constant is not found. - -2001-12-11 Sebastian Bergmann - - * LICENSE: Forgot to update the LICENSE. - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h: Update headers. - - * Zend.m4 - zend.h: MFZE1 (AIX fixes) - - * zend_highlight.h - zend_highlight.c: MFZE1 (added zend_strip mode in the highliter) - -2001-12-10 Andi Gutmans - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - More namespaces work. - - Nuke memory leak. - -2001-12-08 Andi Gutmans - - * zend.c: - Fix crash with unhandled exceptions - -2001-12-06 Andi Gutmans - - * zend_execute.c: - Support constants. The following works now: - - - * zend_language_parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Initial work on changing namespace scope. Only methods & variables - - right now. - - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y: - - Nuke the namespace work I did. It'll be redone differently. - -2001-12-05 Sebastian Bergmann - - * ZEND_CHANGES: Document recent changes. - -2001-12-04 Andi Gutmans - - * zend_builtin_functions.c: - Damn Zeev :) - -2001-12-01 Andi Gutmans - - * zend_API.c: - - Revert one of the changes because it might be before the memory - - manager has started. - - * zend_API.c - zend_constants.c: - Use alloca() when possible. - -2001-11-30 Andi Gutmans - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - - Initial support for class constants. There are still a few semantic - - issues which need to be looked into but basically it seems to work. - - Example: - - - * Zend.m4: - Fix typo - -2001-11-27 Andi Gutmans - - * zend_language_parser.y: - - Support syntax for class constants (doesn't do anything yet but - - required some reworking of the grammar). - -2001-11-26 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Support static $var = 0; style initialization of static class - - members. For example: - - class foo { - - static $my_static = 5; - - - - } - - - - print foo::$my_static; - -2001-11-25 Andi Gutmans - - * zend.c - zend_compile.c: - Fix crash and leak - - * zend_compile.c: - Whitespace - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Support static members. The following script works: - - -2001-11-24 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - MFZE1 - -2001-11-15 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-11-05 stig - - * zend_objects.h: add newline at end of file to avoid warnings - - * zend_language_parser.y: non-zts compile fix - -2001-11-04 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Support instantiation of nested class. The following script now should - - work: - -bar(); - - - - $obj = new foo::barbara(); - - $obj->bar(); - - - -2001-11-03 Andi Gutmans - - * zend.h: - RISC OS patch by Alex Waugh - - * zend.c - zend_API.h - zend_compile.c: - Add some initializations - - * zend_compile.c - zend_execute.c - zend.h: - - Add constructor to the zend_class_entry instead of looking it up each - - time by name. - - This will allow the next patch of being able to instantiate nested - - classes such as new foo::bar::barbara(); - -2001-10-29 Andi Gutmans - - * zend_API.c - zend_opcode.c: - Fix internal classes - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_globals.h - zend_language_parser.y - zend_opcode.c: - Initial support for nested class definitions - -2001-10-27 Zeev Suraski - - * zend_execute.c: MFTGZE1 - -2001-10-26 Andi Gutmans - - * zend_execute_API.c: - Fix Zeev's MFZE1 - -2001-10-23 Zeev Suraski - - * zend_constants.c - zend_execute_API.c - zend_globals.h: MFZE1 - -2001-10-20 Andrei Zmievski - - * zend_API.c: MFHZ1 - -2001-10-12 Sebastian Bergmann - - * zend_API.c - zend_API.h - zend_modules.h: MFZE1: Introduced extension version numbers (Stig) - -2001-10-04 Sebastian Bergmann - - * zend_hash.c: MFZE1 - -2001-09-30 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when - - the whole CVS tree is work in progress - - * zend_compile.h - zend_execute.c: - - At last I've had some time to move all execute() locals into one struct. - - No immediate gain but it makes it more clear what variables are temps - - and which ones are execute() locals. - -2001-09-27 Andi Gutmans - - * zend_modules.h: - Bump it up in the right place - - * zend_modules.h: - Increase API number - -2001-09-26 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c: - Good catch by Sterling - -2001-09-24 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_globals.h: - More namespaces work - -2001-09-22 Sebastian Bergmann - - * ZEND_CHANGES: Keep ZEND_CHANGES up-to-date. - -2001-09-22 Zeev Suraski - - * zend_globals.h - flex.skl - zend.c - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-20 Andi Gutmans - - * zend.c - zend_compile.c: - Fix build on Win32 - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend.c: - - Create a branch for namespaces. This isn't even remotely close to - - working. - - * zend_list.h: - Nuke unused enum - -2001-09-19 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-19 Andi Gutmans - - * Makefile.am: - MFZE1 - -2001-09-19 Sebastian Bergmann - - * Makefile.am - zend_hash.c - zend_hash.h - zend_ini.c - zend_llist.c - zend_llist.h - zend_qsort.c - zend_qsort.h - Zend.dsp - ZendTS.dsp: MFZE1 - -2001-09-17 Brian L. Moon - - * RFCs/003.txt: adding RFC for loose type requirements for functions - -2001-09-16 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-09-10 Zeev Suraski - - * zend_compile.h - zend_globals.h - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: MFZE1 (nuke cplusplus code) - - * zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (support return value in execute_scripts) - -2001-09-08 stig - - * RFCs/002.txt: remove bogus comment :) - - * RFCs/002.txt: RFC document for namespaces - - * RFCs/001.txt: wrapped to 80 columns :) - -2001-09-07 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - Shift around the variable parsing code to make it simpler. - - * zend_llist.c: - - Fix warning (was fixed in ZE1 and not merged at some point). Please make - sure you merge patches! - -2001-09-05 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2001-09-03 Andi Gutmans - - * zend_language_parser.y: - CLS_CC -> TSRMLS_CC - -2001-08-31 Sterling Hughes - - * zend_llist.h: spaces->tabs - - * zend_llist.c - zend_llist.h - zend_execute_locks.h: MFZE1 - -2001-08-31 Zeev Suraski - - * zend.c - zend_compile.h: MFZE1 - -2001-08-30 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Make it compile in thread-safe mode. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Get rid of warning and C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Initial support for exceptions. - -2001-08-30 Zeev Suraski - - * zend_execute.c: MFZE1 - -2001-08-28 Zeev Suraski - - * zend_language_scanner.l: MFZE1 - -2001-08-27 Andi Gutmans - - * RFCs/001.txt: - Add sample RFC - -2001-08-26 Stanislav Malyshev - - * Zend.m4 - zend.h: Add dlsym underscore detection, by Jani Taskinen - -2001-08-26 Andi Gutmans - - * zend_operators.c: - MFZE1 - - * zend_API.c: - - Merge Andrei's fix from Engine 1. Please commit patches to both trees! - -2001-08-21 Zeev Suraski - - * zend.c - zend_execute_API.c: MFZE1 - -2001-08-20 Zeev Suraski - - * zend_hash.c - zend_hash.h: MFZE1 - -2001-08-19 Andi Gutmans - - * zend.h: - Fix compile problem - -2001-08-19 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-08-18 Andi Gutmans - - * zend_execute.c - zend_llist.c - zend_llist.h: - Merge Sterling's patches from ZE1 - -2001-08-17 Andrei Zmievski - - * zend_execute.c: MFZE1 - -2001-08-17 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2001-08-16 Zeev Suraski - - * flex.skl - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-08-16 Andi Gutmans - - * zend_execute.c: - Try and nuke get_object_zval_ptr() - - * zend_objects.c: - Remove bogus notice - - * zend_variables.c: - Sync with ZE1 - - * zend.h - zend_execute.c - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: - Fix a bug in method calls. - - Try to get the old copying behavior of objects to work (doesn't work yet). - -2001-08-15 Zeev Suraski - - * zend_extensions.c: MFZE1 - -2001-08-14 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend_variables.c - zend_variables.h: MFZE1 - -2001-08-13 Andi Gutmans - - * zend_execute.c: - MFZE1 - - * zend_execute.c: - Merge from Engine 1 - -2001-08-13 Zeev Suraski - - * zend_API.c - zend_operators.c - zend_operators.h: MFZE1 - -2001-08-12 Stanislav Malyshev - - * zend_API.h: _FUNCTION is used in definition, so use _D - -2001-08-11 Andi Gutmans - - * zend_API.c - zend_API.h - zend_objects.c - zend_operators.c: - More work on making objects work - - * zend_API.c - zend_objects.c - zend_objects.h - zend_operators.c: - - Fix some places which create objects. The fixes are ugly and will be - revised when things start working well - -2001-08-11 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_ini.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_operators.c: Whitespace - -2001-08-11 Andi Gutmans - - * Makefile.am - zend_objects.c: - Fix UNIX build. - - * zend_compile.c: - - Need to do some rewriting in the parser instead of this. - - * zend.h: - - For Sebastian. Will allow to see you're using the Engine 2 CVS via - phpinfo() - -2001-08-10 Andi Gutmans - - * zend_API.h: - Merge from Engine 1 - - * zend_compile.c: - A couple of fixes - - * zend_API.h: - Merge from Engine 1 CVS - -2001-08-09 Andi Gutmans - - * zend.c: - Merge from Engine 1 tree - -2001-08-08 Andi Gutmans - - * zend.c - zend_compile.c - zend_compile.h - zend_globals.h: - Merge new $_GET, $_POST etc. patch from Engine 1 tree - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Preliminary patch for method() dereferencing - - * zend.c - zend.h: - Merge zend_try fix from Engine 1 - -2001-08-07 Zeev Suraski - - * ZendTS.dsp: Migrate .dsp patches - -2001-08-07 Andi Gutmans - - * ZendTS.dsp: - Forgot to commit the updated dsp - - * ZendTS.dsp: - More sync with latest CVS - - * zend_objects.c - zend_objects.h - zend_operators.h - zend_variables.c - ZendTS.dsp - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Sync Engine2 CVS with latest Engine CVS - -2001-08-06 Zeev Suraski - - * zend_indent.c: Commit uncommitted build fix - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - Fix an off by one lineno issue, in case of an implicit ; - - * flex.skl - zend_highlight.c: Better shared code - - * Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Merge from branch - move to standard C scanners in thread safe mode - - * Makefile.am - Zend.m4 - flex.skl - zend_ini_scanner.l - zend_language_scanner.l: Make the C++less scanner compile under UNIX - -2001-08-06 Andi Gutmans - - * zend_execute.c: - Move to using Z_ macros - - * zend_API.h: - Use Z_ macros - -2001-08-05 Zeev Suraski - - * zend_globals_macros.h: More nulled-out macros - - * zend.c - zend_API.c - zend_API.h: TSRMLS_FETCH work - -2001-08-04 stig - - * .cvsignore: added some more stuff to .cvsignore - -2001-08-03 Zeev Suraski - - * zend_alloc.c: Fix buglet - - * zend_alloc.c: Fix macro - - * zend.c - zend_alloc.c - zend_globals.h: - Implement fast memory allocation and reduced fragmentation under Windows. - - * zend_globals_macros.h: Some compat macros - -2001-08-02 Zeev Suraski - - * zend_execute.c: - require_once()/include_once will return true in case a file was not included - because it was already included earlier. - Changed the default return value type of the include() family from long to - boolean - - * zend_constants.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Avoid going over huge lists of functions, classes and constants. - Special thanks to the guys from the MS lab for the profiling tools :) - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: Some cleanup - - * zend_builtin_functions.c - zend_hash.c - zend_hash.h: TSRMLS fixes - - * zend_ini_parser.y: non ZTS build fix - - * Zend.dsp - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Implement a standard C thread safe scanner within flex - -2001-08-01 Zeev Suraski - - * flex.skl - zend_language_scanner.l: - Implement fast scanning in the multithreaded environment - -2001-07-31 Zeev Suraski - - * zend_language_scanner.l: the make Sebastian happy part of the day :) - - * zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: More TSRMLS_FETCH work - - * zend_list.c - zend_list.h: More TSRMLS_FETCH annihilation - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_hash.c - zend_hash.h - zend_ini.c - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c: More TSRMLS_FETCH work - -2001-07-30 Zeev Suraski - - * zend_language_scanner.l: Compile fix - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.c - zend_highlight.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_language_scanner.l - zend_modules.h: More TSRMLS_FETCH work - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_modules.h: - More TSRMLS_FETCH work, and get rid of redundant ParametersPassedByRef - -2001-07-30 Andrei Zmievski - - * zend_API.c - zend_API.h: - Let's be consisten and keep TSRMLS_DC declaration after num_args. - -2001-07-30 Zeev Suraski - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_operators.c - zend_operators.h - zend_variables.c: More TSRMLS_FETCH annihilation - - * zend_API.c - zend_API.h: Get rid of more TSRMLS_FETCH's - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: Avoid TSRMLS_FETCH()'s (still lots of work left) - -2001-07-29 Andi Gutmans - - * zend_execute.h: - More object junk - - * zend.c: - Object macros... - -2001-07-28 Andi Gutmans - - * zend_operators.c: - Fix build - - * zend_operators.c: - More object macros. - - * zend_builtin_functions.c: - Use the Z_OBJ* macros for accessing objects - - * zend.h - zend_operators.h: - - Small patch to allow fixing the PHP tree to be compatible w/ the initial - - Zend 2 objects patch. Hopefully I can commit that this week. - -2001-07-28 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend.c - zend.h - zend_API.c - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_fast_cache.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_opcode.c: Redesigned thread safety mechanism - nua nua - -2001-07-28 sascha - - * zend.h: Fix build - -2001-07-27 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_globals_macros.h - zend_ini.c - zend_ini.h - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_modules.h - zend_operators.c - zend_variables.c - zend.c: Get rid of ELS_*(), and use TSRMLS_*() instead. - This patch is *bound* to break some files, as I must have had typos somewhere. - If you use any uncommon extension, please try to build it... - -2001-07-23 sascha - - * zend_alloc.c: tsrm_error is only available, if TSRM_DEBUG is defined. - -2001-07-21 Zeev Suraski - - * zend.c - zend.h: Always track bailout file/lineno - - * zend.c: Fix Release builds - - * zend.c - zend.h - zend_execute_API.c - zend_globals.h - zend_list.c: - Improve bailout mechanism, supports nesting of bailouts a-la try..catch - - * zend_hash.c: Fix compile warning - -2001-07-21 Andrei Zmievski - - * zend_compile.c: - Fix certain cases where inheritance of base class's overloaded handlers wasn't - being done. - -2001-07-20 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_list.c: - Implement a more granular shutdown mechanism for the executor - - prevent corruption of constants and missing destructions of resources - -2001-07-19 Zeev Suraski - - * zend_compile.c: Unfix, it has too strong effects - - * zend_compile.c: Catch all cases - - * zend_compile.c: Fix bug #11970, strike 2 - - * zend_execute.c: Revert bogus patch - -2001-07-18 Stanislav Malyshev - - * zend_operators.c: fix double->long conversion - -2001-07-17 Andi Gutmans - - * zend_hash.c: - Remove unused code - -2001-07-16 Zeev Suraski - - * zend_API.h - zend_compile.c - zend_globals.h - zend_variables.c: - Fix bug #10287 - avoid crashing under a bogus usage of list() - - * zend.h - zend_compile.c - zend_execute_API.c: Fix bug #10467 - -2001-07-15 Zeev Suraski - - * zend_hash.h: Minor cleaning - - * zend_language_parser.y: Optimize the parser a bit - - * zend_language_scanner.h - zend_language_scanner.l: Fix an inline - - * zend_variables.c - zend_variables.h: - Time to bid this old timer goodbye - get rid of var_uninit() - - * zend_hash.c: Fix bug #6239 - - * zend_language_parser.y: - Allow indirect reference to method names in class::method() construct - - * zend_execute_API.c: Fix bug #10257 - - * zend_execute.c: Fix bug #11970 - - * zend_compile.c: Fix bug #9884 - - * zend.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_scanner.l - zend_opcode.c: - Improved interactive mode - it is now available in all builds, without any significant slowdown - - * zend.c: Early initialization - -2001-07-13 Zeev Suraski - - * zend_hash.c: layout - -2001-07-13 Thies C. Arntzen - - * zend_hash.c - zend_hash.h - zend_list.c: - the resource-lists are now destroyed backwards. this will make sure that - resources get destroyed in the opposite order they were created and thereby - db-cursors will always be released before their corresponding connection etc. - this sould not break anything! - -2001-07-11 Zeev Suraski - - * zend_API.c - zend_ptr_stack.c - zend_ptr_stack.h: Remove the last couple of bogus inlines - -2001-07-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Move inline_zend_hash_func() to header file - -2001-07-11 Thies C. Arntzen - - * zend_API.h: fixed ZVAL_FALSE and ZVAL_TRUE - -2001-07-11 Stanislav Malyshev - - * zend_hash.h: No hashpjw anymore, but we have zend_hash_func - -2001-07-11 Zeev Suraski - - * zend_operators.c - zend_variables.h: Get rid of ZVAL_RESET... - - * zend_API.c - zend_operators.c - zend_variables.c - zend_variables.h: Get rid of some inlines - -2001-07-10 Andi Gutmans - - * zend_extensions.h - zend_hash.c - zend_hash.h: - Merge faster hash implementation. - - The hash function parameter in hash_init(...) is not used anymore. - - It should be removed but it is "to be decided" if we want to do that now - - or in a major version as it means changing MANY places and third party - - modules might stop working. - -2001-07-10 Thies C. Arntzen - - * zend_API.h - zend_variables.c: cleaned up the RETVAL_ RETURN_ and ZVAL_ macros - - added check for \0 at end-of-string at some places. all strings in PHP - have to be terminated with \0 because 3th party libraries might not be - binary-safe. - -2001-07-10 Andi Gutmans - - * zend_compile.c: - Commit Thies' patch. str.len was too long. - -2001-07-09 Andrei Zmievski - - * zend_API.c - zend_API.h: Adding new parameter parsing API. - -2001-07-09 Andi Gutmans - - * zend_hash.c - zend_hash.h: - - Significantly improve hash table performance by using djb's hash function - instead of hashpjw() and by using power of two sizes of hash tables (this - saves the % and isn't necessary with a good hash function). - Please try this patch. - -2001-07-03 Rasmus Lerdorf - - * zend_API.c: Trivial fix - but the period looks odd in error messages - -2001-06-30 Andi Gutmans - - * zend_alloc.c: - Fix the memory limit fix. - -2001-06-29 Andi Gutmans - - * zend_operators.c: - Remove bogus comment. - -2001-06-29 Zeev Suraski - - * zend_alloc.c: Fix memory_limit, kill warning - -2001-06-28 Zeev Suraski - - * zend_execute_locks.h: Fix warnings - -2001-06-27 Zeev Suraski - - * zend_execute.c: - Fix leak in the patch, and revert a couple of lines I didn't mean to commit - - * zend_execute.c: - Warn about illegal offsets - - Allow assignments to uninitialized string offsets (automatically pads the - string with spaces) - -2001-06-26 Zeev Suraski - - * zend_operators.c: - Fixed autoconversion of negative values to double (Fix bug #11685) - -2001-06-26 Andi Gutmans - - * zend_builtin_functions.c: - Fix crash bug (fix by Jani). - -2001-06-24 Andi Gutmans - - * zend.h: - Bump Zend version - -2001-06-21 Andi Gutmans - - * zend_execute.c - zend_execute_locks.h - zend_globals.h: - - Hopefully fix bug #11476 and improve garbage to be freed very quickly. - Tree tagged as PRE_GRANULAR_GARBAGE_FIX before commiting. - - * zend_execute_locks.h: - - Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it - can be debugged. - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - Nuke dependency of all of PHP on zend_execute_locks.h. - -2001-06-21 Zeev Suraski - - * zend_execute.c: - Eliminate the leak that the original bogus code tried to solve - - * zend_compile.c - zend_execute.c - zend_globals.h: - parent::methodname() now works better with runtime classes (fix bug #11589) - - * zend_execute.c: - Fix bug #11590 (I want Andi to also review this patch before it goes into 4.0.6) - -2001-06-20 Andi Gutmans - - * zend_execute.c: - MFH - - * zend_execute.c: - Fix string offsets crash. - -2001-06-19 Andi Gutmans - - * zend_alloc.c: - Real MFH of memory fragmentation patch - - * zend_alloc.c: - Bad merge. Revert the previous patch (damn CVS). - - * zend_alloc.c: - MFH - - * zend_alloc.c: - - Fix memory fragmention problem which could lead to web server processes - growing much more than they should. (bug #11344?) - - * zend_execute.c - zend_execute.h: - MFH - -2001-06-19 Zeev Suraski - - * zend_execute.c - zend_execute.h: Add missing exports - - * zend_execute.c: Fix warning - -2001-06-13 Zeev Suraski - - * zend.c: MFH - - * zend.c: - Avoid crashing if the error reporting function is called after a bailout during shutdown - -2001-06-12 Zeev Suraski - - * zend_highlight.c: - Improve XHTML compliance (suggested by Anil Madhavapeddy) - -2001-06-10 Zeev Suraski - - * zend.c: Fix ZTS build problem - -2001-06-07 Andi Gutmans - - * zend_compile.h: - Avoid breaking op_array compatibility for 4.0.6 - -2001-05-30 Zeev Suraski - - * Zend.m4 - zend_execute_API.c: Add missing check - -2001-05-25 Andi Gutmans - - * zend_compile.c: - - Change if() to while() to make sure we skip enough opcodes - - * zend_compile.c: - MFH - - * zend_compile.c: - Fix memory leak - -2001-05-23 Andrei Zmievski - - * zend_builtin_functions.c: - Fix segfault -- need to copy-construct constant value. - -2001-05-21 Andrei Zmievski - - * zend_builtin_functions.c: Moving some functions into Zend. - -2001-05-20 sascha - - * .cvsignore: ignore ylwrap - -2001-05-20 Andi Gutmans - - * zend_list.h: - The previous name could be confused with resource # - - * zend_list.c - zend_list.h: - - Whitespace and change the name of the macro to something more verbose - ZEND_GET_RESOURCE_ID(...) - -2001-05-20 James Moore - - * zend_list.c - zend_list.h: - Add new ZEND_GET_LE macro for retrieving destructor - id's from remote extensions. (Jmoore, Zend Engine) - -2001-05-20 Andi Gutmans - - * zend_list.c: - Don't allow resource types of 0 - -2001-05-19 sascha - - * zend_hash.c: Fix segfault when using zend_hash_add_empty_element - -2001-05-18 Thies C. Arntzen - - * zend_alloc.c: reset allocated_memory_peak after each request. - -2001-05-17 Zeev Suraski - - * zend_language_scanner.l: That's slightly clearer that way :) - - * zend_alloc.c: Fix build - - * zend.c: MFH - - * zend.c: Fix corruption issue - -2001-05-16 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Implement zend_hash_add_empty_element() using the existing infrastructure - - * zend_globals.h: Commit missing fix - - * Zend.m4 - zend_alloc.c - zend_globals.h: Merge memory usage into memory limit - -2001-05-14 sascha - - * zend_hash.c: - Initialize empty pDataPtr to a pseudo value to prevent a pefree on - pData. - -2001-05-12 Andi Gutmans - - * zend_variables.c: - Remove check for ht == NULL in copy_ctor. - If ht is NULL at this point then we are better off crashing and fixing - the bug that caused it. - -2001-05-11 sascha - - * zend.h: add missing closing paranthesis - - * zend_hash.c: Some extensions don't associate any data with hash entries, - except the key. Prior to this change, a separate chunk of memory - was allocated in that case to store exactly zero bytes (plus - memory manager overhead). We treat that case similar to the - pointer case, but don't copy any data at all (because the pointer - is usually the NULL pointer). - - * zend_constants.c: - Fix a memory leak which occured upon registering an already existing - constant. - -2001-05-11 Thies C. Arntzen - - * Zend.m4 - zend_alloc.c - zend_globals.h: added --enable-memory-usage-info - -2001-05-11 Andi Gutmans - - * zend_opcode.c: - MFH - - * zend_opcode.c: - - Fix crash bug when opcodes array is erealloc()'ed to a different memory - area before it reaches the loop. - - Some whitespace stuff - -2001-05-10 Zeev Suraski - - * zend_operators.c: - Treat numeric strings as numbers in the increment operator - -2001-05-09 Andrei Zmievski - - * zend_API.c: Nuke unused variable. - - * zend_API.c: Fix a few bugs in zend_is_callable() and make it stricter. - -2001-05-08 Andi Gutmans - - * zend_language_scanner.l: - Fix line numbers when some lines end with \r - - * zend_opcode.c: - Fix crash bug reported by DBG author Dmitri Dmitrienko. - -2001-05-07 Zeev Suraski - - * zend.c: Make zend_execute_scripts() reentrant - -2001-05-06 Zeev Suraski - - * zend.c - zend_compile.c - zend_compile.h: - Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663 - -2001-05-06 Andi Gutmans - - * .cvsignore: - .cc files were renamed. Update .cvsignore. - -2001-05-06 Zeev Suraski - - * zend_operators.h: Yikes, that would have been a very bad bug :) - - * zend_execute.c: - Floating point keys didn't work in array() (fix bug #6662) - - * zend_compile.c - zend_execute_API.c: - Hear hear, interactive mode is finally showing some progress: - - Support function calls - - Fix crash bug - - * zend_compile.h - zend_language_parser.y - zend_language_scanner.l: Support interactive mode in thread-safe builds - - * zend_operators.h: Fix autoconversion of hexadecimal strings - It's time to close bug #5404 :) - - * zend_highlight.c: Retain single spaces as spaces to condense HTML - -2001-05-02 Andi Gutmans - - * zend_ini_scanner.l: - Support \r as newline in the ini scanner - - * zend_language_scanner.l: - Handle MAC OS X \r line endings - - * zend_execute.c: - - Patch by Andrei to prevent crash in error situation when not all - object overloading handles are defined. - -2001-05-01 Andi Gutmans - - * zend.h: - Bump up Zend version - -2001-04-30 Andi Gutmans - - * zend_builtin_functions.c: - Add mistakenly removen closing bracket - - * zend_builtin_functions.c: - Get rid of warning - - * zend_alloc.c: - - Try to solve crash on OS400. There is actually no reason I can see for - why his fix should solve a crash but it doesn't harm. - - * zend_execute_API.c: - Fix crash bug in interactive mode - -2001-04-29 Andi Gutmans - - * zend_alloc.h: - Whitespace - - * zend_alloc.c - zend_alloc.h: - Improve overwrite detection in debug mode. - - * zend_operators.c: - - Previous patch for too early freeing of resources seemed to have worked. - - Clean it up a bit. - - * zend_operators.c: - - Try and solve the too early resource destruction problem. - -2001-04-28 Zeev Suraski - - * zend.h - zend_hash.c - zend_language_scanner.l - zend_operators.c: include limits.h if available - - * zend.h: Fix bug 5661 - -2001-04-28 Andi Gutmans - - * zend_operators.c: - Move all cases into switch(). - - * zend_alloc.c: - Just some little whitespace stuff. - - * zend_alloc.c: - - Don't add/remove cached memory blocks from blocks list as this will slow - - down performance a bit. - -2001-04-28 Zeev Suraski - - * zend_operators.c: - Resources weren't being properly destroyed by the convert_to_*() functions - -2001-04-27 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_hash.c - zend_language_scanner.l - zend_operators.c - zend_operators.h: - More whitespace fixes while I'm at it. - - * zend.h - zend_alloc.c - zend_builtin_functions.c - zend_execute_API.c - zend_extensions.c - zend_language_scanner.l: - - Whitespace changes to be standard like the rest of Zend - -2001-04-24 Andi Gutmans - - * zend_execute.c: - Due to popular demand merge the foreach() crash fix. - -2001-04-24 Andrei Zmievski - - * zend_builtin_functions.c: MFH. - -2001-04-21 Andi Gutmans - - * zend_llist.c - zend_llist.h: - Add typedef for function pointer of llist dtor - -2001-04-20 Andi Gutmans - - * zend_execute.c: - - Fix for crash bug when using invalid arguments in the foreach() loop. - - Reported by Yasuo Ohgaki - -2001-04-19 Andi Gutmans - - * zend_API.h: - Patch from Jason Greene. - - Make it easier to write PHP function definitions in more than just one .c - file while accessing the same module globals. - -2001-04-17 Zeev Suraski - - * zend_alloc.c: small beautification - -2001-03-28 Zeev Suraski - - * zend_list.c: Fix warning - - * zend_list.c: Make Windows happy - - * zend_list.c: Get rid of more redundant code - - * zend_list.c: - Cleaner way of making sure resources start at 1 and not 0... - - * zend_list.c - zend_list.h: Remove redundant code - -2001-03-27 Zeev Suraski - - * zend_list.c - zend_list.h: God knows what this code was doing... - -2001-03-26 Andrei Zmievski - - * zend_builtin_functions.c: - Updated get_class_methods() to take class instance as well as class name. - - * zend_builtin_functions.c: - Making it possible to pass a class name to get_parent_class() as well - as a class instance. - -2001-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Fixing function name length. - -2001-03-19 Andi Gutmans - - * zend_language_parser.y: - - Add support for isset($var1, $var2, $var3); - Will be true only if all - - variables are set. - -2001-03-15 Andi Gutmans - - * zend_language_parser.y: - Nuke commented code - -2001-03-12 Andrei Zmievski - - * zend_API.c: Name length is already known. - -2001-03-12 Andi Gutmans - - * zend_API.c: - Missed second place. - - * zend_API.c: - Nuke snprintf() - - * zend_language_scanner.l: - White space - - * zend_language_scanner.l: - - Fix by Jani Taskinen for whole path also to work - with include_once()/require_once(). - -2001-03-12 Andrei Zmievski - - * zend_API.c - zend_API.h: - Improve zend_is_callable() to the point where it's actually useful. - Now it just needs to be invoked everywhere in PHP where a callback is - expected. - -2001-03-11 Andi Gutmans - - * Zend.m4 - acconfig.h: - Fix for Solaris. - -2001-03-10 Andi Gutmans - - * zend_execute.c: - Whitespace - -2001-03-07 Zeev Suraski - - * zend_ini.h: Add missing #define's - - * zend_compile.c - zend_execute.c: Make parent:: work in runtime bindings as well - -2001-03-06 sascha - - * Zend.m4: We actually only need AC_PROG_LEX here. - -2001-03-04 Zeev Suraski - - * zend_execute.c: Fix bug #8899 (thanks Jani) - -2001-03-03 sascha - - * Zend.m4: -Os is a valid GCC optimization level. - -2001-03-02 Zeev Suraski - - * zend_compile.c: Whitespace fix - -2001-02-28 Andrei Zmievski - - * zend_execute_API.c: Do case-insensitive class name matching when parsing - array('Class', 'method') structure. - You guys can clean it up, if there is a better way. - -2001-02-27 Andi Gutmans - - * zend_variables.c - zend_variables.h: - Nuke zval_del_ref() - -2001-02-27 Andrei Zmievski - - * zend_compile.c: Don't overwrite existing handlers with parent ones. - -2001-02-26 Andi Gutmans - - * Zend.dsp - ZendCore.dep - ZendTS.dsp - zend.c - zend_API.c - zend_API.h: - Rename modules.h to zend_modules.h - - * LICENSE: - One more copyright year update - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_modules.h: - Update copyright year - -2001-02-25 Andi Gutmans - - * zend_modules.h: - Fix dll linkage warnings - -2001-02-24 Andi Gutmans - - * zend_builtin_functions.c - zend_modules.h: - Add exports from Daniel Beulshausen - -2001-02-14 Stanislav Malyshev - - * zend.h: allow more extensions with resources - -2001-02-13 Zeev Suraski - - * zend_extensions.c: Move version registration to a more correct place - -2001-02-12 Andi Gutmans - - * zend_operators.c - zend_operators.h: - Remove two unused functions - - * zend_execute_API.c: - Fix whitespace. - -2001-02-12 Zeev Suraski - - * zend_execute_API.c: - Fix a bug that could cause corruption in case of an error during - get_zval_ptr() - -2001-02-09 Andi Gutmans - - * zend_execute.c: - - Remove duplicate code and do a tiny optimization in DO_FCALL - -2001-02-05 Zeev Suraski - - * zend_execute.c: Fix string offset data corruption - -2001-02-04 Andrei Zmievski - - * zend_execute_API.c: - Allow passing class name as well as an object instance to call methods. - -2001-02-03 Andrei Zmievski - - * zend_execute_API.c: - Set the correct function state during execution. This is mainly to have - get_active_function_name() to return proper value. - - * zend_compile.c: Inherit overloaded handlers. - -2001-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: - Added zend_is_callable() function that checks whether passed zval - represents a valid and exiting callable construct. - -2001-01-31 Andi Gutmans - - * zend_API.h - zend_API.c: - Change unset() functions to null(). unset() is legacy - - * zend_API.h: - - Quick fix. I'm for changing these to add_property_null() as we've nuked - - unset. - -2001-01-27 Andi Gutmans - - * zend_execute.c: - That doesn't seem like a smart thing to do :) - - I wonder if gcc optimized it out. - -2001-01-23 Thies C. Arntzen - - * zend_extensions.h - zend_ini_scanner.h - zend_list.c - zend_list.h: fix a couple of warnings - - * zend_API.c: fixed crash in add_index_bool. - -2001-01-22 Andrei Zmievski - - * zend_API.h: Make add_index_zval() available to the outside world. - -2001-01-21 Andi Gutmans - - * zend.h: - - Make people happy who like the Zend version number bumped up in parallel - with PHP. - -2001-01-20 Andi Gutmans - - * zend_API.c - zend_API.h: - - Patch from Sterling. Add API calls to add zval's as array indeces/ - object properties. Add _ex functions which take the string length as an - argument for better performance. - -2001-01-19 Andi Gutmans - - * zend_API.h - zend_API.c: - - For Sterling. I wonder if not all of the API functions should take the - - key_length as a parameter in order to save that strlen(). - -2001-01-17 Andi Gutmans - - * zend_execute.c: - - Fix leak in fetch_dim_address() which was already fixed in - - fetch_dim_object(). Take the oppertunity to make both use the same - - function and not duplicate the code. - -2001-01-16 Zeev Suraski - - * zend_list.c: Fix persistent resources, once and for all... - -2001-01-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: Add free_estring() - -2001-01-12 Zeev Suraski - - * zend_istdiostream.h: Add newline - -2001-01-12 Rasmus Lerdorf - - * zend_highlight.c: Fix for bug number 8666 - -2001-01-07 Zeev Suraski - - * zend_ini.c: Fix mismatch in return values - - * zend.c - zend.h - zend_alloc.c - zend_ini.c - zend_ini.h: - Remove backward dependency from PHP -> Zend - - Rename get_ini_entry() as get_configuration_directive() for clarity - (it doesn't use the INI subsystem, but the module-supplied function for - retrieving configuration directives) - - * Zend.dsp - ZendTS.dsp: Remove -S option on all bison calls - - * zend.c: - Fix possibility of a crash during startup (very unlikely, but possible) - -2001-01-06 Zeev Suraski - - * ZendTS.dsp: Remove -S - -2001-01-06 Andi Gutmans - - * zend_ini.c: - This slipped in by mistake. - -2001-01-05 Zeev Suraski - - * zend_ini.c - zend_ini.h: - Merge in some ZEND_API additions from Daniel Beulshausen (needed for the - Win32 Apache module) - -2001-01-04 Andi Gutmans - - * zend_list.c: - - Make plist_destructor work like list_destructor to allow it to call - extended destructors. - -2001-01-03 Zeev Suraski - - * zend.h: Fix Zend version while we're at it - - * zend_execute_API.c: Merge call_user_function_ex() fixes - - * zend_language_scanner.l: Merge line number corruption bug fix - - * zend_language_scanner.l: - Fix another case of possible line number corruption - - * zend.h: Commit missing declaration - -2001-01-01 Andi Gutmans - - * zend_execute.c: - Remove unreachable code - -2000-12-30 Zeev Suraski - - * zend_language_scanner.l - zend_opcode.c: Fix possible corruption in line number information - -2000-12-27 Zeev Suraski - - * zend.c - zend_globals.h - zend_ini.c - zend_ini.h - ZendTS.dsp: - Make the INI mechanism thread safe (or at least thread safer :) - -2000-12-26 Zeev Suraski - - * zend_compile.h: - Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h, - and iostream.h should include it) - - * ZendTS.dsp - zend_ini_scanner.l - zend_istdiostream.h - zend_language_scanner.l: - - Use supplied istdiostream definition for the INI scanner too - - Add Release_TSDbg configuration - -2000-12-24 Zeev Suraski - - * zend_extensions.h: This needs updating as well - - * zend_execute_API.c: - More aggressive protection in call_user_function_ex() - -2000-12-23 Zeev Suraski - - * zend_execute_API.c: - Fix a possible crash bug in call_user_function_ex(), if the function is - in fact not a user function - -2000-12-22 sascha - - * zend.c - zend_modules.h: - Set the floating-point exception mask on FreeBSD to 0 (as do other - FreeBSD system applications). Also bump up the module API number - as the zend_hash_get_current_key change affects source and binary - compatibility. - -2000-12-22 Zeev Suraski - - * zend.c - zend_builtin_functions.c - zend_execute.c - zend_hash.c - zend_hash.h: - Allow get_current_key() not to return the key itself, instead of a duplicate - - * zend_hash.c: * Fixed a possible crash in get_class_methods() - -2000-12-19 Stanislav Malyshev - - * zend_language_scanner.l: Add support for ASP tags in one-line comment - -2000-12-18 Andi Gutmans - - * flex.skl: - Success! Yay! - - * flex.skl: - Yet another one. - - * flex.skl: - Testing - - * flex.skl: - No luck - - * flex.skl: - Make this damn commit stuff work. - - * flex.skl: - Testing - -2000-12-18 Stanislav Malyshev - - * zend.c: - Use HashPosition iterator instead of saving/restoring internal pointer - - * zend.c: Preserve internal pointer over print_r (fix #8289) - -2000-12-18 Andi Gutmans - - * zend_compile.c: - Fix leak with useless statements such as "foo"; - - * flex.skl: - - Testing Sascha's CVS commit script which should work with branches. - - * flex.skl: - Testing - - * flex.skl: - Testin - -2000-12-18 Zeev Suraski - - * flex.skl: Test, ignore - -2000-12-18 Stanislav Malyshev - - * zend_operators.c: Add notice when auto-converting array to string - -2000-12-17 Andi Gutmans - - * zend_language_scanner.l: - - Clean up the scanner a tiny bit while messing with it. - - * zend_language_scanner.l: - - %> without asp_tags should not be treated as inline_html but as regular - tokens. Of course the parser will die with a parse error which is the - correct behavior. - - * zend_language_scanner.l: - - Fix problem in one line comments with line endings such as ??> - -2000-12-17 Stanislav Malyshev - - * zend_operators.c: Fix #8279 (-2147483647 > 2147483647). - -2000-12-14 Zeev Suraski - - * zend_modules.h: Update module_api_no - -2000-12-13 Zeev Suraski - - * zend_API.h - zend_execute_API.c: - Fix call_user_function() with objects - it could leak under certain circumstances - -2000-12-12 Stanislav Malyshev - - * zend_operators.c: Fix #8195: strncasecmp returns incorrect value - -2000-12-07 sascha - - * zend_builtin_functions.c: - Hardcode strlen due to problems on SCO OpenServer 5.0.4 which defines - strlen to __std_hdr_strlen. - -2000-12-07 Stanislav Malyshev - - * zend_compile.c: Whitespace fix - - * zend_compile.c: Allow var $foo = array(ABC => 1) constructs - - * zend_builtin_functions.c: - Fix memory leak - get_current_key mallocs it's result, no need to - copy it. - -2000-12-06 sascha - - * zend_hash.c: - INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void - pointer would actually be aligned like a void pointer. This lead - to bus errors on architectures which don't allow unaligned 32-bit accesses. - -2000-12-05 Andi Gutmans - - * zend_language_parser.y: - - Support for $var =& new foo() syntax. This allows you to use objects - which create extra references to themselves in the constructor. - -2000-12-05 Zeev Suraski - - * zend_execute.h: Expose all timeout functions - -2000-12-02 sascha - - * acconfig.h - configure.in: - Use the hardly-documented third parameter of AM_INIT_AUTOMAKE to suppress - defining PACKAGE/VERSION. - -2000-11-27 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Allow passing references which are returned from functions and new - - statements to be passed by reference. - -2000-11-27 Andrei Zmievski - - * zend_builtin_functions.c: - Update class constants before trying to get default properties. - -2000-11-22 Andi Gutmans - - * zend_compile.c: - Remove code which has been commented out for ages. - -2000-11-22 sascha - - * zend_execute.c - zend_globals.h: Pass on the exit status - -2000-11-21 Zeev Suraski - - * zend_operators.c - zend_operators.h: Fix build - -2000-11-21 Andi Gutmans - - * zend_execute.c: - The baby patch wasn't that innocent :) - -2000-11-21 Andrei Zmievski - - * zend_builtin_functions.c: - Sterling's patch to make get_defined_vars() simpler and better. - -2000-11-20 Andi Gutmans - - * zend_execute.c: - NEVER copy and paste :) - - * zend_compile.c - zend_execute.c: - Baby patch towards making the damn pass-by-ref work. - -2000-11-20 Zeev Suraski - - * zend_extensions.h: Update API number - -2000-11-20 Stanislav Malyshev - - * zend.h: - Add macro to replace value of zval with another value while preserving - referencing structure - -2000-11-20 Andi Gutmans - - * zend_execute.c: - This patch is broken and needs more thorough fixing. - -2000-11-19 Andi Gutmans - - * zend_execute.c: - - Try and fix the problem when sending references returned from a function by reference. - -2000-11-19 Zeev Suraski - - * zend_alloc.h: Fix Zend build for non ZTS - -2000-11-18 Zeev Suraski - - * zend_alloc.c: Forgot to commit the non-debug build fix yesterday... - - * zend_alloc.c - zend_alloc.h: - Add thread-safety debugging information (idea - Dmitri Dmitrienko) - -2000-11-14 Stanislav Malyshev - - * zend_language_scanner.l: Restore compatibility with old broken way - - * zend_language_scanner.l: - Better 0x handling - not change non-0x number behaviour - - * zend_language_scanner.l: - Attempt at better handling long 0x-numbers, like 0xffffffff - -2000-11-13 Andi Gutmans - - * zend_extensions.c - zend_extensions.h: - Remove unused function - - * zend_extensions.h: - - Use typedef's for function pointers so that we can easily define arrays - - of these function pointers. - -2000-11-13 Stanislav Malyshev - - * zend_llist.c: - Fix zend_llist_apply_with_del - it should remove from list, - not only call dtor - -2000-11-12 Zeev Suraski - - * ZEND_CHANGES: Test, ignore - -2000-11-11 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Move SET_UNUSED() to header - - * zend_opcode.c: - Beautify by using the standard #define. - -2000-11-10 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Remove this damn thing once again. - - * .cvsignore: - Add files to .cvsignore thanks to Jon Parise - -2000-11-09 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Maybe it's OK now? :) - - * zend_compile.c - zend_compile.h: - Undo the previous commit for fixing $obj = new foo(). - - * zend_compile.c - zend_compile.h: - - Commit experimental patch to fix the problem when doing $a = new foo() - and the constructor assigns $this by reference to other symbol table - elements. Thanks to Daniel J. Rodriguez on this one. - -2000-11-08 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: Add ability to find extensions by name - -2000-11-06 sascha - - * zend_ini.c: Kill a misleading warning which is intended for old code - which assumes sizeof(int) == sizeof(void *). - -2000-11-03 Andi Gutmans - - * zend_ini_scanner.h: - Add trailing \n? - -2000-11-03 Zeev Suraski - - * zend_ini_scanner.l: Fix for bug #5571 (by mookid@sigent.ru) - -2000-11-03 Andi Gutmans - - * Makefile.am: - Fix dependency. - -2000-11-03 Zeev Suraski - - * zend_operators.h: Fix build - - * zend_operators.h: Add RESVAL macros - -2000-11-02 Zeev Suraski - - * zend.c: Fix bug #7599 - - * zend_language_parser.y - zend_language_scanner.l: Missed those - - * zend_API.c - zend_compile.c - zend_compile.h: Maintain consistency - -2000-11-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Replace do_exit() with zend_do_exit(). - - Problem reported by David Hedbor - -2000-11-02 Zeev Suraski - - * zend_ini_parser.y: Remove unnecessary variables - - * zend_ini.c: - explicit declaration here too - sigh, way too early in the morning - - * zend_ini.h: oops - - * zend_ini.h: explicit declaration - -2000-10-31 Zeev Suraski - - * zend_highlight.h: Fix Apache build - - * zend_ini.c - zend_ini.h: Remove unnecessary code, fix phpinfo() - - * Zend.m4: Require bison 1.28 - -2000-10-30 Zeev Suraski - - * Zend.dsp: Fix non-thread-safe Windows build - - * zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Final touches on the INI parser - -2000-10-30 Stanislav Malyshev - - * Makefile.am: Another attempt to make it build - - * Makefile.am - zend_ini_scanner.l: Fix build - -2000-10-29 Zeev Suraski - - * zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Fix leaks - - * zend_alloc.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: The new INI parser is showing some signs of life - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a corruption bug, when erroneously allowing to send non-variables by reference (several - bug-db reports seem to originate in this bug) - - * zend_extensions.c - zend_ini_parser.y: Fix build - - * zend_ini_scanner.h: Forgot this one - - * Makefile.am - ZendTS.dsp - zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: Generalization work - -2000-10-29 Stanislav Malyshev - - * zend_extensions.c - zend_extensions.h: - Allow module to proclaim compatibility with any Zend version - -2000-10-29 Zeev Suraski - - * Makefile.am - ZendTS.dsp - zend_ini_parser.y - zend_ini_scanner.l - zend_language_scanner.l: Some more work on the INI parser/scanner - - * Makefile.am - zend_ini_parser.y - zend_ini_scanner.l: Initial step in rewriting the INI parsing mechanism - - * .cvsignore - Makefile.am - Zend.dsp - ZendCore.dep - ZendTS.dsp - zend-parser.y - zend-scanner.h - zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l: Unify the names of these last 3 files... - - * Zend.dsp - ZendTS.dsp: Fix Windows build - - * Makefile.am - zend_ini.c - zend_ini.h - zend_operators.c - zend_operators.h: - Initial steps to move the INI mechanism to the Zend engine - -2000-10-27 Andrei Zmievski - - * zend_operators.h: Added macros for object properties and class entry. - -2000-10-26 Andi Gutmans - - * zend_API.c - zend_modules.h: - Fix new -m on Windows - -2000-10-25 Andrei Zmievski - - * zend_list.h: Remove the patch to register_list_destructors(). - -2000-10-20 Andrei Zmievski - - * zend_list.c - zend_list.h: - Fixed a bug in zend_rsrc_list_get_rsrc_type() - - Switched register_list_destructors() to use - zend_register_list_destructors_ex() instead - -2000-10-19 Andi Gutmans - - * zend_compile.c: - - Constant expressions which are used multiple times need to be copy_ctored - -2000-10-18 Andi Gutmans - - * zend_llist.c: - Fix whitespace - - * zend_extensions.c - zend_llist.c - zend_llist.h: - - Try #2. Wasn't allowed to delete in the previous manner because we were - in the middle of an llist_apply() - -2000-10-18 sascha - - * zend_fast_cache.h: - Add explicit conversion from 'void *', otherwise ANSI C++ compilers - will break out. - -2000-10-18 Andi Gutmans - - * zend_extensions.c: - Fix crash - -2000-10-17 Andi Gutmans - - * zend_builtin_functions.c: - Fix copy&paste bug - -2000-10-15 Andi Gutmans - - * zend_opcode.c: - - Increase op_array size faster and make eralloc() it in the end to save - memory. - -2000-10-14 Andi Gutmans - - * zend_builtin_functions.c: - Add another patch from Sterling. - - * zend_builtin_functions.c: - - Preliminary commit of Sterlings get_defined_functions()/get_defined_vars - functions - - * zend_extensions.c: - - Only run startup() if ZEND_EXTENSIONS is defined to 1. - This fixes a link error on platforms which don't support libdl - -2000-10-13 Andi Gutmans - - * zend_operators.c: - Make increment of "" become "1" - -2000-10-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: Don't use 'new' symbol - -2000-10-11 Zeev Suraski - - * zend_execute.c - zend_execute_API.c: - Fix -a interactive mode (no idea how the previous commit got committed) - - * zend_execute.c: *** empty log message *** - - * zend.h: Update version - - * zend_hash.c - zend_hash.h: Add zend_hash_merge_ex(), for selective merging - -2000-10-06 Andi Gutmans - - * zend_execute.h: - Fix Bug #7061 - -2000-10-05 Andi Gutmans - - * zend-scanner.l: - - Updated included_files() also for plain include()/require(). - -2000-10-04 Andi Gutmans - - * zend_alloc.c: - Fix fprintf - -2000-10-02 Andi Gutmans - - * zend_extensions.h: - Change zend_extension_api_no - -2000-09-30 Andi Gutmans - - * zend_builtin_functions.c: - Cleanup error output - -2000-09-28 Andi Gutmans - - * zend_hash.c: - - Another has optimization/fix like the hash_copy one from earlier on - -2000-09-28 Stanislav Malyshev - - * zend_hash.c: - Make hash_copy call copy constructor on a real copy, not on a temp - -2000-09-28 Andi Gutmans - - * ZendTS.dsp: - Remove zend_gcc_inline.c - -2000-09-26 sascha - - * Makefile.am - Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Remove --enable-c9x-inline option. We now use a syntax which is compatible - with all compilers by providing the function with static linkage in every - compilation unit. - -2000-09-25 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: - Fix previous update - move extension startup further down the startup sequence - - * zend.c: Move extension startup further down the startup sequence - -2000-09-19 Andi Gutmans - - * zend_operators.h: - Add Z_BVAL* macros - -2000-09-19 Stanislav Malyshev - - * zend_execute_locks.h: - Fix crash on Solaris with function parameter destruction - -2000-09-18 Stanislav Malyshev - - * zend_builtin_functions.c: - Made get_included_files() work again, in somewhat different way - -2000-09-17 Stanislav Malyshev - - * zend_compile.c: Set filename even on recursive include - -2000-09-14 Andi Gutmans - - * zend_execute.c: - - Fix NULL handling in ARRAY opcode and resolve memory leak - -2000-09-12 Zeev Suraski - - * zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.h: Make compile_string() accept a description of the code - -2000-09-11 Andi Gutmans - - * zend_compile.c: - - Forgot to create extended info in include()/require() call - -2000-09-10 Stanislav Malyshev - - * zend-parser.y: Allow require_once to take expressions, just like require - - * ZEND_CHANGES: Try once more to remove dups - - * ZEND_CHANGES: Test commit - weed out duplicate messages - -2000-09-09 Zeev Suraski - - * zend.c: Don't use unsafe sprintf() - -2000-09-08 Stanislav Malyshev - - * zend.c: Don't trust snprintf return - -2000-09-06 Andi Gutmans - - * zend_config.w32.h: - Save two lines - - * zend_config.w32.h: - Fix header - -2000-09-06 sascha - - * Zend.m4: Unless overwritten, default to no optimization in debug mode. - -2000-09-05 Andi Gutmans - - * zend_operators.h - zend_operators.c: - Commiting Sterling's new multi_convert* functions - -2000-09-05 Andrei Zmievski - - * zend_builtin_functions.c: Fix memory overrun. - -2000-09-05 Stanislav Malyshev - - * zend_builtin_functions.c: - Fix crash with trigger_error having no args (#6549) - -2000-09-04 Andi Gutmans - - * Makefile.am: - Remove two tabs - -2000-09-02 Andi Gutmans - - * ZendTS.dsp: - - Defining TSRM_WIN32 in each and every dsp sucked. Revert this change - - * ZendTS.dsp: - Fix windows build - -2000-08-31 Andi Gutmans - - * ZendTS.dsp: - - This should fix the performance problem with Release builds - - * zend-scanner.l - zend.c - zend_execute.c: - - Use emalloc() for opened_path now. This was a potential leak before. - - This patch has potential to break stuff but I tested it as much as I - - could. Fixes should be easy. - - * zend.c: - Remove support for __string_value() in print $obj - -2000-08-31 Zeev Suraski - - * zend.c: Safer shutdown process - -2000-08-29 Andi Gutmans - - * zend.h: - Update Zend version. - -2000-08-26 Andi Gutmans - - * zend_builtin_functions.c: - Don't define this function in non-debug mode - -2000-08-24 Andi Gutmans - - * zend_execute.c: - - Revert patch from 9/7/2000 which seems to have broken unset(). - - I hope what made me do this patch doesn't appear again. - -2000-08-22 Andi Gutmans - - * zend_execute_API.c: - - Fix bug report by Andrei when using a method as a sort user function - - parameter in usort() like functions - -2000-08-20 Zeev Suraski - - * zend_config.w32.h: Fix Win32 build - -2000-08-20 sascha - - * zend_config.w32.h: - _isnan seems to be supported on Win32, add an appropiate macro. - - * acconfig.h: If available, use fpclassify for substituting zend_finite. - - * acconfig.h: - Including math.h before using macros defined there will work better :) - - * acconfig.h: Add zend_isinf and zend_isnan. - -2000-08-19 Andrei Zmievski - - * zend-scanner.l: One more fix to C compile. - -2000-08-19 Zeev Suraski - - * zend-scanner.l: Fix C build - - * zend-scanner.l: Fix eval() leakage in ZTS mode - - * zend_compile.c - zend_globals.h: Eliminate run-time leak with eval()'s - - * zend_alloc.c: Fix build with no memory_limit - - * zend_alloc.c: Fix memory_limit - -2000-08-19 Andi Gutmans - - * zend_execute.c: - Beautify - -2000-08-17 Stanislav Malyshev - - * zend_API.h: Fix EMPTY_STRING macros - -2000-08-15 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: - Fix warning issue (compile errors inside require()'d files were incorrectly supressed) - -2000-08-14 Zeev Suraski - - * zend_execute.c: - Fix leak and some logic - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - This patch should hopefully fix situations where a constructor uses - - the $this pointer as a reference. - -2000-08-14 Stanislav Malyshev - - * zend_execute.c: Fix crash - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.h: - - Unused results should be marked with EXT_TYPE_UNUSED and not IS_UNUSED - -2000-08-13 Stanislav Malyshev - - * zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: Fix zend_fiel_handle handling. Should fix URL include - and various opened_path inconsistencies. - -2000-08-13 Andi Gutmans - - * zend-parser.y: - - Revert foreach() change which only allowed variables and array(...) - -2000-08-11 Andi Gutmans - - * zend-parser.y: - Only support variables and array(...) in foreach loops - -2000-08-10 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Fix problem with nested foreach()'s (Andi, Zend Engine) - - * zend_compile.c: - Fix switch which only has a default rule (Andi, Zend Engine) - Change require_once() to use the same file list as include_once(). - Patch includes making require() & include() to behave the same when it - comes to scoping. require() is now an include() which isn't allowed to fail. - require() caused too many memory reallocations which ended up being quite - slow for sites that required lots of files. (Andi & Zeev, Zend Engine) - - Fix switch() which only has default rule (bug #5879, - -2000-08-09 Zeev Suraski - - * zend_modules.h: that too - - * zend_extensions.h: Update API number - - * zend-parser.y - zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - The patch we promised - redesigned the compilation/execution API: - Advantages: - - Smaller memory footprint for the op arrays - - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op - initialization) - - include_once() & require_once() share the same file list - - Consistency between include() and require() - this mostly means that return() - works inside require()'d files just as it does in include() files (it used to - be meaningless in require()'d files, most of the time (see below)) - - Made require() consistent with itself. Before, if the argument was not a constant - string, require() took the include() behavior (with return()). - - Removed lots of duplicate code. - Bottom line - require() and include() are very similar now; require() is simply an include() - which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require() - didn't end up being any faster than include() in the Zend engine. - -2000-08-05 Andi Gutmans - - * zend_execute.c: - - Use some more SEPARATE_ZVAL macros instead of replicated code. - -2000-08-05 Stanislav Malyshev - - * zend_execute.c: Fix memory leak - -2000-08-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Beautify code. Try and use more macros for splitting instead of - - replicating the code everywhere. - -2000-08-02 Andi Gutmans - - * zend_execute.c: - Remove commented code - -2000-07-29 Zeev Suraski - - * zend-scanner.l - zend_execute.c: Fix filename issues - -2000-07-28 Stanislav Malyshev - - * zend_builtin_functions.c - zend_constants.c - zend_constants.h: - Make define return false and issue E_NOTICE when trying to redefine constant - -2000-07-27 Andi Gutmans - - * zend-scanner.l - zend_execute.c: Always store full filename as compiled file name - -2000-07-26 Zeev Suraski - - * zend_compile.c: - Fix a possible issue with runtime inheritence under fairly rare circumstance - and optimize a tiny bit - -2000-07-26 Stanislav Malyshev - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Add strncasecmp function - -2000-07-18 Zeev Suraski - - * zend_builtin_functions.c: Forgot to link this function... - - * zend_hash.c: This is probably the oldest bug in PHP :) - Luckily it's unlikely we're ever actually bitten by this bug. - -2000-07-16 Andi Gutmans - - * zend_compile.c: - Beautify Zeev's patch a bit. - -2000-07-16 Zeev Suraski - - * zend_compile.c: Implement parent::foo() - -2000-07-15 Zeev Suraski - - * zend-parser.y - zend_compile.c: Add more extended_info calls - -2000-07-14 Zeev Suraski - - * zend_builtin_functions.c - zend_list.c - zend_list.h: Improve register_resource_ex() infrastructure - -2000-07-12 Thies C. Arntzen - - * zend.c: fix ZTS startup without filename (thanx purify!) - - * zend.c: unset active_symbol_table on zend-shutdown. - -2000-07-11 Zeev Suraski - - * zend_list.c: Another persistent hash - disable apply protection - - * zend.c - zend_hash.c - zend_hash.h: - Disable the hash_apply() protection on hashes that persist across requests - it's unsafe - because we may be aborted at any point - -2000-07-11 Stanislav Malyshev - - * zend_execute.c: - Fix a bug in passing second parameter of RECV_INIT with is_ref set - -2000-07-11 Andi Gutmans - - * zend_compile.h: - Oops. Too early in the morning - - * zend_compile.h: - Include iostream.h in C++. - -2000-07-09 Andi Gutmans - - * zend_execute.c: - Fix memory leak. - - * zend_execute.c: - Need to seperate if the hash isn't a reference - -2000-07-08 Andi Gutmans - - * zend.h: - Add zend_ulong - -2000-07-07 Stanislav Malyshev - - * zend_execute.c: Remove C++ commennts. - -2000-07-06 Andi Gutmans - - * zend-scanner.l: - - Remove code which has never been used (neither in PHP 3) - - * zend_compile.c: - - Make is_method_call() static and remove a couple of old lines - - * zend_execute.c - zend_extensions.h: - Yet another fix... - - * zend_execute.c: - One more... - - * zend_compile.c: - One more fix for the latest patch - - * zend_compile.c: - One dumb bug in my latest patch - - * zend-parser.y - zend_compile.c - zend_execute.c: - - Complex fix for solving a problem with objects & method calls. - - Previous version is tagged PRE_METHOD_CALL_SEPERATE_FIX_PATCH. - - I need to check this fix on a server so if it doesn't work I will revert - - it. - - * zend-scanner.l: - - Fix problem with newlines not being recognized under certain conditions - -2000-07-03 Andi Gutmans - - * zend_compile.c: - Fix bug #4120 - -2000-07-03 Stanislav Malyshev - - * zend_execute_API.c: Unblock SIGPROF signal when starting timer. - On Linux, this signal is blocked by default after first signal is run - -2000-07-03 sascha - - * FlexLexer.h - zend-scanner.h - zend_alloc.h - zend_compile.h - zend_constants.h - zend_dynamic_array.h - zend_execute.h - zend_globals.h - zend_hash.h - zend_highlight.h - zend_list.h - zend_operators.h - zend_static_allocator.h - zend_variables.h: - Replace macros which begin with an underscore through an appropiately - named macro. - -2000-07-02 sascha - - * zend.h - zend_API.h - zend_builtin_functions.h - zend_config.w32.h - zend_dynamic_array.h - zend_errors.h - zend_execute_locks.h - zend_extensions.h - zend_fast_cache.h - zend_globals_macros.h - zend_indent.h - zend_llist.h - zend_modules.h - zend_ptr_stack.h - zend_stack.h: Change header protection macros to conform to standard. - - Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment" - - All identifiers that begin with an underscore and either an uppercase - letter or another underscore are always reserved for any use by the - implementation. - -2000-07-02 Andi Gutmans - - * zend-parser.y: - Take #2 with tab size 4 - - * zend-parser.y: - - Beautify parser a bit. It still could do with some more at some point - - * zend_execute.h - zend_execute_API.c: - Forgot ZEND_API - -2000-06-30 Zeev Suraski - - * zend_config.w32.h: - Add a messagebox style that's safe to use from an ISAPI filter - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: error_reporting fix - -2000-06-29 Zeev Suraski - - * zend.c - zend.h: Add $context argument to error handler - -2000-06-28 Zeev Suraski - - * zend.c: Improve error handling code - - * zend-scanner.l: Be HTML friendly - -2000-06-28 Andi Gutmans - - * zend.h: version update - -2000-06-26 Zeev Suraski - - * zend.h - zend_constants.c - zend_extensions.h: - Make it possible to detect whether we're thread safe or not from PHP scripts and the php.ini - file - -2000-06-26 Andi Gutmans - - * zend_extensions.c: - Add another "\n" at the end of error messages. - -2000-06-26 Zeev Suraski - - * zend_execute_API.c: - Make max_execution_time work properly when set to 0 under Win32 (disable) - -2000-06-25 Andi Gutmans - - * zend.c: - I wrote a long msg but the commit didn't go through. - - So here is the short version: - - a) Start moving to binary opens in Windows - - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c - - The mode to this function should at least be a #define but that is for - - another day. Anyway this whole stuff should be given more face lifts in - - the future. - -2000-06-24 Zeev Suraski - - * zend_alloc.c: Nuke a warning - -2000-06-23 Andi Gutmans - - * zend_static_allocator.c - zend_static_allocator.h: - Not returning a value anymore - - * zend_static_allocator.h: - Don't need SUCCESS/FAILURE anymore - - * zend_static_allocator.c - zend_static_allocator.h: - Add license - - * zend_static_allocator.c - zend_static_allocator.h: - - Commit static allocator structure which we might use in an upcoming Zend - - change - -2000-06-22 Andi Gutmans - - * zend-scanner.l: - Fix asp_tags. - - * zend_extensions.c: - Oops I miss-wrote that field - - * zend_extensions.c - zend_extensions.h: - - Change API version and make the error messages more meaningful. - - * zend_alloc.c - zend_alloc.h: - Change cache size and only initialize part of it. - -2000-06-22 Stanislav Malyshev - - * zend_alloc.c: - Cached-freed memory blocks should not be in "occupied" list - - * zend_alloc.c - zend_globals.h: Make cache counters to be unsigned int - Start collecting statistics after cache pre-fill - -2000-06-18 sascha - - * Zend.m4 - acinclude.m4 - zend.c: fp_except check for FreeBSD 1.0-2.2.5 - - * Zend.m4 - acconfig.h - zend_config.w32.h - zend_operators.h: Welcome zend_finite(n). - - This chooses the best combination of what is available: - - finite, isfinite, isinf, isnan - -2000-06-18 Stanislav Malyshev - - * zend.h - zend.c: Make error callback be publicly accessible - -2000-06-18 Andi Gutmans - - * zend.c: - Better FreeBSD fix. Does fp_except_t exist on 3.4? - - * zend.c: - - I don't know how this happened. I tested the bloody thing and I remember - - copy&pasting from code which used ~. - -2000-06-17 Zeev Suraski - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c - zend_ptr_stack.h: - Add restore_error_handler() - error_handler's are now stored in a stack - - * zend-scanner.l - zend.c - zend_API.h - zend_execute_API.c: - Allow the symbol_table to be passed to call_user_function_ex() - - * zend-scanner.h - zend-scanner.l: Fix filenames and line numbers in ZTS mode - - * zend_hash.c - zend_hash.h: - Avoid crashing with recursive applies - limit apply nest level to 3 (I'm not aware of a place - in which applying recursively on the same hash makes sense with more than one nest level, but - 3 should be enough) - -2000-06-16 Zeev Suraski - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Ok, this time here's some real Win32 system programming :) - Redesigned the timeout system using a single timeout thread and a single window, - and used a much quicker check. - -2000-06-16 Andi Gutmans - - * zend_execute_API.c: Fix UNIX build - -2000-06-16 Zeev Suraski - - * zend_execute.c: Macro it up the right way - - * zend_execute.c: Macro this up, so it can be moved to other places - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Move timeout code to Zend - - Implement timeouts in Win32 - -2000-06-15 Zeev Suraski - - * Zend.dsp - zend.c: - Fix non thread-safe mode - asp_tags/short_tags etc weren't getting initialized properly - -2000-06-15 Andi Gutmans - - * zend_list.c: *** empty log message *** - - * zend-parser.y: - Support multiple arguments to unset() - -2000-06-15 Thies C. Arntzen - - * zend_list.h: ups. - - * zend_list.h: - changed return type of ZEND_VERIFY_RESOURCE from FALSE to NULL - -2000-06-14 sascha - - * zend_operators.h - zend_operators.c: - Move some stuff to zend_operators.h which is required by the - moved inline functions. - -2000-06-14 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: - More correct way of doing bit mask - -2000-06-14 sascha - - * Zend.m4: Only replaced C0X and C0x, but not c0x.. - - * Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Rename C0x-inline to C9x-inline, and frame preprocessor directives in - zend_gcc_inline.c with #ifndef C9X_INLINE_SEMANTICS..#endif. - -2000-06-14 Andi Gutmans - - * ZendTS.dsp: - Make Win32 build - -2000-06-13 Andi Gutmans - - * zend_compile.c - zend_compile.h: Add to the API - -2000-06-13 sascha - - * Makefile.am - Zend.m4 - zend_API.h - zend_compile.h - zend_execute.h - zend_execute_API.c - zend_gcc_inline.c - zend_globals.h - zend_operators.c - zend_operators.h: Add optional support for C0x inline semantics. - - These are enabled by specifying `--enable-c0x-inline' on the command - line. We might add an autoconf check for this particular feature - later. - - * zend_llist.h: - Add llist_apply_func_t and make prototypes use the typedefs. - -2000-06-12 Zeev Suraski - - * zend_builtin_functions.c: Make Egon happy :) - - * zend_builtin_functions.c: - Return the previous error handler from set_error_handler() - - * zend_API.c - zend_API.h - zend_builtin_functions.c: - Avoid using E_CORE_* errorlevels in any place which is not in the global startup sequence - - * zend-parser.y - zend-scanner.l - zend.h - zend_compile.c: Get rid of - -2000-06-11 Andi Gutmans - - * zend.c: - Solve floating point precision crash on FreeBSD. - - * zend.c: - - Fixes crash problem on FreeBSD when losing precision. Need to still see - - how to detect we're on FreeBSD - -2000-06-11 Zeev Suraski - - * zend_API.c: Fix zend_get_parameters() - -2000-06-10 Andi Gutmans - - * zend_operators.c: - - Fixed problem when using uninitialized values in comparisons with strings. - - They behave as empty strings again just like in PHP 3. - -2000-06-10 Zeev Suraski - - * zend_execute.c: - I can't think of a reason of why it should just be a notice... Make it a warning, like it was in PHP 3. - - * zend_API.c - zend_builtin_functions.c: Fix bug #4768 - -2000-06-09 Andrei Zmievski - - * zend_builtin_functions.c - zend_hash.h: Made an alias for hash apply with arguments. - -2000-06-09 Andi Gutmans - - * zend_alloc.c: - Forgot to remove the FIXME - - * zend_alloc.c: - Make the memory limit accurate - - * zend_alloc.c: - Fix cache initialization - - * zend_alloc.c - zend_alloc.h: - - Allocate and cache in 8 byte blocks. Most allocators anyway use 8 byte - - blocks. This should help fragmentation and cache hits. - - The old tree is tagged as PRE_EIGHT_BYTE_ALLOC_PATCH - -2000-06-09 Zeev Suraski - - * zend_execute.c: Fix bug #4933 - - * zend_builtin_functions.c: Fixed bug #4819 - -2000-06-09 Andi Gutmans - - * zend_modules.h: - - Time to change it. We changed register_internal_class() -> - - zend_register_internal_class() - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Andrei, this is for you! - - Add zend_register_internal_class_ex() which allows you to specify a - - parent to inherit from. You can either specify the parent directly or via - - its name. - - * zend-parser.y - zend-scanner.l: - Typo - - * zend_execute.c: - Remove old obsolete code. - - * zend_execute.c: - Make unset consistent with the way array offsets work - -2000-06-09 Stanislav Malyshev - - * zend_execute.c: Handle unset with empty key - -2000-06-09 Andi Gutmans - - * zend_API.c - zend_API.h: - - Change register_internal_class to zend_register_internal_class for - - consistency. - - Andrei: I'm still thinking about the _ex you want me to implement - -2000-06-08 sascha - - * Zend.m4 - acconfig.h: Clean up acconfig.h - - * zend_execute_API.c - zend_operators.c: Add a couple of casts - -2000-06-06 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: - Enable asp_tags/short_tags/allow_call_time_pass_by_reference to work on a per-directory - basis as well - -2000-06-06 sascha - - * zend_API.c: - Add newline at the end of the file (breaks at least SCO and Tru64 C compiler). - -2000-06-05 Andi Gutmans - - * zend-scanner.l: - Revert internazionalization fix. - - * zend_builtin_functions.c: - Complete change to create_function() - -2000-06-04 Zeev Suraski - - * zend_compile.c - zend_execute_API.c: - Change shutdown order to sort out a crash when assigning a resource id to a static. - - * zend_hash.c - zend_hash.h - zend_operators.c: - Support unordered hash comparisons - - Make == perform an unordered comparison with arrays/objects, and === perform an ordered comparison - - * zend_builtin_functions.c: Rename lambda() - -2000-06-03 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_operators.c - zend_operators.h: - Support comparisons of arrays (with arrays) and objects (with objects) - -2000-06-03 Andi Gutmans - - * zend.c: - Change #if to #ifdef. - -2000-06-03 Zeev Suraski - - * ZendTS.dsp - zend.c: Don't take chances with new include files - - * zend_execute_API.c: - Improve call_user_function() to support array($obj, $method) - - * zend-parser.y - zend.h - zend_operators.c: - Export normalize_bool - - This global/static syntax fix brought us back to the 4 documented conflicts - - * zend_builtin_functions.c: Fix a lambda() bug - - * zend_builtin_functions.c: Add missing { - - * zend_globals.h - zend_hash.c - ZendTS.dsp - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h: - Fix Win32 compilation (Use winsock2.h from now on) - - Add lambda() support - -2000-06-02 Andi Gutmans - - * zend-parser.y: - global/static require a trailing ';' - -2000-06-02 Zeev Suraski - - * zend_builtin_functions.c: Update error code - - * zend.c - zend.h - zend_config.w32.h: Nuke the old error code, use the new one - -2000-05-31 Zeev Suraski - - * zend.h: IS_BC isn't really being used, but still... - - * zend-parser.y - zend.h - zend_API.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_variables.c: - Fix a bug in static initializers/default values/class member variables that contained - array values - -2000-05-29 Zeev Suraski - - * zend_API.c - zend_API.h: Allow disabling of functions for security reasons - -2000-05-28 Andi Gutmans - - * zend_operators.c: - - Use pointer arithmetic to speed up the function a bit - - * Zend.m4: - This should have been done for 4.0.0. - - Default build is without debug now. Use --enable-debug if you want a - - debug build which includes leak/memory overwrite etc. detection - -2000-05-26 Andi Gutmans - - * zend-scanner.l - zend_operators.c - zend_operators.h: - - Fixed scanning decimal numbers in internationalized environments. They should - - always be in standard US format e.g. 23.3 - -2000-05-25 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in certain situations of class redeclarations - -2000-05-24 Thies C. Arntzen - - * zend_hash.h: rename hastable -> _hashtable to avoid clashes - - * zend-scanner.l: - add rdbuf() to our own istdiostream implementation, allowing C++ compile - using SUN and SGI native compilers. (by Jayakumar Muthukumarasamy ) - -2000-05-22 Zeev Suraski - - * zend.c: - Remove ugly Ltd. - -2000-05-21 Sam Ruby - - * zend.c: Windows build failure - -2000-05-21 Andi Gutmans - - * zend.c - zend_compile.h: - - Fix Apache php source highlighting mode. It was crashing due to the - - module shutdown functions being called when the startup functions weren't - - being called. - - * zend.h - zend_extensions.h: - Get ready for release - -2000-05-19 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: Open these up for the API - -2000-05-18 Zeev Suraski - - * zend_alloc.c: Do it in thread unsafe mode for now. - -2000-05-18 sascha - - * zend_alloc.c: Kill warnings - -2000-05-18 Andi Gutmans - - * zend_alloc.c: - Do this someplace else. - - * zend_execute.c - zend_operators.c: - - Fix include() when used on resources (shouldn't work but shouldn't crash - either). - -2000-05-18 Andrei Zmievski - - * zend_operators.c: - Update for sort functions - user can now specify sort type. - -2000-05-17 Andi Gutmans - - * zend_operators.h - zend_operators.c: - - Add support for string_compare_function() and number_compare_function(). - UNTESTED! - -2000-05-17 Zeev Suraski - - * zend_operators.c: Normalize results of compare_function() - - * zend-scanner.l: - Fix crash if %> is encountered in HTML while ASP-tags are disabled - -2000-05-17 Andi Gutmans - - * zend_opcode.c: Fix order - -2000-05-17 sascha - - * zend_operators.h: Add missing prototype - -2000-05-16 Zeev Suraski - - * zend_alloc.c: - - Small optimization. Filling up the Cache helps performance. - -2000-05-12 sascha - - * Makefile.am: Fix parallel makes on BSD - -2000-05-11 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.h - zend_operators.c: - Get rid of chval - it's really not necessary and seems to be confusing people - - * zend_compile.c: Refined fix - - * zend_compile.c: - Fix a memory corruption bug with by-ref function arguments - -2000-05-10 Andi Gutmans - - * zend_extensions.h: - Bump up Zend extension version number - -2000-05-10 Thies C. Arntzen - - * zend_compile.c: make waning readable - -2000-05-08 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_opcode.c: Thoroughly initialize IS_UNUSED for proper cleanup - - * zend.h: - Change Zend Engine version number - - * zend_alloc.c: - Return real size allocated - -2000-05-08 Zeev Suraski - - * zend_operators.c: Make zend_binary_strcasecmp compile again - -2000-05-08 sascha - - * zend_operators.c: Make strcasecmp() act correctly WRT SUS II. - - Patch by: hholzgra@php.net - PR: #3556 - -2000-05-06 Andi Gutmans - - * zend_execute.h - zend_execute_API.c: - Make zend_eval_string() return SUCCESS/FAILURE - - * zend_execute.c: - - Make $obj->test = 5; work again (assigning to uninitialized objects) - -2000-05-05 sascha - - * Zend.m4: - Linking directly against libc might result in unexpected behaviour. - We check for dlopen in libdl first, and check then whether dlopen exists. - -2000-05-03 Andi Gutmans - - * zend_compile.h: - Change fetch_type to be zend_uint - - * zend_compile.c - zend_execute.c: - Change the place CAST uses for the op_type - -2000-05-02 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Change zend_hash_get_current_key_ex() to also return the string length - -2000-05-02 sascha - - * zend_API.c: - Fix segfault occuring when a temporary module was unloaded and if this - module did not have a request shutdown function. - - * zend_API.h: - Add ZEND_GET_MODULE(name). This is a short-cut for the common - get_module function. - -2000-05-01 sascha - - * zend.c: - Source file does not end with a newline. Some old compilers don't like that. - -2000-05-01 Andrei Zmievski - - * zend_builtin_functions.c: Added a way to get all declared classes. - -2000-05-01 sascha - - * Makefile.am: Fix dependency - -2000-04-29 Zeev Suraski - - * zend_extensions.h - zend_opcode.c: - Pass the op_array to the ctor/dtor, instead of just the resource - - * zend_extensions.c: crash fix - - * zend_extensions.c - zend_extensions.h - zend_llist.c - zend_llist.h: - Add zend_llist_apply_with_arguments() - - Add a message handler to the extensions - - * zend_compile.h - zend_opcode.c: - Fix possible bug with extension dtors being called without the ctors being called first - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_opcode.c: Beautify - -2000-04-28 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: Fix a bug in the resource dispencer - - * zend_operators.c - zend_operators.h: Make convert_to_string() allocations traceable - -2000-04-27 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: *** empty log message *** - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: Change to using the #define's - - * zend.c - zend.h: More error handling work (still completely disabled) - -2000-04-26 Zeev Suraski - - * zend_execute_API.c - zend_variables.c: Fix - forgot to split away if refcount>1 - -2000-04-25 Zeev Suraski - - * zend_extensions.c: Fix bug - - * zend.h: We'll need two... - - * zend_hash.h: Add useful macros - -2000-04-25 Andi Gutmans - - * zend_llist.c: - Fix persistence of llist - -2000-04-24 Zeev Suraski - - * zend_compile.c: - Forgot to keep the ':' in the class_name - - * zend_API.c: Correct fix - -2000-04-24 Thies C. Arntzen - - * zend_API.c: MODULE_TEMPORARY should get a call to RSHUTDOWN as well! - - * zend.c: - fixed shutdown crash if MSHUTDOWN tries to php_error() something. - -2000-04-21 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: export zval_add-ref and zvale_del_ref - -2000-04-20 Zeev Suraski - - * zend_operators.h: - Change macro names from Z to Z_ - - * zend_operators.h: Add some macros for nicer zval handling - -2000-04-20 Andrei Zmievski - - * zend_operators.c: Do proper ieeefp.h check. - -2000-04-20 Thies C. Arntzen - - * zend_operators.c: - compile before commit! compile before commit! compile before commit! - - * zend_operators.c: - revert andrei's path (i can't compile anymore on linux) - we're always using #ifndef HAVE_BLA instead of if !HAVE_BLA and if we need ieeefp.h for some weird platform (which one is that?) we need an autoconf check for it. - -2000-04-19 Andrei Zmievski - - * zend_operators.c: Include proper files for finite. - -2000-04-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: - Initial support for trapping errors (not complete and disabled; will be enabled only - post-PHP 4.0.0) - - * zend_builtin_functions.c - zend_constants.c - zend_errors.h: - - Renamed get_used_files() to get_required_files() for consistency - - Documented some functions - - Added user-level warning messages - - Added user_error() - -2000-04-19 Andi Gutmans - - * zend_opcode.c - zend_compile.h: - Export pass_include() for Windows - -2000-04-18 Zeev Suraski - - * zend_operators.h: - Add convert_to_writable_*_ex() macros (unused at this time) - -2000-04-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix order of JMPZNZ arguments - -2000-04-17 Thies C. Arntzen - - * zend_operators.c: ups, finite is already a macro on Win32 - - * Zend.m4 - zend_operators.c: HPUX11 only has isfinite() - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - Fix leak in require_once() - -2000-04-15 Thies C. Arntzen - - * zend_extensions.c: fixes compile on platforms without dl() support. - -2000-04-15 Zeev Suraski - - * zend.c: Fix ZTS - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - "use" is not yet supported; instead use include_once() or require_once() - for the time being (Andi, Zend library) - -2000-04-15 Zeev Suraski - - * zend.c - zend_API.c - zend_compile.c - zend_execute_API.c - zend_list.c - zend_list.h: - Clean up resource lists namespace - - Prepare extended resource list destructor APIs (currently unused) - -2000-04-13 Zeev Suraski - - * zend_operators.c: - Fix a memory leak when using assign-op bitwise operators on strings - -2000-04-12 Zeev Suraski - - * zend_execute.c: *** empty log message *** - -2000-04-11 Andi Gutmans - - * zend_execute_API.c: - Fix memory leak - -2000-04-11 Zeev Suraski - - * zend_execute.c: Fix warnings - - * zend_execute.c: Fix fd leak in include_once() - -2000-04-10 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - -2000-04-10 Zeev Suraski - - * zend.h - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_operators.c: Fix object overloading support - -2000-04-10 Andi Gutmans - - * zend_execute.c: - Add warnings - - * zend_compile.c: - Two more places needed changing - -2000-04-10 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.h: Clean up last/size definitions - -2000-04-09 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -2000-04-07 Zeev Suraski - - * zend_execute.c: Thoroughly fix include_once() - - * zend_execute.c: Fix include_once() - -2000-04-06 Andi Gutmans - - * zend-parser.y: *** empty log message *** - - * zend_execute.c - zend_execute.h: Initial preparation for OO overloading patch - -2000-04-05 Andi Gutmans - - * zend_extensions.h: - Bump up version number - - * zend_compile.c - zend_execute.c: - FIx JMPZNZ - -2000-04-03 Zeev Suraski - - * zend_list.c: - Fix the problem with dl()'d modules not freeing their resources properly - -2000-04-01 Zeev Suraski - - * zend_API.h - zend_config.w32.h: *** empty log message *** - - * acconfig.h: Have a standard way of exporting symbols - - * zend_modules.h: Use int - - * zend_API.h: Generalize some common thread-safety stuff - - * zend_modules.h: Have a standard entry for the globals id - -2000-03-31 Zeev Suraski - - * zend_compile.c: - The previous fix ended up being broken, this one should do it - -2000-03-31 Andi Gutmans - - * zend_compile.c: - Fix bug - -2000-03-30 Zeev Suraski - - * zend_extensions.c: Fix zend_register_extension() - -2000-03-30 Andi Gutmans - - * zend_extensions.h: - Bump up API number after Lars' change - -2000-03-30 sascha - - * Makefile.am: Give another hint to BSD makes - - * Makefile.am: - Specifically mention $(srcdir), so that OpenBSD's make gets it - -2000-03-29 Zeev Suraski - - * zend_stack.c - zend_stack.h - zend_compile.c: - - Make the argument order for the stack applies more consistent with other Zend - data structures - - Fix a possible corruption problem due to switch() C-level optimization - -2000-03-29 Torben Wilson - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Added !== (is not identical) operator. - -2000-03-29 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: *** empty log message *** - -2000-03-29 Andi Gutmans - - * zend_API.h: - - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that - Zend'ish modules don't need to mix PHP & Zend notation. - -2000-03-28 Zeev Suraski - - * zend_builtin_functions.c: - The checks for func_num_args() and friends were broken - fixed - -2000-03-27 Sam Ruby - - * Zend.dsp: Remove debug libraries from debug build - -2000-03-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_API.c - zend_builtin_functions.c: - Stop zend_func_args() and co. from crashing - - * zend.h: - - Didn't see Thies' commit message although I can't really see how it would - make a difference - - * zend.h - zend_opcode.c: - Include Andrea's fix for alloca.h - -2000-03-26 Thies C. Arntzen - - * zend.h - zend_execute.c: - needs to be included before we define macros calling alloca() - atleast using SGI's cc - should not harm other platforms (i hope) - - * zend_opcode.c: fix cast - -2000-03-25 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: *** empty log message *** - -2000-03-25 Zeev Suraski - - * zend-parser.y - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: - Some header dependencies cleanup - - Generalize zval_print() and zval_print_r() - -2000-03-25 Sam Ruby - - * zend.h: RTLD_NOW => RTLD_LAZY|RTLD_GLOBAL - -2000-03-25 Zeev Suraski - - * Zend.dsp: Update dsp's - -2000-03-24 Zeev Suraski - - * zend_execute.c: - - Fixed a crash when sending a non-variable expression to a runtime-bound function - that expected a reference. - -2000-03-24 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Nuke hash_*_ptr functions - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Use WRONG_PARAM_COUNT. - -2000-03-23 Zeev Suraski - - * zend_builtin_functions.c: - Make it compile - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Added get_class_methods(). - -2000-03-22 Andi Gutmans - - * zend.h: - Change Zend version as API has changed - -2000-03-22 Zeev Suraski - - * zend_operators.c: - Wrong fix - - * zend_operators.c: - Only free when result != op1 - -2000-03-21 Andi Gutmans - - * zend.c - zend.h: - - Change zend_startup to accept a flag for starting builtin functions - - * zend.h - zend_API.h: - Move #defines - -2000-03-19 Thies C. Arntzen - - * zend_compile.h: kill warning - -2000-03-18 Andi Gutmans - - * zend.h: - Fix compile problem on FreeBSD - - * zend.h: - - No reason for refcount to be signed and move to zend_* typedefs - -2000-03-18 Thies C. Arntzen - - * zend.c: renamed _string_value_() to __string_value(). - -2000-03-18 Zeev Suraski - - * zend_builtin_functions.c: - The third argument to define() wasn't working right, fixed - - * zend_execute.c: - false wouldn't automaticaly switch to an array type, which resulted in an - incompatibility with PHP 3. Fixed. - -2000-03-16 Thies C. Arntzen - - * zend.c: renamed "to_string" -> "_string_value_" - -2000-03-15 Zeev Suraski - - * zend-scanner.l - zend.h - zend_execute.c: - Fix newly introduced problem reported by Sam Ruby - -2000-03-15 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Make zend_hash_move_forward()/zenv_hash_move_backwards() a little smarter. - -2000-03-15 Zeev Suraski - - * zend_opcode.c: - Fix warning (I thought I fixed this one before) - -2000-03-14 Andrei Zmievski - - * zend_llist.c - zend_llist.h: Implemented external list traversing. - -2000-03-14 Andi Gutmans - - * zend-parser.y: - - Allow array(1,2,3,) i.e. with trailing comma. You can only have one - trailing comma. - -2000-03-13 Zeev Suraski - - * zend_compile.c: - - - * zend_compile.c: - Spare a byte :) - -2000-03-13 Andi Gutmans - - * zend_compile.h - zend_modules.h: - Another zend_uchar - - * zend_compile.c: *** empty log message *** - - * zend.h - zend_compile.h: - - define zend_uint and zend_uchar and use them in a few places - -2000-03-13 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Introduced a way to traverse hashes through external pointers. - -2000-03-13 Andi Gutmans - - * zend_compile.h: - Change type from int -> char - -2000-03-13 Zeev Suraski - - * zend-scanner.l: - Fix filename/lineno initialization for do_return - -2000-03-12 Zeev Suraski - - * zend_builtin_functions.c - zend_modules.h: - - -2000-03-11 Andi Gutmans - - * zend_execute.c: - - Remove inline from functions which are pretty large and besides eating up - memory in compile time probably doesn't boost performance. - -2000-03-10 Andi Gutmans - - * zend_operators.c: - - Seems to be a problem here with the return value not being set - - * zend-parser.y - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - Quick way of supporting include_once(). - Good enough for RC1. - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h: - Support require_once(). - - * zend_compile.h - zend_execute.c: - Cleanup old IMPORT stuff - - * zend-parser.y - zend-scanner.l: - - Nuke import, add include_once and include_require scanner/parser rules. - Hope to nuke use too :) - - * zend_modules.h: - That broke the Win32 build - - * zend_modules.h: - Fix a bug and define an API_NO for the ZEND_MODULE_API - - * zend_modules.h: - zend_config.h is enough - - * zend_modules.h: - Save ZEND_DEBUG, ZTS, ZEND_API information - -2000-03-09 Andi Gutmans - - * zend_highlight.c: - Fix bug in syntax highlighter - -2000-03-06 stig - - * zend_modules.h: added GINIT_FUNC_ARGS and GINIT_FUNC_ARGS_PASSTHRU - -2000-03-06 Zeev Suraski - - * zend_extensions.h: - Bump up Zend's API version - -2000-03-06 stig - - * zend_modules.h: Added ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU. - -2000-03-06 Andi Gutmans - - * zend-scanner.l: - Fix memory leak - - * zend.c: - Missed one - -2000-03-06 Sam Ruby - - * zend.c - zend.h: Unresolved externs - -2000-03-06 Zeev Suraski - - * zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h - LICENSE - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_modules.h: It's official now... - -2000-03-05 Zeev Suraski - - * ZendTS.dsp - zend.c - zend.h: Wrap some commonly unused callbacks - -2000-03-04 Zeev Suraski - - * zend-scanner.l: - The default return value from include() and eval() changed from 1 to 0 - unintentionally after the old return-reference patches - fixed - -2000-03-02 Sam Ruby - - * zend_config.w32.h: Fix Win32 build breakage - -2000-03-01 Andi Gutmans - - * zend.c: - Upgrade to year 2000 - - * ZEND_CHANGES - zend_compile.c - zend_execute.c: - Fix typos - -2000-03-01 Thies C. Arntzen - - * zend_operators.c: now - -2000-02-27 Egon Schmid - - * zend_builtin_functions.c: Fixed some protos. - -2000-02-26 Sam Ruby - - * zend_builtin_functions.c: compilation error - Win32 - -2000-02-26 Andrei Zmievski - - * zend_builtin_functions.c: - Added get_class_vars() and get_object_vars() functions. - - * zend_execute.c: Fix typo. - -2000-02-26 Zeev Suraski - - * zend_operators.c: Fix comparisons of "inf"=="inf" and "-inf"=="-inf" - -2000-02-25 Zeev Suraski - - * zend_fast_cache.h - zend_variables.c: Use the fast cache here too - -2000-02-19 Zeev Suraski - - * zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: (c) patch - - * zend_API.c - zend_API.h - zend_fast_cache.h - zend_hash.c: - - Fix a nasty bug in the hash, introduced in the recent migration to macros - - Make array_init() and friends trackable - - * zend_API.c - zend_API.h - zend_execute.c - zend_operators.c - zend_operators.h: Generalize macros - -2000-02-18 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -2000-02-18 sascha - - * zend_llist.c - zend_llist.h: - Get rid of second declaration of compare_func_t. Either put in a common - header file or prefix it with i.e. zend_llist_ - -2000-02-18 Andi Gutmans - - * zend_llist.c - zend_llist.h: - - Quick and dirty hack for supporting sorts. Improve later on when I wake up. - - * ZendTS.dsp - zend_dynamic_array.c: - Didn't compile on Win32 - - * zend_dynamic_array.c: - - Tiny change (I know I don't have to cast malloc() to void * but I like - casting my malloc()'s) - - * Makefile.am - zend_dynamic_array.c - zend_dynamic_array.h: - - Preliminary support for dynamic arrays. I need it on order to try out a - new hash implementation. It isn't used anywhere. - -2000-02-17 Andi Gutmans - - * zend.c - zend.h: - Add ZEND_API - -2000-02-16 Andi Gutmans - - * zend_execute.c: -Fix bug 3504 concerning leaks with unset() - - * zend_execute.c - zend.h - zend_compile.h: - Hopefully fix Thies' bug report. - -2000-02-16 Zeev Suraski - - * zend_builtin_functions.c: - ZEND_TEST_EXCEPTIONS should be defined/undefined before it's checked - -2000-02-16 Andi Gutmans - - * zend_execute.c: - Fix bug #3309 - -2000-02-14 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Put in the infrastructure for the unset() fix. Right now it has the old - behavior but I just need time tomorrow to add the correct behavior. - - * zend_builtin_functions.c: - Fix bug in func_get_arg() - - Get rid of compiler warnings for unused function crash() - -2000-02-13 Zeev Suraski - - * zend_constants.c: Fix a memory leak - -2000-02-13 Andi Gutmans - - * zend_hash.c: - Save a function call one very hash_add - - * zend_hash.c - zend_hash.h: - - Make startup a bit faster by changing some hash_update()'s and hash_add()'s - to hash_update_ptr()/hash_add_ptr() - - * zend_hash.c: - - Fix a couple of potential bugs where we were using emalloc/efree instead - of pemalloc/pefree. - - Fix a bug were we potentially would be freeing the key by mistake - -2000-02-13 Zeev Suraski - - * zend_builtin_functions.c: *** empty log message *** - - * zend_operators.c: Make (array) false == array() and not array(false) - -2000-02-11 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made a couple of typedefs for zend_hash_apply_*() calls. - -2000-02-11 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: Update .dsp's - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_config.w32.h - zend_constants.c - zend_execute.c - zend_extensions.c: Fine tune Andi's patch - -2000-02-10 Andi Gutmans - - * zend.h: - #define ZEND_WIN32 differently - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_constants.c - zend_execute.c - zend_extensions.c: - Finally beautify those WIN32|WINNT checks - - * zend_execute.c: - Shouldn't be there - - * zend_execute.c: - Cleanup the code - -2000-02-09 Zeev Suraski - - * zend-parser.y - zend_execute.c: - Fix last known nasty bugs in Zend. It'll be cool if there are no new ones :) - -2000-02-09 Thies C. Arntzen - - * zend_execute.c: foreach() works now for objects as well. - -2000-02-08 Zeev Suraski - - * zend_operators.c: Fix declaration - - * zend_execute.c: Fix an elusive bug - -2000-02-08 Andrei Zmievski - - * zend_operators.c: Fix up the patch. - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Patches from Walter for strncmp() stuff. - -2000-02-07 Zeev Suraski - - * zend_highlight.c: Remove old unnecessary check - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_highlight.c: - Syntax highlighting was erronously emitting more than one semicolon and/or garbage with heredocs - -2000-02-06 Andi Gutmans - - * zend_compile.c: - - Support the string offset syntax $a{2} with the regular array opcodes. - Will need to write new opcodes sometime but right now it's good enough - to announce the change to this string offset syntax for beta 4. - -2000-02-05 Andi Gutmans - - * zend-parser.y - zend_compile.c: - - This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list - by mistake contains the same variable twice. - - BTW, there is no defined order of assignment. The value of $a after the - previous example is undefined, and should not be assumed to be either 1 - nor 2. - -2000-02-05 Zeev Suraski - - * zend_execute.c: More cleanup - - * zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: Pass the executor globals to internal functions - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_modules.h - zend_variables.c: - Stop passing list/plist to internal functions - - Add a typedef for the pCopyConstructor function pointer - - Minor hacks - - * zend-scanner.l: - That was the broken downcasting that prevented the interactive C++ mode from working properly under UNIX - -2000-02-04 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Maintain a state of whether we're compiling and/or executing - -2000-02-03 Andrei Zmievski - - * zend_API.c - zend_API.h: *** empty log message *** - -2000-02-02 Zeev Suraski - - * zend_API.c: - Fix built-in classes with more than 5 methods - - * zend_compile.c: - - Fix the annoying problem with list(), that surfaced up after our recent cleaning - patches - -2000-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: Added add_property_unset() and add_property_bool(). - -2000-02-01 Zeev Suraski - - * ZendTS.dsp - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_execute_locks.h: Improve dependencies - - * zend_execute.c: Sort out a gdb problem - - * zend_execute.c: Fix warning - -2000-02-01 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_globals.h: - Get rid of remains of garbage. - - This should fix Thies' UMR - -2000-02-01 Thies C. Arntzen - - * zend_execute_API.c: - moved destroying of garbage before resource-list gets destroyed - (see my previous mail) - zeev, andi - please comment! - - * zend.c: added missing break. - - * zend_hash.c - zend_hash.h: - took out zend_hash_pointer_update() & zend_hash_pointer_index_update_or_next_insert() - i really prefer link-errors instead of runtime-errors, don't you? - -2000-01-31 Andi Gutmans - - * zend_compile.h: - This has to always be done. - -2000-01-31 Zeev Suraski - - * zend-parser.y - zend_compile.h - zend_execute.c - zend_execute_API.c: - Optimized garbage mechanism - - Fixed another buglet in the parser - - * zend-parser.y - zend_alloc.c - zend_execute.c - zend_fast_cache.h: - Fix foreach() - - Fix indirect reference with object properties - -2000-01-30 Andi Gutmans - - * zend_execute.c: - - Fix the bug Thies found where I forgot to change a break; to NEXT_OPCODE(); - - If you find anymore let me know - - * zend_alloc.h: - Run it on align_test - -2000-01-29 Zeev Suraski - - * zend_compile.c: Fix ``'s - - * zend-parser.y - zend-scanner.l - zend_compile.h: Fix require() - -2000-01-29 Andi Gutmans - - * zend-parser.y: - Get rid of another rule which isn't needed. - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Add parser support for string offsets. This added three shift/reduce - conflicts but they all seem to be fine. - - Cleaned up the parsing rules a bit and made them much more compact and - elegant. - - Please CVS update and see that I didn't break anything. - - * zend_alloc.h: - - This will save some memory w/ GCC compilers on some platforms - - * zend_execute.c: - Yet another tiny optimization. - -2000-01-28 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c: - Make loop a bit faster. - - * zend.h: - Make sure its use is understood. - - * zend.h - zend_execute.c: - Double the speed of some key switch() tests for Win32. - - * zend_execute.c: - - This makes the switch() statement twice as quick. Moving to enum - might make this a general speed up for other platforms too - -2000-01-26 Andi Gutmans - - * zend_execute_API.c: - Keep objects as references. - - * zend_execute_API.c - zend_opcode.c: - - Allow is_ref to become 0 in case the refcount is back to 1. - -2000-01-24 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Make foreach() now copy the array but use the original array. It can - still be optimized A LOT but it's only a performance issue and not - a feature issue. - -2000-01-24 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_operators.c - zend_operators.h: - Implement declare() with declarables framework - - Implement ticks - Germany&Norway - 5 points! - - * zend_execute.c - zend_execute_API.c: Fixes - -2000-01-22 Zeev Suraski - - * zend_execute_API.c: Fix an elusive bug - -2000-01-20 Zeev Suraski - - * zend_hash.c: Add some order... - - * zend_hash.c: Indentation fixes - -2000-01-19 Andi Gutmans - - * zend_hash.c: - Optimize zend_hash_del a tiny bit. - - * zend_hash.c - zend_hash.h: - Hopefully fix the hash problem. - - * zend_hash.c: - Hrm I'm not concentrating - - * zend_hash.c: - - Actually the destructor should run after the data is already detached - from the hash but before the bucket is freed. - - * zend_hash.c: - - Rollback hash_apply and friends. They assume now that hash_del is reentrant - as it first applies the destructor and only later nukes the bucket - - * zend_hash.c: - - Run destructor before the hash structure is modified, thus, making - hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now). - - * zend_hash.c: - Undo a bug we introduced. (Another one out there). - -2000-01-19 Thies C. Arntzen - - * zend_API.h: - RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet - -2000-01-18 Zeev Suraski - - * zend_execute.c: Leak fix - -2000-01-18 Thies C. Arntzen - - * zend_API.h: RETURN_NULL & RETVAL_NULL don't need (). - -2000-01-17 Thies C. Arntzen - - * zend_hash.c: use defines - -2000-01-17 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_variables.c: Get rid of the IsPointer functionality in the hash. - - * zend_hash.c: - Fixes a newly introduced bug in the hash - - * zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: - Destructors no longer return ints, the low level problem it was intended to solve is long gone now... - -2000-01-16 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: - - Make zend_hash_apply() (and friends) reentrant and much, much quicker - - Introduce zend_hash_graceful_destroy(), which allows the destructor functions to - use zend_hash_apply() and/or zend_hash_graceful_destroy() - - Switch to zend_hash_graceful_destroy() in the resource list shutdowns - - * zend.c - zend_compile.c - zend_compile.h: - Allow module startup to be separate from the compiler/executor startup - -2000-01-16 Thies C. Arntzen - - * zend_hash.c: make the ht->inconsistent stuff less ugly:) - -2000-01-15 Zeev Suraski - - * zend_execute_API.c - zend_list.c: Fix a bug in call_user_function_ex() - - * zend-parser.y: - Added support for $foo->{$bar}["foobar"] notation (was supported in PHP 3) - -2000-01-15 Thies C. Arntzen - - * zend_hash.c - zend_hash.h: - if ZEND_DEBUG mode is on we'll now see warnings when a HashTable is accessed - while it's inconsistent. - - Zeev, Andi - you welcome to revert this patch if you don't like it - i find it - useful! accesssing inconsistent hashtables is one of the hardest things to track! - -2000-01-14 Andrei Zmievski - - * zend_highlight.c: - Since we're highlighting code, put and around the code. - -2000-01-13 Zeev Suraski - - * zend.h - zend_config.w32.h: Make Win32 compile again - -2000-01-12 sascha - - * acconfig.h - zend.h: - Move dl stuff from acconfig.h into zend.h. That allows us finer control - when it comes to suppressing dlfcn.h. - -2000-01-09 Zeev Suraski - - * zend_execute.c: Functionality & crash fixes - -2000-01-04 Andi Gutmans - - * zend.h - zend_operators.c: - - Rename IS_BC to FLAG_IS_BC. We will probably nuke it. - -2000-01-04 Thies C. Arntzen - - * zend_API.h: added ZVAL_*() macros. - -2000-01-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Separate the overloaded objects' types from Zend's data types. - There is no reason for them to be the same, and IS_METHOD just cluttered - there data types. - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend-parser.y - zend.c: - Change IS_UNSET -> IS_NULL - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix a bug when using [] on a string - -2000-01-03 Joey Smith - - * zend_operators.c: number.h comes from ext/bcmath, not functions/ - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-03 Andi Gutmans - - * zend_operators.c: - Fix compare_function() for IS_UNSET - -2000-01-02 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-02 Thies C. Arntzen - - * zend_API.h: renamed RET???_UNSET -> RET???_NULL - -2000-01-01 sascha - - * Zend.m4 - acconfig.h - acinclude.m4: Some cleanup - -2000-01-01 Andi Gutmans - - * zend_operators.c: - - IS_NULL should be 0 when converted to a long although I don't think it - really should be documented. - -2000-01-01 Zeev Suraski - - * zend_operators.c: Fix buglet - -1999-12-31 Zeev Suraski - - * Zend.dsp - ZendTS.dsp: .dsp updates - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: - Add Release_inline builds - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_operators.h - zend_variables.c: - Nuke undefined_variable_string - - Introduce IS_UNSET - -1999-12-31 Andi Gutmans - - * ZendTS.dsp - zend-parser.y - zend_compile.c - zend_compile.h: - - Fix bug #3073. continue in do..while() loops should work now - -1999-12-30 Zeev Suraski - - * zend.c - zend_alloc.c - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h: - This should enable people to use ALLOC_ZVAL() in code outside the php4.dll - -1999-12-30 sascha - - * Zend.m4: - Solaris' sed does not like this expression. Since -O0 is the default, - we can also omit it. - -1999-12-29 Zeev Suraski - - * zend_variables.c: - - Change var_reset() to set bool(0) instead of string("") - - Authors should go over their code and change it to use var_reset() instead of manually - setting it to string(""), in case they're interested in the false value. - - * zend_alloc.c: time_t is an int under Linux... this should always work. - -1999-12-28 sascha - - * zend_alloc.c: Fix warnings - -1999-12-28 Thies C. Arntzen - - * zend_API.h - zend_constants.c: new constant: SQL_NULL - new macros: RETURN_SQLNULL,RETVAL_SQLNULL,IS_SQLNULL - -1999-12-27 Zeev Suraski - - * zend_fast_cache.h: Fix - -1999-12-27 Andi Gutmans - - * zend_API.c: - Get rid of warning - -1999-12-27 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_fast_cache.h - zend_globals.h - zend_opcode.c - zend_operators.c - zend_variables.c - zend_zval_alloc.h: - Generalize the fast cache mechanism - - Add the HashTable struct to the fast cache mechanism - -1999-12-27 Andi Gutmans - - * zend_API.c: - - Make zend_internal_function allocate a full zend_function structure so - that we don't get memory overruns and Thies doesn't get angry :) - -1999-12-27 Zeev Suraski - - * zend_alloc.c: *** empty log message *** - - * zend_globals.h - zend_zval_alloc.h - zend_alloc.c: Add cache statistics support - -1999-12-27 Thies C. Arntzen - - * zend.c: fix UMR in ZTS mode - -1999-12-26 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_alloc.c - zend_globals.h - zend_zval_alloc.h: - - Enable the new zval cache on debug too. No real reason not to, and it keeps - the code cleaner. - - ZTS compile fixes - - * zend_alloc.c: Fix buglet - - * zend_zval_alloc.h: Add missing file - - * zend.h - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_globals.h - zend_operators.c: - Introduce a zval-specific cache - 5-15% speed improvement - -1999-12-26 sascha - - * Makefile.am - acinclude.m4: Makefile.am: Add dummy target for dependencies - acinclude.m4: Cache result of broken sprintf check - -1999-12-26 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c: Change ALLOC_ZVAL() semantics - - * zend_alloc.c - zend_alloc.h - zend_globals.h: namespace protection - -1999-12-25 Zeev Suraski - - * zend_ptr_stack.c - zend_ptr_stack.h: inline functions cannot accept varargs - -1999-12-25 Andi Gutmans - - * zend-parser.y: - Prepare Zend for the new $a{2} string offset syntax. - -1999-12-24 Zeev Suraski - - * zend_config.w32.h: - Use __forceinline under Win32 (inlining under Win32 gives roughly 30% performance - increase) - - * zend-scanner.l: Shut gcc up - - * zend_compile.c: Optimize - -1999-12-24 Andi Gutmans - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c: - - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use - them. - -1999-12-24 Zeev Suraski - - * zend_compile.c: - Use function_add_ref() here too - -1999-12-23 Zeev Suraski - - * zend_compile.c - zend_opcode.c: - Fix a class inheritence leak, when using static varibles in a parent class member function - - * zend_compile.c: This one slipped away - -1999-12-23 sascha - - * Zend.m4: Rename option to match description string - -1999-12-23 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: - - require() of a dynamic expression now has the standard require() semantics - - Fixed a memory leak in require() of a dynamic expression - -1999-12-23 sascha - - * Makefile.am - Zend.m4: - Compile zend_execute.c with special CFLAGS. For GCC, INLINE_CFLAGS - contains -O0 to disable optimizations. This can be disabled by using - the appropiate parameter. - -1999-12-22 sascha - - * zend_builtin_functions.c: Kill compiler warning - - * Zend.m4: Don't set DEBUG_CFLAGS to -g, if -g is already in CFLAGS - -1999-12-22 Zeev Suraski - - * zend.c - zend.h: export - - * zend_extensions.h: Those void's don't belong in there - - * zend_API.h - zend_builtin_functions.c: - Fix function_exists() - - * zend_execute.c: - - Fix a very old legacy memory leak in break(n) statements - - * zend_execute.c: Fix for the array() initialization bug Stas found - -1999-12-22 Andi Gutmans - - * zend_compile.c: - Remove unused variable. - -1999-12-21 Zeev Suraski - - * zend-scanner.l - zend.h - zend_compile.c - zend_execute.c: - Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc() - whenever you're dealing with strings that might be coming back from the engine - there seem - to be a few other places like this in PHP. - -1999-12-21 Andrei Zmievski - - * zend.c - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend_variables.h: We're using ZVAL's now. - -1999-12-21 Zeev Suraski - - * zend_execute.c: - Fix Sascha's leak. Good report! - - * zend_alloc.c: No need to block for interruptions so early - -1999-12-21 sascha - - * Zend.m4: - Explicitly check for C++ preprocessor, otherwise autoconf forces it onto - us at the wrong place (subsequent autoconf checks failed). - -1999-12-20 Zeev Suraski - - * zend_compile.c: - Fix @expr - - * zend.h - zend_compile.c - zend_execute.c: - - Fix the crash Thies was experiencing (returning a function call could cause a crash) - - Fix the leak Thies was experiencing (@fcall() leaked) - -1999-12-19 Zeev Suraski - - * Zend.dsp: Some updates - - * Zend.dsp - ZendTS.dsp: Make these work again - - * FlexLexer.h - Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - configure.in - flex.skl - libzend.dsp - libzend.m4 - libzendts.dsp: libzend -> Zend - - * zend.h - zend_API.h - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - - Made things work again (Thies, everybody - please check the latest CVS and see if you're - still getting any problems) - - Changed the interface of call_user_function_ex() to support returning of references - -1999-12-19 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - More fixes related to the return references patch - - eval_string() and call_user_function_ex() still don't work. - - The libzend tree is untested and might not be stabl yet. - -1999-12-19 sascha - - * Makefile.am: Add zend_sprintf.c - - * acconfig.h - zend_sprintf.c: configure sets ZEND_BROKEN_SPRINTF - - * acinclude.m4: Variables are not interpolated unless we use _UNQUOTED - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.h: - The tree compiles again - -1999-12-18 sascha - - * libzend.m4: Let autoconf check for the proper inline keyword - - * Makefile.am - libzend.m4: - automake created illegal target names due to the ZEND_SCANNER definition. - We now substitute @ZEND_SCANNER@ directly - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c: - - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht) - - Rename getParameters() and friends for consistency and namespace cleanliness - -1999-12-17 Zeev Suraski - - * zend_constants.c: - Made PHP_VERSION and PHP_OS work again - - More php3_ cleanup - - Restored the PHP_VERSION and PHP_OS constants - -1999-12-17 sascha - - * libzend.m4: Define inline to inline explicitly - - * Makefile.am - acinclude.m4 - configure.in - libzend.m4: Move config code into separate file - -1999-12-17 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - By mistake commited this to the branch. It fixes a bug we introduced with - the return reference patch. - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: Doh! I'm an idiot. - - * zend_builtin_functions.c - zend_compile.c: - s/inheritence/inheritance/g - - Added is_subclass_of() function - -1999-12-15 Zeev Suraski - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Implement return by reference: - - In function declaration instead of the return statement - - In the assignment phase - - Implement ability to turn off support for call-time pass by reference - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: val->len - - * zend_builtin_functions.c: Faster, must go faster. - -1999-12-15 Andi Gutmans - - * zend_execute.c - zend_opcode.c - zend-parser.y - zend_compile.c - zend_compile.h: - - Preliminary return ref patch. It breaks libzend so don't use this branch - right now. - -1999-12-14 Andrei Zmievski - - * zend_builtin_functions.c: - Added class_exists() - - Moved function_exists() here from from the basic_functions.c - - Modified method_exists() to convert method name to lowercase - when checking - -1999-12-13 Andi Gutmans - - * zend_execute.c: - - Fix problem when return_value's is_ref/refcount is overwritten by the - internal function. - -1999-12-11 Andi Gutmans - - * zend_execute.c: - Another small fix. - - * zend_execute.c: - Support returning references - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - This is supposed to be commited to the RETURN_REF_PATCH branch which is - the beginning of work on allowing returning of references from functions. - -1999-12-07 Andi Gutmans - - * zend-scanner.l: - - opened_path should not be freed here as the zend_file_dtor() takes care - of it. This doesn't fix the bug report for the crash of highlight_file() - though. - -1999-12-07 Zeev Suraski - - * zend-parser.y: Support ZTS definition in zend_config.h - -1999-12-06 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c: Move the #include of zend-parser.h out of zend_compile.h - - * zend-parser.y - zend_globals_macros.h: More localization - - * zend-parser.y - zend_compile.h - zend_globals_macros.h: Localize a couple of macros - -1999-12-05 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -1999-12-05 sascha - - * .cvsignore - zend-parser.y - zend.c - zend_API.c - zend_compile.c - zend_execute_API.c: Fix some warnings - -1999-12-04 Andrei Zmievski - - * zend_API.c: *** empty log message *** - - * zend_API.c - zend_API.h - zend_hash.h: Added zend_set_hash_symbol() function. - -1999-12-04 Thies C. Arntzen - - * zend_API.h: - backed out last change after andi decided on a different approach. - -1999-12-04 Andi Gutmans - - * zend_API.h: - - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard - ZEND_SET_SYMBOL() - -1999-12-04 Zeev Suraski - - * zend-scanner.l - zend_builtin_functions.c - zend_compile.c: - Implement get_used_files() and get_imported_files() - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h: - - Break the zend->PHP dependency introduced by the .php extension for use(), - by providing an API - - Enable Stig's patch for use() extensions (it wasn't refered to by the parser) - - Fix a memory leak in that code - -1999-12-04 Thies C. Arntzen - - * zend_API.h: the new SET_VAR_* macros forgot to set the refcount! - -1999-12-04 Sam Ruby - - * zend-scanner.l: build error - windows - -1999-12-04 stig - - * zend-scanner.l - zend_compile.h: Fix typo, add prototype for use_filename(). - - * zend-scanner.l: "use" should use arg+".php" as parameter to require - -1999-12-04 Zeev Suraski - - * zend-scanner.l: This should fix the fd leak with include()/require() - -1999-12-03 Andrei Zmievski - - * zend_API.h: *** empty log message *** - - * zend_API.h: Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro. - -1999-12-03 Thies C. Arntzen - - * zend-scanner.l: revert my last patch - WARNING: we leak fd's again. - add initialzation of opened_path highlight_file() - -1999-12-03 Andi Gutmans - - * zend_API.h: - Remove _EX and make it the old _LENGTH - -1999-12-02 Andi Gutmans - - * zend_API.h: - Add _EX macro for Andrei - -1999-12-02 Zeev Suraski - - * zend-scanner.h - zend_compile.h: Solve a couple of compile issues - -1999-12-02 Thies C. Arntzen - - * zend-scanner.l: - php_fopen_wrapper_for_zend() does *NOT* insert the opened files into any list - the caller needs to fclose() the file. (not sure if this is desired) - fixed "Uninitialized memory read" when including URLs - -1999-12-01 stig - - * zend-scanner.h - zend.c - zend.h - zend_alloc.h - zend_builtin_functions.h - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_extensions.h - zend_globals_macros.h - zend_hash.h - zend_indent.h: Fix warnings surfacing in maintainer-mode. - -1999-12-01 Zeev Suraski - - * zend_API.h: - Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_LENGTH(), part 2 - - * libzendts.dsp - zend_API.h: - Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_LENGTH() - -1999-12-01 Andi Gutmans - - * zend_execute.c: - - Forgot to check for BP_VAR_IS in the fix made for Thies' string offset - problem. - -1999-11-30 Andi Gutmans - - * zend_API.c: - Applied Thies' bug fix. Great work! - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Add use support (behaves like require, but will not use the same file twice) - - Add import support (behaves like include, but requires parentheses; will not - use the same file twice; Currently, it is not yet properly implemented, and - only behaves like include) - - * zend_execute.c: - - Fix problem Thies reported. We by mistake separated variables which were - being fetched for read only. - -1999-11-27 Zeev Suraski - - * zend_alloc.c: Add ability to disable the memory cache - -1999-11-26 Zeev Suraski - - * zend-scanner.l: - Fix fd leak in ZTS mode - - * zend-scanner.l - zend_compile.c: UNIX/non ZTS compile fixes - - * zend-scanner.l - zend_compile.c - zend_compile.h: - Improve the file handle closing code - - * zend_llist.c - zend_llist.h: - Modify zend_llist_del() to receive a comparison function - - * zend_API.c: - This request_shutdown() is no longer needed (never was needed really) - - * zend-scanner.l: This should get the file to close properly - -1999-11-26 sascha - - * Makefile.am: Rebuild libzend.la, if the scanner was rebuilt - -1999-11-26 Zeev Suraski - - * zend_API.c - zend_modules.h: Remove request_started, increase thread safety - -1999-11-25 Zeev Suraski - - * zend_execute.c: That's a more thorough fix... - - * zend_execute.c: - Fix bug #2817 - assignments to string offsets could erronously modify unrelated strings - -1999-11-22 Zeev Suraski - - * zend_alloc.c: Fix compile problem with enable-memory-limit - - * zend-scanner.l: Fix inconsistencies with here-docs implementation - - * zend-scanner.l - zend_globals.h: Fix #2744 - -1999-11-21 Andi Gutmans - - * zend_execute.c: That slipped away - -1999-11-21 Zeev Suraski - - * zend.h - zend_API.c - zend_compile.c - zend_execute.h - zend_execute_API.c: - Optimize class instanciation - - Fix constant instanciation for array elements inside objects - -1999-11-19 Andi Gutmans - - * zend_execute.c: - - Moved var_uninit() for return_value to the beginning of DO_FCALL. - We forgot to do it for overloaded methods - - * zend.h - zend_execute.c: - - Functions whose return values aren't used have them freed in DO_FCALL - and don't need a special ZEND_FREE opcode following them anymore - -1999-11-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - If a function's return value is unused then don't create a ZEND_FREE - opcode but free it after the function call in zend_execute. - - * zend_execute.c: - Forgot this - -1999-11-16 Andi Gutmans - - * zend_execute_API.c: - Weird that this compiled for me. - - * zend.h: - CHange used_return_value -> return_value_used - - * zend_compile.c: - - In any case create the free opcode. Need to allow the functions to - create a hint. - - * zend.h - zend_compile.c - zend_execute.c: - - Add support for used_return_value passed to internal functions. - -1999-11-14 Andi Gutmans - - * zend_compile.h: - Fix comment as to Joey's findings - -1999-11-13 Andi Gutmans - - * zend_execute.c: - Fix crash with string offset assignments. - -1999-11-04 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made zend_hash_rehash() callable from outside. - -1999-11-03 Andi Gutmans - - * zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - Add support for BYREF_FORCE_REST - -1999-10-28 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix for Thies' leak and Andrei's crash - -1999-10-25 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -1999-10-23 Sam Ruby - - * libzend.dsp - libzendts.dsp: - Allow CYGWIN directory to be specified as via environment variable - -1999-10-22 Andi Gutmans - - * zend_execute.c: - Fix isset() with string offsets. - -1999-10-19 Thies C. Arntzen - - * zend_operators.c: fixed is_identicat_function() - -1999-10-19 Andi Gutmans - - * zend_compile.h: - Move IS_IDENTICAL next to IS_EQUAL - - * zend_operators.c: - Fix is_identical function - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Preliminary submit of Thie's patch. Will fix the rest on Windows - as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL - -1999-10-18 Andrei Zmievski - - * zend_API.h: Be safe, use (). - -1999-10-15 Andrei Zmievski - - * zend_operators.c - zend_operators.h: unstatic'fy is_numeric_string() - - * zend_hash.c - zend_hash.h - zend_compile.c: *** empty log message *** - -1999-10-15 Andi Gutmans - - * zend_operators.h: - Add convert_to_number_ex() - -1999-10-14 sascha - - * configure.in: - Add "--disable-inline" for low-memory machines (be it limited - RAM or virtual memory). It's also useful for Digital C where - the C++ compiler thinks "inline" is an invalid specifier. - - * Makefile.am: Use sources from $(srcdir) - -1999-10-13 sascha - - * Makefile.am: Do not use $< for anything but implicit rules. - -1999-10-13 Thies C. Arntzen - - * zend_list.c: - (zend_fetch_resource) added warinig if resource is of wrong type - -1999-10-13 sascha - - * acconfig.h: Disable ZEND_EXTENSIONS_SUPPORT, if RTLD_NOW is not defined. - - Note that this part could be made platform independent by using - libltdl (for Solaris, Linux, *BSD, HP-UX, Win16/32, BeOS). - -1999-10-12 Thies C. Arntzen - - * zend_list.c - zend_list.h: new improved resource-API - -1999-10-12 sascha - - * acconfig.h: - Use DL_LAZY for OpenBSD. This seems to be a compatibility flag which - should be used for the 2nd parameter to dlopen. - - http://www.openbsd.org/cgi-bin/cvsweb/src/share/man/man3/dlfcn.3?rev=1.8 - -1999-10-12 Andi Gutmans - - * zend_execute.c: - - object.ptr was made NULL in DO_FCALL but wasn't restored. Right now I - push it in DO_FCALL and at the end of do_fcall_common it always gets - popped. We might be able to optimize it out. - -1999-10-11 Andrei Zmievski - - * .cvsignore: *** empty log message *** - - * zend_hash.c - zend_hash.h: Modified zend_hash() to accept a pointer to sort function. - -1999-10-11 Andi Gutmans - - * zend_execute.c: - - No idea why this bug didn't exist before. But I'm too tired to think of it. - During a regular do_fcall we need to set object.ptr to NULL and, thus, - push it in the beginning and pop it in the end. - I hope this fix more or less cuts it. I just want to sleep :) - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Didn't lower refcount when doing an internal function call linked to a regular object. - -1999-10-10 Thies C. Arntzen - - * .cvsignore: added some more autoconf/libtool stuff to be ignored - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Clean up a bit. Separate before the locking so that we can use SEPARATE_ZVAL - macro. - -1999-10-10 sascha - - * build.mk: Add clean target which removes standard targets - - * build.mk: build.mk can be used to generate build tools. It is usually - faster than buildconf, since it rebuilds only components, if - it is necessary. To use it, run - - $ make -f build.mk - -1999-10-09 Andi Gutmans - - * zend_execute.c: - Shouldn't be needed - - * zend_execute.c: - - God damn this sucked. I hopefully fixed the problems with classes although - we might need to clean stuff up a bit. - -1999-10-09 sascha - - * acconfig.h: - Define RTLD_NOW to DL_NOW, if RTLD_NOW is not defined (for OpenBSD). - -1999-10-07 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: added zval_del_ref() function - -1999-10-07 Andi Gutmans - - * zend_execute.c: - Reverse my patch - -1999-10-06 Andi Gutmans - - * zend_execute.c: - - Fixed memory leak with this pointer. It was somtimes initialized with refcount - of 2 instead of 1. - - Also fixed a place where object.ptr_ptr is set to pointing to a zval* instead - of zval**. I don't think this is ever used so we might be able to remove it - altogether. - -1999-10-06 Thies C. Arntzen - - * zend_execute.c: fix for using resources as array indices - -1999-10-05 sascha - - * configure.in - zend.h - zend_globals.h: More portability stuff - - * configure.in: OSF/1 V4.0 wants -lcxx - - * zend_compile.h: - This causes link problems with anything higher than -O0. - -1999-10-04 sascha - - * Makefile.am: Add necessary rule. - - * Makefile.am - acconfig.h - acinclude.m4 - buildconf - configure.in - zend_config.in: Use libtool to build. - -1999-10-04 Thies C. Arntzen - - * zend_builtin_functions.c: use getParametersEx for all builtin functions - - * zend_API.c - zend_API.h: added add_*_resource() and add_*_bool() functions - -1999-10-03 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - Hooray. This might actually work. (I hope) - -1999-10-03 sascha - - * configure.in: Make it executable. - -1999-10-02 Andi Gutmans - - * zend_execute.c: - Another locking fix. - - * zend_execute.c: - Fixed locking problem when fetching string offsets - -1999-10-02 Zeev Suraski - - * zend_execute.c: - Fix the leak reported on the PHP 3 list (isset() on string offsets) - -1999-10-01 Andi Gutmans - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - - Move is_ref back to being an unsigned char and not a bit field. - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Remove locking support completely - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - For Andrei. Implement references in array() initializations - -1999-09-29 Zeev Suraski - - * zend_config.w32.h: *** empty log message *** - -1999-09-29 Andi Gutmans - - * zend_operators.c: Fix leak in += with arrays - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Fix SEND_VAR problem after fetch'ing a variable and not knowing the fetch type - -1999-09-29 Thies C. Arntzen - - * zend_API.c - zend_API.h: added add_property_resource - -1999-09-28 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c: - - Stop using the locking mechanism and start using refcount. - Now we know when we need to free but we still need to support it - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - First part of the patch which makes reads use ptr and not ptr_ptr. - -1999-09-28 sascha - - * acconfig.h - configure.in - zend-scanner.l: Provide alternative istdiostream. - - This has been tested with Sun WorkShop 4.2 C++ which does not - contain class istdiostream. - -1999-09-26 sascha - - * Makefile.am - configure.in: Actually allow to set CXXFLAGS - - * configure.in - zend_config.in: - Build communication channel and add checks for C++ library - -1999-09-26 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Changed Ts{}.var to Ts{}.var.ptr_ptr. - -1999-09-24 sascha - - * zend_operators.h: Add _ex API implementation for booleans. - -1999-09-24 Zeev Suraski - - * zend_list.c - zend_list.h: Exify the standardized resource stuff - -1999-09-23 Andi Gutmans - - * zend_operators.c: - Fix bug #2364. - I haven't checked all of the conversion macros yet but there's a change - there are more such bugs there. - -1999-09-23 sascha - - * configure.in: Fix vpath build w/ thread-safe enabled on Unix. - -1999-09-22 Thies C. Arntzen - - * zend_builtin_functions.c: - preliminary fix for each until andi & zeev clean up! - - * zend_list.c: - if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found! - -1999-09-21 Andi Gutmans - - * zend_compile.c: - - Fix problem where function parameter fetches were created too late. - -1999-09-21 Zeev Suraski - - * zend_builtin_functions.c: Add get_func_args() - - * zend_builtin_functions.c: *** empty log message *** - -1999-09-20 Andi Gutmans - - * zend_builtin_functions.c: - - Move some more Zend internal functions from PHP - - * zend-parser.y: - Next part of locking fix. - $var = expr; and $var += expr; first create code for expr and later on - for the fetch_w of $var. - - * zend_builtin_functions.c: - Newline for Sun's compiler - - * zend_API.h - zend_builtin_functions.c: - Add some internal functions to Zend - - * zend_compile.c - zend_compile.h - zend_opcode.c: - - First step in fixing locking problem. Array fetches are now always done last. - Later on we will want to delay the write fetches even longer until after their - resulting expression is parsed. The way it is now, will make it very easy - to delay as long as we need. - - * zend_compile.c - zend_compile.h: - - Indirect references had all of the fetches by mistakenly backpatched. - Actually all of the fetches are supposed to be read, except for the last - one. - -1999-09-20 Zeev Suraski - - * libzend.dsp - libzendts.dsp - zend_builtin_functions.c: Added zend_num_args() and zend_get_arg() - - * Makefile.am - zend.c - zend_builtin_functions.c - zend_builtin_functions.h: - Add a file in which we can put Zend builtin functions - -1999-09-18 Andi Gutmans - - * zend_execute.c: - - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really - not sure this fix is OK.I can't remember all of what we did there. - -1999-09-18 Zeev Suraski - - * zend_list.c: Safer behavior - -1999-09-17 Thies C. Arntzen - - * zend_execute.c: make SUNs c89 happy - - * zend_execute_API.c: no // in the sources please - - * zend_globals_macros.h: added newline at end of file - -1999-09-17 Zeev Suraski - - * zend_execute.c: - Fix bug #2318 - -1999-09-16 Zeev Suraski - - * zend_operators.h: Introduce convert_to_*_ex() - -1999-09-16 sascha - - * configure.in: this helps compiling on non-ANSI C compliant platforms - -1999-09-13 stig - - * acconfig.h - configure.in: Make sure HAVE_LIBDL gets defined. - Disable more C++ tests when not configured for thread safety. - -1999-09-12 Zeev Suraski - - * zend.c: Make this class instanciatable - -1999-09-12 sascha - - * configure.in: check for c++ only, if thread safety is enabled - -1999-09-10 Zeev Suraski - - * zend_compile.c: Shut up a warning - -1999-09-09 Andi Gutmans - - * zend_compile.c - zend_globals.h - zend_stack.c - zend_stack.h: - Add foreach() freeing code. - - Fix switch() freeing code to only free current function's switch expressions. - - I have a feeling break expr; in a switch where expr > 1 leaks because it - won't free all of the expressions. Fix is probably not trivial. - - * zend_operators.c: - - Fix leak when decrementing strings which actually are longs. - -1999-09-08 Andi Gutmans - - * zend_execute.c: - - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We - casted to (long). - - * Makefile.am - libzendts.dsp: - Add -b option to flex++ - -1999-09-07 stig - - * acconfig.h: define tests first, use after. - -1999-09-06 Andi Gutmans - - * zend_config.w32.h: - Fix win32 compile - - * zend_config.w32.h: - Make zend compile again in Win32. - -1999-09-06 stig - - * .cvsignore: ignore zend-scanner.cc - - * ZendCore.dep - libzend.dsp - libzendts.dsp: hand-patched some MSVC files - - * Makefile.am - acconfig.h - acinclude.m4 - config.unix.h - config.w32.h - configure.in - zend-scanner.l - zend.h - zend_API.c - zend_alloc.c - zend_compile.h - zend_config.w32.h - zend_execute.c - zend_hash.c - zend_list.c - zend_ptr_stack.c - zend_sprintf.c: * header file cleanup - * fixed --enable-thread-safety build for UNIX - - I don't have a Win32 environment available, could someone please try - compiling on Win32 to see if I got all the header file stuff right there? - -1999-09-05 Andi Gutmans - - * zend_globals_macros.h: - Oops - - * libzendts.dsp - zend.c - zend.h - zend_alloc.c - zend_alloc.h - zend_globals.h: - Shift around header files. - -1999-09-04 Zeev Suraski - - * zend_list.c: Fix a stupid bug (from stefan@roehri.ch) - -1999-09-03 Zeev Suraski - - * zend_list.h: Damn, forgot to commit that - - * zend_list.c - zend_list.h - zend_modules.h: Add new API for resources - -1999-09-03 sascha - - * zend_modules.h: Add global startup/shutdown functions - -1999-09-03 Zeev Suraski - - * zend_operators.c: - Revert the IS_RESOURCE patch. It had some unintended behavior. - - * zend_variables.c: Let $GLOBALS actually work... - - * zend_operators.c: - Release resources when converting to other types (fix Thies's reported problem) - -1999-09-02 Zeev Suraski - - * zend_compile.c: - Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions - -1999-08-28 Zeev Suraski - - * zend_extensions.c - zend.h - zend_alloc.c - zend_extensions.h - zend_variables.c - zend_variables.h: *** empty log message *** - - * zend.h - zend_alloc.c - zend_alloc.h - zend_variables.c: Beef up debug macros - -1999-08-27 Zeev Suraski - - * zend_execute_API.c: Fix a crash bug in case of aborted execution - - * zend.h - zend_alloc.c - zend_alloc.h - zend_execute_API.c - zend_variables.c - zend_variables.h: Better debug macros - -1999-08-26 Andi Gutmans - - * zend_execute_API.c: - Damn. It wasn't a correct fix. This should do it. - When the zval ** are equal we don't want to assign_ref, in any other case - I can think of we do want to assign_ref. - - * zend_execute_API.c: - Fix leak when global is used in the global scope. - - * zend_compile.c: - Fix when redefining classes at run-time. - -1999-08-25 sascha - - * zend.h: make it compile with gcc again - -1999-08-25 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Add hash_apply_with_arguments() - - * zend-scanner.l: - More elegant fix for Win32 include_path - - * zend-scanner.l: - - Temporary fix to allow Win32 MT safe version to use zend_fopen(). - -1999-08-23 Andi Gutmans - - * zend_execute.c: - Fixed a specific memory leak linked to locking. - -1999-08-22 sascha - - * zend.h - zend_globals.h: This changes makes it work on egcs 1.1.2/Alpha - - * configure.in - zend.h: remove checks - -1999-08-20 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend.c: Fix for Thies's UMR - -1999-08-19 Andi Gutmans - - * zend-parser.y - zend_opcode.c: - - Make sure expr_list and echo_list are either empty or comma seperated - expressions - -1999-08-18 Thies C. Arntzen - - * zend-scanner.l: on unix ZTS gets defined in zend_config.h - -1999-08-17 Zeev Suraski - - * zend_execute_API.c: Fix #2012 - - * zend_execute.c: Fix #2070 - -1999-08-17 Andi Gutmans - - * zend.c - zend.h: - Add some ZENDAPI's - -1999-08-15 Andi Gutmans - - * zend_execute.c: - Oopsie - - * zend.h - zend_compile.h - zend_execute.c - zend_globals.h: - Optimize the execute stack a bit. - -1999-08-14 Zeev Suraski - - * zend_compile.c: Fix several class issues - - * zend_compile.c - zend_compile.h: - Generate better warnings for class/function redefinitions - -1999-08-10 Andi Gutmans - - * zend_compile.c - zend_constants.c: - Got rid of the C++ comments. - -1999-08-09 Andi Gutmans - - * zend_execute.c: - Thies's crash fix. - -1999-08-07 Zeev Suraski - - * zend_compile.h - zend_execute.c - zend_execute_API.c: Fix a few leaks - -1999-08-06 Zeev Suraski - - * zend_execute_API.c: Fix a bug in call_user_func_ex() - - * zend_API.h: Now that's an annoying bug. - - * zend_API.h - zend_execute_API.c: Introduce call_user_func_ex() - - * zend_execute.c: *** empty log message *** - -1999-08-03 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - - Initialize extended value's and put the fetch_type in it's own variable - name. - -1999-08-02 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Make set_compiled_filename() return a pointer to the allocated file name - -1999-07-31 Zeev Suraski - - * zend_API.h: These aren't necessary - -1999-07-30 Zeev Suraski - - * zend_API.h: Support symbols in any symbol table, not just the active one - -1999-07-30 Andi Gutmans - - * zend_ptr_stack.c: - Damn that's more like it. - - * zend_ptr_stack.c: - Cut&paste crap - - * zend_execute.c - zend_ptr_stack.c - zend_ptr_stack.h: - - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit. - There seems to be no reason for stack->top in the ptr_stack except for - when realloc()'in the stack. I think I'll remove it. - -1999-07-30 Zeev Suraski - - * zend_API.h: - * Setting variables in the global scope wasn't handling is_ref's properly - -1999-07-29 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Fixed a leak when doing inheritance. The parent class name wasn't being freed. - - Fixed a stack leak. Functions that had late argument binding were set up as - INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding - DO_FCALL_BY_NAME. - -1999-07-28 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c: - Fixed various inheritance problems & Andrey's leak - -1999-07-27 Zeev Suraski - - * zend_compile.c: Inherit parent's constructor - - * zend_compile.c: - Fix runtime inheritence (child functions/members should have higher precedence) - -1999-07-27 Andi Gutmans - - * zend_execute.c: - Add missing lock - - * zend_execute.c: - Fix up the new operator a bit more. - -1999-07-27 Zeev Suraski - - * zend_execute.c: Set reference count and is_ref values for new objects - -1999-07-26 Zeev Suraski - - * zend_operators.c: - - Fixed a memory leak when using assignment-op operators with lvalue of type - string (or array/object) - - * zend_compile.c: *** empty log message *** - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a bug in inheritence from classes defined in include files, that are - inherited from require()'d files - -1999-07-26 Andi Gutmans - - * zend_execute.c: - Oops I erased this by mistake - - * zend_execute.c: - - Should be a complete fix now. This break away code should maybe be made - somewhat generic - - * zend_execute.c: - Temporary fix for "this". Have to fix it tomorrow. - - * zend_execute.c: - - Fix compile error. Weird that Visual didn't catch this one. - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c: - Fix the new operator incompatibility. - - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped - win32 from compiling. This needs to be fixed!!! - - Check out libzend to compile the tree now. - - * zend.h - zend_execute.c: - new operator fixes - -1999-07-25 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Commiting to branch newoperator. - - To check it out do cvs checkout -rnewoperator libzend - -1999-07-24 Zeev Suraski - - * zend_compile.c: Fix that memory leak... nested function issue remains - - * zend_compile.c - zend_stack.c - zend_stack.h: Fix RETURN & SWITCH memory leak issue - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Thoroughly fix the SWITCH problem. No RETURN handling yet. - -1999-07-23 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: Fix bug #1812 - - * zend.h - zend_operators.c: - * Add an API macro users can use to ensure an array member can be modifed - before they modify it. - * Fix a bug and remove redundant code in convert_to_long() (booleans and - resources weren't changing their types - -1999-07-22 Zeev Suraski - - * zend_constants.c: New constants - -1999-07-22 stig - - * buildconf: identify ourselves - -1999-07-20 Andi Gutmans - - * zend_execute.c: - Include alloca.h when need and available. - - * zend_compile.c - zend_execute_API.c - zend_list.c - zend_operators.c: - Get rid of C++ comments - -1999-07-19 Zeev Suraski - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: 0.91 update - -1999-07-19 Andi Gutmans - - * zend.h - zend_execute.c - zend_extensions.h: * Fix Zend version - * Fix a method call bug - - * LICENSE - libzendts.dsp: License update - - * zend_errors.h: Make error codes PHP 3.0 compatible - -1999-07-18 Andi Gutmans - - * zend_execute_API.c: - - Should fix the memory leak when returning from the main scope. - -1999-07-17 Zeev Suraski - - * configure.in: Debug on by default - -1999-07-16 Zeev Suraski - - * zend_compile.c: - Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner) - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: License update - -1999-07-15 Andi Gutmans - - * zend.c: Change true/false back to 1/"" - - * zend_execute.c: Fix a lock issue - -1999-07-15 sascha - - * zend_execute_API.c: disable zend_handle_sigsegv - -1999-07-14 Andi Gutmans - - * libzendts.dsp - zend.c: Fix thread unsafe constants startup - - * LICENSE - zend.c - zend_constants.c - zend_constants.h: - License update - - Fix multithreaded constants startup - - * zend_operators.c: - Fix for boolean convert to number - -1999-07-12 Andi Gutmans - - * zend_execute.c: - Fixed a purify warning - -1999-07-10 Zeev Suraski - - * zend_alloc.c: Oh, that dumb bug. - -1999-07-10 Andi Gutmans - - * zend_execute.c - zend_hash.c: Ok, so we do have to lock in there - - * zend.c - zend_execute.c: Fix assignments of reference variables - -1999-07-10 Zeev Suraski - - * zend_execute_API.c: Woops, fix. - - * zend_execute.c - zend_execute_API.c - zend_globals.h: Put the garbage in the garbage bin - - * zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_variables.c: Get rid of AiCount completely - - * zend_execute.c: Final tweaks - - * zend_execute.c - zend_hash.c: More locking work - -1999-07-09 Zeev Suraski - - * zend_execute.c: *** empty log message *** - - * zend_execute.c: More stuff - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c - zend_variables.c: Step 4: - Move to a 7-bit counter (not fully implemented yet) - - * zend_API.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: Phase 3: - Use a single bit to mark IS_REF variables - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c: Step 2: - Rename is_ref to EA - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: Step 1 in nuking the garbage collector: - - Change the hash destructor to return int - - Don't kill the bucket on hash_destroy if the destructor returns 0 - - * config.w32.h - configure.in - zend_alloc.c: *** empty log message *** - - * zend_alloc.c: Send a SIGSEGV instead of exiting, to trigger a core dump - - * zend_alloc.c - zend_alloc.h - zend_hash.c: * Support recoverable failure from erealloc() - * Fix the shutdown code on an unrecoverable erealloc() failure - - * zend_execute_API.c: Fix the mess in SIGSEGV handling, hopefully - -1999-07-08 Zeev Suraski - - * zend_compile.h - zend_compile.c: - Support definition of classes that are derived from classes that are defined in runtime - -1999-07-06 sascha - - * zend.h: enable it, until we find a better way - -1999-07-05 sascha - - * zend.h: make Solaris gcc happy - - * configure.in - zend.h: use void * instead of long for 64-bit test - -1999-07-05 Thies C. Arntzen - - * zend_API.h: added RETVAL_RESOURCE and RETURN_RESOURCE - -1999-07-04 Zeev Suraski - - * zend_operators.c: - Make convert_to_string() regard false as "" instead of "0" - -1999-07-03 sascha - - * Makefile.am: don't wipe files for distributions - - * configure.in - zend.h: - checking for ints won't work, since they are 32 bit on both platforms - -1999-07-03 Zeev Suraski - - * zend_execute.c: Support isset()/empty() for string offsets - - * zend-scanner.l: Fix a crash - -1999-07-03 sascha - - * configure.in: add usual rhapsody hack - - * config.unix.h: missing DL_HANDLE broke build - - * zend_extensions.c: typo - -1999-07-02 sascha - - * acconfig.h - configure.in - zend.h: workaround for 64-bit platforms - -1999-07-02 Zeev Suraski - - * acconfig.h - configure.in - zend_globals.h: define zend_bool - -1999-06-30 Zeev Suraski - - * zend-parser.y: Make require accept any parameter - -1999-06-26 Zeev Suraski - - * zend_alloc.h - zend_operators.c - zend_alloc.c: - * Make the memory leak reporting code much better with repeats - * Remove useless variables - -1999-06-22 Zeev Suraski - - * zend_compile.c: Fix Thies's bug report - - * zend_alloc.c - zend_compile.c - zend_operators.c: - * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead - of zval *, and it wasn't using reference counting) - * Fix a memory leak in static array()'s with textual indices - -1999-06-19 Zeev Suraski - - * zend.c: *** empty log message *** - - * zend.h - zend_extensions.h: - Add a standard get_ini_entry() to interface between Zend and the outside world - - * configure.in: *** empty log message *** - -1999-06-16 stig - - * zend_modules.h: - added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU - -1999-06-15 stig - - * zend_operators.c - zend_operators.h: * added zend_binary_strcasecmp() - -1999-06-12 Zeev Suraski - - * zend-parser.y: - We can't quite go with expr there (shift/reduce conflict), go with scalar. - - * zend-parser.y: require() improvement as per Andi's suggestion - -1999-06-11 Zeev Suraski - - * zend_operators.c: - Make the concatenation operator use make_printable as well - - * zend-scanner.l: Don't take failing on an include file so badly - - * zend-scanner.l: Support E_COMPILE_ERROR in the compiler - - * zend_compile.c: Two fixes: - * The error generated by a failed class inheritence wasn't properly - displaying the file in which he error occured. - * Inheritence didn't work if the parent class had uppercase letters in it. - - * zend-parser.y - zend-scanner.l - zend_execute.c: * Use to_string() instead of __print() - * Support boolean casts ((bool) and (boolean)) - - * zend.c: Change __print into to_string() - - * zend.c - zend.h - zend_execute.c - zend_execute_API.c: - * Make the output handling of variables much, much cooler. - Uses zend_make_printable_zval() instead of convert_to_string() now: - - $foo = true; - print "\$foo is $foo"; - will now print - $foo is true - (instead of "$foo is 1", earlier). - - Also, with objects, it automatically tries to call __print() and use it as a printing - function. - - For example: - - class foo { - function __print() { return "Foo Object"; } - }; - - $foo = new foo; - print $foo; - - will print "Foo Object". - -1999-06-10 Zeev Suraski - - * zend_operators.c: Now THAT's an annoying bug. - -1999-06-09 Zeev Suraski - - * zend_extensions.c: Fix - - * zend_API.c - zend_execute.c: - * Fix cases where you assign an array element to the parent array (the array was - being erased before the assignment, so the element was being smashed). - - * zend_execute.c - zend_execute_API.c: * Fix foreach() that receives a non array argument - * Clean up some C++ comments - -1999-06-09 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_operators.c: - Fix the static array() initializing - -1999-06-08 Zeev Suraski - - * zend_extensions.c: Replace error messages - -1999-06-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: * Fix a by-name call/method call bug - * Clean and optimize the whole function call process - -1999-06-07 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add zend_hash_get_current_key_type() - -1999-06-06 Andi Gutmans - - * zend_compile.c: - Work around a compiler bug - mark variables that are sent to functions that aren't yet - defined as FETCH_W (because they might end up being sent by reference) - -1999-06-05 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h: * Centralized shutdown - * Change shutdown order again - - * zend_compile.c: - Call the request_shutdown on modules before destroying symbol tables, so that - the session module can be implemented - - * zend-scanner.l - zend_compile.c - zend_execute.c: - - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue. - - Fixed numerous AiCount problems - -1999-06-04 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: New $GLOBALS init - - * zend_execute_API.c: - Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table, - but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.) - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_list.c - zend_list.h - zend_opcode.c - zend_operators.c: Minor updates (mostly __declspec() stuff) - -1999-06-04 Thies C. Arntzen - - * zend_API.h: added is_ref=0 and refcount=1 to SET_VAR_* macros - -1999-06-03 Zeev Suraski - - * zend-parser.y: T_BAD_CHARACTER is actually a string. - -1999-06-03 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - We weren't counting newlines in heredocs. The only place which is still questionable - is when there's a \ followed by a newline but it seems we have a parse error in this - case anyways. - - Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash - with the real win32 alloca(). - -1999-06-01 Andi Gutmans - - * zend_execute.c: - - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack. - -1999-05-31 Zeev Suraski - - * zend.h - zend_alloc.c: *** empty log message *** - -1999-05-31 Andi Gutmans - - * zend-scanner.l - zend_compile.c - zend_execute.c - zend_execute_API.c: Fixes - -1999-05-30 sascha - - * zend_alloc.c - zend_compile.h - zend_execute_API.c - zend_indent.c - zend_opcode.c: * fix some casts - * introduce unary_op_type - cleaner than casting data voids to function ptrs - -1999-05-29 Zeev Suraski - - * zend_execute_API.c: - That got fucked up when we went back to using uninitialized_zval - -1999-05-29 sascha - - * Makefile.am: another VPATH related change - -1999-05-29 Zeev Suraski - - * zend-parser.y: Fix a bug - - * zend_hash.c - zend_hash.h - zend_operators.c: Support overwrite mode in zend_hash_merge() - -1999-05-29 sascha - - * Makefile.am: - clean is not called from automake. use CLEANFILES instead - - allow VPATH compilation - -1999-05-29 Zeev Suraski - - * zend_execute.c: Correct fix - - * zend_execute_API.c: *** empty log message *** - - * zend_execute.c: Fix a leak - -1999-05-28 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: * Support getThis() for internal functions. - * Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't - work with the optimizer). - * Add new macros for standardized definition of classes. - * Only report AiCount problems if shutdown was not silent. - -1999-05-27 Zeev Suraski - - * zend_execute.c: Fix the AiCount issue with objects - - * zend_API.h: Moved all #define's for SET_ and RETURN_ to zend_API.h - -1999-05-25 Zeev Suraski - - * zend_execute_API.c: - Avoid crashing if an error occurs before we open the first file. - -1999-05-24 Zeev Suraski - - * zend_operators.c: The last fix was wrong - - * zend_operators.c: Another operators fix - -1999-05-23 Zeev Suraski - - * zend_operators.c: - boolean comparison didn't work with smaller-than and greater-than, something that - fucked up berber's site a bit. fixed. - -1999-05-22 Zeev Suraski - - * zend_execute.c: - Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR. - - * zend-parser.y: I'm on a roll. Fix a nasty yet stupid AiCount bug - - * zend_alloc.c: Warn about AiCount not zeroing out - - * zend-parser.y - zend-scanner.h - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_highlight.h - zend_list.h - zend_llist.h - zend_ptr_stack.h - zend_stack.h: - * Add struct name to all typedef's so that they can be debugged with MSVC - * Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus - causing AiCount to be decreased multiple times even though it was increased only - once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only - decrease AiCount on the last FETCH_DIM. - * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason - MSVC doesn't report these :I - - * zend.h - zend_alloc.c - zend_execute_API.c: - Give more information and save log lines in memory leak reports - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_globals.h - zend_llist.c - zend_llist.h: Avoid leaking fd's in case of failures - - * zend-scanner.l: more fixes - -1999-05-21 Zeev Suraski - - * zend-scanner.l: That wasn't supposed to slip in - - * zend-scanner.l: * Properly handle failed file opens in C++ - * Properly handle failed require()'s within libzend - - * zend-scanner.l: * Fix the comments issue. yymore() worked like a charm. - * Change all flex states to be prefixed with ST_ - -1999-05-20 Zeev Suraski - - * zend_compile.h - zend_execute.c: Optimize allocations into uninitialized_zval assignments - -1999-05-20 Andi Gutmans - - * config.w32.h - libzend.dsp - libzendts.dsp - zend_compile.c - zend_compile.h: - Updates we did today - - * zend_compile.c: - Fix a small problem with class decelerations. - - * zend-scanner.l: -Open curly braces fix? - -1999-05-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_hash.c - zend-parser.y: - * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed - to char[1], these checks should have been changed to Bucket.nKeyLength==0 - * Support runtime declaration of functions. I ended up changing the grammar - to catch top level functions vs. nested functions. The reason is simple - - if we don't have functions properly declared at compile-time, function calls - cannot be resolved at compile time, and have to be resolved at runtime, which - ends up being much much slower (without the optimizer, that is). - It's no biggy though, the grammar change isn't that bad. - -1999-05-14 Zeev Suraski - - * configure.in - zend-scanner.l: - If a require() dies, we must bail out (since it corrupts an existing op_array - - * zend-scanner.l: Fix a bug - -1999-05-14 stig - - * Makefile.am: don't install Zend on the system - -1999-05-14 Zeev Suraski - - * zend-scanner.l: - Add \012 and \xff missing support to constant quoted string - -1999-05-12 Zeev Suraski - - * zend.h: *** empty log message *** - -1999-05-12 stig - - * Makefile.am: install libzend.a and header files on "make install" - - * acconfig.h - configure.in: add --enable-thread-safety option - -1999-05-12 Zeev Suraski - - * zend_llist.c - zend_llist.h: Added prepend to llist - -1999-05-11 Zeev Suraski - - * zend-scanner.l - zend.c: Fixes: - * Avoid closing stdin (I could have sworn I've committed that already) - * unclean_shutdown patches - - * zend_alloc.c: Easier Win32 debug code - - * zend-scanner.l - zend_compile.c - zend_globals.h - zend_highlight.c: - * Fix a bug that occured in case of parse errors. We need to restore the lexical state - even if the compilation failed. - -1999-05-10 Zeev Suraski - - * zend-scanner.h - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h: - Weed out all BoundsChecker-found bugs (including a serious file descriptor leak - in the C++ scanner) - -1999-05-09 Zeev Suraski - - * zend_modules.h: Change argument name - - * zend.c - zend_API.c - zend_API.h - zend_modules.h: Almost forgot to commit those - -1999-05-06 Zeev Suraski - - * zend-scanner.l: Ok, I tested it now. It works very nicely! - -1999-05-05 Andi Gutmans - - * zend_llist.c - zend_llist.h: llist improvements - -1999-05-02 Andi Gutmans - - * zend.c - zend_compile.h: - Don't support interactive mode when thread safe. - -1999-05-01 Zeev Suraski - - * zend_operators.c: Several operator fixes. Should fix the MySQL problem. - -1999-04-30 Andi Gutmans - - * zend_opcode.c: - Free refcount when destroying the last class reference. - - * zend-parser.y: - Missed one place - - * zend-parser.y: - First try at fixing $a->foo[] syntax. - - * zend-scanner.l: - - Move back to yyless(). I haven't tested it yet because it's taking too long - to compile and I have to disconnect - -1999-04-30 Zeev Suraski - - * zend-parser.y - zend-scanner.l: - Fix Boris's problem (in my never ending struggle to show I never mean what I say - when I say something's not gonna happen :) - - * zend-scanner.l - zend_compile.c: - * Fix a problem with constant quoted strings, that was causing Thies's problem - * Remove a development-time printf - -1999-04-29 Andi Gutmans - - * zend-scanner.l: - No reason to handle newlines here. - -1999-04-28 Zeev Suraski - - * zend-scanner.l: Make the C++ scanner support interactive input - -1999-04-27 Zeev Suraski - - * zend-scanner.l - zend_compile.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_opcode.c: * Fix debugger+interactive mode bug - * Recognize whether an extension is with debug information or not - -1999-04-26 Zeev Suraski - - * libzendts.dsp: fix - - * config.w32.h - libzend.dsp - libzendts.dsp - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_opcode.c - zend_sprintf.c: Various thread safety fixes and DLL updates - -1999-04-26 Andi Gutmans - - * zend-scanner.l - zend.c - zend_alloc.c - zend_globals.h: -More commits - -1999-04-24 Zeev Suraski - - * zend_compile.c: Another small fix - - * libzendts.dsp: dsp update - - * zend.c - zend_globals.h: Thread safety fixes - - * zend_list.c: Remove redundant includes - -1999-04-24 zeevread - - * zend-scanner.l: g++ compile fix - -1999-04-24 Zeev Suraski - - * Makefile.am - zend-scanner.l: *** empty log message *** - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c - zend-parser.y - zend-scanner.l: Cleanups, remove old ts code - -1999-04-23 Zeev Suraski - - * zend_operators.c: Arithmetics bug fix - - * zend-scanner.h - zend-scanner.l: Support eval() and highlight_string() in the C++ scanner - -1999-04-23 Andi Gutmans - - * zend-scanner.l: - - Use yyless() instead of unput() where possible. I'll erase the commented - out code in a day or so. - -1999-04-23 Zeev Suraski - - * FlexLexer.h - flex.skl - zend-scanner.h - zend-scanner.l - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_operators.h - zend_variables.h: Ok, call me crazy, because I probably am. - Thread safe version now uses a C++ scanner object. Works fully. - -1999-04-22 Zeev Suraski - - * acconfig.h - zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_highlight.c - zend_indent.c - zend_opcode.c: Make token names uniform, they all begin with T_ now. - -1999-04-21 stig - - * buildconf: state which aclocal.m4 and configure files are created - - * Makefile.am: - zend-parser.o and zend-scanner.o were included twice in libzend.a - -1999-04-21 Zeev Suraski - - * FlexLexer.h - flex.skl - libzendts.dsp - zend_API.c - zend_API.h - zend_globals.h: - * Change the thread safe project to create a C++ scanner. - * Add in a slightly modified skeleton file (only a couple of #if's for #include's - that we dont have in Windows) - - It does NOT compile or work yet :) - - * zend_list.h: Fix - - * zend.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_list.c - zend_list.h: - Thread safety patch. It works now with 'just in time' resource initialization! - - * libzend.dsp - libzendts.dsp - zend_globals.h: Thread-safe project - -1999-04-21 stig - - * buildconf: move automake back to before autoconf - - * buildconf: - autoheader must be called after autoconf, automake after autoheader - - * zend_config.h.in: think before one commits - - * zend_config.h.in: doh. cvs appears to ignore .in files by default - -1999-04-21 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Thread safety patch. We're still not quite there but it compiles again, and - more logic has been implemented. - -1999-04-20 stig - - * .cvsignore - Makefile.am - Makefile.in - aclocal.m4 - buildconf: Makefile.in and aclocal.m4 are generated - added buildconf script - -1999-04-19 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: - Return a success value from the startup function, so we can unload immediately - if it fails. - -1999-04-19 stig - - * .cvsignore - Makefile.am - Makefile.in - acconfig.h - acinclude.m4 - aclocal.m4 - config.h.in - configure.in - zend.h: convert to automake - -1999-04-19 Andi Gutmans - - * zend_API.c - zend_API.h: Add a couple of ZEND_API's - - * config.w32.h - zend-parser.y - zend_compile.c - zend_execute.c: Support =unset as arguments - -1999-04-19 stig - - * acconfig.h - config.h.in - configure.in: removed -lnsl and -lsocket checks from zend - -1999-04-18 Zeev Suraski - - * zend_execute.c: AiCount needs to be decreased here - - * configure.in - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_llist.c - zend_modules.h - zend_opcode.c: Whatnot: - * updated alloc_persist to use critical sections - * changed extension shutdown to two-phase - * updated dependencies - * PR support (don't remember if there was any really) - -1999-04-15 Andi Gutmans - - * zend_execute.c: - - one more place which seems to have needed fixing. I don't have time to look - more into it. I hope we don't have anymore places which need fixing. - - * zend_compile.c: - - Should fix the pass by reference problem. This happened because we moved - start from arg 1 now and not arg 0. There might be more places which need fixing - like in the executor but the bug seems OK now. - -1999-04-14 Zeev Suraski - - * zend_compile.h: Compile fix - -1999-04-14 Andi Gutmans - - * config.w32.h - libzend.dsp - zend-scanner.l - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_opcode.c: -Tiny patches - -1999-04-13 Zeev Suraski - - * zend_execute.c: Better detection - - * zend_execute.c: - Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge - memory leak - -1999-04-13 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c: - Fix various memory leaks. - - * zend_execute.c: Refcount bugfix - - * libzend.dsp - zend_API.c - zend_execute_API.c - zend_ptr_stack.c: * Optimize argument_stack top lookup - * Fix a nasty bug in zend_ptr_stack_clean() - -1999-04-12 Zeev Suraski - - * zend_execute_API.c - zend_globals.h: Remove unnecessary stack - - * zend_API.c: off by one - - * zend_execute.c: Minor optimization - - * zend_API.c: Make functions that don't take arguments somewhat happier:) - - * zend_execute.c: - This should take care of "this" for user-defined functions. It wasn't yet working - for built-in functions anyway, this one is coming soon. - - * zend_compile.c - zend_execute_API.c: - Destroy the resource list after destroying the symbol table, otherwise the - auto-destructor for resources are run when the resource list is no longer valid - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c: - This patch is a go. Not fully optimized yet, but working properly. - Prepatch tagged as BEFORE_STACK_PATCH. - - * zend_compile.c - zend_execute.c: Minor fixes: - missing zval_copy_ctor() - messed up AiCount fix - -1999-04-10 Zeev Suraski - - * zend_alloc.c - zend_alloc.h: Allow runtime setting of the memory limit - - * zend_alloc.c - zend_alloc.h - zend_globals.h: Get rid of php3_ini in Zend - - * zend.c - zend.h: - We need to initialize the utility values after we initialize the INI file, which in - turn, is after we initialize Zend. Set the utility values separately from Zend's - initialization - -1999-04-09 Andi Gutmans - - * zend-scanner.l: - Changed here-docs to <<< followed by whitespace. - -1999-04-09 stig - - * .cvsignore: ignore file - -1999-04-09 Andi Gutmans - - * zend-parser.y - zend_compile.h: - - I guess print $GLOBALS and print "$GLOBALS" should yield the same result - so I returned the one in encaps_var. - - Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the - erealloc()'s during compile time are such a biggy, we might make it even - smaller. We can have a configure time option as to it's size. - - * zend-parser.y: - - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work. - - Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't - supposed to work in any case. - -1999-04-09 Zeev Suraski - - * zend-scanner.l: - Honor a semicolon on the same line as an ending token of a heredoc - - * zend_compile.c: Prevent class redeclarations - -1999-04-08 Zeev Suraski - - * zend_API.c - zend_modules.h: * Add arguments to shutdown functions - * Remove traces of php_ini stuff - - * zend-parser.y: "Our favourite mistake" - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: $GLOBALS support - -1999-04-08 Andi Gutmans - - * ZEND_CHANGES: foreach() syntax has changed - -1999-04-08 Zeev Suraski - - * zend_compile.c - zend_execute.c: Fix static assignment - -1999-04-07 Zeev Suraski - - * zend_execute_API.c: Remove an unused variable - - * libzend.dsp: That's better. - - * libzend.dsp: We didn't save the .dsp back then... - - * ZendCore.dsp - ZendCore.dsw - ZendCore.mak - diffs - libzend.dsp: Cleanups: ZendCore->libzend - -1999-04-07 Rasmus Lerdorf - - * zend.c: *** empty log message *** - -1999-04-07 Andi Gutmans - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: New file. - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: Zend Library - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: New file. - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: Zend Library - diff --git a/makedist b/makedist index 992e8a1ef92..892bab66cef 100755 --- a/makedist +++ b/makedist @@ -69,9 +69,6 @@ echo "" cd $DIR || exit 5 -# The full ChangeLog is available separately from lxr.php.net -rm -f ChangeLog* - # hide away our own versions of libtool-generated files for i in $LT_TARGETS; do if test -f "$i"; then From 1d3f37ddedc931d700a4e1135f63e094df88dbc4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 23 Jun 2012 00:03:28 +0200 Subject: [PATCH 169/641] Fix segfault in method test A ref has to be added to $this if the generator is called !nested (which is the case when it is invoked via getIterator). --- Zend/zend_vm_def.h | 16 +++++++++++++--- Zend/zend_vm_execute.h | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index fea1f404e14..cb24eb99046 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5234,10 +5234,15 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) /* back up some executor globals */ SAVE_OPLINE(); - EX(current_this) = EG(This); + EX(current_scope) = EG(scope); EX(current_called_scope) = EG(called_scope); + if (EG(This)) { + Z_ADDREF_P(EG(This)); + } + EX(current_this) = EG(This); + /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; @@ -5278,6 +5283,13 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_RETURN(); } + /* Free $this and stack arguments */ + if (EG(This)) { + zval_ptr_dtor(&EG(This)); + } + + zend_vm_stack_clear_multiple(TSRMLS_C); + /* Bring back the previous execution context */ execute_data = EG(current_execute_data); @@ -5295,8 +5307,6 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) EX(object) = EX(current_object); EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_vm_stack_clear_multiple(TSRMLS_C); - LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_INC_OPCODE(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0f965c5eef7..3bf89d317c6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1217,10 +1217,15 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP /* back up some executor globals */ SAVE_OPLINE(); - EX(current_this) = EG(This); + EX(current_scope) = EG(scope); EX(current_called_scope) = EG(called_scope); + if (EG(This)) { + Z_ADDREF_P(EG(This)); + } + EX(current_this) = EG(This); + /* back up the execution context */ generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); generator->execute_data = execute_data; @@ -1261,6 +1266,13 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP ZEND_VM_RETURN(); } + /* Free $this and stack arguments */ + if (EG(This)) { + zval_ptr_dtor(&EG(This)); + } + + zend_vm_stack_clear_multiple(TSRMLS_C); + /* Bring back the previous execution context */ execute_data = EG(current_execute_data); @@ -1278,8 +1290,6 @@ static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OP EX(object) = EX(current_object); EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_vm_stack_clear_multiple(TSRMLS_C); - LOAD_REGS(); LOAD_OPLINE(); ZEND_VM_INC_OPCODE(); From 04e781f0e4a4ea879c5e85b8d209b9b44cc32f8d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 23 Jun 2012 01:28:16 +0200 Subject: [PATCH 170/641] Implement get_iterator This implements the get_iterator handler for Generator objects, thus making direct foreach() iteration significantly faster. --- Zend/zend_generators.c | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index b7538e7c9ef..10d91f5b112 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -564,6 +564,114 @@ ZEND_METHOD(Generator, close) } /* }}} */ +/* get_iterator implementation */ + +typedef struct _zend_generator_iterator { + zend_object_iterator intern; + zend_generator *generator; +} zend_generator_iterator; + +static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ +{ + zval_ptr_dtor((zval **) &iterator->data); + efree(iterator); +} +/* }}} */ + +static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ +{ + zval *object = (zval *) iterator->data; + zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + + zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + return generator->value != NULL ? SUCCESS : FAILURE; +} +/* }}} */ + +static void zend_generator_iterator_get_data(zend_object_iterator *iterator, zval ***data TSRMLS_DC) /* {{{ */ +{ + zval *object = (zval *) iterator->data; + zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + + zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + if (generator->value) { + *data = &generator->value; + } else { + *data = NULL; + } +} +/* }}} */ + +static int zend_generator_iterator_get_key(zend_object_iterator *iterator, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */ +{ + zval *object = (zval *) iterator->data; + zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + + zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + if (!generator->key) { + return HASH_KEY_NON_EXISTANT; + } + + if (Z_TYPE_P(generator->key) == IS_LONG) { + *int_key = Z_LVAL_P(generator->key); + return HASH_KEY_IS_LONG; + } + + if (Z_TYPE_P(generator->key) == IS_STRING) { + *str_key = estrndup(Z_STRVAL_P(generator->key), Z_STRLEN_P(generator->key)); + *str_key_len = Z_STRLEN_P(generator->key) + 1; + return HASH_KEY_IS_STRING; + } + + /* Waiting for Etienne's patch to allow arbitrary zval keys. Until then + * error out on non-int and non-string keys. */ + zend_error(E_ERROR, "Currently only int and string keys can be yielded"); +} +/* }}} */ + +static void zend_generator_iterator_move_forward(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ +{ + zval *object = (zval *) iterator->data; + zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + + zend_generator_ensure_initialized(object, generator TSRMLS_CC); + + zend_generator_resume(object, generator TSRMLS_CC); +} +/* }}} */ + +static zend_object_iterator_funcs zend_generator_iterator_functions = { + zend_generator_iterator_dtor, + zend_generator_iterator_valid, + zend_generator_iterator_get_data, + zend_generator_iterator_get_key, + zend_generator_iterator_move_forward, + NULL +}; + +zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ +{ + zend_generator_iterator *iterator; + + if (by_ref) { + zend_error(E_ERROR, "By reference iteration of generators is currently not supported"); + } + + iterator = emalloc(sizeof(zend_generator_iterator)); + iterator->intern.funcs = &zend_generator_iterator_functions; + + Z_ADDREF_P(object); + iterator->intern.data = (void *) object; + + iterator->generator = zend_object_store_get_object(object TSRMLS_CC); + + return (zend_object_iterator *) iterator; +} +/* }}} */ + ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0) ZEND_END_ARG_INFO() @@ -590,6 +698,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_generator->create_object = zend_generator_create; + zend_ce_generator->get_iterator = zend_generator_get_iterator; zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator); From 14766e1417c721d9643f6a2a785db3e88b565814 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 23 Jun 2012 14:43:52 +0200 Subject: [PATCH 171/641] Pass zend_generator directly to Zend VM Previously the zval* of the generator was passed into the VM by misusing EG(return_value_ptr_ptr). Now the zend_generator* itself is directly passed in. This saves us from always having to pass the zval* around everywhere. --- Zend/zend_generators.c | 93 ++++++++++++++++++++---------------------- Zend/zend_vm_def.h | 8 ++-- Zend/zend_vm_execute.h | 62 ++++++++++++++-------------- 3 files changed, 79 insertions(+), 84 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 10d91f5b112..487975e23e6 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -321,7 +321,7 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* } /* }}} */ -static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ +static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ { /* The generator is already closed, thus can't resume */ if (!generator->execute_data) { @@ -352,7 +352,7 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS /* We (mis)use the return_value_ptr_ptr to provide the generator object * to the executor, so YIELD will be able to set the yielded value */ - EG(return_value_ptr_ptr) = &object; + EG(return_value_ptr_ptr) = (zval **) generator; /* Set executor globals */ EG(current_execute_data) = generator->execute_data; @@ -399,10 +399,10 @@ static void zend_generator_resume(zval *object, zend_generator *generator TSRMLS } /* }}} */ -static void zend_generator_ensure_initialized(zval *object, zend_generator *generator TSRMLS_DC) /* {{{ */ +static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */ { if (!generator->value) { - zend_generator_resume(object, generator TSRMLS_CC); + zend_generator_resume(generator TSRMLS_CC); } } /* }}} */ @@ -411,17 +411,15 @@ static void zend_generator_ensure_initialized(zval *object, zend_generator *gene * Rewind the generator */ ZEND_METHOD(Generator, rewind) { - zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); /* Generators aren't rewindable, so rewind() only has to make sure that * the generator is initialized, nothing more */ @@ -432,17 +430,15 @@ ZEND_METHOD(Generator, rewind) * Check whether the generator is valid */ ZEND_METHOD(Generator, valid) { - zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); RETURN_BOOL(generator->value != NULL); } @@ -452,17 +448,15 @@ ZEND_METHOD(Generator, valid) * Get the current value */ ZEND_METHOD(Generator, current) { - zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->value) { RETURN_ZVAL(generator->value, 1, 0); @@ -474,17 +468,15 @@ ZEND_METHOD(Generator, current) * Get the current key */ ZEND_METHOD(Generator, key) { - zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->key) { RETURN_ZVAL(generator->key, 1, 0); @@ -496,19 +488,17 @@ ZEND_METHOD(Generator, key) * Advances the generator */ ZEND_METHOD(Generator, next) { - zval *object; zend_generator *generator; if (zend_parse_parameters_none() == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); - zend_generator_resume(object, generator TSRMLS_CC); + zend_generator_resume(generator TSRMLS_CC); } /* }}} */ @@ -516,17 +506,16 @@ ZEND_METHOD(Generator, next) * Sends a value to the generator */ ZEND_METHOD(Generator, send) { - zval *object, *value; + zval *value; zend_generator *generator; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) { return; } - object = getThis(); - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); /* The generator is already closed, thus can't send anything */ if (!generator->execute_data) { @@ -541,7 +530,7 @@ ZEND_METHOD(Generator, send) generator->send_target->var.ptr = value; generator->send_target->var.ptr_ptr = &value; - zend_generator_resume(object, generator TSRMLS_CC); + zend_generator_resume(generator TSRMLS_CC); if (generator->value) { RETURN_ZVAL(generator->value, 1, 0); @@ -568,22 +557,27 @@ ZEND_METHOD(Generator, close) typedef struct _zend_generator_iterator { zend_object_iterator intern; - zend_generator *generator; + + /* The generator object zval has to be stored, because the iterator is + * holding a ref to it, which has to be dtored. */ + zval *object; } zend_generator_iterator; static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ { - zval_ptr_dtor((zval **) &iterator->data); + zval *object = ((zend_generator_iterator *) iterator)->object; + + zval_ptr_dtor(&object); + efree(iterator); } /* }}} */ static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ { - zval *object = (zval *) iterator->data; - zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + zend_generator *generator = (zend_generator *) iterator->data; - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); return generator->value != NULL ? SUCCESS : FAILURE; } @@ -591,10 +585,9 @@ static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_D static void zend_generator_iterator_get_data(zend_object_iterator *iterator, zval ***data TSRMLS_DC) /* {{{ */ { - zval *object = (zval *) iterator->data; - zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + zend_generator *generator = (zend_generator *) iterator->data; - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->value) { *data = &generator->value; @@ -606,10 +599,9 @@ static void zend_generator_iterator_get_data(zend_object_iterator *iterator, zva static int zend_generator_iterator_get_key(zend_object_iterator *iterator, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */ { - zval *object = (zval *) iterator->data; - zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + zend_generator *generator = (zend_generator *) iterator->data; - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); if (!generator->key) { return HASH_KEY_NON_EXISTANT; @@ -628,18 +620,17 @@ static int zend_generator_iterator_get_key(zend_object_iterator *iterator, char /* Waiting for Etienne's patch to allow arbitrary zval keys. Until then * error out on non-int and non-string keys. */ - zend_error(E_ERROR, "Currently only int and string keys can be yielded"); + zend_error_noreturn(E_ERROR, "Currently only int and string keys can be yielded"); } /* }}} */ static void zend_generator_iterator_move_forward(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ { - zval *object = (zval *) iterator->data; - zend_generator *generator = ((zend_generator_iterator *) iterator)->generator; + zend_generator *generator = (zend_generator *) iterator->data; - zend_generator_ensure_initialized(object, generator TSRMLS_CC); + zend_generator_ensure_initialized(generator TSRMLS_CC); - zend_generator_resume(object, generator TSRMLS_CC); + zend_generator_resume(generator TSRMLS_CC); } /* }}} */ @@ -655,18 +646,22 @@ static zend_object_iterator_funcs zend_generator_iterator_functions = { zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ { zend_generator_iterator *iterator; + zend_generator *generator; if (by_ref) { zend_error(E_ERROR, "By reference iteration of generators is currently not supported"); } + generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + iterator = emalloc(sizeof(zend_generator_iterator)); iterator->intern.funcs = &zend_generator_iterator_functions; + iterator->intern.data = (void *) generator; + /* We have to keep a reference to the generator object zval around, + * otherwise the generator may be destroyed during iteration. */ Z_ADDREF_P(object); - iterator->intern.data = (void *) object; - - iterator->generator = zend_object_store_get_object(object TSRMLS_CC); + iterator->object = object; return (zend_object_iterator *) iterator; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index cb24eb99046..015263f52f5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2819,7 +2819,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -4998,7 +4998,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) * arguments that have to be dtor'ed) starts */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* For generators the next stack frame is conveniently stored in the * generator object. */ @@ -5087,7 +5087,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) /* For generators skip the leave handler return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -5318,7 +5318,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3bf89d317c6..29b6d7c500c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1061,7 +1061,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER * arguments that have to be dtor'ed) starts */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* For generators the next stack frame is conveniently stored in the * generator object. */ @@ -1150,7 +1150,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER /* For generators skip the leave handler return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -2371,7 +2371,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -4119,7 +4119,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -4760,7 +4760,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -5726,7 +5726,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -6387,7 +6387,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -7087,7 +7087,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -7426,7 +7426,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -9095,7 +9095,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -9736,7 +9736,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -10702,7 +10702,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -11229,7 +11229,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -11867,7 +11867,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -12386,7 +12386,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -15731,7 +15731,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -17759,7 +17759,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -20167,7 +20167,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -21254,7 +21254,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -23331,7 +23331,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -24767,7 +24767,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -26026,7 +26026,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -27285,7 +27285,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -27656,7 +27656,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -28912,7 +28912,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -29412,7 +29412,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Close the generator to free up resources */ zend_generator_close(generator, 1 TSRMLS_CC); @@ -32377,7 +32377,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -34275,7 +34275,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -36552,7 +36552,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -37499,7 +37499,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { @@ -39445,7 +39445,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS USE_OPLINE /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) zend_object_store_get_object(*EG(return_value_ptr_ptr) TSRMLS_CC); + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); /* Destroy the previously yielded value */ if (generator->value) { From ab75ed6ba9b5eace710976bf76d631728d4bb403 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 23 Jun 2012 16:08:15 +0200 Subject: [PATCH 172/641] Disallow closing a generator during its execution If a generator is closed while it is running an E_WARNING is thrown and the call is ignored. Maybe a fatal error should be thrown instead? --- Zend/zend_generators.c | 13 +++++++++++++ Zend/zend_generators.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 487975e23e6..bccbb48ca41 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -300,6 +300,8 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM /* The key will be incremented on first use, so it'll start at 0 */ generator->largest_used_integer_key = -1; + generator->is_currently_running = 0; + zend_object_std_init(&generator->std, class_type TSRMLS_CC); object.handle = zend_objects_store_put(generator, NULL, @@ -339,6 +341,8 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ zend_class_entry *original_scope = EG(scope); zend_class_entry *original_called_scope = EG(called_scope); + zend_bool original_is_currently_running = generator->is_currently_running; + /* Remember the current stack position so we can back up pushed args */ generator->original_stack_top = zend_vm_stack_top(TSRMLS_C); @@ -363,6 +367,8 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ EG(scope) = generator->execute_data->current_scope; EG(called_scope) = generator->execute_data->current_called_scope; + generator->is_currently_running = 1; + /* We want the backtrace to look as if the generator function was * called from whatever method we are current running (e.g. next()). * The first prev_execute_data contains an additional stack frame, @@ -387,6 +393,8 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ EG(scope) = original_scope; EG(called_scope) = original_called_scope; + generator->is_currently_running = original_is_currently_running; + /* The stack top before and after the execution differ, i.e. there are * arguments pushed to the stack. */ if (generator->original_stack_top != zend_vm_stack_top(TSRMLS_C)) { @@ -549,6 +557,11 @@ ZEND_METHOD(Generator, close) generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); + if (generator->is_currently_running) { + zend_error(E_WARNING, "A generator cannot be closed while it is running"); + return; + } + zend_generator_close(generator, 0 TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 89193bbe6e4..73d85287a70 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -46,6 +46,10 @@ typedef struct _zend_generator { temp_variable *send_target; /* Largest used integer key for auto-incrementing keys */ long largest_used_integer_key; + + /* We need to know whether the generator is currently executed to avoid it + * being closed while still running */ + zend_bool is_currently_running; } zend_generator; extern ZEND_API zend_class_entry *zend_ce_generator; From c3f34796a053f5ff1016d872f8c339e32468783f Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 23 Jun 2012 15:10:47 -0300 Subject: [PATCH 173/641] - Improved fix for #62384 --- ext/reflection/php_reflection.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 966c9a5448e..180ce8f91aa 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2749,12 +2749,10 @@ ZEND_METHOD(reflection_method, invokeArgs) fcc.object_ptr = object; /* - * Closure::__invoke() actually expects a copy of zend_function, so that it - * frees it after the invoking. + * Copy the zend_function when calling via handler (e.g. Closure::__invoke()) */ - if (obj_ce == zend_ce_closure && object && - strlen(mptr->common.function_name) == sizeof(ZEND_INVOKE_FUNC_NAME)-1 && - memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) { + if (mptr->type == ZEND_INTERNAL_FUNCTION && + (mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { fcc.function_handler = _copy_function(mptr TSRMLS_CC); } From cc90ac54beb7359e5a3210261ce09159bbc43e92 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 23 Jun 2012 15:21:20 -0300 Subject: [PATCH 174/641] - BFN --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 79b7325626f..b9bb0091c03 100644 --- a/NEWS +++ b/NEWS @@ -50,6 +50,8 @@ PHP NEWS . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) - Reflection: + . Fixed bug #62384 (Attempting to invoke a Closure more than once causes + segfault). (Felipe) . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant). (Laruence) From e8862725770c3d5ee27c6c8c8a01b226b610fa08 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 23 Jun 2012 15:21:32 -0300 Subject: [PATCH 175/641] - BFN --- NEWS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index dfad253f5a2..e93d717c9e1 100644 --- a/NEWS +++ b/NEWS @@ -52,8 +52,10 @@ PHP NEWS return a value). (Johannes) - Reflection: - . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks - with constant). (Laruence) + . Fixed bug #62384 (Attempting to invoke a Closure more than once causes + segfault). (Felipe) + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) - Sockets: . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) From 84fe2cc890e49f40bac7c3ba74b3cfc6dc4cef2f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 23 Jun 2012 20:46:27 +0200 Subject: [PATCH 176/641] Improve json_encode error handling json_encode() now returns bool(false) for all possible errors, throws the respective warning and also sets the respective json_last_error() error code. Three new error codes have been added: * JSON_ERROR_RECURSION * JSON_ERROR_INF_OR_NAN * JSON_ERROR_UNSUPPORTED_TYPE To get a partial JSON output instead of bool(false) the option JSON_PARTIAL_OUTPUT_ON_ERROR can be specified. In this case the invalid segments will be replaced either by null (for recursion, unsupported type and invalid JSON) or 0 (for Inf and NaN). The warning for invalid UTF-8 stays intact and is thrown also with display_errors = On. If this behavior is undesired this can be remedied later. --- ext/json/JSON_parser.h | 5 ++- ext/json/json.c | 15 ++++++-- ext/json/tests/003.phpt | 13 +++++-- ext/json/tests/004.phpt | 10 +++++ ext/json/tests/inf_nan_error.phpt | 44 ++++++++++++++++++++++ ext/json/tests/json_encode_basic.phpt | 4 +- ext/json/tests/pass001.1.phpt | 4 +- ext/json/tests/pass001.phpt | 4 +- ext/json/tests/unsupported_type_error.phpt | 26 +++++++++++++ 9 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 ext/json/tests/inf_nan_error.phpt create mode 100644 ext/json/tests/unsupported_type_error.phpt diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 746190bb355..5037344890b 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -24,7 +24,10 @@ enum error_codes { PHP_JSON_ERROR_STATE_MISMATCH, PHP_JSON_ERROR_CTRL_CHAR, PHP_JSON_ERROR_SYNTAX, - PHP_JSON_ERROR_UTF8 + PHP_JSON_ERROR_UTF8, + PHP_JSON_ERROR_RECURSION, + PHP_JSON_ERROR_INF_OR_NAN, + PHP_JSON_ERROR_UNSUPPORTED_TYPE }; extern JSON_parser new_JSON_parser(int depth); diff --git a/ext/json/json.c b/ext/json/json.c index ce2cf43fcc9..a90476530e8 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -81,6 +81,9 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -181,6 +184,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } if (myht && myht->nApplyCount > 1) { + JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); smart_str_appendl(buf, "null", 4); return; @@ -303,7 +307,8 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR smart_str_appendl(buf, tmp, l); efree(tmp); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", d); + JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec", d); smart_str_appendc(buf, '0'); } } @@ -460,7 +465,8 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ smart_str_appendl(buf, d, len); efree(d); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", dbl); + JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec", dbl); smart_str_appendc(buf, '0'); } } @@ -476,7 +482,8 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported, encoded as null"); + JSON_G(error_code) = PHP_JSON_ERROR_UNSUPPORTED_TYPE; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported"); smart_str_appendl(buf, "null", 4); break; } @@ -570,7 +577,7 @@ static PHP_FUNCTION(json_encode) php_json_encode(&buf, parameter, options TSRMLS_CC); - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && options ^ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR) { + if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) { ZVAL_FALSE(return_value); } else { ZVAL_STRINGL(return_value, buf.c, buf.len, 1); diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index 3b52fb08841..ab637110087 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -9,10 +9,12 @@ $a = array(); $a[] = &$a; var_dump($a); -var_dump(json_encode($a)); -/* Break circular data structure to prevent memory leaks */ -unset($a[0]); +var_dump(json_encode($a)); +var_dump(json_last_error()); + +var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_last_error()); echo "Done\n"; ?> @@ -25,6 +27,11 @@ array(1) { } } +Warning: json_encode(): recursion detected in %s on line %d +bool(false) +int(6) + Warning: json_encode(): recursion detected in %s on line %d string(8) "[[null]]" +int(6) Done diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 1d282f9a961..9f9abfe46a6 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -9,7 +9,12 @@ $a = new stdclass; $a->prop = $a; var_dump($a); + var_dump(json_encode($a)); +var_dump(json_last_error()); + +var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_last_error()); echo "Done\n"; ?> @@ -19,6 +24,11 @@ object(stdClass)#%d (1) { *RECURSION* } +Warning: json_encode(): recursion detected in %s on line %d +bool(false) +int(6) + Warning: json_encode(): recursion detected in %s on line %d string(22) "{"prop":{"prop":null}}" +int(6) Done diff --git a/ext/json/tests/inf_nan_error.phpt b/ext/json/tests/inf_nan_error.phpt new file mode 100644 index 00000000000..a3ed5e7b882 --- /dev/null +++ b/ext/json/tests/inf_nan_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +An error is thrown when INF or NaN are encoded +--FILE-- + +--EXPECTF-- +float(INF) + +Warning: json_encode(): double INF does not conform to the JSON spec in %s on line %d +bool(false) +int(7) + +Warning: json_encode(): double INF does not conform to the JSON spec in %s on line %d +string(1) "0" +int(7) +float(NAN) + +Warning: json_encode(): double NAN does not conform to the JSON spec in %s on line %d +bool(false) +int(7) + +Warning: json_encode(): double NAN does not conform to the JSON spec in %s on line %d +string(1) "0" +int(7) diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index 003fcd44c6a..7ee68c58ca8 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -151,8 +151,8 @@ string(4) "null" string(4) "null" -- Iteration 26 -- -Warning: json_encode(): type is unsupported, encoded as null in %s on line %d -string(4) "null" +Warning: json_encode(): type is unsupported in %s on line %d +bool(false) -- Iteration 27 -- string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" ===Done=== diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index 7e15a7622ac..a51f885780d 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -90,10 +90,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj); +$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr); +$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt index 43be11e2b0f..1fd05fcdd87 100644 --- a/ext/json/tests/pass001.phpt +++ b/ext/json/tests/pass001.phpt @@ -79,10 +79,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj); +$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr); +$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt new file mode 100644 index 00000000000..2564c6a3c8c --- /dev/null +++ b/ext/json/tests/unsupported_type_error.phpt @@ -0,0 +1,26 @@ +--TEST-- +An error is thrown when an unsupported type is encoded +--FILE-- + +--EXPECTF-- +resource(5) of type (stream) + +Warning: json_encode(): type is unsupported in %s on line %d +bool(false) +int(8) + +Warning: json_encode(): type is unsupported in %s on line %d +string(4) "null" +int(8) From 5b3f4d25ea047f14d6485fb6f456cece384d33ee Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 24 Jun 2012 23:32:50 +0200 Subject: [PATCH 177/641] Fix memory allocation checks for base64 encode base64_encode used safe_emalloc, but one of the arguments was derived from a multiplication, thus making the allocation unsafe again. There was a size check in place, but it was off by a factor of two as it didn't account for the signedness of the integer type. The unsafe allocation is not exploitable, but still causes funny behavior when the sized overflows into a negative number. To fix the issue the *4 factor is moved into the size argument (where it is known to be safe), so safe_emalloc can carry out the multiplication. The size check is removed as it doesn't really make sense once safe_emalloc works correctly. (Would only cause base64_encode to silently return false instead of throwing an error. Also could cause problems with other uses of the base64 encoding API, which all don't check for a NULL return value.) Furthermore the (length + 2) < 0 check is replaced with just length < 0. Allowing lengths -2 and -1 doesn't make sense semantically and also is not honored in the following code (negative length would access unallocated memory.) Actually the length < 0 check doesn't make sense altogether, but I left it there just to be safe. --- ext/standard/base64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 9e9c36250cc..d78cb244c5e 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -59,14 +59,14 @@ PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, in unsigned char *p; unsigned char *result; - if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) { + if (length < 0) { if (ret_length != NULL) { *ret_length = 0; } return NULL; } - result = (unsigned char *)safe_emalloc(((length + 2) / 3) * 4, sizeof(char), 1); + result = (unsigned char *) safe_emalloc((length + 2) / 3, 4 * sizeof(char), 1); p = result; while (length > 2) { /* keep going until we have less than 24 bits */ From 9c5074a484b7f10e65471a21a7ef50dda8391509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 10:59:58 +0200 Subject: [PATCH 178/641] Fix undeclared intl_locale_get_default() This was causing segfaults at least in the resourcebundle constructor. Also moved intl_locale_get_default() to a more central location and fixed a constness warning in resourcebundle_ctor(). --- ext/intl/calendar/calendar_methods.cpp | 2 +- ext/intl/calendar/gregoriancalendar_methods.cpp | 2 +- ext/intl/locale/locale.h | 2 -- ext/intl/locale/locale_methods.c | 8 -------- ext/intl/php_intl.c | 8 ++++++++ ext/intl/php_intl.h | 2 ++ ext/intl/resourcebundle/resourcebundle_class.c | 13 ++++++------- ext/intl/timezone/timezone_methods.cpp | 2 +- 8 files changed, 19 insertions(+), 20 deletions(-) diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 8562a2d69ea..539b11a1f7e 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -25,12 +25,12 @@ #include #include "../intl_convertcpp.h" extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" #include "../intl_convert.h" -#include "../locale/locale.h" #include #include #include diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 47e84633a2d..3c05253de1e 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -24,11 +24,11 @@ #include #include extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" -#include "../locale/locale.h" #include } diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h index 0aaab4b5b51..f3859c7a2a1 100755 --- a/ext/intl/locale/locale.h +++ b/ext/intl/locale/locale.h @@ -22,8 +22,6 @@ #include void locale_register_constants( INIT_FUNC_ARGS ); - -const char *intl_locale_get_default( TSRMLS_D ); #define OPTION_DEFAULT NULL #define LOC_LANG_TAG "language" diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 466dba1f20d..936e3142ad9 100755 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -201,14 +201,6 @@ static int getSingletonPos(char* str) } /* }}} */ -const char *intl_locale_get_default( TSRMLS_D ) -{ - if( INTL_G(default_locale) == NULL ) { - return uloc_getDefault(); - } - return INTL_G(default_locale); -} - /* {{{ proto static string Locale::getDefault( ) Get default locale */ /* }}} */ diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 59272db7127..e0d1081514f 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -109,6 +109,14 @@ ZEND_DECLARE_MODULE_GLOBALS( intl ) +const char *intl_locale_get_default( TSRMLS_D ) +{ + if( INTL_G(default_locale) == NULL ) { + return uloc_getDefault(); + } + return INTL_G(default_locale); +} + /* {{{ Arguments info */ ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index c3d5c60f078..7a7112317de 100755 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -69,6 +69,8 @@ PHP_RINIT_FUNCTION(intl); PHP_RSHUTDOWN_FUNCTION(intl); PHP_MINFO_FUNCTION(intl); +const char *intl_locale_get_default( TSRMLS_D ); + #define PHP_INTL_VERSION "1.1.0" #endif /* PHP_INTL_H */ diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 3d7fd5f00ac..7f1529e519b 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -78,13 +78,11 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM /* {{{ ResourceBundle_ctor */ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char * bundlename; - int bundlename_len = 0; - char * locale; - int locale_len = 0; - zend_bool fallback = 1; - - char * pbuf; + const char *bundlename; + int bundlename_len = 0; + const char *locale; + int locale_len = 0; + zend_bool fallback = 1; zval *object = return_value; ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); @@ -116,6 +114,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING || INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) { + char *pbuf; intl_errors_set_code(NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC); spprintf(&pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource " "'%s' without fallback from %s to %s", diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 1435679fe74..caf5dcdedc0 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -25,10 +25,10 @@ #include #include "intl_convertcpp.h" extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" #include "intl_convert.h" -#include "../locale/locale.h" #include #include } From 715e59ad82862785261dcf91570583eda9fef081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 11:13:23 +0200 Subject: [PATCH 179/641] Duplicate test for ICU 49 The output in ICU < 49 actually seems wrong here; ICU 49 seems to fix the data. --- .../tests/locale_get_display_script2.phpt | 4 +- .../tests/locale_get_display_script3.phpt | 275 ++++++++++++++++++ 2 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 ext/intl/tests/locale_get_display_script3.phpt diff --git a/ext/intl/tests/locale_get_display_script2.phpt b/ext/intl/tests/locale_get_display_script2.phpt index 92652bde906..2b9e037b788 100644 --- a/ext/intl/tests/locale_get_display_script2.phpt +++ b/ext/intl/tests/locale_get_display_script2.phpt @@ -1,8 +1,8 @@ --TEST-- -locale_get_display_script() icu >= 4.8 +locale_get_display_script() icu = 4.8 --SKIPIF-- - += 0) print 'skip'; ?> --FILE-- = 49 +--SKIPIF-- + + +--FILE-- + +--EXPECT-- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='root' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='Hindi' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='fr' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ja' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='i-enochian' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-Hant' +disp_locale=en : display_script=Traditional Han +disp_locale=fr : display_script=chinois traditionnel +disp_locale=de : display_script=Traditionelles Chinesisch +----------------- +locale='zh-Hans' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Cyrl' +disp_locale=en : display_script=Cyrillic +disp_locale=fr : display_script=cyrillique +disp_locale=de : display_script=Kyrillisch +----------------- +locale='sr-Latn' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sl-rozaj' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-1901' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='de-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-US' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='es-419' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_script=Arabic +disp_locale=fr : display_script=arabe +disp_locale=de : display_script=Arabisch +----------------- +locale='zh-min' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='x-whatever' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-419-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='a-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- From 5a9dca458a517f62fc596c57594a02c363c5a3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 11:53:20 +0200 Subject: [PATCH 180/641] Fix build error one ext/intl --- ext/intl/breakiterator/codepointiterator_internal.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp index 2dfae1aa4ff..e88f2eaf6b8 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -16,6 +16,7 @@ #include "codepointiterator_internal.h" #include +#include //copied from cmemory.h, which is not public typedef union { @@ -283,4 +284,4 @@ CodePointBreakIterator &CodePointBreakIterator::refreshInputText(UText *input, U } return *this; -} \ No newline at end of file +} From d8b067e66f4b458108821df512090ede623df214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 12:03:27 +0200 Subject: [PATCH 181/641] BreakIterator: fix compat with old ICU versions --- ext/intl/breakiterator/breakiterator_class.cpp | 4 +++- ext/intl/breakiterator/codepointiterator_internal.cpp | 4 ++++ ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 8 ++++++++ ext/intl/tests/breakiter___construct_error.phpt | 3 +++ ext/intl/tests/rbbiter_getBinaryRules_basic.phpt | 5 ++++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index d193fc44577..de4bfbb7b0d 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -312,7 +312,9 @@ static const zend_function_entry RuleBasedBreakIterator_class_functions[] = { PHP_ME_MAPPING(getRules, rbbi_get_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatus, rbbi_get_rule_status, ainfo_biter_void, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRuleStatusVec, rbbi_get_rule_status_vec, ainfo_biter_void, ZEND_ACC_PUBLIC) +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 PHP_ME_MAPPING(getBinaryRules, rbbi_get_binary_rules, ainfo_biter_void, ZEND_ACC_PUBLIC) +#endif PHP_FE_END }; /* }}} */ @@ -329,7 +331,7 @@ static const zend_function_entry CodePointBreakIterator_class_functions[] = { /* {{{ breakiterator_register_BreakIterator_class * Initialize 'BreakIterator' class */ -void breakiterator_register_BreakIterator_class(TSRMLS_D) +U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) { zend_class_entry ce; diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp index e88f2eaf6b8..bf9239d531f 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -212,6 +212,10 @@ int32_t CodePointBreakIterator::next(int32_t n) { UBool res = utext_moveIndex32(this->fText, n); +#ifndef UTEXT_CURRENT32 +#define UTEXT_CURRENT32 utext_current32 +#endif + if (res) { this->lastCodePoint = UTEXT_CURRENT32(this->fText); return (int32_t)UTEXT_GETNATIVEINDEX(this->fText); diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 288179a7859..41ebfe5e0f5 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -73,12 +73,18 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) RETURN_NULL(); } } else { // compiled +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 rbbi = new RuleBasedBreakIterator((uint8_t*)rules, rules_len, status); if (U_FAILURE(status)) { intl_error_set(NULL, status, "rbbi_create_instance: unable to " "creaete instance from compiled rules", 0 TSRMLS_CC); RETURN_NULL(); } +#else + intl_error_set(NULL, U_UNSUPPORTED_ERROR, "rbbi_create_instance: " + "compiled rules require ICU >= 4.8", 0 TSRMLS_CC); + RETURN_NULL(); +#endif } breakiterator_object_create(return_value, rbbi TSRMLS_CC); @@ -180,6 +186,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) delete[] rules; } +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) { BREAKITER_METHOD_INIT_VARS; @@ -209,3 +216,4 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) RETURN_STRINGL(ret_rules, rules_len, 0); } +#endif diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index e96086de567..8d6a7181ed5 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -1,5 +1,8 @@ --TEST-- IntlRuleBasedBreakIterator::__construct(): arg errors +--SKIPIF-- + += 4.8 only'; ?> --FILE-- += 4.8 only'; ?> --FILE-- getRules() == $rbbi2->getRules()); string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;" bool(true) -==DONE== \ No newline at end of file +==DONE== From 0df73a85e19d71612ab3a0ba03061123453ff2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 12:06:31 +0200 Subject: [PATCH 182/641] Fix typo in error message --- ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 2 +- ext/intl/tests/breakiter___construct_error.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 41ebfe5e0f5..f2a39ba0225 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -77,7 +77,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) rbbi = new RuleBasedBreakIterator((uint8_t*)rules, rules_len, status); if (U_FAILURE(status)) { intl_error_set(NULL, status, "rbbi_create_instance: unable to " - "creaete instance from compiled rules", 0 TSRMLS_CC); + "create instance from compiled rules", 0 TSRMLS_CC); RETURN_NULL(); } #else diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index 8d6a7181ed5..770f1403c71 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -34,5 +34,5 @@ Warning: IntlRuleBasedBreakIterator::__construct() expects parameter 2 to be boo Warning: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: bad arguments in %s on line %d NULL -Warning: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to creaete instance from compiled rules in %s on line %d +Warning: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create instance from compiled rules in %s on line %d NULL From 794d2268f20f8516f07e3189ec6c6b47b556a62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 12:12:22 +0200 Subject: [PATCH 183/641] Update UPGRADING given 7596445 --- UPGRADING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPGRADING b/UPGRADING index 3581b65dea7..77fe97257d4 100755 --- a/UPGRADING +++ b/UPGRADING @@ -188,6 +188,9 @@ PHP X.Y UPGRADE NOTES - IntlCalendar - IntlGregorianCalendar - IntlTimeZone + - IntlBreakIterator + - IntlRuleBasedBreakIterator + - IntlCodePointBreakIterator ======================================== 7. Removed Extensions From e42718227945202044516c71f0098fe464987410 Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Mon, 25 Jun 2012 19:13:23 +0900 Subject: [PATCH 184/641] Fix bug #62373 (serialize() generates wrong reference to the object) --- ext/standard/tests/serialize/bug62373.phpt | 25 ++++++++++++++++++++++ ext/standard/var.c | 7 ++---- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 ext/standard/tests/serialize/bug62373.phpt diff --git a/ext/standard/tests/serialize/bug62373.phpt b/ext/standard/tests/serialize/bug62373.phpt new file mode 100644 index 00000000000..666c33ebdbc --- /dev/null +++ b/ext/standard/tests/serialize/bug62373.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #62373 (serialize() generates wrong reference to the object) +--FILE-- + +--EXPECT-- +OK diff --git a/ext/standard/var.c b/ext/standard/var.c index ddcfde0a204..3e2a45c54b1 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -544,12 +544,9 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old /* relies on "(long)" being a perfect hash function for data pointers, * however the actual identity of an object has had to be determined - * by its object handle and the class entry since 5.0. */ + * by its object handle since 5.0. */ if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { - p = smart_str_print_long(id + sizeof(id) - 1, - (((size_t)Z_OBJCE_P(var) << 5) - | ((size_t)Z_OBJCE_P(var) >> (sizeof(long) * 8 - 5))) - + (long) Z_OBJ_HANDLE_P(var)); + p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else { From 91e1df704eed40325fd963a308e466bbbf96184f Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Mon, 25 Jun 2012 19:13:23 +0900 Subject: [PATCH 185/641] Fix bug #62373 (serialize() generates wrong reference to the object) --- ext/standard/tests/serialize/bug62373.phpt | 25 ++++++++++++++++++++++ ext/standard/var.c | 7 ++---- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 ext/standard/tests/serialize/bug62373.phpt diff --git a/ext/standard/tests/serialize/bug62373.phpt b/ext/standard/tests/serialize/bug62373.phpt new file mode 100644 index 00000000000..666c33ebdbc --- /dev/null +++ b/ext/standard/tests/serialize/bug62373.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #62373 (serialize() generates wrong reference to the object) +--FILE-- + +--EXPECT-- +OK diff --git a/ext/standard/var.c b/ext/standard/var.c index c6126e95fad..735d0a7cbb5 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -541,12 +541,9 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old /* relies on "(long)" being a perfect hash function for data pointers, * however the actual identity of an object has had to be determined - * by its object handle and the class entry since 5.0. */ + * by its object handle since 5.0. */ if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { - p = smart_str_print_long(id + sizeof(id) - 1, - (((size_t)Z_OBJCE_P(var) << 5) - | ((size_t)Z_OBJCE_P(var) >> (sizeof(long) * 8 - 5))) - + (long) Z_OBJ_HANDLE_P(var)); + p = smart_str_print_long(id + sizeof(id) - 1, (long) Z_OBJ_HANDLE_P(var)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else { From ce2082d24f2461b6403e13563ed18656a95581fa Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Mon, 25 Jun 2012 19:20:38 +0900 Subject: [PATCH 186/641] BFN --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index b9bb0091c03..63e91f5c6bc 100644 --- a/NEWS +++ b/NEWS @@ -92,6 +92,8 @@ PHP NEWS (Anatoliy) . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) . Changed php://fd to be available only for CLI. + . Fixed bug #62373 (serialize() generates wrong reference to the object). + (Moriyoshi) - Fileinfo: . Fixed bug #61812 (Uninitialised value used in libmagic). From 5a9bddba6699d056383107728392048cd7ccb598 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 25 Jun 2012 21:41:50 +0200 Subject: [PATCH 187/641] Forgot to git add two tests --- .../generators/close_inside_generator.phpt | 22 +++++++++++++++++++ Zend/tests/generators/func_get_args.phpt | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Zend/tests/generators/close_inside_generator.phpt create mode 100644 Zend/tests/generators/func_get_args.phpt diff --git a/Zend/tests/generators/close_inside_generator.phpt b/Zend/tests/generators/close_inside_generator.phpt new file mode 100644 index 00000000000..41a91c9fc7b --- /dev/null +++ b/Zend/tests/generators/close_inside_generator.phpt @@ -0,0 +1,22 @@ +--TEST-- +Calling close() during the exectution of the generator +--FILE-- +close(); + + echo "Still running"; +} + +$gen = gen(); +$gen->send($gen); + +?> +--EXPECTF-- +Warning: A generator cannot be closed while it is running in %s on line %d +Still running diff --git a/Zend/tests/generators/func_get_args.phpt b/Zend/tests/generators/func_get_args.phpt new file mode 100644 index 00000000000..7ce7fb002f0 --- /dev/null +++ b/Zend/tests/generators/func_get_args.phpt @@ -0,0 +1,20 @@ +--TEST-- +func_get_args() can be used inside generator functions +--FILE-- +rewind(); + +?> +--EXPECT-- +array(2) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" +} From d6e421f6a614ee90893469390f08cfe030f646a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Tue, 26 Jun 2012 12:33:36 +0200 Subject: [PATCH 188/641] Pass orig filename and line through to emalloc and friends --- ext/mysqlnd/mysqlnd_alloc.c | 53 +++++++++++++++++++------------------ ext/mysqlnd/mysqlnd_alloc.h | 4 +-- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 06e979a6e12..f156137cd96 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -65,8 +65,8 @@ const char * mysqlnd_debug_std_no_trace_funcs[] = #if ZEND_DEBUG #else -#define __zend_filename "/unknown/unknown" -#define __zend_lineno 0 +#define __zend_orig_filename "/unknown/unknown" +#define __zend_orig_lineno 0 #endif #define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s)) @@ -83,13 +83,13 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) #endif DBG_ENTER(mysqlnd_emalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = emalloc(REAL_SIZE(size)); + ret = _emalloc(REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -117,13 +117,13 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif DBG_ENTER(mysqlnd_pemalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = pemalloc(REAL_SIZE(size), persistent); + ret = (persistent) ? __zend_malloc(REAL_SIZE(size)) : _emalloc(REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -154,14 +154,14 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif DBG_ENTER(mysqlnd_ecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = ecalloc(nmemb, REAL_SIZE(size)); + ret = _ecalloc(nmemb, REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -189,13 +189,13 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif DBG_ENTER(mysqlnd_pecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = pecalloc(nmemb, REAL_SIZE(size), persistent); + ret = (persistent) ? __zend_calloc(nmemb, REAL_SIZE(size)) : _ecalloc(nmemb, REAL_SIZE(size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -227,14 +227,14 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif DBG_ENTER(mysqlnd_erealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); #if PHP_DEBUG /* -1 is also "true" */ if (*threshold) { #endif - ret = erealloc(REAL_PTR(ptr), REAL_SIZE(new_size)); + ret = _erealloc(REAL_PTR(ptr), REAL_SIZE(new_size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); #if PHP_DEBUG --*threshold; } else if (*threshold == 0) { @@ -262,7 +262,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif DBG_ENTER(mysqlnd_perealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); #if PHP_DEBUG @@ -296,7 +296,7 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); DBG_ENTER(mysqlnd_efree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p", ptr); if (ptr) { @@ -304,7 +304,7 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } - efree(REAL_PTR(ptr)); + _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } if (collect_memory_statistics) { @@ -321,7 +321,7 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); DBG_ENTER(mysqlnd_pefree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p persistent=%u", ptr, persistent); if (ptr) { @@ -329,7 +329,7 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } - pefree(REAL_PTR(ptr), persistent); + (persistent) ? free(REAL_PTR(ptr)) : _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } if (collect_memory_statistics) { @@ -338,6 +338,7 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) } DBG_VOID_RETURN; } +/* }}} */ /* {{{ _mysqlnd_malloc */ @@ -349,7 +350,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif DBG_ENTER(mysqlnd_malloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -382,7 +383,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif DBG_ENTER(mysqlnd_calloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -415,7 +416,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif DBG_ENTER(mysqlnd_realloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); DBG_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); @@ -448,7 +449,7 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); DBG_ENTER(mysqlnd_free_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p", ptr); if (ptr) { @@ -477,10 +478,10 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi char * ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); DBG_ENTER(mysqlnd_pestrndup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p", ptr); - ret = pemalloc(REAL_SIZE(length) + 1, persistent); + ret = (persistent) ? __zend_malloc(REAL_SIZE(length + 1)) : _emalloc(REAL_SIZE(length + 1) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); { size_t l = length; char * p = (char *) ptr; @@ -509,13 +510,13 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME const char * p = ptr; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); DBG_ENTER(mysqlnd_pestrdup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno); + DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); DBG_INF_FMT("ptr=%p", ptr); do { smart_str_appendc(&tmp_str, *p); } while (*p++); - ret = pemalloc(tmp_str.len + sizeof(size_t), persistent); + ret = (persistent) ? __zend_malloc(tmp_str.len + sizeof(size_t)) : _emalloc(REAL_SIZE(tmp_str.len + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); memcpy(FAKE_PTR(ret), tmp_str.c, tmp_str.len); if (ret && collect_memory_statistics) { @@ -549,7 +550,7 @@ PHPAPI void _mysqlnd_sprintf_free(char * p) } /* }}} */ - +/* {{{ _mysqlnd_vsprintf */ PHPAPI int _mysqlnd_vsprintf(char ** pbuf, size_t max_len, const char * format, va_list ap) { return vspprintf(pbuf, max_len, format, ap); diff --git a/ext/mysqlnd/mysqlnd_alloc.h b/ext/mysqlnd/mysqlnd_alloc.h index 673d4f6daed..8d0e3bfacc5 100644 --- a/ext/mysqlnd/mysqlnd_alloc.h +++ b/ext/mysqlnd/mysqlnd_alloc.h @@ -26,8 +26,8 @@ extern const char * mysqlnd_debug_std_no_trace_funcs[]; -#define MYSQLND_MEM_D TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC -#define MYSQLND_MEM_C TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC +#define MYSQLND_MEM_D TSRMLS_DC ZEND_FILE_LINE_ORIG_DC +#define MYSQLND_MEM_C TSRMLS_CC ZEND_FILE_LINE_CC struct st_mysqlnd_allocator_methods { From a44a1dc194e60c51a4b7716f78f34a7dc334744b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 26 Jun 2012 18:42:33 +0800 Subject: [PATCH 189/641] Fixed bug #62357 (compile failure: (S) Arguments missing for built-in function __memcmp). Any C library function may be a macro, We should avoid using ZEND_STRS(L) as their arguments --- NEWS | 2 ++ Zend/zend_language_parser.y | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e93d717c9e1..f8a98c73d29 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.5 - Core: + . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in + function __memcmp). (Laruence) . Fixed bug #61998 (Using traits with method aliases appears to result in crash during execution). (Dmitry) . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index d0730b75d6d..9a0b3209e5b 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -1191,7 +1191,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr) if (LANG_SCNG(yy_text)[0] == 0 && LANG_SCNG(yy_leng) == 1 && - memcmp(yystr, ZEND_STRL("\"end of file\"")) == 0) { + memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) { yystpcpy(yyres, "end of file"); return sizeof("end of file")-1; } From ad2bee193d9850cac9e214e9293f4dc3cd77d857 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 26 Jun 2012 15:22:29 -0700 Subject: [PATCH 190/641] ws fix --- php.ini-development | 2 +- php.ini-production | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/php.ini-development b/php.ini-development index 13755165b13..d1fa7a35e87 100644 --- a/php.ini-development +++ b/php.ini-development @@ -1909,7 +1909,7 @@ ldap.max_links = -1 [xsl] ; Write operations from within XSLT are disabled by default. -; XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE = 44 +; XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE = 44 ; Set it to 0 to allow all operations ;xsl.security_prefs = 44 diff --git a/php.ini-production b/php.ini-production index 495fb01a4d7..9d5861dd55e 100644 --- a/php.ini-production +++ b/php.ini-production @@ -1909,7 +1909,7 @@ ldap.max_links = -1 [xsl] ; Write operations from within XSLT are disabled by default. -; XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE = 44 +; XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE = 44 ; Set it to 0 to allow all operations ;xsl.security_prefs = 44 From 7a0f4cfddef2761b5893ececc4682e0cbd90facc Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 26 Jun 2012 21:56:11 -0700 Subject: [PATCH 191/641] update NEWS --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f8a98c73d29..b1de5f189e4 100644 --- a/NEWS +++ b/NEWS @@ -69,7 +69,7 @@ PHP NEWS - Zip: . Upgraded libzip to 0.10.1 (Anatoliy) -?? ??? 2012, PHP 5.4.4 +14 Jun 2012, PHP 5.4.4 - COM: . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) From bc0972e78daec4d7b7adccb7116f8ded2ca5044d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 27 Jun 2012 11:42:43 +0200 Subject: [PATCH 192/641] Fix memleak in CLI --- sapi/cli/php_cli.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index f26db43151b..d63ee1ae840 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1367,6 +1367,9 @@ out: if (request_started) { php_request_shutdown((void *) 0); } + if (translated_path) { + free(translated_path); + } if (exit_status == 0) { exit_status = EG(exit_status); } From 4662151ea7d7b6920d115cf2a2d6e9d4232727a3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 27 Jun 2012 12:19:41 +0200 Subject: [PATCH 193/641] Improve JSON error handling json_encode() no longer throws warnings. Instead only the error code for json_last_error() is set. As it is hard to debug the error from just an error code an optional $as_string parameter was added to json_last_error(), which returns an error message instead of an error code. --- NEWS | 3 ++ ext/json/json.c | 41 +++++++++++++++++----- ext/json/tests/003.phpt | 10 ++++-- ext/json/tests/004.phpt | 10 ++++-- ext/json/tests/bug54058.phpt | 16 +++++---- ext/json/tests/bug61537.phpt | 29 +++++++++------ ext/json/tests/inf_nan_error.phpt | 23 ++++++------ ext/json/tests/json_encode_basic.phpt | 2 -- ext/json/tests/unsupported_type_error.phpt | 10 +++--- 9 files changed, 95 insertions(+), 49 deletions(-) diff --git a/NEWS b/NEWS index 63e91f5c6bc..79db5c6b7bf 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,9 @@ PHP NEWS . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks pattern). (Gustavo) . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) + +- JSON: + . Improved error handling. (Nikita Popov) - PDO: . Fixed bug #61755 (A parsing bug in the prepared statements can lead to diff --git a/ext/json/json.c b/ext/json/json.c index a90476530e8..5e0351f3f1e 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -51,7 +51,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1) ZEND_ARG_INFO(0, depth) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_json_last_error, 0, 0, 0) + ZEND_ARG_INFO(0, as_string) ZEND_END_ARG_INFO() /* }}} */ @@ -185,7 +186,6 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) if (myht && myht->nApplyCount > 1) { JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); smart_str_appendl(buf, "null", 4); return; } @@ -308,7 +308,6 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR efree(tmp); } else { JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec", d); smart_str_appendc(buf, '0'); } } @@ -326,7 +325,6 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (len < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); smart_str_appendl(buf, "null", 4); } else { smart_str_appendl(buf, "\"\"", 2); @@ -466,7 +464,6 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ efree(d); } else { JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec", dbl); smart_str_appendc(buf, '0'); } } @@ -483,7 +480,6 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ default: JSON_G(error_code) = PHP_JSON_ERROR_UNSUPPORTED_TYPE; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported"); smart_str_appendl(buf, "null", 4); break; } @@ -614,11 +610,40 @@ static PHP_FUNCTION(json_decode) Returns the error code of the last json_decode(). */ static PHP_FUNCTION(json_last_error) { - if (zend_parse_parameters_none() == FAILURE) { + zend_bool as_string = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &as_string) == FAILURE) { return; } - RETURN_LONG(JSON_G(error_code)); + /* return error code (JSON_ERROR_* constants) */ + if (!as_string) { + RETURN_LONG(JSON_G(error_code)); + } + + /* return error message (for debugging purposes) */ + switch(JSON_G(error_code)) { + case PHP_JSON_ERROR_NONE: + RETURN_STRING("No error", 1); + case PHP_JSON_ERROR_DEPTH: + RETURN_STRING("Maximum stack depth exceeded", 1); + case PHP_JSON_ERROR_STATE_MISMATCH: + RETURN_STRING("State mismatch (invalid or malformed JSON)", 1); + case PHP_JSON_ERROR_CTRL_CHAR: + RETURN_STRING("Control character error, possibly incorrectly encoded", 1); + case PHP_JSON_ERROR_SYNTAX: + RETURN_STRING("Syntax error", 1); + case PHP_JSON_ERROR_UTF8: + RETURN_STRING("Malformed UTF-8 characters, possibly incorrectly encoded", 1); + case PHP_JSON_ERROR_RECURSION: + RETURN_STRING("Recursion detected", 1); + case PHP_JSON_ERROR_INF_OR_NAN: + RETURN_STRING("Inf and NaN cannot be JSON encoded", 1); + case PHP_JSON_ERROR_UNSUPPORTED_TYPE: + RETURN_STRING("Type is not supported", 1); + default: + RETURN_STRING("Unknown error", 1); + } } /* }}} */ diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index ab637110087..71874525a70 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -10,11 +10,17 @@ $a[] = &$a; var_dump($a); +echo "\n"; + var_dump(json_encode($a)); var_dump(json_last_error()); +var_dump(json_last_error(true)); + +echo "\n"; var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); var_dump(json_last_error()); +var_dump(json_last_error(true)); echo "Done\n"; ?> @@ -27,11 +33,11 @@ array(1) { } } -Warning: json_encode(): recursion detected in %s on line %d bool(false) int(6) +string(%d) "Recursion detected" -Warning: json_encode(): recursion detected in %s on line %d string(8) "[[null]]" int(6) +string(%d) "Recursion detected" Done diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 9f9abfe46a6..49c543edcae 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -10,11 +10,17 @@ $a->prop = $a; var_dump($a); +echo "\n"; + var_dump(json_encode($a)); var_dump(json_last_error()); +var_dump(json_last_error(true)); + +echo "\n"; var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); var_dump(json_last_error()); +var_dump(json_last_error(true)); echo "Done\n"; ?> @@ -24,11 +30,11 @@ object(stdClass)#%d (1) { *RECURSION* } -Warning: json_encode(): recursion detected in %s on line %d bool(false) int(6) +string(%d) "Recursion detected" -Warning: json_encode(): recursion detected in %s on line %d string(22) "{"prop":{"prop":null}}" int(6) +string(%d) "Recursion detected" Done diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt index 08c7f579ab9..2c2304578e2 100644 --- a/ext/json/tests/bug54058.phpt +++ b/ext/json/tests/bug54058.phpt @@ -9,17 +9,20 @@ $bad_utf8 = quoted_printable_decode('=B0'); json_encode($bad_utf8); var_dump(json_last_error()); +var_dump(json_last_error(true)); $a = new stdclass; $a->foo = quoted_printable_decode('=B0'); json_encode($a); var_dump(json_last_error()); +var_dump(json_last_error(true)); $b = new stdclass; $b->foo = $bad_utf8; $b->bar = 1; json_encode($b); var_dump(json_last_error()); +var_dump(json_last_error(true)); $c = array( 'foo' => $bad_utf8, @@ -27,16 +30,15 @@ $c = array( ); json_encode($c); var_dump(json_last_error()); +var_dump(json_last_error(true)); + ?> --EXPECTF-- -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt index e2abdda66a3..f6bb02bae45 100644 --- a/ext/json/tests/bug61537.phpt +++ b/ext/json/tests/bug61537.phpt @@ -5,26 +5,35 @@ Bug #61537 (json_encode() incorrectly truncates/discards information) --FILE-- --EXPECTF-- -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d bool(false) int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" string(4) "null" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d bool(false) int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" string(4) "null" int(5) +string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/inf_nan_error.phpt b/ext/json/tests/inf_nan_error.phpt index a3ed5e7b882..f12e902d9f0 100644 --- a/ext/json/tests/inf_nan_error.phpt +++ b/ext/json/tests/inf_nan_error.phpt @@ -8,37 +8,36 @@ $inf = INF; var_dump($inf); var_dump(json_encode($inf)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); var_dump(json_encode($inf, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); + +echo "\n"; $nan = NAN; var_dump($nan); var_dump(json_encode($nan)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); var_dump(json_encode($nan, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); ?> --EXPECTF-- float(INF) - -Warning: json_encode(): double INF does not conform to the JSON spec in %s on line %d bool(false) int(7) - -Warning: json_encode(): double INF does not conform to the JSON spec in %s on line %d +string(34) "Inf and NaN cannot be JSON encoded" string(1) "0" int(7) +string(34) "Inf and NaN cannot be JSON encoded" + float(NAN) - -Warning: json_encode(): double NAN does not conform to the JSON spec in %s on line %d bool(false) int(7) - -Warning: json_encode(): double NAN does not conform to the JSON spec in %s on line %d +string(34) "Inf and NaN cannot be JSON encoded" string(1) "0" int(7) +string(34) "Inf and NaN cannot be JSON encoded" diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index 7ee68c58ca8..fc348eed811 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -150,8 +150,6 @@ string(4) "null" -- Iteration 25 -- string(4) "null" -- Iteration 26 -- - -Warning: json_encode(): type is unsupported in %s on line %d bool(false) -- Iteration 27 -- string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt index 2564c6a3c8c..f36afb44a5e 100644 --- a/ext/json/tests/unsupported_type_error.phpt +++ b/ext/json/tests/unsupported_type_error.phpt @@ -8,19 +8,17 @@ $resource = fopen(__FILE__, "r"); var_dump($resource); var_dump(json_encode($resource)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); var_dump(json_encode($resource, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error()); +var_dump(json_last_error(), json_last_error(true)); ?> --EXPECTF-- resource(5) of type (stream) - -Warning: json_encode(): type is unsupported in %s on line %d bool(false) int(8) - -Warning: json_encode(): type is unsupported in %s on line %d +string(21) "Type is not supported" string(4) "null" int(8) +string(21) "Type is not supported" From 8d264dba93416cfafb289f04db47c427a89d4977 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 27 Jun 2012 09:01:02 -0300 Subject: [PATCH 194/641] - Fixed build --- ext/intl/breakiterator/breakiterator_methods.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 7b502528f3e..6a61f8cb93e 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -24,6 +24,7 @@ #include "breakiterator_iterators.h" extern "C" { +#include "../php_intl.h" #define USE_BREAKITERATOR_POINTER 1 #include "breakiterator_class.h" #include "../locale/locale.h" From 6e648e934052c784eeb7ee3784aea0cf52bf4898 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 27 Jun 2012 16:51:07 +0300 Subject: [PATCH 195/641] trace allocations in a file --- ext/mysqlnd/mysqlnd.h | 6 +- ext/mysqlnd/mysqlnd_alloc.c | 132 ++++++++++++++++++------------------ ext/mysqlnd/mysqlnd_debug.c | 29 ++++---- ext/mysqlnd/mysqlnd_debug.h | 84 +++++++++++++++++------ ext/mysqlnd/php_mysqlnd.c | 16 ++++- 5 files changed, 165 insertions(+), 102 deletions(-) diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 33338cfc80a..30d42578023 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -262,8 +262,10 @@ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_L ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) zend_bool collect_statistics; zend_bool collect_memory_statistics; - char* debug; /* The actual string */ - MYSQLND_DEBUG *dbg; /* The DBG object */ + char * debug; /* The actual string */ + char * trace_alloc_settings; /* The actual string */ + MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */ + MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */ long net_cmd_buffer_size; long net_read_buffer_size; long log_mask; diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index f156137cd96..65423e44fa2 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -81,9 +81,9 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_emalloc_name); + TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -97,13 +97,13 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT, 1, STAT_MEM_EMALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -116,8 +116,9 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_pemalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", + strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno,persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -131,7 +132,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT; @@ -140,7 +141,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -153,9 +154,9 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_ecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); + TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); #if PHP_DEBUG /* -1 is also "true" */ @@ -169,13 +170,13 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC)); - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC)); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -188,8 +189,9 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_pecalloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", + strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno, persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -203,7 +205,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT; @@ -212,7 +214,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -226,9 +228,9 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_erealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); + TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); #if PHP_DEBUG /* -1 is also "true" */ @@ -242,12 +244,12 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMOUNT, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -261,9 +263,9 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_perealloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); + TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -277,7 +279,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT; @@ -285,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -295,14 +297,14 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_efree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p", ptr); + TRACE_ALLOC_ENTER(mysqlnd_efree_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } @@ -310,7 +312,7 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) if (collect_memory_statistics) { MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EFREE_COUNT, 1, STAT_MEM_EFREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } /* }}} */ @@ -320,14 +322,14 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pefree_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p persistent=%u", ptr, persistent); + TRACE_ALLOC_ENTER(mysqlnd_pefree_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p persistent=%u", ptr, persistent); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } (persistent) ? free(REAL_PTR(ptr)) : _efree(REAL_PTR(ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } @@ -336,7 +338,7 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(persistent? STAT_MEM_FREE_COUNT:STAT_MEM_EFREE_COUNT, 1, persistent? STAT_MEM_FREE_AMOUNT:STAT_MEM_EFREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } /* }}} */ @@ -349,8 +351,8 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_malloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_ENTER(mysqlnd_malloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -364,12 +366,12 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -382,8 +384,8 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_calloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_ENTER(mysqlnd_calloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -397,12 +399,12 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("size=%lu ptr=%p", size, ret); + TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); if (ret && collect_memory_statistics) { *(size_t *) ret = size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMOUNT, size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -415,10 +417,10 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif - DBG_ENTER(mysqlnd_realloc_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); - DBG_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); + TRACE_ALLOC_ENTER(mysqlnd_realloc_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); + TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); #if PHP_DEBUG /* -1 is also "true" */ @@ -432,13 +434,13 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) } #endif - DBG_INF_FMT("new_ptr=%p", (char*)ret); + TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); if (ret && collect_memory_statistics) { *(size_t *) ret = new_size; MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMOUNT, new_size); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -448,14 +450,14 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_free_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p", ptr); + TRACE_ALLOC_ENTER(mysqlnd_free_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { if (collect_memory_statistics) { free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); + TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); } free(REAL_PTR(ptr)); } @@ -463,7 +465,7 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) if (collect_memory_statistics) { MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_FREE_COUNT, 1, STAT_MEM_FREE_AMOUNT, free_amount); } - DBG_VOID_RETURN; + TRACE_ALLOC_VOID_RETURN; } /* }}} */ @@ -477,9 +479,9 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi { char * ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pestrndup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p", ptr); + TRACE_ALLOC_ENTER(mysqlnd_pestrndup_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); ret = (persistent) ? __zend_malloc(REAL_SIZE(length + 1)) : _emalloc(REAL_SIZE(length + 1) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); { @@ -497,7 +499,7 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi MYSQLND_INC_GLOBAL_STATISTIC(persistent? STAT_MEM_STRNDUP_COUNT : STAT_MEM_ESTRNDUP_COUNT); } - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ @@ -509,9 +511,9 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME smart_str tmp_str = {0, 0, 0}; const char * p = ptr; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - DBG_ENTER(mysqlnd_pestrdup_name); - DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); - DBG_INF_FMT("ptr=%p", ptr); + TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("ptr=%p", ptr); do { smart_str_appendc(&tmp_str, *p); } while (*p++); @@ -525,7 +527,7 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME } smart_str_free(&tmp_str); - DBG_RETURN(FAKE_PTR(ret)); + TRACE_ALLOC_RETURN(FAKE_PTR(ret)); } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index 5c77b42459b..cf355d2ffb5 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -745,21 +745,26 @@ mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC) PHPAPI void _mysqlnd_debug(const char * mode TSRMLS_DC) { #if PHP_DEBUG - MYSQLND_DEBUG *dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * dbg = MYSQLND_G(dbg); if (!dbg) { - MYSQLND_G(dbg) = dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); - if (!dbg) { - return; + struct st_mysqlnd_plugin_trace_log * trace_log_plugin = mysqlnd_plugin_find("debug_trace"); + if (trace_log_plugin) { + dbg = trace_log_plugin->methods.trace_instance_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); + if (!dbg) { + return; + } + MYSQLND_G(dbg) = dbg; } } - - dbg->m->close(dbg); - dbg->m->set_mode(dbg, mode); - while (zend_stack_count(&dbg->call_stack)) { - zend_stack_del_top(&dbg->call_stack); - } - while (zend_stack_count(&dbg->call_time_stack)) { - zend_stack_del_top(&dbg->call_time_stack); + if (dbg) { + dbg->m->close(dbg); + dbg->m->set_mode(dbg, mode); + while (zend_stack_count(&dbg->call_stack)) { + zend_stack_del_top(&dbg->call_stack); + } + while (zend_stack_count(&dbg->call_time_stack)) { + zend_stack_del_top(&dbg->call_time_stack); + } } #endif } diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index 5d2d1d2867c..3441dc74e1a 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -101,44 +101,63 @@ PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); #define DBG_INF_FMT_EX(dbg_obj, ...) do { if (dbg_skip_trace == FALSE) (dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", __VA_ARGS__); } while (0) #define DBG_ERR_FMT_EX(dbg_obj, ...) do { if (dbg_skip_trace == FALSE) (dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "error: ", __VA_ARGS__); } while (0) -#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \ - { \ - DBG_ENTER_EX(dbg_obj, (block_name)); +#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) DBG_BLOCK_ENTER_EX2((dbg_obj), NULL, (block_name)) +#define DBG_BLOCK_LEAVE_EX(dbg_obj) DBG_BLOCK_LEAVE_EX2((dbg_obj)) -#define DBG_BLOCK_LEAVE_EX(dbg_obj) \ - DBG_LEAVE_EX((dbg_obj), ;) \ +#define DBG_BLOCK_ENTER_EX2(dbg_obj1, dbg_obj2, block_name) \ + { \ + DBG_ENTER_EX2((dbg_obj1), (db_obj2), (block_name)); + +#define DBG_BLOCK_LEAVE_EX2(dbg_obj1, dbg_obj2) \ + DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), ;) \ } \ -#define DBG_ENTER_EX(dbg_obj, func_name) \ +#define DBG_ENTER_EX(dbg_obj, func_name) DBG_ENTER_EX2((dbg_obj), (MYSQLND_DEBUG *) NULL, (func_name)) +#define DBG_LEAVE_EX(dbg_obj, leave) DBG_LEAVE_EX2((dbg_obj), (MYSQLND_DEBUG *) NULL, leave) + +#define DBG_ENTER_EX2(dbg_obj1, dbg_obj2, func_name) \ struct timeval __dbg_prof_tp = {0}; \ uint64_t __dbg_prof_start = 0; /* initialization is needed */ \ zend_bool dbg_skip_trace = TRUE; \ - if ((dbg_obj)) { \ - dbg_skip_trace = !(dbg_obj)->m->func_enter((dbg_obj), __LINE__, __FILE__, func_name, strlen(func_name)); \ + if ((dbg_obj1)) { \ + dbg_skip_trace = !(dbg_obj1)->m->func_enter((dbg_obj1), __LINE__, __FILE__, func_name, strlen(func_name)); \ } \ - if (dbg_skip_trace); /* shut compiler's mouth */ \ + if ((dbg_obj2)) { \ + dbg_skip_trace = !(dbg_obj2)->m->func_enter((dbg_obj2), __LINE__, __FILE__, func_name, strlen(func_name)); \ + } \ + if (dbg_skip_trace); /* shut compiler's mouth */\ do { \ - if ((dbg_obj) && (dbg_obj)->flags & MYSQLND_DEBUG_PROFILE_CALLS) { \ + if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \ + ((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \ + { \ DBG_PROFILE_START_TIME(); \ } \ } while (0); -#define DBG_LEAVE_EX(dbg_obj, leave) \ +#define DBG_LEAVE_EX2(dbg_obj1, dbg_obj2, leave) \ do {\ - if ((dbg_obj)) { \ - uint64_t this_call_duration = 0; \ - if ((dbg_obj)->flags & MYSQLND_DEBUG_PROFILE_CALLS) { \ - DBG_PROFILE_END_TIME(this_call_duration); \ - } \ - (dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__, this_call_duration); \ + uint64_t this_call_duration = 0; \ + if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \ + ((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \ + { \ + DBG_PROFILE_END_TIME(this_call_duration); \ + } \ + if ((dbg_obj1)) { \ + (dbg_obj1)->m->func_leave((dbg_obj1), __LINE__, __FILE__, this_call_duration); \ + } \ + if ((dbg_obj2)) { \ + (dbg_obj2)->m->func_leave((dbg_obj2), __LINE__, __FILE__, this_call_duration); \ } \ leave \ } while (0); -#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);) -#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;) +#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX((dbg_obj), return (value);) +#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX((dbg_obj), return;) + +#define DBG_RETURN_EX2(dbg_obj1, dbg_obj2, value) DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), return (value);) +#define DBG_VOID_RETURN_EX2(dbg_obj1, dbg_obj2) DBG_LEAVE_EX2((dbg_obj1), (dbg_obj2), return;) @@ -168,6 +187,18 @@ static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const func #define DBG_VOID_RETURN DBG_VOID_RETURN_EX(MYSQLND_G(dbg)) #define DBG_BLOCK_LEAVE DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg)) + +#define TRACE_ALLOC_INF(msg) DBG_INF_EX(MYSQLND_G(trace_alloc), (msg)) +#define TRACE_ALLOC_ERR(msg) DBG_ERR_EX(MYSQLND_G(trace_alloc), (msg)) +#define TRACE_ALLOC_INF_FMT(...) DBG_INF_FMT_EX(MYSQLND_G(trace_alloc), __VA_ARGS__) +#define TRACE_ALLOC_ERR_FMT(...) DBG_ERR_FMT_EX(MYSQLND_G(trace_alloc), __VA_ARGS__) + +#define TRACE_ALLOC_ENTER(func_name) DBG_ENTER_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (func_name)) +#define TRACE_ALLOC_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (bname)) +#define TRACE_ALLOC_RETURN(value) DBG_RETURN_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc), (value)) +#define TRACE_ALLOC_VOID_RETURN DBG_VOID_RETURN_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc)) +#define TRACE_ALLOC_BLOCK_LEAVE DBG_BLOCK_LEAVE_EX2(MYSQLND_G(dbg), MYSQLND_G(trace_alloc)) + #elif MYSQLND_DBG_ENABLED == 0 static inline void DBG_INF(const char * const msg) {} @@ -176,10 +207,21 @@ static inline void DBG_INF_FMT(const char * const format, ...) {} static inline void DBG_ERR_FMT(const char * const format, ...) {} static inline void DBG_ENTER(const char * const func_name) {} #define DBG_BLOCK_ENTER(bname) { -#define DBG_RETURN(value) return (value) -#define DBG_VOID_RETURN return +#define DBG_RETURN(value) return (value) +#define DBG_VOID_RETURN return #define DBG_BLOCK_LEAVE } + +static inline void TRACE_ALLOC_INF(const char * const msg) {} +static inline void TRACE_ALLOC_ERR(const char * const msg) {} +static inline void TRACE_ALLOC_INF_FMT(const char * const format, ...) {} +static inline void TRACE_ALLOC_ERR_FMT(const char * const format, ...) {} +static inline void TRACE_ALLOC_ENTER(const char * const func_name) {} +#define TRACE_ALLOC_BLOCK_ENTER(bname) { +#define TRACE_ALLOC_RETURN(value) return (value) +#define TRACE_ALLOC_VOID_RETURN return +#define TRACE_ALLOC_BLOCK_LEAVE } + #endif #endif /* MYSQLND_DEBUG_H */ diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 20fcc5e7adb..0a8fd609086 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -221,6 +221,8 @@ static PHP_GINIT_FUNCTION(mysqlnd) mysqlnd_globals->collect_memory_statistics = FALSE; mysqlnd_globals->debug = NULL; /* The actual string */ mysqlnd_globals->dbg = NULL; /* The DBG object*/ + mysqlnd_globals->trace_alloc_settings = NULL; + mysqlnd_globals->trace_alloc = NULL; mysqlnd_globals->net_cmd_buffer_size = MYSQLND_NET_CMD_BUFFER_MIN_SIZE; mysqlnd_globals->net_read_buffer_size = 32768; mysqlnd_globals->net_read_timeout = 31536000; @@ -253,6 +255,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("mysqlnd.collect_statistics", "1", PHP_INI_ALL, OnUpdateBool, collect_statistics, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_BOOLEAN("mysqlnd.collect_memory_statistics", "0", PHP_INI_SYSTEM, OnUpdateBool, collect_memory_statistics, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.debug", NULL, PHP_INI_SYSTEM, OnUpdateString, debug, zend_mysqlnd_globals, mysqlnd_globals) + STD_PHP_INI_ENTRY("mysqlnd.trace_alloc", NULL, PHP_INI_SYSTEM, OnUpdateString, trace_alloc_settings, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_cmd_buffer_size", MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR, PHP_INI_ALL, OnUpdateNetCmdBufferSize, net_cmd_buffer_size, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_read_buffer_size", "32768",PHP_INI_ALL, OnUpdateLong, net_read_buffer_size, zend_mysqlnd_globals, mysqlnd_globals) STD_PHP_INI_ENTRY("mysqlnd.net_read_timeout", "31536000", PHP_INI_SYSTEM, OnUpdateLong, net_read_timeout, zend_mysqlnd_globals, mysqlnd_globals) @@ -306,11 +309,14 @@ static PHP_RINIT_FUNCTION(mysqlnd) MYSQLND_G(dbg) = NULL; if (trace_log_plugin) { MYSQLND_DEBUG * dbg = trace_log_plugin->methods.trace_instance_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); - if (!dbg) { + MYSQLND_DEBUG * trace_alloc = trace_log_plugin->methods.trace_instance_init(NULL TSRMLS_CC); + if (!dbg || !trace_alloc) { return FAILURE; } dbg->m->set_mode(dbg, MYSQLND_G(debug)); + trace_alloc->m->set_mode(trace_alloc, MYSQLND_G(trace_alloc_settings)); MYSQLND_G(dbg) = dbg; + MYSQLND_G(trace_alloc) = trace_alloc; } } return SUCCESS; @@ -324,13 +330,19 @@ static PHP_RINIT_FUNCTION(mysqlnd) */ static PHP_RSHUTDOWN_FUNCTION(mysqlnd) { - MYSQLND_DEBUG *dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * dbg = MYSQLND_G(dbg); + MYSQLND_DEBUG * trace_alloc = MYSQLND_G(trace_alloc); DBG_ENTER("RSHUTDOWN"); if (dbg) { dbg->m->close(dbg); dbg->m->free_handle(dbg); MYSQLND_G(dbg) = NULL; } + if (trace_alloc) { + trace_alloc->m->close(trace_alloc); + trace_alloc->m->free_handle(trace_alloc); + MYSQLND_G(trace_alloc) = NULL; + } return SUCCESS; } /* }}} */ From b025b9d0cf9921d26fc4dad43cf26390d0a8c5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 27 Jun 2012 23:26:33 +0200 Subject: [PATCH 196/641] Fix #62432 ReflectionMethod random corrupt memory on high concurrent This fixes the same issue in multiple extensions. This isn't needed in later branches as 5.4 introduced object_properties_init() --- NEWS | 2 ++ ext/date/php_date.c | 8 ++++---- ext/fileinfo/fileinfo.c | 2 +- ext/pdo/pdo_dbh.c | 2 +- ext/pdo/pdo_stmt.c | 2 +- ext/reflection/php_reflection.c | 2 +- ext/soap/soap.c | 2 +- ext/spl/spl_array.c | 2 +- ext/spl/spl_directory.c | 2 +- ext/spl/spl_dllist.c | 2 +- ext/spl/spl_fixedarray.c | 2 +- ext/spl/spl_heap.c | 2 +- ext/spl/spl_iterators.c | 2 +- ext/spl/spl_observer.c | 2 +- ext/sqlite/sqlite.c | 2 +- ext/sqlite3/sqlite3.c | 6 +++--- ext/tidy/tidy.c | 2 +- ext/xmlreader/php_xmlreader.c | 2 +- ext/xmlwriter/php_xmlwriter.c | 2 +- ext/xsl/php_xsl.c | 2 +- ext/zip/php_zip.c | 2 +- 21 files changed, 27 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 79db5c6b7bf..520aa192f27 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ PHP NEWS . Fixed CVE-2012-2143. (Solar Designer) . Fixed potential overflow in _php_stream_scandir. (Jason Powell, Stas) + . Fixed bug #62432 (ReflectionMethod random corrupt memory on high + concurrent). (Johannes) - Fileinfo: . Fixed magic file regex support. (Felipe) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index ab4cc494429..527894d2236 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2035,7 +2035,7 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_ } zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC); retval.handlers = &date_object_handlers_date; @@ -2159,7 +2159,7 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl } zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC); retval.handlers = &date_object_handlers_timezone; @@ -2215,7 +2215,7 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl } zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC); retval.handlers = &date_object_handlers_interval; @@ -2291,7 +2291,7 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas } zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC); retval.handlers = &date_object_handlers_period; diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 2c0e39a714f..36c5e392ebc 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -104,7 +104,7 @@ PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_typ memset(intern, 0, sizeof(struct finfo_object)); zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); intern->ptr = NULL; diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 1c3bb8a8b3d..6b3ba3bb1ba 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1580,7 +1580,7 @@ zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC) dbh->refcount = 1; ALLOC_HASHTABLE(dbh->properties); zend_hash_init(dbh->properties, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(dbh->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(dbh->properties, &ce->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); dbh->def_stmt_ce = pdo_dbstmt_ce; retval.handle = zend_objects_store_put(dbh, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)pdo_dbh_free_storage, NULL TSRMLS_CC); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index f2828499f7b..0cf0cf852a6 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2466,7 +2466,7 @@ zend_object_value pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC) stmt->refcount = 1; ALLOC_HASHTABLE(stmt->properties); zend_hash_init(stmt->properties, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(stmt->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(stmt->properties, &ce->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(stmt, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)pdo_dbstmt_free_storage, (zend_objects_store_clone_t)dbstmt_clone_obj TSRMLS_CC); retval.handlers = &pdo_dbstmt_object_handlers; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 180ce8f91aa..e98652ba232 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -314,7 +314,7 @@ static zend_object_value reflection_objects_new(zend_class_entry *class_type TSR intern->zo.ce = class_type; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, NULL TSRMLS_CC); retval.handlers = &reflection_object_handlers; return retval; diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 87391ab76dd..120f78071b5 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1265,7 +1265,7 @@ PHP_METHOD(SoapServer, SoapServer) ALLOC_HASHTABLE(service->class_map); zend_hash_init(service->class_map, zend_hash_num_elements((*tmp)->value.ht), NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &ztmp, sizeof(zval *)); + zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_property_ctor, (void *) &ztmp, sizeof(zval *)); } if (zend_hash_find(ht, "typemap", sizeof("typemap"), (void**)&tmp) == SUCCESS && diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 5bbab907e46..80ca5be6128 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -174,7 +174,7 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); intern->ar_flags = 0; intern->serialize_data = NULL; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index aaa256de7b2..4f8edb5211a 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -158,7 +158,7 @@ static zend_object_value spl_filesystem_object_new_ex(zend_class_entry *class_ty if (obj) *obj = intern; zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_filesystem_object_free_storage, NULL TSRMLS_CC); retval.handlers = &spl_filesystem_object_handlers; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 84afdd68490..0774857cc38 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -376,7 +376,7 @@ static zend_object_value spl_dllist_object_new_ex(zend_class_entry *class_type, ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); intern->flags = 0; intern->traverse_position = 0; diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 4cd78f3774b..ee8f51eb33f 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -215,7 +215,7 @@ static zend_object_value spl_fixedarray_object_new_ex(zend_class_entry *class_ty ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); intern->current = 0; intern->flags = 0; diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index a0055f410df..a663422a275 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -394,7 +394,7 @@ static zend_object_value spl_heap_object_new_ex(zend_class_entry *class_type, sp ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); intern->flags = 0; intern->fptr_cmp = NULL; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index ddcdedbd69d..eecd483ba77 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -921,7 +921,7 @@ static zend_object_value spl_RecursiveIteratorIterator_new_ex(zend_class_entry * } zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)spl_RecursiveIteratorIterator_dtor, (zend_objects_free_object_storage_t) spl_RecursiveIteratorIterator_free_storage, NULL TSRMLS_CC); retval.handlers = &spl_handlers_rec_it_it; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index a1e497ec5e7..85bbeec7319 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -206,7 +206,7 @@ static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type, *obj = intern; zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); zend_hash_init(&intern->storage, 0, NULL, (void (*)(void *))spl_object_storage_dtor, 0); diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 15517db909c..a7070a9b060 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -1166,7 +1166,7 @@ static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers memset(intern, 0, sizeof(sqlite_object)); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC); retval->handlers = handlers; diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index e793206624c..d3314d3f864 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2134,7 +2134,7 @@ static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSR zend_llist_init(&(intern->free_list), sizeof(php_sqlite3_free_list *), (llist_dtor_func_t)php_sqlite3_free_list_dtor, 0); zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_object_handlers; @@ -2156,7 +2156,7 @@ static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_typ intern->db_obj_zval = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_stmt_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_stmt_object_handlers; @@ -2180,7 +2180,7 @@ static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_t intern->stmt_obj_zval = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_result_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_result_object_handlers; diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 619d5a3a6ac..529929342fd 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -687,7 +687,7 @@ static void tidy_object_new(zend_class_entry *class_type, zend_object_handlers * memset(intern, 0, sizeof(PHPTidyObj)); zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); switch(objtype) { case is_node: diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 4ffdb179ff5..7a4cd0e7184 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -401,7 +401,7 @@ zend_object_value xmlreader_objects_new(zend_class_entry *class_type TSRMLS_DC) intern->prop_handler = &xmlreader_prop_handlers; zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) xmlreader_objects_free_storage, xmlreader_objects_clone TSRMLS_CC); intern->handle = retval.handle; retval.handlers = &xmlreader_object_handlers; diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 588ca4bf3a1..c1152eb1134 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -151,7 +151,7 @@ static zend_object_value xmlwriter_object_new(zend_class_entry *class_type TSRML intern->xmlwriter_ptr = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 7262e7804a0..6f7237d57da 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -129,7 +129,7 @@ zend_object_value xsl_objects_new(zend_class_entry *class_type TSRMLS_DC) intern->profiling = NULL; zend_object_std_init(&intern->std, class_type TSRMLS_CC); - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); ALLOC_HASHTABLE(intern->parameter); zend_hash_init(intern->parameter, 0, NULL, ZVAL_PTR_DTOR, 0); ALLOC_HASHTABLE(intern->registered_phpfunctions); diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index e6a30a00661..75f98b591f6 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1104,7 +1104,7 @@ static zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_ intern->zo.ce = class_type; #endif - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, From 974324676b2436f159f42d9241c569f813471684 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 28 Jun 2012 20:09:47 +0200 Subject: [PATCH 197/641] Add json_last_error_msg() function This replaces json_last_error(true) and is consistent with other custom error handling functions. --- ext/json/json.c | 29 ++++++++++++++-------- ext/json/tests/003.phpt | 6 ++--- ext/json/tests/004.phpt | 6 ++--- ext/json/tests/007.phpt | 16 +++++++----- ext/json/tests/bug54058.phpt | 12 +++------ ext/json/tests/bug61537.phpt | 8 +++--- ext/json/tests/inf_nan_error.phpt | 10 +++++--- ext/json/tests/unsupported_type_error.phpt | 6 +++-- 8 files changed, 51 insertions(+), 42 deletions(-) diff --git a/ext/json/json.c b/ext/json/json.c index 5e0351f3f1e..4d29a666886 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -34,6 +34,7 @@ static PHP_MINFO_FUNCTION(json); static PHP_FUNCTION(json_encode); static PHP_FUNCTION(json_decode); static PHP_FUNCTION(json_last_error); +static PHP_FUNCTION(json_last_error_msg); static const char digits[] = "0123456789abcdef"; @@ -51,8 +52,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1) ZEND_ARG_INFO(0, depth) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_json_last_error, 0, 0, 0) - ZEND_ARG_INFO(0, as_string) +ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0) ZEND_END_ARG_INFO() /* }}} */ @@ -61,6 +64,7 @@ static const function_entry json_functions[] = { PHP_FE(json_encode, arginfo_json_encode) PHP_FE(json_decode, arginfo_json_decode) PHP_FE(json_last_error, arginfo_json_last_error) + PHP_FE(json_last_error_msg, arginfo_json_last_error_msg) PHP_FE_END }; /* }}} */ @@ -607,21 +611,25 @@ static PHP_FUNCTION(json_decode) /* }}} */ /* {{{ proto int json_last_error() - Returns the error code of the last json_decode(). */ + Returns the error code of the last json_encode() or json_decode() call. */ static PHP_FUNCTION(json_last_error) { - zend_bool as_string = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &as_string) == FAILURE) { + if (zend_parse_parameters_none() == FAILURE) { return; } - /* return error code (JSON_ERROR_* constants) */ - if (!as_string) { - RETURN_LONG(JSON_G(error_code)); + RETURN_LONG(JSON_G(error_code)); +} +/* }}} */ + +/* {{{ proto string json_last_error_msg() + Returns the error string of the last json_encode() or json_decode() call. */ +static PHP_FUNCTION(json_last_error_msg) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; } - /* return error message (for debugging purposes) */ switch(JSON_G(error_code)) { case PHP_JSON_ERROR_NONE: RETURN_STRING("No error", 1); @@ -644,6 +652,7 @@ static PHP_FUNCTION(json_last_error) default: RETURN_STRING("Unknown error", 1); } + } /* }}} */ diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index 71874525a70..4ce5b0fde9d 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -13,14 +13,12 @@ var_dump($a); echo "\n"; var_dump(json_encode($a)); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); echo "\n"; var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 49c543edcae..70ef3ffd1b8 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -13,14 +13,12 @@ var_dump($a); echo "\n"; var_dump(json_encode($a)); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); echo "\n"; var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 9ee190a24cd..7557ac9ed74 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -5,15 +5,15 @@ json_last_error() tests --FILE-- foo = quoted_printable_decode('=B0'); json_encode($a); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); $b = new stdclass; $b->foo = $bad_utf8; $b->bar = 1; json_encode($b); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); $c = array( 'foo' => $bad_utf8, 'bar' => 1 ); json_encode($c); -var_dump(json_last_error()); -var_dump(json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); ?> --EXPECTF-- diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt index f6bb02bae45..80ed051c9a6 100644 --- a/ext/json/tests/bug61537.phpt +++ b/ext/json/tests/bug61537.phpt @@ -7,20 +7,20 @@ Bug #61537 (json_encode() incorrectly truncates/discards information) $invalid_utf8 = "\x9f"; var_dump(json_encode($invalid_utf8)); -var_dump(json_last_error(), json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); echo "\n"; $invalid_utf8 = "an invalid sequen\xce in the middle of a string"; var_dump(json_encode($invalid_utf8)); -var_dump(json_last_error(), json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error(true)); +var_dump(json_last_error(), json_last_error_msg()); ?> --EXPECTF-- diff --git a/ext/json/tests/inf_nan_error.phpt b/ext/json/tests/inf_nan_error.phpt index f12e902d9f0..f9deecc4699 100644 --- a/ext/json/tests/inf_nan_error.phpt +++ b/ext/json/tests/inf_nan_error.phpt @@ -1,5 +1,7 @@ --TEST-- An error is thrown when INF or NaN are encoded +--SKIPIF-- + --FILE-- --EXPECTF-- float(INF) diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt index f36afb44a5e..45a167a5ac0 100644 --- a/ext/json/tests/unsupported_type_error.phpt +++ b/ext/json/tests/unsupported_type_error.phpt @@ -1,5 +1,7 @@ --TEST-- An error is thrown when an unsupported type is encoded +--SKIPIF-- + --FILE-- --EXPECTF-- From 7e8276ca68fc622124d51d18e4f7b5cde3536de4 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Thu, 28 Jun 2012 20:00:03 -0400 Subject: [PATCH 198/641] Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed Salt) Fixed a memory allocation bug in crypt() SHA256/512 that can cause segmentation faults when passed in salts with a null byte early. --- NEWS | 2 ++ ext/standard/crypt.c | 4 ++-- ext/standard/tests/strings/bug62443.phpt | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/strings/bug62443.phpt diff --git a/NEWS b/NEWS index 520aa192f27..80d56bc7f86 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ PHP NEWS Stas) . Fixed bug #62432 (ReflectionMethod random corrupt memory on high concurrent). (Johannes) + . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed + Salt). (Anthony Ferrara) - Fileinfo: . Fixed magic file regex support. (Felipe) diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index e0d90e7e392..2eb4fc3678f 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -199,7 +199,7 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha512_salt_prefix) - 1 + sizeof(sha512_rounds_prefix) + 9 + 1 - + strlen(salt) + 1 + 43 + 1); + + PHP_MAX_SALT_LEN + 1 + 43 + 1); output = emalloc(needed * sizeof(char *)); salt[salt_in_len] = '\0'; @@ -222,7 +222,7 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha256_salt_prefix) - 1 + sizeof(sha256_rounds_prefix) + 9 + 1 - + strlen(salt) + 1 + 43 + 1); + + PHP_MAX_SALT_LEN + 1 + 43 + 1); output = emalloc(needed * sizeof(char *)); salt[salt_in_len] = '\0'; diff --git a/ext/standard/tests/strings/bug62443.phpt b/ext/standard/tests/strings/bug62443.phpt new file mode 100644 index 00000000000..9e0dc38cfbc --- /dev/null +++ b/ext/standard/tests/strings/bug62443.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #62443 Crypt SHA256/512 Segfaults With Malformed Salt +--FILE-- + Date: Thu, 28 Jun 2012 18:08:11 -0700 Subject: [PATCH 199/641] fix NEWS order --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6821a7ebce5..f5112502054 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.5 - Core: + . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed + Salt). (Anthony Ferrara) . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in function __memcmp). (Laruence) . Fixed bug #61998 (Using traits with method aliases appears to result in @@ -11,8 +13,6 @@ PHP NEWS includes a semi-colon). (Pierrick) . Fixed potential overflow in _php_stream_scandir (CVE-2012-2688). (Jason Powell, Stas) - . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed - Salt). (Anthony Ferrara) - EXIF: . Fixed information leak in ext exif (discovered by Martin Noga, From e778b03307ef51a501136f6876495dc2e7409e41 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Thu, 28 Jun 2012 22:43:59 -0400 Subject: [PATCH 200/641] Restore old NEWS file, and re-add new entry. This fixes a merge artifact where the 5.4 NEWS file was accidentally brought in. --- NEWS | 334 +---------------------------------------------------------- 1 file changed, 2 insertions(+), 332 deletions(-) diff --git a/NEWS b/NEWS index 1b658c7c931..e76c564c34c 100644 --- a/NEWS +++ b/NEWS @@ -2,338 +2,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 201?, PHP 5.5.0 -- Core: - . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in - function __memcmp). (Laruence) - . Fixed bug #61998 (Using traits with method aliases appears to result in - crash during execution). (Dmitry) - . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that - includes a semi-colon). (Pierrick) - . Fixed potential overflow in _php_stream_scandir (CVE-2012-2688). - (Jason Powell, Stas) - . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed - Salt). (Anthony Ferrara) - -- EXIF: - . Fixed information leak in ext exif (discovered by Martin Noga, - Matthew "j00ru" Jurczyk, Gynvael Coldwind) - -- FPM: - . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - . Fixed bug #62153 (when using unix sockets, multiples FPM instances - . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). - (fat) - . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) - . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - . Fixed bug #61295 (php-fpm should not fail with commented 'user' - . Fixed bug #61218 (FPM drops connection while receiving some binary values - in FastCGI requests). (fat) - . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) - for non-root start). (fat) - . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - can be launched without errors). (fat) - -- Iconv: - . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) - -- Intl: - . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) - . ResourceBundle constructor now accepts NULL for the first two arguments. - (Gustavo) - . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called - twice). (Gustavo) - . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) - . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks - pattern). (Gustavo) - -- libxml: - . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM - SAPI). (Gustavo) - -- Readline: - . Fixed bug #62186 (readline fails to compile - void function should not - return a value). (Johannes) - -- Reflection: - . Fixed bug #62384 (Attempting to invoke a Closure more than once causes - segfault). (Felipe) - . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks - with constant). (Laruence) - -- Sockets: - . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) - -- XML Writer: - . Fixed bug #62064 (memory leak in the XML Writer module). - (jean-pierre dot lozi at lip6 dot fr) - -- Zip: - . Upgraded libzip to 0.10.1 (Anatoliy) - -14 Jun 2012, PHP 5.4.4 - -- COM: - . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) - -- CLI Server: - . Implemented FR #61977 (Need CLI web-server support for files with .htm & - svg extensions). (Sixd, Laruence) - . Improved performance while sending error page, this also fixed - bug #61785 (Memory leak when access a non-exists file without router). - (Laruence) - . Fixed bug #61546 (functions related to current script failed when chdir() - in cli sapi). (Laruence, reeze.xia@gmail.com) - -- CURL: - . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction). - (Laruence) - -- Core: - . Fixed missing bound check in iptcparse(). (chris at chiappa.net) - . Fixed CVE-2012-2143. (Solar Designer) - . Fixed bug #62097 (fix for for bug #54547). (Gustavo) - . Fixed bug #62005 (unexpected behavior when incrementally assigning to a - member of a null object). (Laruence) - . Fixed bug #61978 (Object recursion not detected for classes that implement - JsonSerializable). (Felipe) - . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) - . Fixed bug #61922 (ZTS build doesn't accept zend.script_encoding config). - (Laruence) - . Fixed bug #61827 (incorrect \e processing on Windows) (Anatoliy) - . Fixed bug #61782 (__clone/__destruct do not match other methods when checking - access controls). (Stas) - . Fixed bug #61761 ('Overriding' a private static method with a different - signature causes crash). (Laruence) - . Fixed bug #61730 (Segfault from array_walk modifying an array passed by - reference). (Laruence) - . Fixed bug #61728 (PHP crash when calling ob_start in request_shutdown - phase). (Laruence) - . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov) - . Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables - (without apache2)). (Laruence) - . Fixed bug #61605 (header_remove() does not remove all headers). (Laruence) - . Fixed bug #54547 (wrong equality of string numbers). (Gustavo) - . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename - set to null). (Anatoliy) - . Changed php://fd to be available only for CLI. - -- PDO: - . Fixed bug #61755 (A parsing bug in the prepared statements can lead to - access violations). (Johannes) - -- Phar: - . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) - -- Pgsql: - . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) - -- Fileinfo - . Fixed bug #61812 (Uninitialised value used in libmagic). - (Laruence, Gustavo) - . Fixed bug #61566 failure caused by the posix lseek and read versions - under windows in cdf_read(). (Anatoliy) - . Fixed bug #61565 where php_stream_open_wrapper_ex tries to open a - directory descriptor under windows. (Anatoliy) - -- Intl - . Fixed bug #62082 (Memory corruption in internal function - get_icu_disp_value_src_php()). (Gustavo) - -- Libxml: - . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). - (Laruence) - -- Zlib: - . Fixed bug #61820 (using ob_gzhandler will complain about headers already - sent when no compression). (Mike) - . Fixed bug #61443 (can't change zlib.output_compression on the fly). (Mike) - . Fixed bug #60761 (zlib.output_compression fails on refresh). (Mike) - -08 May 2012, PHP 5.4.3 - -- CGI - . Re-Fix PHP-CGI query string parameter vulnerability, CVE-2012-1823. - (Stas) - . Fix bug #61807 - Buffer Overflow in apache_request_headers. - (nyt-php at countercultured dot net). - -03 May 2012, PHP 5.4.2 - -- Fix PHP-CGI query string parameter vulnerability, CVE-2012-1823. (Rasmus) - -26 Apr 2012, PHP 5.4.1 - -- CLI Server: - . Fixed bug #61461 (missing checks around malloc() calls). (Ilia) - . Implemented FR #60850 (Built in web server does not set - $_SERVER['SCRIPT_FILENAME'] when using router). (Laruence) - . "Connection: close" instead of "Connection: closed" (Gustavo) - -- Core: - . Fixed crash in ZTS using same class in many threads. (Johannes) - . Fixed bug #61374 (html_entity_decode tries to decode code points that don't - exist in ISO-8859-1). (Gustavo) - . Fixed bug #61273 (call_user_func_array with more than 16333 arguments - leaks / crashes). (Laruence) - . Fixed bug #61225 (Incorrect lexing of 0b00*+). (Pierrick) - . Fixed bug #61165 (Segfault - strip_tags()). (Laruence) - . Fixed bug #61106 (Segfault when using header_register_callback). (Nikita - Popov) - . Fixed bug #61087 (Memory leak in parse_ini_file when specifying - invalid scanner mode). (Nikic, Laruence) - . Fixed bug #61072 (Memory leak when restoring an exception handler). - (Nikic, Laruence) - . Fixed bug #61058 (array_fill leaks if start index is PHP_INT_MAX). - (Laruence) - . Fixed bug #61052 (Missing error check in trait 'insteadof' clause). (Stefan) - . Fixed bug #61011 (Crash when an exception is thrown by __autoload - accessing a static property). (Laruence) - . Fixed bug #61000 (Exceeding max nesting level doesn't delete numerical - vars). (Laruence) - . Fixed bug #60978 (exit code incorrect). (Laruence) - . Fixed bug #60911 (Confusing error message when extending traits). (Stefan) - . Fixed bug #60801 (strpbrk() mishandles NUL byte). (Adam) - . Fixed bug #60717 (Order of traits in use statement can cause a fatal - error). (Stefan) - . Fixed bug #60573 (type hinting with "self" keyword causes weird errors). - (Laruence) - . Fixed bug #60569 (Nullbyte truncates Exception $message). (Ilia) - . Fixed bug #52719 (array_walk_recursive crashes if third param of the - function is by reference). (Nikita Popov) - . Improve performance of set_exception_handler while doing reset (Laruence) - -- fileinfo: - . Fix fileinfo test problems. (Anatoliy Belsky) - -- FPM - . Fixed bug #61430 (Transposed memset() params in sapi/fpm/fpm/fpm_shm.c). - (michaelhood at gmail dot com, Ilia) - -- Ibase - . Fixed bug #60947 (Segmentation fault while executing ibase_db_info). - (Ilia) - -- Installation - . Fixed bug #61172 (Add Apache 2.4 support). (Chris Jones) - -- Intl: - . Fixed bug #61487 (Incorrent bounds checking in grapheme_strpos). - (Stas) - -- mbstring: - . MFH mb_ereg_replace_callback() for security enhancements. (Rui) - -- mysqli - . Fixed bug #61003 (mysql_stat() require a valid connection). (Johannes). - -- mysqlnd - . Fixed bug #61704 (Crash apache, phpinfo() threading issue). (Johannes) - . Fixed bug #60948 (mysqlnd FTBFS when -Wformat-security is enabled). - (Johannes) - -- Readline: - . Fixed bug #61088 (Memory leak in readline_callback_handler_install). - (Nikic, Laruence) - -- Session - . Fixed bug #60634 (Segmentation fault when trying to die() in - SessionHandler::write()). (Ilia) - -- SOAP - . Fixed bug #61423 (gzip compression fails). (Ilia) - . Fixed bug #60887 (SoapClient ignores user_agent option and sends no - User-Agent header). (carloschilazo at gmail dot com) - . Fixed bug #60842, #51775 (Chunked response parsing error when - chunksize length line is > 10 bytes). (Ilia) - . Fixed bug #49853 (Soap Client stream context header option ignored). - (Dmitry) - -- PDO - . Fixed bug #61292 (Segfault while calling a method on an overloaded PDO - object). (Laruence) - -- PDO_mysql - . Fixed bug #61207 (PDO::nextRowset() after a multi-statement query doesn't - always work). (Johannes) - . Fixed bug #61194 (PDO should export compression flag with myslqnd). - (Johannes) - -- PDO_odbc - . Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia) - -- Phar - . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL - bytes). (Nikita Popov) - -- Reflection: - . Implemented FR #61602 (Allow access to the name of constant - used as function/method parameter's default value). (reeze.xia@gmail.com) - . Fixed bug #60968 (Late static binding doesn't work with - ReflectionMethod::invokeArgs()). (Laruence) - -- SPL: - . Fixed bug #61453 (SplObjectStorage does not identify objects correctly). - (Gustavo) - . Fixed bug #61347 (inconsistent isset behavior of Arrayobject). (Laruence) - -- Standard: - . Fixed memory leak in substr_replace. (Pierrick) - . Make max_file_uploads ini directive settable outside of php.ini (Rasmus) - . Fixed bug #61409 (Bad formatting on phpinfo()). (Jakub Vrana) - . Fixed bug #60222 (time_nanosleep() does validate input params). (Ilia) - . Fixed bug #60106 (stream_socket_server silently truncates long unix socket - paths). (Ilia) - -- XMLRPC: - . Fixed bug #61264 (xmlrpc_parse_method_descriptions leaks temporary - variable). (Nikita Popov) - . Fixed bug #61097 (Memory leak in xmlrpc functions copying zvals). (Nikita - Popov) - -- Zlib: - . Fixed bug #61306 (initialization of global inappropriate for ZTS). (Gustavo) - . Fixed bug #61287 (A particular string fails to decompress). (Mike) - . Fixed bug #61139 (gzopen leaks when specifying invalid mode). (Nikita Popov) - -01 Mar 2012, PHP 5.4.0 - -- Installation: - . autoconf 2.59+ is now supported (and required) for generating the - configure script with ./buildconf. Autoconf 2.60+ is desirable - otherwise the configure help order may be incorrect. (Rasmus, Chris Jones) - -- Removed legacy features: - . break/continue $var syntax. (Dmitry) - . Safe mode and all related php.ini options. (Kalle) - . register_globals and register_long_arrays php.ini options. (Kalle) - . import_request_variables(). (Kalle) - . allow_call_time_pass_reference. (Pierrick) - . define_syslog_variables php.ini option and its associated function. (Kalle) - . highlight.bg php.ini option. (Kalle) - . safe_mode, safe_mode_gid, safe_mode_include_dir, - safe_mode_exec_dir, safe_mode_allowed_env_vars and - safe_mode_protected_env_vars php.ini options. - . zend.ze1_compatibility_mode php.ini option. - . Session bug compatibility mode (session.bug_compat_42 and - session.bug_compat_warn php.ini options). (Kalle) - . session_is_registered(), session_register() and session_unregister() - functions. (Kalle) - . y2k_compliance php.ini option. (Kalle) - . magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase - php.ini options. get_magic_quotes_gpc, get_magic_quotes_runtime are kept - but always return false, set_magic_quotes_runtime raises an - E_CORE_ERROR. (Pierrick, Pierre) - . Removed support for putenv("TZ=..") for setting the timezone. (Derick) - . Removed the timezone guessing algorithm in case the timezone isn't set with - date.timezone or date_default_timezone_set(). Instead of a guessed - timezone, "UTC" is now used instead. (Derick) - -- Moved extensions to PECL: - . ext/sqlite. (Note: the ext/sqlite3 and ext/pdo_sqlite extensions are - not affected) (Johannes) ->>>>>>> PHP-5.4 - - General improvements: . Drop Windows XP and 2003 support. (Pierre) . World domination @@ -344,6 +12,8 @@ PHP NEWS (Nikita Popov) - Core: + . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed + Salt). (Anthony Ferrara) . Added boolval(). (Jille Timmermans). . Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence). . Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected). From f826ea093f8317dda2e5476db128dc5ad3eba442 Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 29 Jun 2012 12:42:54 +0300 Subject: [PATCH 201/641] new charsets --- ext/mysqlnd/mysqlnd_charset.c | 75 ++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index 5b60711a804..704c1190260 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -449,20 +449,27 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 6, "hp8", "hp8_english_ci", 1, 1, "", NULL, NULL}, { 7, "koi8r", "koi8r_general_ci", 1, 1, "", NULL, NULL}, { 8, "latin1", "latin1_swedish_ci", 1, 1, "", NULL, NULL}, + { 5, "latin1", "latin1_german_ci", 1, 1, "", NULL, NULL}, /* should be after 0x9 because swedish_ci is the default collation */ { 9, "latin2", "latin2_general_ci", 1, 1, "", NULL, NULL}, + { 2, "latin2", "latin2_czech_cs", 1, 1, "", NULL, NULL}, /* should be after 0x9 because general_ci is the default collation */ { 10, "swe7", "swe7_swedish_ci", 1, 1, "", NULL, NULL}, { 11, "ascii", "ascii_general_ci", 1, 1, "", NULL, NULL}, { 12, "ujis", "ujis_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, { 13, "sjis", "sjis_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_sjis, check_mb_sjis}, { 16, "hebrew", "hebrew_general_ci", 1, 1, "", NULL, NULL}, + { 17, "filename", "filename", 1, 5, "", NULL, NULL}, { 18, "tis620", "tis620_thai_ci", 1, 1, "", NULL, NULL}, { 19, "euckr", "euckr_korean_ci", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, + { 21, "latin2", "latin2_hungarian_ci", 1, 1, "", NULL, NULL}, + { 27, "latin2", "latin2_croatian_ci", 1, 1, "", NULL, NULL}, { 22, "koi8u", "koi8u_general_ci", 1, 1, "", NULL, NULL}, { 24, "gb2312", "gb2312_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, { 25, "greek", "greek_general_ci", 1, 1, "", NULL, NULL}, { 26, "cp1250", "cp1250_general_ci", 1, 1, "", NULL, NULL}, { 28, "gbk", "gbk_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gbk, check_mb_gbk}, { 30, "latin5", "latin5_turkish_ci", 1, 1, "", NULL, NULL}, + { 31, "latin1", "latin1_german2_ci", 1, 1, "", NULL, NULL}, + { 15, "latin1", "latin1_danish_ci", 1, 1, "", NULL, NULL}, { 32, "armscii8", "armscii8_general_ci", 1, 1, "", NULL, NULL}, { 33, UTF8_MB3, UTF8_MB3"_general_ci", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 35, "ucs2", "ucs2_general_ci", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, @@ -472,22 +479,11 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 39, "macroman", "macroman_general_ci", 1, 1, "", NULL, NULL}, { 40, "cp852", "cp852_general_ci", 1, 1, "", NULL, NULL}, { 41, "latin7", "latin7_general_ci", 1, 1, "", NULL, NULL}, - { 51, "cp1251", "cp1251_general_ci", 1, 1, "", NULL, NULL}, + { 20, "latin7", "latin7_estonian_cs", 1, 1, "", NULL, NULL}, { 57, "cp1256", "cp1256_general_ci", 1, 1, "", NULL, NULL}, { 59, "cp1257", "cp1257_general_ci", 1, 1, "", NULL, NULL}, { 63, "binary", "binary", 1, 1, "", NULL, NULL}, - { 92, "geostd8", "geostd8_general_ci", 1, 1, "", NULL, NULL}, - { 95, "cp932", "cp932_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, - { 2, "latin2", "latin2_czech_cs", 1, 1, "", NULL, NULL}, - { 5, "latin1", "latin1_german_ci", 1, 1, "", NULL, NULL}, - { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, "", NULL, NULL}, - { 15, "latin1", "latin1_danish_ci", 1, 1, "", NULL, NULL}, - { 17, "filename", "filename", 1, 5, "", NULL, NULL}, - { 20, "latin7", "latin7_estonian_cs", 1, 1, "", NULL, NULL}, - { 21, "latin2", "latin2_hungarian_ci", 1, 1, "", NULL, NULL}, - { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, "", NULL, NULL}, - { 27, "latin2", "latin2_croatian_ci", 1, 1, "", NULL, NULL}, { 29, "cp1257", "cp1257_lithunian_ci", 1, 1, "", NULL, NULL}, { 31, "latin1", "latin1_german2_ci", 1, 1, "", NULL, NULL}, { 34, "cp1250", "cp1250_czech_cs", 1, 1, "", NULL, NULL}, @@ -499,6 +495,9 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 47, "latin1", "latin1_bin", 1, 1, "", NULL, NULL}, { 48, "latin1", "latin1_general_ci", 1, 1, "", NULL, NULL}, { 49, "latin1", "latin1_general_cs", 1, 1, "", NULL, NULL}, + { 51, "cp1251", "cp1251_general_ci", 1, 1, "", NULL, NULL}, + { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, "", NULL, NULL}, + { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, "", NULL, NULL}, { 50, "cp1251", "cp1251_bin", 1, 1, "", NULL, NULL}, { 52, "cp1251", "cp1251_general_cs", 1, 1, "", NULL, NULL}, { 53, "macroman", "macroman_bin", 1, 1, "", NULL, NULL}, @@ -508,8 +507,8 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = #ifdef USED_TO_BE_SO_BEFORE_MYSQL_5_5 { 60, "armascii8", "armascii8_bin", 1, 1, "", NULL, NULL}, #endif - { 60, "utf32", "utf32_general_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, - { 61, "utf32", "utf32_bin", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*55*/{ 60, "utf32", "utf32_general_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*55*/{ 61, "utf32", "utf32_bin", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, { 65, "ascii", "ascii_bin", 1, 1, "", NULL, NULL}, { 66, "cp1250", "cp1250_bin", 1, 1, "", NULL, NULL}, { 67, "cp1256", "cp1256_bin", 1, 1, "", NULL, NULL}, @@ -527,7 +526,6 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 80, "cp850", "cp850_bin", 1, 1, "", NULL, NULL}, { 81, "cp852", "cp852_bin", 1, 1, "", NULL, NULL}, { 82, "swe7", "swe7_bin", 1, 1, "", NULL, NULL}, - { 93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL}, { 83, UTF8_MB3, UTF8_MB3"_bin", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 84, "big5", "big5_bin", 1, 2, "", mysqlnd_mbcharlen_big5, check_mb_big5}, { 85, "euckr", "euckr_bin", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, @@ -537,10 +535,14 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 89, "tis620", "tis620_bin", 1, 1, "", NULL, NULL}, { 90, "ucs2", "ucs2_bin", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 91, "ujis", "ujis_bin", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, + { 92, "geostd8", "geostd8_general_ci", 1, 1, "", NULL, NULL}, + { 93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL}, { 94, "latin1", "latin1_spanish_ci", 1, 1, "", NULL, NULL}, + { 95, "cp932", "cp932_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, { 96, "cp932", "cp932_bin", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, - { 99, "cp1250", "cp1250_polish_ci", 1, 1, "", NULL, NULL}, + { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, { 98, "eucjpms", "eucjpms_bin", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, + { 99, "cp1250", "cp1250_polish_ci", 1, 1, "", NULL, NULL}, { 128, "ucs2", "ucs2_unicode_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 129, "ucs2", "ucs2_icelandic_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 130, "ucs2", "ucs2_latvian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, @@ -561,7 +563,35 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 145, "ucs2", "ucs2_esperanto_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 146, "ucs2", "ucs2_hungarian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, { 147, "ucs2", "ucs2_sinhala_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 149, "ucs2", "ucs2_croatian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, /* MDB */ + { 148, "ucs2", "ucs2_german2_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 149, "ucs2", "ucs2_croatian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 150, "ucs2", "ucs2_unicode_520_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 151, "ucs2", "ucs2_vietnamese_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + +/*56*/{160, "utf32", "utf32_unicode_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{161, "utf32", "utf32_icelandic_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{162, "utf32", "utf32_latvian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{163, "utf32", "utf32_romanian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{164, "utf32", "utf32_slovenian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{165, "utf32", "utf32_polish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{166, "utf32", "utf32_estonian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{167, "utf32", "utf32_spanish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{168, "utf32", "utf32_swedish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{169, "utf32", "utf32_turkish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{170, "utf32", "utf32_czech_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{171, "utf32", "utf32_danish_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{172, "utf32", "utf32_lithuanian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{173, "utf32", "utf32_slovak_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{174, "utf32", "utf32_spanish2_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{175, "utf32", "utf32_roman_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{176, "utf32", "utf32_persian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{177, "utf32", "utf32_esperanto_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{178, "utf32", "utf32_hungarian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{179, "utf32", "utf32_sinhala_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{180, "utf32", "utf32_german2_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{181, "utf32", "utf32_croatian_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{182, "utf32", "utf32_unicode_520_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, +/*56*/{183, "utf32", "utf32_vietnamese_ci", 4, 4, "UTF-32 Unicode", mysqlnd_mbcharlen_utf32, check_mb_utf32}, { 192, UTF8_MB3, UTF8_MB3"_general_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 193, UTF8_MB3, UTF8_MB3"_icelandic_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, @@ -570,7 +600,7 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 196, UTF8_MB3, UTF8_MB3"_slovenian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 197, UTF8_MB3, UTF8_MB3"_polish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 198, UTF8_MB3, UTF8_MB3"_estonian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 119, UTF8_MB3, UTF8_MB3"_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 199, UTF8_MB3, UTF8_MB3"_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 200, UTF8_MB3, UTF8_MB3"_swedish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 201, UTF8_MB3, UTF8_MB3"_turkish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 202, UTF8_MB3, UTF8_MB3"_czech_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, @@ -583,7 +613,10 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 209, UTF8_MB3, UTF8_MB3"_esperanto_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 210, UTF8_MB3, UTF8_MB3"_hungarian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 211, UTF8_MB3, UTF8_MB3"_sinhala_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, - { 213, UTF8_MB3, UTF8_MB3"_croatian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/ + { 211, UTF8_MB3, UTF8_MB3"_german2_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 213, UTF8_MB3, UTF8_MB3"_croatian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 214, UTF8_MB3, UTF8_MB3"_unicode_520_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, + { 215, UTF8_MB3, UTF8_MB3"_vietnamese_ci", 1, 3, "", mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, { 224, UTF8_MB4, UTF8_MB4"_unicode_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 225, UTF8_MB4, UTF8_MB4"_icelandic_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, @@ -605,6 +638,10 @@ const MYSQLND_CHARSET mysqlnd_charsets[] = { 241, UTF8_MB4, UTF8_MB4"_esperanto_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 242, UTF8_MB4, UTF8_MB4"_hungarian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 243, UTF8_MB4, UTF8_MB4"_sinhala_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 244, UTF8_MB4, UTF8_MB4"_german2_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 245, UTF8_MB4, UTF8_MB4"_croatian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 246, UTF8_MB4, UTF8_MB4"_unicode_520_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 247, UTF8_MB4, UTF8_MB4"_vietnamese_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 254, UTF8_MB3, UTF8_MB3"_general_cs", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, { 0, NULL, NULL, 0, 0, NULL, NULL, NULL} From e6cf7d774519300c08399cae5bfba90e33749727 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 29 Jun 2012 12:47:37 +0200 Subject: [PATCH 202/641] Fix some lengths in crypt() Use salt_len_in instead of strlen(salt) or PHP_MAX_SALT_LEN, otherwise too much memory will be allocated. sha512 has a 86 character checksum, not 43. That probably was a copy&paste from the sha256 code which indeed has 43. The allocation also was using sizeof(char *), thus allocating 4 or 8 times as much memory as necessary. The sizeof(char *) was removed in the 5.4 branch in b7a92c9 but forgotten on 5.3. The memset 0 call was using PHP_MAX_SALT_LEN which can be smaller than the output buffer and thus not zeroing out everything. Use the size of the output buffer (needed) instead. --- ext/standard/crypt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 2eb4fc3678f..27a8d82d0e4 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -199,8 +199,8 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha512_salt_prefix) - 1 + sizeof(sha512_rounds_prefix) + 9 + 1 - + PHP_MAX_SALT_LEN + 1 + 43 + 1); - output = emalloc(needed * sizeof(char *)); + + salt_in_len + 1 + 86 + 1); + output = emalloc(needed); salt[salt_in_len] = '\0'; crypt_res = php_sha512_crypt_r(str, salt, output, needed); @@ -214,7 +214,7 @@ PHP_FUNCTION(crypt) RETVAL_STRING(output, 1); } - memset(output, 0, PHP_MAX_SALT_LEN + 1); + memset(output, 0, needed); efree(output); } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') { const char sha256_salt_prefix[] = "$5$"; @@ -222,8 +222,8 @@ PHP_FUNCTION(crypt) char *output; int needed = (sizeof(sha256_salt_prefix) - 1 + sizeof(sha256_rounds_prefix) + 9 + 1 - + PHP_MAX_SALT_LEN + 1 + 43 + 1); - output = emalloc(needed * sizeof(char *)); + + salt_in_len + 1 + 43 + 1); + output = emalloc(needed); salt[salt_in_len] = '\0'; crypt_res = php_sha256_crypt_r(str, salt, output, needed); @@ -237,7 +237,7 @@ PHP_FUNCTION(crypt) RETVAL_STRING(output, 1); } - memset(output, 0, PHP_MAX_SALT_LEN + 1); + memset(output, 0, needed); efree(output); } else if ( salt[0] == '$' && From 8fe87e7feaab2c031998d553585ba8cabf077499 Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 29 Jun 2012 14:42:36 +0300 Subject: [PATCH 203/641] fix Bug #62273 Segmentation Fault in Mysqli/Mysqlnd --- ext/mysqlnd/mysqlnd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index cc2dd06c318..b539c5180ca 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -680,6 +680,13 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn, conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent); conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no); + if (!conn->greet_charset) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no); + SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, + "Server sent charset unknown to the client. Please, report to the developers"); + goto err; + } /* we allow load data local infile by default */ mysql_flags |= CLIENT_LOCAL_FILES | CLIENT_PS_MULTI_RESULTS; mysql_flags |= MYSQLND_CAPABILITIES; From ed1f058591778103ea852324ad6cd847a10b2911 Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 29 Jun 2012 16:32:55 +0300 Subject: [PATCH 204/641] merge --- ext/mysqlnd/mysqlnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 81ecd33d0be..4a63681fb79 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -767,7 +767,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, if (!conn->greet_charset) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no); - SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Server sent charset unknown to the client. Please, report to the developers"); goto err; } From c51fbbe4b4e2c047d1be76d8bffc6391203adbdd Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 29 Jun 2012 16:58:53 +0300 Subject: [PATCH 205/641] merge --- ext/mysqlnd/mysqlnd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index cc3a3917a18..417ff5ef2b5 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -789,6 +789,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn, conn->server_version = mnd_pestrdup(greet_packet->server_version, conn->persistent); conn->greet_charset = mysqlnd_find_charset_nr(greet_packet->charset_no); + if (!conn->greet_charset) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Server sent charset (%d) unknown to the client. Please, report to the developers", greet_packet->charset_no); + SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, + "Server sent charset unknown to the client. Please, report to the developers"); + goto err; + } if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len, greet_packet, conn->options, mysql_flags TSRMLS_CC)) From 75d8af715cd624dda243d31f826c7da927ccd22f Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 30 Jun 2012 16:29:30 -0300 Subject: [PATCH 206/641] - Fixed bug #62415 (Undefined variable: diff in run-tests.php on line 2093 for successful XFAIL) --- run-tests.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run-tests.php b/run-tests.php index 9a01f56c975..2a4698639f3 100755 --- a/run-tests.php +++ b/run-tests.php @@ -2089,8 +2089,10 @@ $output if (isset($old_php)) { $php = $old_php; } + + $diff = empty($diff) ? '' : "', $diff) . "\n]]>"; - junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, "', $diff) . "\n]]>"); + junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), $tested, null, $info, $diff); return $restype[0] . 'ED'; } From 896ac689c91967dec0601fa9fe048c518da52a3c Mon Sep 17 00:00:00 2001 From: Marc Easen Date: Mon, 11 Jun 2012 21:47:40 +0100 Subject: [PATCH 207/641] Fixed the common misspelling of the word occurred (occured -> occurred) --- Zend/tests/bug39018.phpt | 14 ++++++------ Zend/tests/offset_string.phpt | 8 +++---- Zend/zend_compile.c | 4 ++-- Zend/zend_execute.c | 4 ++-- ext/dom/xpath.c | 2 +- ext/imap/tests/imap_errors_basic.phpt | 2 +- ext/intl/common/common_error.c | 4 ++-- ext/intl/doc/collator_api.php | 8 +++---- ext/intl/doc/common_api.php | 4 ++-- ext/intl/doc/datefmt_api.php | 4 ++-- ext/intl/doc/formatter_api.php | 4 ++-- ext/intl/doc/msgfmt_api.php | 4 ++-- ext/intl/intl_convert.c | 4 ++-- ext/intl/normalizer/normalizer_normalize.c | 6 ++--- ext/intl/tests/formatter_get_error.phpt | 2 +- ext/mysqli/mysqli.c | 2 +- .../tests/mysqli_stmt_affected_rows.phpt | 2 +- ext/mysqlnd/mysqlnd_loaddata.c | 4 ++-- ext/pcntl/pcntl.c | 8 +++---- ext/pcntl/tests/pcntl_exec_3.phpt | 2 +- ext/pdo_mysql/mysql_statement.c | 2 +- ext/simplexml/tests/bug48601.phpt | 2 +- .../socket_sentto_recvfrom_ipv4_udp.phpt | 4 ++-- .../socket_sentto_recvfrom_ipv6_udp.phpt | 4 ++-- .../tests/socket_sentto_recvfrom_unix.phpt | 4 ++-- ext/spl/tests/bug52238.phpt | 2 +- ext/sqlite3/libsqlite/sqlite3.c | 22 +++++++++---------- ext/sqlite3/sqlite3.c | 2 +- ext/standard/basic_functions.c | 2 +- ext/standard/tests/file/umask_basic.phpt | 2 +- ext/tidy/examples/cleanhtml.php | 2 +- ext/tidy/examples/cleanhtml5.php | 2 +- ext/tidy/tidy.c | 2 +- ext/xsl/xsltprocessor.c | 2 +- 34 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt index e1968ad0416..32566ba8646 100644 --- a/Zend/tests/bug39018.phpt +++ b/Zend/tests/bug39018.phpt @@ -62,17 +62,17 @@ print "\nDone\n"; ?> --EXPECTF-- -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 0 in %s on line %d Notice: Uninitialized string offset: 0 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: %i in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: %i in %s on line %d @@ -88,16 +88,16 @@ Notice: Uninitialized string offset: 4 in %s on line %d Notice: Uninitialized string offset: 4 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 12 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d Notice: Uninitialized string offset: 12 in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d b Done diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt index 34604d6347a..f7cb81bb20d 100644 --- a/Zend/tests/offset_string.phpt +++ b/Zend/tests/offset_string.phpt @@ -30,10 +30,10 @@ echo "Done\n"; --EXPECTF-- string(1) "i" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" Warning: Illegal string offset 'run away' in %s on line %d @@ -46,10 +46,10 @@ string(1) "o" Notice: A non well formed numeric value encountered in %s on line %d string(1) "r" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "i" -Notice: String offset cast occured in %s on line %d +Notice: String offset cast occurred in %s on line %d string(1) "S" Warning: Illegal offset type in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index cca7c1976e9..841e1b93165 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3712,7 +3712,7 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args } else { /* Add it to result function table */ if (zend_hash_quick_add(resulting_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating resulting trait method table", fn->common.function_name); + zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating resulting trait method table", fn->common.function_name); } } @@ -3829,7 +3829,7 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int function_add_ref(&fn_copy); if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occured during updating class method table", hash_key->arKey); + zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating class method table", hash_key->arKey); } zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 205531fd28e..fbc73258c70 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1161,7 +1161,7 @@ convert_to_array: case IS_DOUBLE: case IS_NULL: case IS_BOOL: - zend_error(E_NOTICE, "String offset cast occured"); + zend_error(E_NOTICE, "String offset cast occurred"); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -1284,7 +1284,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont case IS_NULL: case IS_BOOL: if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "String offset cast occured"); + zend_error(E_NOTICE, "String offset cast occurred"); } break; default: diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index dd98511e9ca..70e7aff6900 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -216,7 +216,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, if (Z_TYPE(handler) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); } - /* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */ + /* retval is == NULL, when an exception occurred, don't report anything, because PHP itself will handle that */ } else if (retval == NULL) { } else { if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { diff --git a/ext/imap/tests/imap_errors_basic.phpt b/ext/imap/tests/imap_errors_basic.phpt index 9d2ca30ecea..91be3286aae 100644 --- a/ext/imap/tests/imap_errors_basic.phpt +++ b/ext/imap/tests/imap_errors_basic.phpt @@ -7,7 +7,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); --FILE-- getErrorMessage() . " (" . $fmt->getErrorCode() . ")\n"; else - return "Ooops, an error should have occured."; + return "Ooops, an error should have occurred."; } include_once( 'ut_common.inc' ); diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index f18a503b5ee..6d283aa9ca1 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -162,7 +162,7 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC) { if (stmt->stmt) { if (mysqli_stmt_close(stmt->stmt, TRUE)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error occured while closing statement"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error occurred while closing statement"); return; } } diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt index b8dd11a6994..7fc32f7e61b 100644 --- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt @@ -63,7 +63,7 @@ require_once('skipifconnectfailure.inc'); // NOTE: the error message varies with the MySQL Server version, dump only the error code! printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt)); - /* an error occured: affected rows should return -1 */ + /* an error occurred: affected rows should return -1 */ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 8e8622e5404..82ee63458ee 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -188,7 +188,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen char tmp_buf[sizeof(conn->error_info->error)]; int tmp_error_no; *is_warning = TRUE; - /* error occured */ + /* error occurred */ tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf) TSRMLS_CC); SET_CLIENT_ERROR(*conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); /* write empty packet to server */ @@ -211,7 +211,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen goto infile_error; } - /* error during read occured */ + /* error during read occurred */ if (bufsize < 0) { char tmp_buf[sizeof(conn->error_info->error)]; int tmp_error_no; diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index e5910a5dca4..8647e105ef9 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -816,7 +816,7 @@ PHP_FUNCTION(pcntl_exec) if (execve(path, argv, envp) == -1) { PCNTL_G(last_error) = errno; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno)); } /* Cleanup */ @@ -826,7 +826,7 @@ PHP_FUNCTION(pcntl_exec) if (execv(path, argv) == -1) { PCNTL_G(last_error) = errno; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno)); } } @@ -1127,7 +1127,7 @@ PHP_FUNCTION(pcntl_getpriority) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Invalid identifier flag", errno); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occured", errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno); break; } RETURN_FALSE; @@ -1167,7 +1167,7 @@ PHP_FUNCTION(pcntl_setpriority) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Only a super user may attempt to increase the process priority", errno); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occured", errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno); break; } RETURN_FALSE; diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt index d27c1c99628..5349381d92b 100644 --- a/ext/pcntl/tests/pcntl_exec_3.phpt +++ b/ext/pcntl/tests/pcntl_exec_3.phpt @@ -13,5 +13,5 @@ unlink($file); Warning: pcntl_exec() expects at least 1 parameter, 0 given %s NULL -Warning: pcntl_exec(): Error has occured: (errno %d) %s +Warning: pcntl_exec(): Error has occurred: (errno %d) %s bool(false) diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 0c2689f9d55..fc5ec5135bd 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -134,7 +134,7 @@ static int pdo_mysql_fill_stmt_from_result(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ row_count = mysql_affected_rows(H->server); if (row_count == (my_ulonglong)-1) { - /* we either have a query that returned a result set or an error occured + /* we either have a query that returned a result set or an error occurred lets see if we have access to a result set */ if (!H->buffered) { S->result = mysql_use_result(H->server); diff --git a/ext/simplexml/tests/bug48601.phpt b/ext/simplexml/tests/bug48601.phpt index 24bf2bf8a5f..0b81facf491 100644 --- a/ext/simplexml/tests/bug48601.phpt +++ b/ext/simplexml/tests/bug48601.phpt @@ -10,7 +10,7 @@ $sxe = simplexml_load_string('1'); $nodes = $sxe->xpath("/root/node2/@test"); if (! is_array($nodes)) { - echo "An error occured\n"; + echo "An error occurred\n"; } else { echo "Result Count: " . count($nodes) . "\n"; } diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt index 96cbf8f4db6..bf95044d48a 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt @@ -25,7 +25,7 @@ if (!extension_loaded('sockets')) { $len = strlen($msg); $bytes_sent = socket_sendto($socket, $msg, $len, 0, $address, 1223); if ($bytes_sent == -1) { - die('An error occured while sending to the socket'); + die('An error occurred while sending to the socket'); } else if ($bytes_sent != $len) { die($bytes_sent . ' bytes have been sent instead of the ' . $len . ' bytes expected'); } @@ -36,7 +36,7 @@ if (!extension_loaded('sockets')) { socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port); if ($bytes_received == -1) { - die('An error occured while receiving from the socket'); + die('An error occurred while receiving from the socket'); } else if ($bytes_received != $len) { die($bytes_received . ' bytes have been received instead of the ' . $len . ' bytes expected'); } diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt index 1fa42fd5da4..04f62eddd37 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt @@ -26,7 +26,7 @@ require 'ipv6_skipif.inc'; $len = strlen($msg); $bytes_sent = socket_sendto($socket, $msg, $len, 0, $address, 1223); if ($bytes_sent == -1) { - die('An error occured while sending to the socket'); + die('An error occurred while sending to the socket'); } else if ($bytes_sent != $len) { die($bytes_sent . ' bytes have been sent instead of the ' . $len . ' bytes expected'); } @@ -37,7 +37,7 @@ require 'ipv6_skipif.inc'; socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port); if ($bytes_received == -1) { - die('An error occured while receiving from the socket'); + die('An error occurred while receiving from the socket'); } else if ($bytes_received != $len) { die($bytes_received . ' bytes have been received instead of the ' . $len . ' bytes expected'); } diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt index 4cfdebbcbe0..55ad75c65e4 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt @@ -30,7 +30,7 @@ if (!extension_loaded('sockets')) { $bytes_sent = socket_sendto($socket, $msg, $len, 0, $address); if ($bytes_sent == -1) { @unlink($address); - die('An error occured while sending to the socket'); + die('An error occurred while sending to the socket'); } else if ($bytes_sent != $len) { @unlink($address); die($bytes_sent . ' bytes have been sent instead of the ' . $len . ' bytes expected'); @@ -41,7 +41,7 @@ if (!extension_loaded('sockets')) { $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from); if ($bytes_received == -1) { @unlink($address); - die('An error occured while receiving from the socket'); + die('An error occurred while receiving from the socket'); } else if ($bytes_received != $len) { @unlink($address); die($bytes_received . ' bytes have been received instead of the ' . $len . ' bytes expected'); diff --git a/ext/spl/tests/bug52238.phpt b/ext/spl/tests/bug52238.phpt index 85410bdf1e7..10da0b5fd93 100644 --- a/ext/spl/tests/bug52238.phpt +++ b/ext/spl/tests/bug52238.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #52238 - Crash when an Exception occured in iterator_to_array +Bug #52238 - Crash when an Exception occurred in iterator_to_array --FILE-- mutex); } else { - /* Error occured. Free our link object. */ + /* Error occurred. Free our link object. */ sqlite3_free(pLink); } @@ -28994,7 +28994,7 @@ static int fillInUnixFile( unixEnterMutex(); rc = findInodeInfo(pNew, &pNew->pInode); if( rc!=SQLITE_OK ){ - /* If an error occured in findInodeInfo(), close the file descriptor + /* If an error occurred in findInodeInfo(), close the file descriptor ** immediately, before releasing the mutex. findInodeInfo() may fail ** in two scenarios: ** @@ -32173,7 +32173,7 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){ ** containing the lower 32-bits of the new file-offset. Or, if it fails, ** it returns INVALID_SET_FILE_POINTER. However according to MSDN, ** INVALID_SET_FILE_POINTER may also be a valid new offset. So to determine - ** whether an error has actually occured, it is also necessary to call + ** whether an error has actually occurred, it is also necessary to call ** GetLastError(). */ dwRet = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN); @@ -32273,7 +32273,7 @@ static int winWrite( int amt, /* Number of bytes to write */ sqlite3_int64 offset /* Offset into the file to begin writing at */ ){ - int rc; /* True if error has occured, else false */ + int rc; /* True if error has occurred, else false */ winFile *pFile = (winFile*)id; /* File handle */ assert( amt>0 ); @@ -37068,7 +37068,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** * A write transaction is active. ** * An EXCLUSIVE or greater lock is held on the database file. ** * All writing and syncing of journal and database data has finished. -** If no error occured, all that remains is to finalize the journal to +** If no error occurred, all that remains is to finalize the journal to ** commit the transaction. If an error did occur, the caller will need ** to rollback the transaction. ** @@ -54279,7 +54279,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); - /* If no error has occured and pPage has an overflow cell, call balance() + /* If no error has occurred and pPage has an overflow cell, call balance() ** to redistribute the cells within the tree. Since balance() may move ** the cursor, zero the BtCursor.info.nSize and BtCursor.validNKey ** variables. @@ -57935,7 +57935,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ } sqlite3DbFree(v->db, sIter.apSub); - /* Return true if hasAbort==mayAbort. Or if a malloc failure occured. + /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. ** If malloc failed, then the while() loop above may not have iterated ** through all opcodes and hasAbort may be set incorrectly. Return ** true for this case to prevent the assert() in the callers frame @@ -59562,7 +59562,7 @@ SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ /* If p->iStatement is greater than zero, then this Vdbe opened a ** statement transaction that should be closed here. The only exception - ** is that an IO error may have occured, causing an emergency rollback. + ** is that an IO error may have occurred, causing an emergency rollback. ** In this case (db->nStatement==0), and there is nothing to do. */ if( db->nStatement && p->iStatement ){ @@ -59697,7 +59697,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ ** ** Even if the statement is read-only, it is important to perform ** a statement or transaction rollback operation. If the error - ** occured while writing to the journal, sub-journal or database + ** occurred while writing to the journal, sub-journal or database ** file as part of an effort to free up cache space (see function ** pagerStress() in pager.c), the rollback is required to restore ** the pager to a consistent state. @@ -61245,7 +61245,7 @@ end_of_step: assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE ); if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ /* If this statement was prepared using sqlite3_prepare_v2(), and an - ** error has occured, then return the error code in p->rc to the + ** error has occurred, then return the error code in p->rc to the ** caller. Set the error code in the database handle to the same value. */ rc = db->errCode = p->rc; @@ -113286,7 +113286,7 @@ static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){ }else{ int rc = sqlite3_reset(pCsr->pStmt); if( rc==SQLITE_OK ){ - /* If no row was found and no error has occured, then the %_content + /* If no row was found and no error has occurred, then the %_content ** table is missing a row that is present in the full-text index. ** The data structures are corrupt. */ diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 4bf24fbc6a5..0bb8616d96f 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1097,7 +1097,7 @@ static int php_sqlite3_stream_close(php_stream *stream, int close_handle TSRMLS_ php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract; if (sqlite3_blob_close(sqlite3_stream->blob) != SQLITE_OK) { - /* Error occured, but it still closed */ + /* Error occurred, but it still closed */ } efree(sqlite3_stream); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 646005ebc78..a5637db50d7 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3833,7 +3833,7 @@ PHP_NAMED_FUNCTION(php_inet_ntop) } if (!inet_ntop(af, address, buffer, sizeof(buffer))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occured"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred"); RETURN_FALSE; } diff --git a/ext/standard/tests/file/umask_basic.phpt b/ext/standard/tests/file/umask_basic.phpt index 7a2eb762db1..761df972533 100644 --- a/ext/standard/tests/file/umask_basic.phpt +++ b/ext/standard/tests/file/umask_basic.phpt @@ -20,7 +20,7 @@ for($mask = 0000; $mask <= 0777; $mask++) { var_dump( umask() ); echo "\n"; if ($mask != umask()) { - die('An error occured while changing back the umask'); + die('An error occurred while changing back the umask'); } } diff --git a/ext/tidy/examples/cleanhtml.php b/ext/tidy/examples/cleanhtml.php index 9a6713dc55f..2644210cbf3 100644 --- a/ext/tidy/examples/cleanhtml.php +++ b/ext/tidy/examples/cleanhtml.php @@ -26,7 +26,7 @@ if(tidy_warning_count() || tidy_error_count()) { - echo "\n\nThe following errors or warnings occured:\n"; + echo "\n\nThe following errors or warnings occurred:\n"; echo tidy_get_error_buffer(); echo "\n"; } diff --git a/ext/tidy/examples/cleanhtml5.php b/ext/tidy/examples/cleanhtml5.php index 4dfd7643e13..2ce683acadd 100644 --- a/ext/tidy/examples/cleanhtml5.php +++ b/ext/tidy/examples/cleanhtml5.php @@ -25,7 +25,7 @@ if(!empty($tidy->errorBuffer)) { - echo "\n\nThe following errors or warnings occured:\n"; + echo "\n\nThe following errors or warnings occurred:\n"; echo "{$tidy->errorBuffer}\n"; } diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 5ac1a69196b..72d8f5db662 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1238,7 +1238,7 @@ static PHP_FUNCTION(tidy_parse_string) /* }}} */ /* {{{ proto string tidy_get_error_buffer() - Return warnings and errors which occured parsing the specified document*/ + Return warnings and errors which occurred parsing the specified document*/ static PHP_FUNCTION(tidy_get_error_buffer) { TIDY_FETCH_OBJECT; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index d48e7090aea..5aa6aa943b2 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -336,7 +336,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler)); valuePush(ctxt, xmlXPathNewString("")); } - /* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */ + /* retval is == NULL, when an exception occurred, don't report anything, because PHP itself will handle that */ } else if (retval == NULL) { } else { if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) { From 5f31c81f0754ac031c2c5c056cb48ff4153fea81 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 30 Jun 2012 17:36:22 -0700 Subject: [PATCH 208/641] remove duplicates, fix order --- NEWS | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 80d56bc7f86..c650c85ab8e 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,6 @@ PHP NEWS . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) - Core: - . Fixed CVE-2012-2143. (Solar Designer) . Fixed potential overflow in _php_stream_scandir. (Jason Powell, Stas) . Fixed bug #62432 (ReflectionMethod random corrupt memory on high @@ -37,8 +36,6 @@ PHP NEWS - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) - . Fixed bug #62082 (memory corruption in internal get_icu_disp_value_src_php - function). (Gustavo) . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called twice). (Gustavo) . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) @@ -48,10 +45,6 @@ PHP NEWS - JSON: . Improved error handling. (Nikita Popov) - -- PDO: - . Fixed bug #61755 (A parsing bug in the prepared statements can lead to - access violations). (Johannes) - Phar: . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) @@ -87,20 +80,20 @@ PHP NEWS - Core: . Fixed CVE-2012-2143. (Solar Designer) - . Fixed bug #62005 (unexpected behavior when incrementally assigning to a - member of a null object). (Laruence) - . Fixed bug #61730 (Segfault from array_walk modifying an array passed by - reference). (Laruence) . Fixed missing bound check in iptcparse(). (chris at chiappa.net) - . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo) - . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename - set to null). (Anatoliy) - . Fixed bug #61713 (Logic error in charset detection for htmlentities). - (Anatoliy) - . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) - . Changed php://fd to be available only for CLI. . Fixed bug #62373 (serialize() generates wrong reference to the object). (Moriyoshi) + . Fixed bug #62005 (unexpected behavior when incrementally assigning to a + member of a null object). (Laruence) + . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) + . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo) + . Fixed bug #61730 (Segfault from array_walk modifying an array passed by + reference). (Laruence) + . Fixed bug #61713 (Logic error in charset detection for htmlentities). + (Anatoliy) + . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename + set to null). (Anatoliy) + . Changed php://fd to be available only for CLI. - Fileinfo: . Fixed bug #61812 (Uninitialised value used in libmagic). From dfce6bf5d698a65f76f5ab416c022d8f2af92288 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 30 Jun 2012 17:37:09 -0700 Subject: [PATCH 209/641] update NEWS --- NEWS | 138 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 108 insertions(+), 30 deletions(-) diff --git a/NEWS b/NEWS index f5112502054..44784626c2a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,10 @@ PHP NEWS - Core: . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed Salt). (Anthony Ferrara) + . Fixed bug #62432 (ReflectionMethod random corrupt memory on high + concurrent). (Johannes) + . Fixed bug #62373 (serialize() generates wrong reference to the object). + (Moriyoshi) . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in function __memcmp). (Laruence) . Fixed bug #61998 (Using traits with method aliases appears to result in @@ -46,11 +50,15 @@ PHP NEWS . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks pattern). (Gustavo) + . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) - libxml: . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM SAPI). (Gustavo) +- Phar: + . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) + - Readline: . Fixed bug #62186 (readline fails to compile - void function should not return a value). (Johannes) @@ -64,6 +72,10 @@ PHP NEWS - Sockets: . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) +- SPL: + . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). + (Nikita Popov) + - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) @@ -85,10 +97,6 @@ PHP NEWS . Fixed bug #61546 (functions related to current script failed when chdir() in cli sapi). (Laruence, reeze.xia@gmail.com) -- CURL: - . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction). - (Laruence) - - Core: . Fixed missing bound check in iptcparse(). (chris at chiappa.net) . Fixed CVE-2012-2143. (Solar Designer) @@ -103,12 +111,15 @@ PHP NEWS . Fixed bug #61827 (incorrect \e processing on Windows) (Anatoliy) . Fixed bug #61782 (__clone/__destruct do not match other methods when checking access controls). (Stas) + . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo) . Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash). (Laruence) . Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference). (Laruence) . Fixed bug #61728 (PHP crash when calling ob_start in request_shutdown phase). (Laruence) + . Fixed bug #61713 (Logic error in charset detection for htmlentities). + (Anatoliy) . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov) . Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2)). (Laruence) @@ -118,15 +129,9 @@ PHP NEWS set to null). (Anatoliy) . Changed php://fd to be available only for CLI. -- PDO: - . Fixed bug #61755 (A parsing bug in the prepared statements can lead to - access violations). (Johannes) - -- Phar: - . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) - -- Pgsql: - . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) +- CURL: + . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction). + (Laruence) - Fileinfo . Fixed bug #61812 (Uninitialised value used in libmagic). @@ -144,6 +149,20 @@ PHP NEWS . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). (Laruence) +- PDO: + . Fixed bug #61755 (A parsing bug in the prepared statements can lead to + access violations). (Johannes) + +- Phar: + . Fixed bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) + +- Pgsql: + . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) + +- Streams: + . Fixed bug #61961 (file_get_contents leaks when access empty file with + maxlen set). (Reeze) + - Zlib: . Fixed bug #61820 (using ob_gzhandler will complain about headers already sent when no compression). (Mike) @@ -232,23 +251,6 @@ PHP NEWS . Fixed bug #60948 (mysqlnd FTBFS when -Wformat-security is enabled). (Johannes) -- Readline: - . Fixed bug #61088 (Memory leak in readline_callback_handler_install). - (Nikic, Laruence) - -- Session - . Fixed bug #60634 (Segmentation fault when trying to die() in - SessionHandler::write()). (Ilia) - -- SOAP - . Fixed bug #61423 (gzip compression fails). (Ilia) - . Fixed bug #60887 (SoapClient ignores user_agent option and sends no - User-Agent header). (carloschilazo at gmail dot com) - . Fixed bug #60842, #51775 (Chunked response parsing error when - chunksize length line is > 10 bytes). (Ilia) - . Fixed bug #49853 (Soap Client stream context header option ignored). - (Dmitry) - - PDO . Fixed bug #61292 (Segfault while calling a method on an overloaded PDO object). (Laruence) @@ -266,12 +268,29 @@ PHP NEWS . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL bytes). (Nikita Popov) +- Readline: + . Fixed bug #61088 (Memory leak in readline_callback_handler_install). + (Nikic, Laruence) + - Reflection: . Implemented FR #61602 (Allow access to the name of constant used as function/method parameter's default value). (reeze.xia@gmail.com) . Fixed bug #60968 (Late static binding doesn't work with ReflectionMethod::invokeArgs()). (Laruence) +- Session + . Fixed bug #60634 (Segmentation fault when trying to die() in + SessionHandler::write()). (Ilia) + +- SOAP + . Fixed bug #61423 (gzip compression fails). (Ilia) + . Fixed bug #60887 (SoapClient ignores user_agent option and sends no + User-Agent header). (carloschilazo at gmail dot com) + . Fixed bug #60842, #51775 (Chunked response parsing error when + chunksize length line is > 10 bytes). (Ilia) + . Fixed bug #49853 (Soap Client stream context header option ignored). + (Dmitry) + - SPL: . Fixed bug #61453 (SplObjectStorage does not identify objects correctly). (Gustavo) @@ -728,6 +747,65 @@ PHP NEWS . Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression). (Mike) +14 Jun 2012, PHP 5.3.14 + +- CLI SAPI: + . Fixed bug #61546 (functions related to current script failed when chdir() + in cli sapi). (Laruence, reeze.xia@gmail.com) + +- CURL: + . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction). + (Laruence) + +- COM: + . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) + +- Core: + . Fixed CVE-2012-2143. (Solar Designer) + . Fixed missing bound check in iptcparse(). (chris at chiappa.net) + . Fixed bug #62373 (serialize() generates wrong reference to the object). + (Moriyoshi) + . Fixed bug #62005 (unexpected behavior when incrementally assigning to a + member of a null object). (Laruence) + . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) + . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo) + . Fixed bug #61730 (Segfault from array_walk modifying an array passed by + reference). (Laruence) + . Fixed bug #61713 (Logic error in charset detection for htmlentities). + (Anatoliy) + . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename + set to null). (Anatoliy) + . Changed php://fd to be available only for CLI. + +- Fileinfo: + . Fixed bug #61812 (Uninitialised value used in libmagic). + (Laruence, Gustavo) + +- Iconv extension: + . Fixed a bug that iconv extension fails to link to the correct library + when another extension makes use of a library that links to the iconv + library. See https://bugs.gentoo.org/show_bug.cgi?id=364139 for detail. + (Moriyoshi) + +- Intl: + . Fixed bug #62082 (Memory corruption in internal function + get_icu_disp_value_src_php()). (Gustavo) + +- JSON + . Fixed bug #61537 (json_encode() incorrectly truncates/discards + information). (Adam) + +- PDO: + . Fixed bug #61755 (A parsing bug in the prepared statements can lead to + access violations). (Johannes) + +- Phar: + . Fix bug #61065 (Secunia SA44335). (Rasmus) + +- Streams: + . Fixed bug #61961 (file_get_contents leaks when access empty file with + maxlen set). (Reeze) + 08 May 2012, PHP 5.3.13 - CGI . Improve fix for PHP-CGI query string parameter vulnerability, CVE-2012-2311. From b741d3315be5cbddae5a895b9dceb2b71d394366 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 30 Jun 2012 19:14:30 -0700 Subject: [PATCH 210/641] fix bug #61359: json_encode() calls too many reallocs --- NEWS | 3 +++ ext/json/json.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 44784626c2a..6dd1feb7774 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,9 @@ PHP NEWS pattern). (Gustavo) . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) +- JSON: + . Fixed bug #61359 (json_encode() calls too many reallocs). (Stas) + - libxml: . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM SAPI). (Gustavo) diff --git a/ext/json/json.c b/ext/json/json.c index b467079610f..96690477c94 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -311,7 +311,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) smart_str_appendc(buf, ':'); json_pretty_print_char(buf, options, ' ' TSRMLS_CC); - + php_json_encode(buf, *data, options TSRMLS_CC); } else { if (need_comma) { @@ -329,7 +329,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) smart_str_appendc(buf, ':'); json_pretty_print_char(buf, options, ' ' TSRMLS_CC); - + php_json_encode(buf, *data, options TSRMLS_CC); } } @@ -340,7 +340,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } } } - + --JSON_G(encoder_depth); json_pretty_print_char(buf, options, '\n' TSRMLS_CC); json_pretty_print_indent(buf, options TSRMLS_CC); @@ -360,6 +360,7 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR int pos = 0, ulen = 0; unsigned short us; unsigned short *utf16; + size_t newlen; if (len == 0) { smart_str_appendl(buf, "\"\"", 2); @@ -387,9 +388,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } return; } - + } - + utf16 = (options & PHP_JSON_UNESCAPED_UNICODE) ? NULL : (unsigned short *) safe_emalloc(len, sizeof(unsigned short), 0); ulen = utf8_to_utf16(utf16, s, len); if (ulen <= 0) { @@ -408,6 +409,8 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR len = ulen; } + /* pre-allocate for string length plus 2 quotes */ + smart_str_alloc(buf, len+2, 0); smart_str_appendc(buf, '"'); while (pos < len) @@ -520,13 +523,13 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio zend_class_entry *ce = Z_OBJCE_P(val); zval *retval = NULL, fname; HashTable* myht; - + if (Z_TYPE_P(val) == IS_ARRAY) { myht = HASH_OF(val); } else { myht = Z_OBJPROP_P(val); - } - + } + if (myht && myht->nApplyCount > 1) { JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; smart_str_appendl(buf, "null", 4); @@ -539,7 +542,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name); smart_str_appendl(buf, "null", sizeof("null") - 1); return; - } + } if (EG(exception)) { /* Error already raised */ From 250393f92523fffe643df06a1de2101fd50a327e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 1 Jul 2012 16:28:57 +0200 Subject: [PATCH 211/641] Revert JSON changes to PHP 5.3 This reverts the following commits: 974324676b2436f159f42d9241c569f813471684 4662151ea7d7b6920d115cf2a2d6e9d4232727a3 84fe2cc890e49f40bac7c3ba74b3cfc6dc4cef2f This does not revert the JSON changes released in PHP 5.3.14. --- ext/json/JSON_parser.h | 5 +- ext/json/json.c | 55 +++------------------- ext/json/tests/003.phpt | 17 ++----- ext/json/tests/004.phpt | 16 +------ ext/json/tests/007.phpt | 16 +++---- ext/json/tests/bug54058.phpt | 20 ++++---- ext/json/tests/bug61537.phpt | 37 ++++++--------- ext/json/tests/inf_nan_error.phpt | 45 ------------------ ext/json/tests/json_encode_basic.phpt | 4 +- ext/json/tests/pass001.1.phpt | 4 +- ext/json/tests/pass001.phpt | 4 +- ext/json/tests/unsupported_type_error.phpt | 26 ---------- 12 files changed, 50 insertions(+), 199 deletions(-) delete mode 100644 ext/json/tests/inf_nan_error.phpt delete mode 100644 ext/json/tests/unsupported_type_error.phpt diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 5037344890b..746190bb355 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -24,10 +24,7 @@ enum error_codes { PHP_JSON_ERROR_STATE_MISMATCH, PHP_JSON_ERROR_CTRL_CHAR, PHP_JSON_ERROR_SYNTAX, - PHP_JSON_ERROR_UTF8, - PHP_JSON_ERROR_RECURSION, - PHP_JSON_ERROR_INF_OR_NAN, - PHP_JSON_ERROR_UNSUPPORTED_TYPE + PHP_JSON_ERROR_UTF8 }; extern JSON_parser new_JSON_parser(int depth); diff --git a/ext/json/json.c b/ext/json/json.c index 4d29a666886..ce2cf43fcc9 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -34,7 +34,6 @@ static PHP_MINFO_FUNCTION(json); static PHP_FUNCTION(json_encode); static PHP_FUNCTION(json_decode); static PHP_FUNCTION(json_last_error); -static PHP_FUNCTION(json_last_error_msg); static const char digits[] = "0123456789abcdef"; @@ -54,9 +53,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0) ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0) -ZEND_END_ARG_INFO() /* }}} */ /* {{{ json_functions[] */ @@ -64,7 +60,6 @@ static const function_entry json_functions[] = { PHP_FE(json_encode, arginfo_json_encode) PHP_FE(json_decode, arginfo_json_decode) PHP_FE(json_last_error, arginfo_json_last_error) - PHP_FE(json_last_error_msg, arginfo_json_last_error_msg) PHP_FE_END }; /* }}} */ @@ -86,9 +81,6 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -189,7 +181,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } if (myht && myht->nApplyCount > 1) { - JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); smart_str_appendl(buf, "null", 4); return; } @@ -311,7 +303,7 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR smart_str_appendl(buf, tmp, l); efree(tmp); } else { - JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", d); smart_str_appendc(buf, '0'); } } @@ -329,6 +321,7 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (len < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); smart_str_appendl(buf, "null", 4); } else { smart_str_appendl(buf, "\"\"", 2); @@ -467,7 +460,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ smart_str_appendl(buf, d, len); efree(d); } else { - JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", dbl); smart_str_appendc(buf, '0'); } } @@ -483,7 +476,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ break; default: - JSON_G(error_code) = PHP_JSON_ERROR_UNSUPPORTED_TYPE; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported, encoded as null"); smart_str_appendl(buf, "null", 4); break; } @@ -577,7 +570,7 @@ static PHP_FUNCTION(json_encode) php_json_encode(&buf, parameter, options TSRMLS_CC); - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) { + if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && options ^ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR) { ZVAL_FALSE(return_value); } else { ZVAL_STRINGL(return_value, buf.c, buf.len, 1); @@ -611,7 +604,7 @@ static PHP_FUNCTION(json_decode) /* }}} */ /* {{{ proto int json_last_error() - Returns the error code of the last json_encode() or json_decode() call. */ + Returns the error code of the last json_decode(). */ static PHP_FUNCTION(json_last_error) { if (zend_parse_parameters_none() == FAILURE) { @@ -622,40 +615,6 @@ static PHP_FUNCTION(json_last_error) } /* }}} */ -/* {{{ proto string json_last_error_msg() - Returns the error string of the last json_encode() or json_decode() call. */ -static PHP_FUNCTION(json_last_error_msg) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - switch(JSON_G(error_code)) { - case PHP_JSON_ERROR_NONE: - RETURN_STRING("No error", 1); - case PHP_JSON_ERROR_DEPTH: - RETURN_STRING("Maximum stack depth exceeded", 1); - case PHP_JSON_ERROR_STATE_MISMATCH: - RETURN_STRING("State mismatch (invalid or malformed JSON)", 1); - case PHP_JSON_ERROR_CTRL_CHAR: - RETURN_STRING("Control character error, possibly incorrectly encoded", 1); - case PHP_JSON_ERROR_SYNTAX: - RETURN_STRING("Syntax error", 1); - case PHP_JSON_ERROR_UTF8: - RETURN_STRING("Malformed UTF-8 characters, possibly incorrectly encoded", 1); - case PHP_JSON_ERROR_RECURSION: - RETURN_STRING("Recursion detected", 1); - case PHP_JSON_ERROR_INF_OR_NAN: - RETURN_STRING("Inf and NaN cannot be JSON encoded", 1); - case PHP_JSON_ERROR_UNSUPPORTED_TYPE: - RETURN_STRING("Type is not supported", 1); - default: - RETURN_STRING("Unknown error", 1); - } - -} -/* }}} */ - /* * Local variables: * tab-width: 4 diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index 4ce5b0fde9d..3b52fb08841 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -9,16 +9,10 @@ $a = array(); $a[] = &$a; var_dump($a); - -echo "\n"; - var_dump(json_encode($a)); -var_dump(json_last_error(), json_last_error_msg()); -echo "\n"; - -var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error_msg()); +/* Break circular data structure to prevent memory leaks */ +unset($a[0]); echo "Done\n"; ?> @@ -31,11 +25,6 @@ array(1) { } } -bool(false) -int(6) -string(%d) "Recursion detected" - +Warning: json_encode(): recursion detected in %s on line %d string(8) "[[null]]" -int(6) -string(%d) "Recursion detected" Done diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 70ef3ffd1b8..1d282f9a961 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -9,16 +9,7 @@ $a = new stdclass; $a->prop = $a; var_dump($a); - -echo "\n"; - var_dump(json_encode($a)); -var_dump(json_last_error(), json_last_error_msg()); - -echo "\n"; - -var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> @@ -28,11 +19,6 @@ object(stdClass)#%d (1) { *RECURSION* } -bool(false) -int(6) -string(%d) "Recursion detected" - +Warning: json_encode(): recursion detected in %s on line %d string(22) "{"prop":{"prop":null}}" -int(6) -string(%d) "Recursion detected" Done diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 7557ac9ed74..9ee190a24cd 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -5,15 +5,15 @@ json_last_error() tests --FILE-- foo = quoted_printable_decode('=B0'); json_encode($a); -var_dump(json_last_error(), json_last_error_msg()); +var_dump(json_last_error()); $b = new stdclass; $b->foo = $bad_utf8; $b->bar = 1; json_encode($b); -var_dump(json_last_error(), json_last_error_msg()); +var_dump(json_last_error()); $c = array( 'foo' => $bad_utf8, 'bar' => 1 ); json_encode($c); -var_dump(json_last_error(), json_last_error_msg()); - +var_dump(json_last_error()); ?> --EXPECTF-- +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" + +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" + +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" + +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt index 80ed051c9a6..e2abdda66a3 100644 --- a/ext/json/tests/bug61537.phpt +++ b/ext/json/tests/bug61537.phpt @@ -5,35 +5,26 @@ Bug #61537 (json_encode() incorrectly truncates/discards information) --FILE-- --EXPECTF-- +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d bool(false) int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" -string(4) "null" -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" -bool(false) -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +string(4) "null" +int(5) + +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d +bool(false) +int(5) + +Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d string(4) "null" int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/inf_nan_error.phpt b/ext/json/tests/inf_nan_error.phpt deleted file mode 100644 index f9deecc4699..00000000000 --- a/ext/json/tests/inf_nan_error.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -An error is thrown when INF or NaN are encoded ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -float(INF) -bool(false) -int(7) -string(34) "Inf and NaN cannot be JSON encoded" -string(1) "0" -int(7) -string(34) "Inf and NaN cannot be JSON encoded" - -float(NAN) -bool(false) -int(7) -string(34) "Inf and NaN cannot be JSON encoded" -string(1) "0" -int(7) -string(34) "Inf and NaN cannot be JSON encoded" diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index fc348eed811..003fcd44c6a 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -150,7 +150,9 @@ string(4) "null" -- Iteration 25 -- string(4) "null" -- Iteration 26 -- -bool(false) + +Warning: json_encode(): type is unsupported, encoded as null in %s on line %d +string(4) "null" -- Iteration 27 -- string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" ===Done=== diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index a51f885780d..7e15a7622ac 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -90,10 +90,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); +$obj_enc = json_encode($obj); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); +$arr_enc = json_encode($arr); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt index 1fd05fcdd87..43be11e2b0f 100644 --- a/ext/json/tests/pass001.phpt +++ b/ext/json/tests/pass001.phpt @@ -79,10 +79,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); +$obj_enc = json_encode($obj); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); +$arr_enc = json_encode($arr); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt deleted file mode 100644 index 45a167a5ac0..00000000000 --- a/ext/json/tests/unsupported_type_error.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -An error is thrown when an unsupported type is encoded ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -resource(5) of type (stream) -bool(false) -int(8) -string(21) "Type is not supported" -string(4) "null" -int(8) -string(21) "Type is not supported" From b7903f9778a57fda71867f9661505f635d602067 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 1 Jul 2012 16:38:26 +0200 Subject: [PATCH 212/641] Revert JSON merges to 5.4 This reverts the following merge commits (-m 1): 405ebfcd182a39f0960ff7d7055d49053d3e0316 d372b33c9b941be9a795bf3705bd22dc5f6092c3 36fa17a5fae84ab332366a202f0a709279a2466a --- ext/json/JSON_parser.h | 5 +- ext/json/json.c | 64 ++++------------------ ext/json/php_json.h | 1 - ext/json/tests/003.phpt | 17 +----- ext/json/tests/004.phpt | 16 +----- ext/json/tests/007.phpt | 16 ++---- ext/json/tests/bug43941.phpt | 7 ++- ext/json/tests/bug53946.phpt | 6 +- ext/json/tests/bug54058.phpt | 13 ++--- ext/json/tests/bug61537.phpt | 39 ------------- ext/json/tests/bug61978.phpt | 10 +++- ext/json/tests/inf_nan_error.phpt | 45 --------------- ext/json/tests/json_encode_basic.phpt | 6 +- ext/json/tests/pass001.1.phpt | 4 +- ext/json/tests/pass001.phpt | 4 +- ext/json/tests/unsupported_type_error.phpt | 26 --------- main/php_version.h | 2 +- 17 files changed, 48 insertions(+), 233 deletions(-) delete mode 100644 ext/json/tests/bug61537.phpt delete mode 100644 ext/json/tests/inf_nan_error.phpt delete mode 100644 ext/json/tests/unsupported_type_error.phpt diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 8671765b4d9..541664b8c6f 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -25,10 +25,7 @@ enum error_codes { PHP_JSON_ERROR_STATE_MISMATCH, PHP_JSON_ERROR_CTRL_CHAR, PHP_JSON_ERROR_SYNTAX, - PHP_JSON_ERROR_UTF8, - PHP_JSON_ERROR_RECURSION, - PHP_JSON_ERROR_INF_OR_NAN, - PHP_JSON_ERROR_UNSUPPORTED_TYPE + PHP_JSON_ERROR_UTF8 }; extern JSON_parser new_JSON_parser(int depth); diff --git a/ext/json/json.c b/ext/json/json.c index 96690477c94..786b21ac910 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -35,7 +35,6 @@ static PHP_MINFO_FUNCTION(json); static PHP_FUNCTION(json_encode); static PHP_FUNCTION(json_decode); static PHP_FUNCTION(json_last_error); -static PHP_FUNCTION(json_last_error_msg); static const char digits[] = "0123456789abcdef"; @@ -58,9 +57,6 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0) ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0) -ZEND_END_ARG_INFO() /* }}} */ /* {{{ json_functions[] */ @@ -68,7 +64,6 @@ static const zend_function_entry json_functions[] = { PHP_FE(json_encode, arginfo_json_encode) PHP_FE(json_decode, arginfo_json_decode) PHP_FE(json_last_error, arginfo_json_last_error) - PHP_FE(json_last_error_msg, arginfo_json_last_error_msg) PHP_FE_END }; /* }}} */ @@ -101,7 +96,6 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); @@ -109,9 +103,6 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); @@ -240,7 +231,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } if (myht && myht->nApplyCount > 1) { - JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); smart_str_appendl(buf, "null", 4); return; } @@ -382,7 +373,7 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR smart_str_appendl(buf, tmp, l); efree(tmp); } else { - JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", d); smart_str_appendc(buf, '0'); } } @@ -399,6 +390,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (ulen < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; + if (!PG(display_errors)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); + } smart_str_appendl(buf, "null", 4); } else { smart_str_appendl(buf, "\"\"", 2); @@ -531,7 +525,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio } if (myht && myht->nApplyCount > 1) { - JSON_G(error_code) = PHP_JSON_ERROR_RECURSION; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected"); smart_str_appendl(buf, "null", 4); return; } @@ -595,7 +589,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ smart_str_appendl(buf, d, len); efree(d); } else { - JSON_G(error_code) = PHP_JSON_ERROR_INF_OR_NAN; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "double %.9g does not conform to the JSON spec, encoded as 0", dbl); smart_str_appendc(buf, '0'); } } @@ -616,7 +610,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_ break; default: - JSON_G(error_code) = PHP_JSON_ERROR_UNSUPPORTED_TYPE; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "type is unsupported, encoded as null"); smart_str_appendl(buf, "null", 4); break; } @@ -711,11 +705,7 @@ static PHP_FUNCTION(json_encode) php_json_encode(&buf, parameter, options TSRMLS_CC); - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) { - ZVAL_FALSE(return_value); - } else { - ZVAL_STRINGL(return_value, buf.c, buf.len, 1); - } + ZVAL_STRINGL(return_value, buf.c, buf.len, 1); smart_str_free(&buf); } @@ -753,7 +743,7 @@ static PHP_FUNCTION(json_decode) /* }}} */ /* {{{ proto int json_last_error() - Returns the error code of the last json_encode() or json_decode() call. */ + Returns the error code of the last json_decode(). */ static PHP_FUNCTION(json_last_error) { if (zend_parse_parameters_none() == FAILURE) { @@ -764,40 +754,6 @@ static PHP_FUNCTION(json_last_error) } /* }}} */ -/* {{{ proto string json_last_error_msg() - Returns the error string of the last json_encode() or json_decode() call. */ -static PHP_FUNCTION(json_last_error_msg) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - switch(JSON_G(error_code)) { - case PHP_JSON_ERROR_NONE: - RETURN_STRING("No error", 1); - case PHP_JSON_ERROR_DEPTH: - RETURN_STRING("Maximum stack depth exceeded", 1); - case PHP_JSON_ERROR_STATE_MISMATCH: - RETURN_STRING("State mismatch (invalid or malformed JSON)", 1); - case PHP_JSON_ERROR_CTRL_CHAR: - RETURN_STRING("Control character error, possibly incorrectly encoded", 1); - case PHP_JSON_ERROR_SYNTAX: - RETURN_STRING("Syntax error", 1); - case PHP_JSON_ERROR_UTF8: - RETURN_STRING("Malformed UTF-8 characters, possibly incorrectly encoded", 1); - case PHP_JSON_ERROR_RECURSION: - RETURN_STRING("Recursion detected", 1); - case PHP_JSON_ERROR_INF_OR_NAN: - RETURN_STRING("Inf and NaN cannot be JSON encoded", 1); - case PHP_JSON_ERROR_UNSUPPORTED_TYPE: - RETURN_STRING("Type is not supported", 1); - default: - RETURN_STRING("Unknown error", 1); - } - -} -/* }}} */ - /* * Local variables: * tab-width: 4 diff --git a/ext/json/php_json.h b/ext/json/php_json.h index afeff3f6cc8..ef3e4b5a799 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -63,7 +63,6 @@ extern zend_class_entry *php_json_serializable_ce; #define PHP_JSON_UNESCAPED_SLASHES (1<<6) #define PHP_JSON_PRETTY_PRINT (1<<7) #define PHP_JSON_UNESCAPED_UNICODE (1<<8) -#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) /* Internal flags */ #define PHP_JSON_OUTPUT_ARRAY 0 diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt index 4ce5b0fde9d..3b52fb08841 100644 --- a/ext/json/tests/003.phpt +++ b/ext/json/tests/003.phpt @@ -9,16 +9,10 @@ $a = array(); $a[] = &$a; var_dump($a); - -echo "\n"; - var_dump(json_encode($a)); -var_dump(json_last_error(), json_last_error_msg()); -echo "\n"; - -var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error_msg()); +/* Break circular data structure to prevent memory leaks */ +unset($a[0]); echo "Done\n"; ?> @@ -31,11 +25,6 @@ array(1) { } } -bool(false) -int(6) -string(%d) "Recursion detected" - +Warning: json_encode(): recursion detected in %s on line %d string(8) "[[null]]" -int(6) -string(%d) "Recursion detected" Done diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt index 70ef3ffd1b8..1d282f9a961 100644 --- a/ext/json/tests/004.phpt +++ b/ext/json/tests/004.phpt @@ -9,16 +9,7 @@ $a = new stdclass; $a->prop = $a; var_dump($a); - -echo "\n"; - var_dump(json_encode($a)); -var_dump(json_last_error(), json_last_error_msg()); - -echo "\n"; - -var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR)); -var_dump(json_last_error(), json_last_error_msg()); echo "Done\n"; ?> @@ -28,11 +19,6 @@ object(stdClass)#%d (1) { *RECURSION* } -bool(false) -int(6) -string(%d) "Recursion detected" - +Warning: json_encode(): recursion detected in %s on line %d string(22) "{"prop":{"prop":null}}" -int(6) -string(%d) "Recursion detected" Done diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 7557ac9ed74..9ee190a24cd 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -5,15 +5,15 @@ json_last_error() tests --FILE-- --EXPECTF-- string(5) ""abc"" -bool(false) +string(4) "null" string(4) "null" string(17) "[null,null,"abc"]" Done + diff --git a/ext/json/tests/bug53946.phpt b/ext/json/tests/bug53946.phpt index 111438ddc48..abbb81238b8 100644 --- a/ext/json/tests/bug53946.phpt +++ b/ext/json/tests/bug53946.phpt @@ -9,8 +9,8 @@ var_dump(json_encode("latin 1234 -/ russian мама мыла раму speci var_dump(json_encode("ab\xE0")); var_dump(json_encode("ab\xE0", JSON_UNESCAPED_UNICODE)); ?> ---EXPECTF-- +--EXPECT-- string(156) ""latin 1234 -\/ russian \u043c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0440\u0430\u043c\u0443 specialchars \u0002 \b \n U+1D11E >\ud834\udd1e<"" string(100) ""latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >ð„ž<"" -bool(false) -bool(false) +string(4) "null" +string(4) "null" diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt index df1b3130f84..3b1136bdd95 100644 --- a/ext/json/tests/bug54058.phpt +++ b/ext/json/tests/bug54058.phpt @@ -8,33 +8,28 @@ Bug #54058 (json_last_error() invalid UTF-8 produces wrong error) $bad_utf8 = quoted_printable_decode('=B0'); json_encode($bad_utf8); -var_dump(json_last_error(), json_last_error_msg()); +var_dump(json_last_error()); $a = new stdclass; $a->foo = quoted_printable_decode('=B0'); json_encode($a); -var_dump(json_last_error(), json_last_error_msg()); +var_dump(json_last_error()); $b = new stdclass; $b->foo = $bad_utf8; $b->bar = 1; json_encode($b); -var_dump(json_last_error(), json_last_error_msg()); +var_dump(json_last_error()); $c = array( 'foo' => $bad_utf8, 'bar' => 1 ); json_encode($c); -var_dump(json_last_error(), json_last_error_msg()); - +var_dump(json_last_error()); ?> --EXPECTF-- int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt deleted file mode 100644 index 80ed051c9a6..00000000000 --- a/ext/json/tests/bug61537.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Bug #61537 (json_encode() incorrectly truncates/discards information) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -bool(false) -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" -string(4) "null" -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" - -bool(false) -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" -string(4) "null" -int(5) -string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt index c34b03f8f73..2c732979ef4 100644 --- a/ext/json/tests/bug61978.phpt +++ b/ext/json/tests/bug61978.phpt @@ -29,15 +29,19 @@ class JsonTest2 implements JsonSerializable { $obj1 = new JsonTest1(); -var_dump(json_encode($obj1, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_encode($obj1)); -echo "==\n"; +echo "\n==\n"; $obj2 = new JsonTest2(); -var_dump(json_encode($obj2, JSON_PARTIAL_OUTPUT_ON_ERROR)); +var_dump(json_encode($obj2)); ?> --EXPECTF-- +Warning: json_encode(): recursion detected in %s on line %d string(44) "{"test":"123","me":{"test":"123","me":null}}" + == + +Warning: json_encode(): recursion detected in %s on line %d string(44) "{"test":"123","me":{"test":"123","me":null}}" diff --git a/ext/json/tests/inf_nan_error.phpt b/ext/json/tests/inf_nan_error.phpt deleted file mode 100644 index f9deecc4699..00000000000 --- a/ext/json/tests/inf_nan_error.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -An error is thrown when INF or NaN are encoded ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -float(INF) -bool(false) -int(7) -string(34) "Inf and NaN cannot be JSON encoded" -string(1) "0" -int(7) -string(34) "Inf and NaN cannot be JSON encoded" - -float(NAN) -bool(false) -int(7) -string(34) "Inf and NaN cannot be JSON encoded" -string(1) "0" -int(7) -string(34) "Inf and NaN cannot be JSON encoded" diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index fc348eed811..152e24444c0 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -150,7 +150,9 @@ string(4) "null" -- Iteration 25 -- string(4) "null" -- Iteration 26 -- -bool(false) + +Warning: json_encode(): type is unsupported, encoded as null in %s on line %d +string(4) "null" -- Iteration 27 -- string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" -===Done=== +===Done=== \ No newline at end of file diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index a51f885780d..7e15a7622ac 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -90,10 +90,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); +$obj_enc = json_encode($obj); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); +$arr_enc = json_encode($arr); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt index 1fd05fcdd87..43be11e2b0f 100644 --- a/ext/json/tests/pass001.phpt +++ b/ext/json/tests/pass001.phpt @@ -79,10 +79,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); +$obj_enc = json_encode($obj); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); +$arr_enc = json_encode($arr); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; diff --git a/ext/json/tests/unsupported_type_error.phpt b/ext/json/tests/unsupported_type_error.phpt deleted file mode 100644 index 45a167a5ac0..00000000000 --- a/ext/json/tests/unsupported_type_error.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -An error is thrown when an unsupported type is encoded ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -resource(5) of type (stream) -bool(false) -int(8) -string(21) "Type is not supported" -string(4) "null" -int(8) -string(21) "Type is not supported" diff --git a/main/php_version.h b/main/php_version.h index 4b7709c552b..6b49f408647 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -5,4 +5,4 @@ #define PHP_RELEASE_VERSION 5 #define PHP_EXTRA_VERSION "-dev" #define PHP_VERSION "5.4.5-dev" -#define PHP_VERSION_ID 50405 +#define PHP_VERSION_ID 50404 From ff41bfc87882440cfde0ed5673bd6c3f2347c892 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 1 Jul 2012 17:05:19 +0200 Subject: [PATCH 213/641] Fix accidential change of php_version.h For some reason the merge reverts changed the version :/ --- main/php_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/php_version.h b/main/php_version.h index 6b49f408647..4b7709c552b 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -5,4 +5,4 @@ #define PHP_RELEASE_VERSION 5 #define PHP_EXTRA_VERSION "-dev" #define PHP_VERSION "5.4.5-dev" -#define PHP_VERSION_ID 50404 +#define PHP_VERSION_ID 50405 From 2416719fb184f84fcd521be2c8a5feabf65270e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 2 Jul 2012 00:24:54 +0200 Subject: [PATCH 214/641] Unified zval -> UDate conversions Now IntlDateFormatter::format() also accepts IntlCalendar objects. Code is shared in MessageFormatter and IntlDateFormatter. --- ext/intl/common/common_date.cpp | 88 ++++++++++++++++++++++++ ext/intl/common/common_date.h | 29 ++++++++ ext/intl/config.m4 | 1 + ext/intl/config.w32 | 1 + ext/intl/dateformat/dateformat.h | 1 - ext/intl/dateformat/dateformat_format.c | 80 +++++++-------------- ext/intl/msgformat/msgformat_helpers.cpp | 68 +----------------- ext/intl/tests/dateformat_format.phpt | 10 +-- 8 files changed, 149 insertions(+), 129 deletions(-) create mode 100644 ext/intl/common/common_date.cpp create mode 100644 ext/intl/common/common_date.h diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp new file mode 100644 index 00000000000..812a196ed0f --- /dev/null +++ b/ext/intl/common/common_date.cpp @@ -0,0 +1,88 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include + +extern "C" { +#include "../php_intl.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +#include +} + +U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) +{ + double rv = NAN; + long lv; + int type; + + if (U_FAILURE(*status)) { + return NAN; + } + + switch (Z_TYPE_P(z)) { + case IS_STRING: + type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); + if (type == IS_DOUBLE) { + rv *= U_MILLIS_PER_SECOND; + } else if (type == IS_LONG) { + rv = U_MILLIS_PER_SECOND * (double)lv; + } else { + *status = U_ILLEGAL_ARGUMENT_ERROR; + } + break; + case IS_LONG: + rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); + break; + case IS_DOUBLE: + rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); + break; + case IS_OBJECT: + if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce() TSRMLS_CC)) { + zval retval; + zval *zfuncname; + INIT_ZVAL(retval); + MAKE_STD_ZVAL(zfuncname); + ZVAL_STRING(zfuncname, "getTimestamp", 1); + if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) + != SUCCESS || Z_TYPE(retval) != IS_LONG) { + *status = U_INTERNAL_PROGRAM_ERROR; + } else { + rv = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + } + zval_ptr_dtor(&zfuncname); + } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr TSRMLS_CC)) { + Calendar_object *co = (Calendar_object *) + zend_object_store_get_object(z TSRMLS_CC ); + if (co->ucal == NULL) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + } else { + rv = (double)co->ucal->getTime(*status); + } + } else { + /* TODO: try with cast(), get() to obtain a number */ + *status = U_ILLEGAL_ARGUMENT_ERROR; + } + break; + default: + *status = U_ILLEGAL_ARGUMENT_ERROR; + } + + return rv; +} + diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h new file mode 100644 index 00000000000..cfa14d1a583 --- /dev/null +++ b/ext/intl/common/common_date.h @@ -0,0 +1,29 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#ifndef COMMON_DATE_H +#define COMMON_DATE_H + +#include + +U_CDECL_BEGIN +#include +U_CDECL_END + +U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC); + +#endif /* COMMON_DATE_H */ + diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 431deeb7d29..8598161e2b8 100755 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -33,6 +33,7 @@ if test "$PHP_INTL" != "no"; then collator/collator_error.c \ common/common_error.c \ common/common_enum.cpp \ + common/common_date.cpp \ formatter/formatter.c \ formatter/formatter_main.c \ formatter/formatter_class.c \ diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 index 735749ab438..d57c7f3a334 100755 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -24,6 +24,7 @@ if (PHP_INTL != "no") { ADD_SOURCES(configure_module_dirname + "/common", "\ common_error.c \ common_enum.cpp \ + common_date.cpp \ ", "intl"); ADD_SOURCES(configure_module_dirname + "/formatter", "\ formatter.c \ diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h index f11918b79f1..a5a747328f7 100755 --- a/ext/intl/dateformat/dateformat.h +++ b/ext/intl/dateformat/dateformat.h @@ -40,6 +40,5 @@ These are not necessary at this point of time #define CALENDAR_YEAR "tm_year" #define CALENDAR_WDAY "tm_wday" #define CALENDAR_YDAY "tm_yday" -#define CALENDAR_ISDST "tm_isdst" #endif // DATE_FORMATTER_H diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 82f825f1403..65fe68eaf5d 100755 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -21,15 +21,13 @@ #include #include -#include "php_intl.h" -#include "intl_convert.h" +#include "../php_intl.h" +#include "../intl_convert.h" +#include "../common/common_date.h" #include "dateformat.h" #include "dateformat_class.h" #include "dateformat_format.h" #include "dateformat_data.h" -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 -#include "ext/date/php_date.h" /* {{{ * Internal function which calls the udat_format @@ -126,70 +124,38 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, HashTable* ha * Format the time value as a string. }}}*/ PHP_FUNCTION(datefmt_format) { - UDate timestamp =0; - UDate p_timestamp =0; - HashTable* hash_arr = NULL; - zval* zarg = NULL; + UDate timestamp = 0; + HashTable *hash_arr = NULL; + zval *zarg = NULL; DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", &object, IntlDateFormatter_ce_ptr,&zarg ) == FAILURE ) - { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: unable to parse input params", 0 TSRMLS_CC ); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", + &object, IntlDateFormatter_ce_ptr, &zarg) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: unable " + "to parse input params", 0 TSRMLS_CC ); RETURN_FALSE; } - /* Fetch the object. */ DATE_FORMAT_METHOD_FETCH_OBJECT; - switch(Z_TYPE_P(zarg) ){ - case IS_LONG: - p_timestamp = Z_LVAL_P(zarg) ; - timestamp = p_timestamp * 1000; - break; - case IS_DOUBLE: - /* timestamp*1000 since ICU expects it in milliseconds */ - p_timestamp = Z_DVAL_P(zarg) ; - timestamp = p_timestamp * 1000; - break; - case IS_ARRAY: - hash_arr = Z_ARRVAL_P(zarg); - if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) - RETURN_FALSE; - - timestamp = internal_get_timestamp(dfo, hash_arr TSRMLS_CC); - INTL_METHOD_CHECK_STATUS( dfo, "datefmt_format: Date formatting failed" ) - break; - case IS_OBJECT: { - zend_class_entry *date_ce = php_date_get_date_ce(); - zval retval; - zval *zfuncname; - if(!instanceof_function(Z_OBJCE_P(zarg), date_ce TSRMLS_CC)) { - intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: object must be an instance of DateTime", 0 TSRMLS_CC ); - RETURN_FALSE; - } - INIT_ZVAL(retval); - MAKE_STD_ZVAL(zfuncname); - ZVAL_STRING(zfuncname, "getTimestamp", 1); - if(call_user_function(NULL, &zarg, zfuncname, &retval, 0, NULL TSRMLS_CC) != SUCCESS || Z_TYPE(retval) != IS_LONG) { - intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: cannot get timestamp", 0 TSRMLS_CC ); - zval_ptr_dtor(&zfuncname); - RETURN_FALSE; - } - zval_ptr_dtor(&zfuncname); - p_timestamp = Z_LVAL(retval); - timestamp = p_timestamp*1000; - } - break; - default: - intl_errors_set( INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: takes either an array or an integer timestamp value or a DateTime object", 0 TSRMLS_CC ); + if (Z_TYPE_P(zarg) == IS_ARRAY) { + hash_arr = Z_ARRVAL_P(zarg); + if (!hash_arr || zend_hash_num_elements(hash_arr) == 0) { RETURN_FALSE; - } + } - internal_format( dfo, timestamp, return_value TSRMLS_CC); + timestamp = internal_get_timestamp(dfo, hash_arr TSRMLS_CC); + INTL_METHOD_CHECK_STATUS(dfo, "datefmt_format: date formatting failed") + } else { + timestamp = intl_zval_to_millis(zarg, + &INTL_DATA_ERROR_CODE(dfo) TSRMLS_CC); + INTL_METHOD_CHECK_STATUS(dfo, "datefmt_format: could not convert input " + "into a date") + } + internal_format( dfo, timestamp, return_value TSRMLS_CC); } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index fd8df1a39c3..c8223190784 100755 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -31,6 +31,7 @@ #include #include "../intl_convertcpp.h" +#include "../common/common_date.h" extern "C" { #include "php_intl.h" @@ -38,11 +39,6 @@ extern "C" { #include "msgformat_format.h" #include "msgformat_helpers.h" #include "intl_convert.h" -#define USE_CALENDAR_POINTER 1 -#include "../calendar/calendar_class.h" -/* avoid redefinition of int8_t, already defined in unicode/pwin32.h */ -#define _MSC_STDINT_H_ 1 -#include "ext/date/php_date.h" #define USE_TIMEZONE_POINTER #include "../timezone/timezone_class.h" } @@ -95,66 +91,6 @@ U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt) return fmt_count; } -static double umsg_helper_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) { - double rv = NAN; - long lv; - int type; - - if (U_FAILURE(*status)) { - return NAN; - } - - switch (Z_TYPE_P(z)) { - case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); - if (type == IS_DOUBLE) { - rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_LONG) { - rv = U_MILLIS_PER_SECOND * (double)lv; - } else { - *status = U_ILLEGAL_ARGUMENT_ERROR; - } - break; - case IS_LONG: - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); - break; - case IS_DOUBLE: - rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); - break; - case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce() TSRMLS_CC)) { - zval retval; - zval *zfuncname; - INIT_ZVAL(retval); - MAKE_STD_ZVAL(zfuncname); - ZVAL_STRING(zfuncname, "getTimestamp", 1); - if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_LONG) { - *status = U_INTERNAL_PROGRAM_ERROR; - } else { - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); - } - zval_ptr_dtor(&zfuncname); - } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr TSRMLS_CC)) { - Calendar_object *co = (Calendar_object *) - zend_object_store_get_object(z TSRMLS_CC ); - if (co->ucal == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - } else { - rv = (double)co->ucal->getTime(*status); - } - } else { - /* TODO: try with cast(), get() to obtain a number */ - *status = U_ILLEGAL_ARGUMENT_ERROR; - } - break; - default: - *status = U_ILLEGAL_ARGUMENT_ERROR; - } - - return rv; -} - static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, intl_error& err TSRMLS_DC) { @@ -613,7 +549,7 @@ retry_kint64: } case Formattable::kDate: { - double dd = umsg_helper_zval_to_millis(*elem, &err.code TSRMLS_CC); + double dd = intl_zval_to_millis(*elem, &err.code TSRMLS_CC); if (U_FAILURE(err.code)) { char *message, *key_char; int key_len; diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 98f9d34c03a..d09de0e4396 100755 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -399,24 +399,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: object must be an instance of DateTime: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' From 46629e35ffadae77114088c59faf301328159d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 2 Jul 2012 00:26:38 +0200 Subject: [PATCH 215/641] Refactored internal_get_timestamp() Added bounds checking for 32-bit ints. Do not fetch array elements that ::parse() generates but that ::format() does not actually care about.y --- ext/intl/dateformat/dateformat_format.c | 96 ++++++++++++++++--------- 1 file changed, 61 insertions(+), 35 deletions(-) diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 65fe68eaf5d..468a3d7748d 100755 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -59,20 +59,38 @@ static void internal_format(IntlDateFormatter_object *dfo, UDate timestamp, zval /* {{{ * Internal function which fetches an element from the passed array for the key_name passed */ -static double internal_get_arr_ele(IntlDateFormatter_object *dfo, HashTable* hash_arr, char* key_name TSRMLS_DC) +static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, + HashTable* hash_arr, char* key_name, intl_error *err TSRMLS_DC) { - zval** ele_value = NULL; - UDate result = -1; + zval **ele_value = NULL; + int32_t result = 0; + char *message; - if( zend_hash_find( hash_arr, key_name, strlen(key_name) + 1, (void **)&ele_value ) == SUCCESS ){ - if( Z_TYPE_PP(ele_value)!= IS_LONG ){ - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: parameter array does not contain a long element.", 0 TSRMLS_CC ); - }else{ - result = Z_LVAL_PP(ele_value); + if (U_FAILURE(err->code)) { + return result; + } + + if (zend_hash_find(hash_arr, key_name, strlen(key_name) + 1, + (void **)&ele_value) == SUCCESS) { + if(Z_TYPE_PP(ele_value) != IS_LONG) { + spprintf(&message, 0, "datefmt_format: parameter array contains " + "a non-integer element for key '%s'", key_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + efree(message); + } else { + if (Z_LVAL_PP(ele_value) > INT32_MAX || + Z_LVAL_PP(ele_value) < INT32_MIN) { + spprintf(&message, 0, "datefmt_format: value %ld is out of " + "bounds for a 32-bit integer in key '%s'", + Z_LVAL_PP(ele_value), key_name); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); + efree(message); + } else { + result = Z_LVAL_PP(ele_value); + } } } - /* printf("\n Inside internal_get_arr_ele key_name= %s, result = %g \n", key_name, result); */ + return result; } /* }}} */ @@ -80,41 +98,49 @@ static double internal_get_arr_ele(IntlDateFormatter_object *dfo, HashTable* has /* {{{ * Internal function which sets UCalendar from the passed array and retrieves timestamp */ -static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, HashTable* hash_arr TSRMLS_DC) +static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, + HashTable *hash_arr TSRMLS_DC) { - long year =0; - long month =0; - long hour =0; - long minute =0; - long second =0; - long wday =0; - long yday =0; - long mday =0; - UBool isInDST = FALSE; - const UCalendar *pcal; + int32_t year, + month, + hour, + minute, + second, + mday; + UCalendar *pcal; + intl_error *err = &dfo->datef_data.error; + +#define INTL_GET_ELEM(elem) \ + internal_get_arr_ele(dfo, hash_arr, (elem), err TSRMLS_CC) /* Fetch values from the incoming array */ - year = internal_get_arr_ele( dfo, hash_arr, CALENDAR_YEAR TSRMLS_CC) + 1900; /* tm_year is years since 1900 */ + year = INTL_GET_ELEM(CALENDAR_YEAR) + 1900; /* tm_year is years since 1900 */ /* Month in ICU and PHP starts from January =0 */ - month = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MON TSRMLS_CC); - hour = internal_get_arr_ele( dfo, hash_arr, CALENDAR_HOUR TSRMLS_CC); - minute = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MIN TSRMLS_CC); - second = internal_get_arr_ele( dfo, hash_arr, CALENDAR_SEC TSRMLS_CC); - wday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_WDAY TSRMLS_CC); - yday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_YDAY TSRMLS_CC); - isInDST = internal_get_arr_ele( dfo, hash_arr, CALENDAR_ISDST TSRMLS_CC); + month = INTL_GET_ELEM(CALENDAR_MON); + hour = INTL_GET_ELEM(CALENDAR_HOUR); + minute = INTL_GET_ELEM(CALENDAR_MIN); + second = INTL_GET_ELEM(CALENDAR_SEC); /* For the ucal_setDateTime() function, this is the 'date' value */ - mday = internal_get_arr_ele( dfo, hash_arr, CALENDAR_MDAY TSRMLS_CC); + mday = INTL_GET_ELEM(CALENDAR_MDAY); - pcal = udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); - /* set the incoming values for the calendar */ - ucal_setDateTime( pcal, year, month, mday, hour, minute, second, &INTL_DATA_ERROR_CODE(dfo)); - if( INTL_DATA_ERROR_CODE(dfo) != U_ZERO_ERROR){ +#undef INTL_GET_ELEM + + pcal = ucal_clone(udat_getCalendar(DATE_FORMAT_OBJECT(dfo)), + &INTL_DATA_ERROR_CODE(dfo)); + + if (INTL_DATA_ERROR_CODE(dfo) != U_ZERO_ERROR) { + intl_errors_set(err, INTL_DATA_ERROR_CODE(dfo), "datefmt_format: " + "error cloning calendar", 0 TSRMLS_CC); return 0; } + + /* set the incoming values for the calendar */ + ucal_setDateTime(pcal, year, month, mday, hour, minute, second, &INTL_DATA_ERROR_CODE(dfo)); + /* actually, ucal_setDateTime cannot fail */ /* Fetch the timestamp from the UCalendar */ - return ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo) ); + return ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo)); + udat_close(pcal); } From be4053cea0462c9de5396641f4e4fa2f56f5a675 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 2 Jul 2012 11:33:38 +0800 Subject: [PATCH 216/641] Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to dot files). --- NEWS | 2 ++ ext/spl/spl_directory.c | 3 ++- ext/spl/tests/bug62433.phpt | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ext/spl/tests/bug62433.phpt diff --git a/NEWS b/NEWS index 6dd1feb7774..70a8eb9ec08 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,8 @@ PHP NEWS . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) - SPL: + . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to + dot files). (Laruence) . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). (Nikita Popov) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index dbae3e2a093..0fcbd317e35 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1432,6 +1432,7 @@ SPL_METHOD(FilesystemIterator, __construct) SPL_METHOD(FilesystemIterator, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS); if (zend_parse_parameters_none() == FAILURE) { return; @@ -1443,7 +1444,7 @@ SPL_METHOD(FilesystemIterator, rewind) } do { spl_filesystem_dir_read(intern TSRMLS_CC); - } while (spl_filesystem_is_dot(intern->u.dir.entry.d_name)); + } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); } /* }}} */ diff --git a/ext/spl/tests/bug62433.phpt b/ext/spl/tests/bug62433.phpt new file mode 100644 index 00000000000..86b5df83872 --- /dev/null +++ b/ext/spl/tests/bug62433.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. and ..) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(false) From f2bf98a589b63ea6e604036eb6ab02aba5fce5ef Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 2 Jul 2012 01:31:40 -0400 Subject: [PATCH 217/641] fix (signed) integer overflow (part of bug #52550 --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 84ca1de3452..5c3b1cde346 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -330,7 +330,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = (ulong)(-(long)idx); \ + idx = -idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From d80ff391899f7aead3b9b9c6c084adba8a8203ba Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 2 Jul 2012 01:31:40 -0400 Subject: [PATCH 218/641] fix (signed) integer overflow (part of bug #52550 --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index ad0f9f70b96..a763fc7033d 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -331,7 +331,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = (ulong)(-(long)idx); \ + idx = -idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From 91ce8041a3e85594e81466a528f8d55cdc164c1f Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 2 Jul 2012 01:31:40 -0400 Subject: [PATCH 219/641] fix (signed) integer overflow (part of bug #52550 --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 84ca1de3452..5c3b1cde346 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -330,7 +330,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = (ulong)(-(long)idx); \ + idx = -idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From bcc87ba68ede7b90cd544ec0911bdbe5d844aa2a Mon Sep 17 00:00:00 2001 From: johannes Date: Thu, 5 Jul 2012 00:55:47 +0200 Subject: [PATCH 220/641] Revert change 3f3ad30c50: There shouldn't be new features in 5.3, especially not if they aren't in 5.4, too. --- ext/json/json.c | 11 ++++------- ext/json/php_json.h | 1 - ext/json/tests/bug43941.phpt | 21 +++++++++++++++++++++ ext/json/tests/bug54058.phpt | 7 ------- ext/json/tests/bug61537.phpt | 30 ------------------------------ 5 files changed, 25 insertions(+), 45 deletions(-) create mode 100644 ext/json/tests/bug43941.phpt delete mode 100644 ext/json/tests/bug61537.phpt diff --git a/ext/json/json.c b/ext/json/json.c index ce2cf43fcc9..5b62c2feeaf 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -73,7 +73,6 @@ static PHP_MINIT_FUNCTION(json) REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); @@ -321,7 +320,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } if (len < 0) { JSON_G(error_code) = PHP_JSON_ERROR_UTF8; - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); + if (!PG(display_errors)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument"); + } smart_str_appendl(buf, "null", 4); } else { smart_str_appendl(buf, "\"\"", 2); @@ -570,11 +571,7 @@ static PHP_FUNCTION(json_encode) php_json_encode(&buf, parameter, options TSRMLS_CC); - if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && options ^ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR) { - ZVAL_FALSE(return_value); - } else { - ZVAL_STRINGL(return_value, buf.c, buf.len, 1); - } + ZVAL_STRINGL(return_value, buf.c, buf.len, 1); smart_str_free(&buf); } diff --git a/ext/json/php_json.h b/ext/json/php_json.h index 3cb4902e27f..b104d4ca6a3 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -56,7 +56,6 @@ PHP_JSON_API void php_json_decode(zval *return_value, char *str, int str_len, ze #define PHP_JSON_HEX_QUOT (1<<3) #define PHP_JSON_FORCE_OBJECT (1<<4) #define PHP_JSON_NUMERIC_CHECK (1<<5) -#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) #define PHP_JSON_OUTPUT_ARRAY 0 #define PHP_JSON_OUTPUT_OBJECT 1 diff --git a/ext/json/tests/bug43941.phpt b/ext/json/tests/bug43941.phpt new file mode 100644 index 00000000000..0f86d1dfad2 --- /dev/null +++ b/ext/json/tests/bug43941.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #43941 (json_encode() invalid UTF-8) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(5) ""abc"" +string(4) "null" +string(4) "null" +string(17) "[null,null,"abc"]" +Done + diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt index 08c7f579ab9..3b1136bdd95 100644 --- a/ext/json/tests/bug54058.phpt +++ b/ext/json/tests/bug54058.phpt @@ -29,14 +29,7 @@ json_encode($c); var_dump(json_last_error()); ?> --EXPECTF-- -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d int(5) diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt deleted file mode 100644 index e2abdda66a3..00000000000 --- a/ext/json/tests/bug61537.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Bug #61537 (json_encode() incorrectly truncates/discards information) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d -bool(false) -int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d -string(4) "null" -int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d -bool(false) -int(5) - -Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d -string(4) "null" -int(5) From 6b2b1952671c74056c3335ded8342a94d5df931f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Thu, 5 Jul 2012 01:15:27 +0200 Subject: [PATCH 221/641] This wil be PHP 5.3.16 --- NEWS | 67 +++------------------------------------------- configure.in | 2 +- main/php_version.h | 6 ++--- 3 files changed, 8 insertions(+), 67 deletions(-) diff --git a/NEWS b/NEWS index c650c85ab8e..782bb62a339 100644 --- a/NEWS +++ b/NEWS @@ -1,69 +1,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2012, PHP 5.3.16 + ?? ??? 2012, PHP 5.3.15 -- Zend Engine: - . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that - includes a semi-colon). (Pierrick) - -- COM: - . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) - -- Core: - . Fixed potential overflow in _php_stream_scandir. (Jason Powell, - Stas) - . Fixed bug #62432 (ReflectionMethod random corrupt memory on high - concurrent). (Johannes) - . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed - Salt). (Anthony Ferrara) - -- Fileinfo: - . Fixed magic file regex support. (Felipe) - -- FPM: - . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) - . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - . Fixed bug #61295 (php-fpm should not fail with commented 'user' - for non-root start). (fat) - . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). - (fat) - . Fixed bug #62153 (when using unix sockets, multiples FPM instances - can be launched without errors). (fat) - . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - . Fixed bug #61218 (FPM drops connection while receiving some binary values - in FastCGI requests). (fat) - . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - -- Intl: - . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) - . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called - twice). (Gustavo) - . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) - . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks - pattern). (Gustavo) - . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) - -- JSON: - . Improved error handling. (Nikita Popov) - -- Phar: - . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) - -- Reflection: - . Fixed bug #62384 (Attempting to invoke a Closure more than once causes - segfault). (Felipe) - . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks - with constant). (Laruence) - -- SPL: - . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). - (Nikita Popov) - -- XML Writer: - . Fixed bug #62064 (memory leak in the XML Writer module). - (jean-pierre dot lozi at lip6 dot fr) -- Zip: - . Upgraded libzip to 0.10.1 (Anatoliy) + (NEWS will be merged after release by johannes. Formerging changes to the + PHP-5.3.15 release branch talk to johannes) 14 Jun 2012, PHP 5.3.14 diff --git a/configure.in b/configure.in index 6d24249d78f..fa6c55769e2 100644 --- a/configure.in +++ b/configure.in @@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h) PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=3 -PHP_RELEASE_VERSION=15 +PHP_RELEASE_VERSION=16 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/main/php_version.h b/main/php_version.h index 2f65dbdb29b..3107a2808a3 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 3 -#define PHP_RELEASE_VERSION 15 +#define PHP_RELEASE_VERSION 16 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.3.15-dev" -#define PHP_VERSION_ID 50315 +#define PHP_VERSION "5.3.16-dev" +#define PHP_VERSION_ID 50316 From 88f46b162b3bf9bc9a7a1d3d7280f702f5b9f501 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 5 Jul 2012 20:14:49 +0200 Subject: [PATCH 222/641] Fix potential integer overflow in bin2hex The code was already using safe_emalloc but did the multiplication in the first argument, thus making the use of safe_emalloc pretty useless. The *2 is now moved to the second argument. --- ext/standard/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index e3fc27e7e22..a521d78261b 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -131,7 +131,7 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t * register unsigned char *result = NULL; size_t i, j; - result = (unsigned char *) safe_emalloc(oldlen * 2, sizeof(char), 1); + result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); for (i = j = 0; i < oldlen; i++) { result[j++] = hexconvtab[old[i] >> 4]; From 157ddd95773114c1148536b4b32fcbedf0c79b20 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 5 Jul 2012 20:31:58 +0200 Subject: [PATCH 223/641] Fix potential integer overflow in nl2br The buffer size was calculated manually, thus creating integer overflows for very large inputs, e.g. nl2br(str_repeat("\n", 613566757)). The code now uses safe_emalloc, thus making the code throw an error instead of crashing. --- ext/standard/string.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index a521d78261b..1a7bd1e0b47 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4001,13 +4001,12 @@ PHP_FUNCTION(nl2br) RETURN_STRINGL(str, str_len, 1); } - if (is_xhtml) { - new_length = str_len + repl_cnt * (sizeof("
") - 1); - } else { - new_length = str_len + repl_cnt * (sizeof("
") - 1); - } + { + size_t repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); - tmp = target = emalloc(new_length + 1); + new_length = str_len + repl_cnt * repl_len; + tmp = target = safe_emalloc(repl_cnt, repl_len, str_len + 1); + } while (str < end) { switch (*str) { From 26b37f1792dfaf9b0b30f81e492c8f68b9ece571 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Fri, 6 Jul 2012 22:37:50 -0400 Subject: [PATCH 224/641] Fix two issues with run-tests.php 1. E_STRICT error due to passing return of array_intersect() into reset() directly 2. Details in junit output can produce invalid UTF-8 and XML due to unescaped characters --- run-tests.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/run-tests.php b/run-tests.php index 2a4698639f3..302167a6e5c 100755 --- a/run-tests.php +++ b/run-tests.php @@ -2668,12 +2668,15 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag $time = null !== $time ? $time : junit_get_timer($file_name); junit_suite_record($suite, 'execution_time', $time); + $escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8'); + $escaped_test_name = basename($file_name) . ' - ' . htmlspecialchars($test_name, ENT_QUOTES); $JUNIT['files'][$file_name]['xml'] = "\n"; if (is_array($type)) { $output_type = $type[0] . 'ED'; - $type = reset(array_intersect(array('XFAIL', 'FAIL'), $type)); + $temp = array_intersect(array('XFAIL', 'FAIL'), $type); + $type = reset($temp); } else { $output_type = $type . 'ED'; } @@ -2688,10 +2691,10 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag $JUNIT['files'][$file_name]['xml'] .= "$message\n"; } elseif('FAIL' == $type) { junit_suite_record($suite, 'test_fail'); - $JUNIT['files'][$file_name]['xml'] .= "$details\n"; + $JUNIT['files'][$file_name]['xml'] .= "$escaped_details\n"; } else { junit_suite_record($suite, 'test_error'); - $JUNIT['files'][$file_name]['xml'] .= "$details\n"; + $JUNIT['files'][$file_name]['xml'] .= "$escaped_details\n"; } $JUNIT['files'][$file_name]['xml'] .= "\n"; From f0df7dbc8f5d39260b9e230cf1db3c436e36dbad Mon Sep 17 00:00:00 2001 From: Lonny Kapelushnik Date: Sat, 7 Jul 2012 09:10:08 -0400 Subject: [PATCH 225/641] Added in NEWS and UPGRADING for feature 55218 --- NEWS | 3 +++ UPGRADING | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index dfad253f5a2..6e8cb137792 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,9 @@ PHP NEWS . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant). (Laruence) +- SimpleXMLElement: + . Implemented FR #55218 Get namespaces from current node. (Lonny) + - Sockets: . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) diff --git a/UPGRADING b/UPGRADING index a10dca991c4..3886aee7ba4 100755 --- a/UPGRADING +++ b/UPGRADING @@ -343,6 +343,10 @@ PHP 5.4 UPGRADE NOTES - Since 5.4.5, resourcebundle_create() accepts null for the first two arguments. +- Since 5.4.5, SimpleXMLElement::getDocNamespaces() has and extra parameter which + allows for toggling if the list of namespaces starts from the document root + or from the node you call the method on + ============================== 5. Changes to existing classes ============================== From e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 9 Jul 2012 00:25:48 +0800 Subject: [PATCH 226/641] Fixed Bug #62500 (Segfault in DateInterval class when extended) This fix also fixed bug #62508 (Segfault while access a non-string property of DateInterval object) --- NEWS | 3 +++ ext/date/php_date.c | 19 +++++++++++++++++++ ext/date/tests/bug62500.phpt | 28 ++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 ext/date/tests/bug62500.phpt diff --git a/NEWS b/NEWS index c1ad1837d89..a0763aeb126 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ PHP NEWS - SimpleXML: . Implemented FR #55218 Get namespaces from current node. (Lonny) +- DateTime: + . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + ?? ??? 2012, PHP 5.4.5 - Core: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index cd48de2731b..13e7b753d38 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3430,10 +3430,19 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; + key = NULL; } obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + retval = (zend_get_std_object_handlers())->read_property(object, member, type, key TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return retval; + } + #define GET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ value = obj->diff->n; \ @@ -3482,9 +3491,19 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; + key = NULL; } + obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return; + } + #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ if (value->type != IS_LONG) { \ diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt new file mode 100644 index 00000000000..69523320144 --- /dev/null +++ b/ext/date/tests/bug62500.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #62500 (Segfault in DateInterval class when extended) +--INI-- +date.timezone=GMT +--FILE-- +foo); + $this->foo = 3; + var_dump($this->foo); + var_dump($this->{2}); + parent::__construct($time_spec); + } +} +try { + $c = new Crasher('blah'); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +--EXPECTF-- +NULL +int(3) + +Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d +NULL +string(%s) "DateInterval::__construct(): Unknown or bad format (blah)" From 2019062cfc6e4b4832aaca3b73891d93adc115a8 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 8 Jul 2012 14:05:28 -0300 Subject: [PATCH 227/641] - Fixed bug #62507 (['REQUEST_TIME'] under mod_php5 returns miliseconds instead of seconds) --- sapi/apache2filter/sapi_apache2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index e8116f9eba0..0b51cfbe62f 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -311,7 +311,7 @@ php_apache_disable_caching(ap_filter_t *f) static double php_apache_sapi_get_request_time(TSRMLS_D) { php_struct *ctx = SG(server_context); - return apr_time_as_msec(ctx->r->request_time); + return ((double) apr_time_as_msec(ctx->r->request_time)) / 1000.0; } extern zend_module_entry php_apache_module; From e6d9cd983b3503d38389d0c67267c773a98af174 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 8 Jul 2012 15:19:41 -0400 Subject: [PATCH 228/641] appease MSVC (doesnt like unary minus of unsigned ints) --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 5c3b1cde346..1bd64394ac1 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -330,7 +330,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = -idx; \ + idx = 0 - idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From 5910d8d4f499bf84bcaa1161bd0b89c15a19a304 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 8 Jul 2012 15:19:41 -0400 Subject: [PATCH 229/641] appease MSVC (doesnt like unary minus of unsigned ints) --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 5c3b1cde346..1bd64394ac1 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -330,7 +330,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = -idx; \ + idx = 0 - idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From b2b018d5f7d0d7a0bc88e6a95fe804c39bd65b9a Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 8 Jul 2012 15:19:41 -0400 Subject: [PATCH 230/641] appease MSVC (doesnt like unary minus of unsigned ints) --- Zend/zend_hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index a763fc7033d..81146e9dd0d 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -331,7 +331,7 @@ END_EXTERN_C() if (idx-1 > LONG_MAX) { /* overflow */ \ break; \ } \ - idx = -idx; \ + idx = 0 - idx; \ } else if (idx > LONG_MAX) { /* overflow */ \ break; \ } \ From c819cf9d6bd43d79b894f1d0f0c6c282893fd9bd Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 9 Jul 2012 08:32:40 +0800 Subject: [PATCH 231/641] Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false) this bc break is caused by the fix for #61948 --- NEWS | 4 ++++ ext/curl/interface.c | 2 +- ext/curl/tests/bug61948.phpt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 782bb62a339..c9f3fc4ac3a 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ PHP NEWS (NEWS will be merged after release by johannes. Formerging changes to the PHP-5.3.15 release branch talk to johannes) +- CURL: + . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). + (r.hampartsumyan@gmail.com, Laruence) + 14 Jun 2012, PHP 5.3.14 - CLI SAPI: diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 270a7dd8070..94be60fd5d5 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2167,7 +2167,7 @@ string_copy: convert_to_string_ex(zvalue); - if (!Z_STRLEN_PP(zvalue) || php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(zvalue), "rb+", CHECKUID_CHECK_MODE_PARAM))) { + if ((Z_STRLEN_PP(zvalue) && php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(zvalue), "rb+", CHECKUID_CHECK_MODE_PARAM))) { RETVAL_FALSE; return 1; } diff --git a/ext/curl/tests/bug61948.phpt b/ext/curl/tests/bug61948.phpt index 23bbda7d5f1..00df07d73e2 100644 --- a/ext/curl/tests/bug61948.phpt +++ b/ext/curl/tests/bug61948.phpt @@ -16,7 +16,7 @@ open_basedir="/tmp" curl_close($ch); ?> --EXPECTF-- -bool(false) +bool(true) bool(true) Warning: curl_setopt(): open_basedir restriction in effect. File(/xxx/bar) is not within the allowed path(s): (/tmp) in %sbug61948.php on line %d From 4323a7acedf0eff76f709456930d89380c16f0b8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 9 Jul 2012 08:44:59 +0800 Subject: [PATCH 232/641] update NEWS --- NEWS | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index a0763aeb126..3d91e502f8d 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,16 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.6 -- SimpleXML: - . Implemented FR #55218 Get namespaces from current node. (Lonny) +- CURL: + . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). + (r.hampartsumyan@gmail.com, Laruence) - DateTime: . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) +- SimpleXML: + . Implemented FR #55218 Get namespaces from current node. (Lonny) + ?? ??? 2012, PHP 5.4.5 - Core: From 2032470e4113dfbf04a1ed3b12de85ffcde6f367 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 9 Jul 2012 12:42:10 +0200 Subject: [PATCH 233/641] fixed #62433 test for win --- ext/spl/tests/bug62433.phpt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/spl/tests/bug62433.phpt b/ext/spl/tests/bug62433.phpt index 86b5df83872..bfb3568bacb 100644 --- a/ext/spl/tests/bug62433.phpt +++ b/ext/spl/tests/bug62433.phpt @@ -5,11 +5,11 @@ Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. a $dots = array_keys(iterator_to_array(new RecursiveDirectoryIterator(__DIR__))); $ndots = array_keys(iterator_to_array(new RecursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS))); -var_dump(in_array(__DIR__ . '/.', $dots)); -var_dump(in_array(__DIR__ . '/..', $dots)); +var_dump(in_array(__DIR__ . DIRECTORY_SEPARATOR . '.', $dots)); +var_dump(in_array(__DIR__ . DIRECTORY_SEPARATOR . '..', $dots)); -var_dump(in_array(__DIR__ . '/.', $ndots)); -var_dump(in_array(__DIR__ . '/..', $ndots)); +var_dump(in_array(__DIR__ . DIRECTORY_SEPARATOR . '.', $ndots)); +var_dump(in_array(__DIR__ . DIRECTORY_SEPARATOR . '..', $ndots)); ?> --EXPECT-- bool(true) From 555db7dc4ecaffdbfb4a10f4d00ddd81c0f89ef6 Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 9 Jul 2012 17:59:23 +0300 Subject: [PATCH 234/641] fix valgrind warning --- ext/mysqlnd/mysqlnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 4a63681fb79..900f8207b40 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -2184,7 +2184,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn, } memcpy(conn->auth_plugin_data, plugin_data, plugin_data_len); - DBG_INF_FMT("salt=[%*s]", plugin_data_len - 1, plugin_data); + DBG_INF_FMT("salt=[%*.s]", plugin_data_len - 1, plugin_data); /* The data should be allocated with malloc() */ scrambled_data = From 049abdfb2635f4f05bb4c51eccc246ffcdfa0dfe Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 9 Jul 2012 18:13:35 +0300 Subject: [PATCH 235/641] fix valgrind warning --- ext/mysqlnd/mysqlnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 417ff5ef2b5..9a907a5644d 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -581,7 +581,7 @@ mysqlnd_run_authentication( } memcpy(conn->auth_plugin_data, plugin_data, plugin_data_len); - DBG_INF_FMT("salt=[%*s]", plugin_data_len - 1, plugin_data); + DBG_INF_FMT("salt=[%*.s]", plugin_data_len - 1, plugin_data); /* The data should be allocated with malloc() */ scrambled_data = auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len, From 97b8798520533f062a5c5c422d79cd84526312ce Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 9 Jul 2012 18:21:51 +0200 Subject: [PATCH 236/641] Fixed test bug #62312 (warnings changed one more time) --- ext/sockets/tests/socket_import_stream-4-win.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt index 68b6582b839..e2fc523ce58 100644 --- a/ext/sockets/tests/socket_import_stream-4-win.phpt +++ b/ext/sockets/tests/socket_import_stream-4-win.phpt @@ -83,11 +83,11 @@ socket_set_block Warning: socket_set_block(): An operation was attempted on something that is not a socket. in %ssocket_import_stream-4-win.php on line %d -Warning: socket_set_block(): unable to set blocking mode [0]: The operation completed successfully. +Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket. in %ssocket_import_stream-4-win.php on line %d socket_get_option -Warning: socket_get_option(): unable to retrieve socket option [0]: An operation was attempted on something that is not a socket. +Warning: socket_get_option(): unable to retrieve socket option [%d]: An operation was attempted on something that is not a socket. in %ssocket_import_stream-4-win.php on line %d From bcf5853eaa8b8be793d4a1bd325eaea68cfe57bb Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 10 Jul 2012 18:43:11 +0800 Subject: [PATCH 237/641] Fixed Bug #62500 (Segfault in DateInterval class when extended) --- NEWS | 3 +++ ext/date/php_date.c | 17 +++++++++++++++++ ext/date/tests/bug62500.phpt | 28 ++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 ext/date/tests/bug62500.phpt diff --git a/NEWS b/NEWS index c9f3fc4ac3a..902185cffe9 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ PHP NEWS . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). (r.hampartsumyan@gmail.com, Laruence) +- DateTime: + . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + 14 Jun 2012, PHP 5.3.14 - CLI SAPI: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 527894d2236..e8a457052ec 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3511,6 +3511,14 @@ zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + retval = (zend_get_std_object_handlers())->read_property(object, member, type TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return retval; + } + #define GET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ value = obj->diff->n; \ @@ -3560,8 +3568,17 @@ void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS convert_to_string(&tmp_member); member = &tmp_member; } + obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC); + if (!obj->initialized) { + (zend_get_std_object_handlers())->write_property(object, member, value TSRMLS_CC); + if (member == &tmp_member) { + zval_dtor(member); + } + return; + } + #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ if (value->type != IS_LONG) { \ diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt new file mode 100644 index 00000000000..69523320144 --- /dev/null +++ b/ext/date/tests/bug62500.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #62500 (Segfault in DateInterval class when extended) +--INI-- +date.timezone=GMT +--FILE-- +foo); + $this->foo = 3; + var_dump($this->foo); + var_dump($this->{2}); + parent::__construct($time_spec); + } +} +try { + $c = new Crasher('blah'); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +--EXPECTF-- +NULL +int(3) + +Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d +NULL +string(%s) "DateInterval::__construct(): Unknown or bad format (blah)" From bf0154896705afe0da6ee1c7af4dc3d75afd194b Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 10 Jul 2012 13:13:30 -0400 Subject: [PATCH 238/641] Add new function hash_pbkdf2() to UGRAPDING doc --- UPGRADING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPGRADING b/UPGRADING index 77fe97257d4..8b52be26d75 100755 --- a/UPGRADING +++ b/UPGRADING @@ -97,6 +97,9 @@ PHP X.Y UPGRADE NOTES - Core: - boolval() +- Hash: + - hash_pbkdf2() + - Intl: - datefmt_get_calendar_object() - datefmt_get_timezone() From 6071bfb325e4facd697c38e4d398d008dd1dc37a Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 11 Jul 2012 13:32:19 +0200 Subject: [PATCH 239/641] fix windows build - there should be no trailing white spaces after \ in multiline macros --- ext/mysqlnd/mysqlnd_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index 3441dc74e1a..272cdb20e5c 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -126,7 +126,7 @@ PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); if ((dbg_obj2)) { \ dbg_skip_trace = !(dbg_obj2)->m->func_enter((dbg_obj2), __LINE__, __FILE__, func_name, strlen(func_name)); \ } \ - if (dbg_skip_trace); /* shut compiler's mouth */\ + if (dbg_skip_trace); /* shut compiler's mouth */\ do { \ if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \ ((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \ From b383ddf1e5175abf1d000e887961fdcebae646a0 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 11 Jul 2012 22:25:31 +0200 Subject: [PATCH 240/641] Fixed bug #62477 LimitIterator int overflow --- ext/spl/spl_iterators.c | 21 ++++++++++++++++++++- ext/spl/spl_iterators.h | 2 +- ext/spl/tests/bug62477_1.phpt | 12 ++++++++++++ ext/spl/tests/bug62477_2.phpt | 12 ++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 ext/spl/tests/bug62477_1.phpt create mode 100644 ext/spl/tests/bug62477_2.phpt diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index eecd483ba77..1cbb2e48a94 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1380,12 +1380,31 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->dit_type = dit_type; switch (dit_type) { case DIT_LimitIterator: { + zval *tmp_offset, *tmp_count; intern->u.limit.offset = 0; /* start at beginning */ intern->u.limit.count = -1; /* get all */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|zz", &zobject, ce_inner, &tmp_offset, &tmp_count) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } + if (tmp_offset && Z_TYPE_P(tmp_offset) != IS_NULL) { + if (Z_TYPE_P(tmp_offset) != IS_LONG) { + zend_throw_exception(spl_ce_OutOfRangeException, "offset param must be of type int", 0 TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); + return NULL; + } else { + intern->u.limit.offset = Z_LVAL_P(tmp_offset); + } + } + if (tmp_count && Z_TYPE_P(tmp_count) != IS_NULL) { + if (Z_TYPE_P(tmp_count) != IS_LONG) { + zend_throw_exception(spl_ce_OutOfRangeException, "count param must be of type int", 0 TSRMLS_CC); + zend_restore_error_handling(&error_handling TSRMLS_CC); + return NULL; + } else { + intern->u.limit.count = Z_LVAL_P(tmp_count); + } + } if (intern->u.limit.offset < 0) { zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be >= 0", 0 TSRMLS_CC); zend_restore_error_handling(&error_handling TSRMLS_CC); diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 525a25cc9e2..9494b26a0d8 100755 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -128,7 +128,7 @@ typedef struct _spl_dual_it_object { uint str_key_len; ulong int_key; int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */ - int pos; + long pos; } current; dual_it_type dit_type; union { diff --git a/ext/spl/tests/bug62477_1.phpt b/ext/spl/tests/bug62477_1.phpt new file mode 100644 index 00000000000..1b768a741b0 --- /dev/null +++ b/ext/spl/tests/bug62477_1.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #62477 LimitIterator int overflow when float is passed (1) +--FILE-- +__construct(Object(ArrayIterator), %f) +#1 {main} + thrown in %sbug62477_1.php on line %d diff --git a/ext/spl/tests/bug62477_2.phpt b/ext/spl/tests/bug62477_2.phpt new file mode 100644 index 00000000000..aa3468a3977 --- /dev/null +++ b/ext/spl/tests/bug62477_2.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #62477 LimitIterator int overflow when float is passed (2) +--FILE-- +__construct(Object(ArrayIterator), 0, %f) +#1 {main} + thrown in %sbug62477_2.php on line %d From 896d0fcd41df13fc852417de222aac2482d2704b Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 11 Jul 2012 22:33:42 +0200 Subject: [PATCH 241/641] updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 902185cffe9..2f60c430612 100644 --- a/NEWS +++ b/NEWS @@ -204,6 +204,7 @@ PHP NEWS having had its dtor callback called in between). (Gustavo) . Fixed bug #61347 (inconsistent isset behavior of Arrayobject). (Laruence) . Fixed bug #61326 (ArrayObject comparison). (Gustavo) + . Fixed bug #62477 LimitIterator int overflow. (Anatoliy) - SQLite3 extension: . Add createCollation() method. (Brad Dewar) From be8f089a13ef5e023ec27f14de8bc2453c75bb54 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 11 Jul 2012 22:37:39 +0200 Subject: [PATCH 242/641] updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 3d91e502f8d..32816631b5a 100644 --- a/NEWS +++ b/NEWS @@ -92,6 +92,7 @@ PHP NEWS dot files). (Laruence) . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). (Nikita Popov) + . Fixed bug #62477 LimitIterator int overflow. (Anatoliy) - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). From ad7eeba3c1a4c77f439afc936fbf50b811a46a6b Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 12 Jul 2012 10:54:14 +0200 Subject: [PATCH 243/641] reverted changes for #62477 --- NEWS | 1 - ext/spl/spl_iterators.c | 21 +-------------------- ext/spl/spl_iterators.h | 2 +- ext/spl/tests/bug62477_1.phpt | 12 ------------ ext/spl/tests/bug62477_2.phpt | 12 ------------ 5 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 ext/spl/tests/bug62477_1.phpt delete mode 100644 ext/spl/tests/bug62477_2.phpt diff --git a/NEWS b/NEWS index 2f60c430612..902185cffe9 100644 --- a/NEWS +++ b/NEWS @@ -204,7 +204,6 @@ PHP NEWS having had its dtor callback called in between). (Gustavo) . Fixed bug #61347 (inconsistent isset behavior of Arrayobject). (Laruence) . Fixed bug #61326 (ArrayObject comparison). (Gustavo) - . Fixed bug #62477 LimitIterator int overflow. (Anatoliy) - SQLite3 extension: . Add createCollation() method. (Brad Dewar) diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 1cbb2e48a94..eecd483ba77 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1380,31 +1380,12 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z intern->dit_type = dit_type; switch (dit_type) { case DIT_LimitIterator: { - zval *tmp_offset, *tmp_count; intern->u.limit.offset = 0; /* start at beginning */ intern->u.limit.count = -1; /* get all */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|zz", &zobject, ce_inner, &tmp_offset, &tmp_count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } - if (tmp_offset && Z_TYPE_P(tmp_offset) != IS_NULL) { - if (Z_TYPE_P(tmp_offset) != IS_LONG) { - zend_throw_exception(spl_ce_OutOfRangeException, "offset param must be of type int", 0 TSRMLS_CC); - zend_restore_error_handling(&error_handling TSRMLS_CC); - return NULL; - } else { - intern->u.limit.offset = Z_LVAL_P(tmp_offset); - } - } - if (tmp_count && Z_TYPE_P(tmp_count) != IS_NULL) { - if (Z_TYPE_P(tmp_count) != IS_LONG) { - zend_throw_exception(spl_ce_OutOfRangeException, "count param must be of type int", 0 TSRMLS_CC); - zend_restore_error_handling(&error_handling TSRMLS_CC); - return NULL; - } else { - intern->u.limit.count = Z_LVAL_P(tmp_count); - } - } if (intern->u.limit.offset < 0) { zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be >= 0", 0 TSRMLS_CC); zend_restore_error_handling(&error_handling TSRMLS_CC); diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 9494b26a0d8..525a25cc9e2 100755 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -128,7 +128,7 @@ typedef struct _spl_dual_it_object { uint str_key_len; ulong int_key; int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */ - long pos; + int pos; } current; dual_it_type dit_type; union { diff --git a/ext/spl/tests/bug62477_1.phpt b/ext/spl/tests/bug62477_1.phpt deleted file mode 100644 index 1b768a741b0..00000000000 --- a/ext/spl/tests/bug62477_1.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Bug #62477 LimitIterator int overflow when float is passed (1) ---FILE-- -__construct(Object(ArrayIterator), %f) -#1 {main} - thrown in %sbug62477_1.php on line %d diff --git a/ext/spl/tests/bug62477_2.phpt b/ext/spl/tests/bug62477_2.phpt deleted file mode 100644 index aa3468a3977..00000000000 --- a/ext/spl/tests/bug62477_2.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Bug #62477 LimitIterator int overflow when float is passed (2) ---FILE-- -__construct(Object(ArrayIterator), 0, %f) -#1 {main} - thrown in %sbug62477_2.php on line %d From ec7e479562506842766fcf2bc47f417e9da44813 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 12 Jul 2012 10:57:56 +0200 Subject: [PATCH 244/641] reverted news about #62477 --- NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS b/NEWS index 32816631b5a..3d91e502f8d 100644 --- a/NEWS +++ b/NEWS @@ -92,7 +92,6 @@ PHP NEWS dot files). (Laruence) . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). (Nikita Popov) - . Fixed bug #62477 LimitIterator int overflow. (Anatoliy) - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). From cf91b163e1c16cfc0f6e4cd2b3ec78d82bc3ba1c Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 12 Jul 2012 18:24:38 +0200 Subject: [PATCH 245/641] fixed the test for warnings changed --- ext/fileinfo/tests/finfo_open_error-win32.phpt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ext/fileinfo/tests/finfo_open_error-win32.phpt b/ext/fileinfo/tests/finfo_open_error-win32.phpt index e168b7f7d4c..0260ca5708c 100644 --- a/ext/fileinfo/tests/finfo_open_error-win32.phpt +++ b/ext/fileinfo/tests/finfo_open_error-win32.phpt @@ -43,13 +43,7 @@ bool(false) Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error-win32.php on line %d bool(false) - -Warning: finfo_open(%smagic): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d - -Warning: finfo_open(%smagic): failed to open stream: No such file or directory in %sfinfo_open_error-win32.php on line %d - -Warning: finfo_open(): Failed to load magic database at '%smagic'. in %sfinfo_open_error-win32.php on line %d -bool(false) +resource(6) of type (file_info) Warning: finfo_open() expects parameter 1 to be long, string given in %sfinfo_open_error-win32.php on line %d bool(false) From 02b8362ec231edb5be2a4ff633ad609c70713131 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Fri, 13 Jul 2012 11:39:57 +0200 Subject: [PATCH 246/641] Fixed bug #61677 ext\zlib\tests\bug_52944.phpt fails The test is known to fail on windows with zlib version < 1.2.7 (current dep is 1.2.5), with 1.2.7 it works. As it's primarily a zlib 1.2.5 issue on windows, skip it for now. --- ext/zlib/tests/bug_52944.phpt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/zlib/tests/bug_52944.phpt b/ext/zlib/tests/bug_52944.phpt index 850371190e0..c090fe6f5c8 100644 --- a/ext/zlib/tests/bug_52944.phpt +++ b/ext/zlib/tests/bug_52944.phpt @@ -2,6 +2,11 @@ Bug #52944 (segfault with zlib filter and corrupted data) --SKIPIF-- += 1.2.7 on windows'); +} --INI-- allow_url_fopen=1 --FILE-- From 10251b20c3be842f1a8dbc43e2f4894fa41aa16b Mon Sep 17 00:00:00 2001 From: Matt Ficken Date: Fri, 13 Jul 2012 15:34:00 +0200 Subject: [PATCH 247/641] Fixed bug #62379 failing ODBC long column functionality --- ext/pdo/tests/pdo_test.inc | 12 ++- ext/pdo_odbc/odbc_stmt.c | 79 ++++++++----------- ext/pdo_odbc/tests/common.phpt | 45 +++++++++-- ext/pdo_odbc/tests/long_columns.phpt | 114 ++++++++++++++++++++++++--- 4 files changed, 185 insertions(+), 65 deletions(-) diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index f2e076793a7..443c8dd8222 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -66,13 +66,19 @@ class PDOTest { } static function test_factory($file) { - $data = file_get_contents($file); - $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); - $config = eval($data); + $config = self::get_config($file); foreach ($config['ENV'] as $k => $v) { putenv("$k=$v"); } return self::factory(); } + + static function get_config($file) { + $data = file_get_contents($file); + $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); + $config = eval($data); + + return $config; + } } ?> diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 4e039d2a740..e700ef8c3ce 100755 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -633,58 +633,49 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l } if (rc == SQL_SUCCESS_WITH_INFO) { - /* promote up to a bigger buffer */ - - if (C->fetched_len != SQL_NO_TOTAL) { - /* use size suggested by the driver, if it knows it */ - buf = emalloc(C->fetched_len + 1); - memcpy(buf, C->data, C->fetched_len); - buf[C->fetched_len] = 0; - used = C->fetched_len; - } else { - buf = estrndup(C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ - } + /* this is a 'long column' + + read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks + in order into the output buffer + + this loop has to work whether or not SQLGetData() provides the total column length. + calling SQLDescribeCol() or other, specifically to get the column length, then doing a single read + for that size would be slower except maybe for extremely long columns.*/ + char *buf2; + buf2 = emalloc(256); + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ + do { C->fetched_len = 0; - rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, - buf + used, alloced - used, - &C->fetched_len); - - if (rc == SQL_NO_DATA) { - /* we got the lot */ - break; - } else if (rc != SQL_SUCCESS) { - pdo_odbc_stmt_error("SQLGetData"); - if (rc != SQL_SUCCESS_WITH_INFO) { - break; - } - } - - if (C->fetched_len == SQL_NO_TOTAL) { - used += alloced - used; + /* read block. 256 bytes => 255 bytes are actually read, the last 1 is NULL */ + rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len); + + /* resize output buffer and reassemble block */ + if (rc==SQL_SUCCESS_WITH_INFO) { + /* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx + states that if SQL_SUCCESS_WITH_INFO, fetched_len will be > 255 (greater than buf2's size) + (if a driver fails to follow that and wrote less than 255 bytes to buf2, this will AV or read garbage into buf) */ + buf = erealloc(buf, used + 255+1); + memcpy(buf + used, buf2, 255); + used = used + 255; + } else if (rc==SQL_SUCCESS) { + buf = erealloc(buf, used + C->fetched_len+1); + memcpy(buf + used, buf2, C->fetched_len); + used = used + C->fetched_len; } else { - used += C->fetched_len; - } - - if (rc == SQL_SUCCESS) { - /* this was the final fetch */ + /* includes SQL_NO_DATA */ break; } - - /* we need to fetch another chunk; resize the - * buffer */ - alloced *= 2; - buf = erealloc(buf, alloced); + } while (1); - - /* size down */ - if (used < alloced - 1024) { - alloced = used+1; - buf = erealloc(buf, used+1); - } + + efree(buf2); + + /* NULL terminate the buffer once, when finished, for use with the rest of PHP */ buf[used] = '\0'; + *ptr = buf; *caller_frees = 1; *len = used; diff --git a/ext/pdo_odbc/tests/common.phpt b/ext/pdo_odbc/tests/common.phpt index f64da1a438e..276f2b78e3d 100644 --- a/ext/pdo_odbc/tests/common.phpt +++ b/ext/pdo_odbc/tests/common.phpt @@ -2,17 +2,40 @@ ODBC --SKIPIF-- +if (!extension_loaded('pdo_odbc')) print 'skip'; +if (substr(PHP_OS, 0, 3) == 'WIN' && + false === getenv('PDOTEST_DSN') && + false === getenv('PDO_ODBC_TEST_DSN') && + !extension_loaded('com_dotnet')) { + die('skip - either PDOTEST_DSN or com_dotnet extension is needed to setup the connection'); +} --REDIRECTTEST-- # magic auto-configuration $config = array( - 'TESTS' => 'ext/pdo/tests' + 'TESTS' => 'ext/pdo/tests', + 'ENV' => array() ); - -if (false !== getenv('PDO_ODBC_TEST_DSN')) { - # user set them from their shell +// try loading PDO driver using ENV vars and if none given, and on Windows, try using MS Access +// and if not, skip the test +// +// try to use common PDO env vars, instead of PDO_ODBC specific +if (false !== getenv('PDOTEST_DSN')) { + // user should have to set PDOTEST_DSN so that: + // 1. test is skipped if user doesn't want to test it, even if they have MS Access installed + // 2. it detects if ODBC driver is not installed - to avoid test bug + // 3. it detects if ODBC driver is installed - so test will be run + // 4. so a specific ODBC driver can be tested - if system has multiple ODBC drivers + + $config['ENV']['PDOTEST_DSN'] = getenv('PDOTEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDOTEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDOTEST_PASS'); + if (false !== getenv('PDOTEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDOTEST_ATTR'); + } +} else if (false !== getenv('PDO_ODBC_TEST_DSN')) { + // user set these from their shell instead $config['ENV']['PDOTEST_DSN'] = getenv('PDO_ODBC_TEST_DSN'); $config['ENV']['PDOTEST_USER'] = getenv('PDO_ODBC_TEST_USER'); $config['ENV']['PDOTEST_PASS'] = getenv('PDO_ODBC_TEST_PASS'); @@ -20,10 +43,13 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_ODBC_TEST_ATTR'); } } elseif (preg_match('/^WIN/i', PHP_OS)) { - # on windows, try to create a temporary MS access database + // on Windows and user didn't set PDOTEST_DSN, try this as a fallback: + // check if MS Access DB is installed, and if yes, try using it. create a temporary MS access database. + // $path = realpath(dirname(__FILE__)) . '\pdo_odbc.mdb'; if (!file_exists($path)) { try { + // try to create database $adox = new COM('ADOX.Catalog'); $adox->Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' . $path); $adox = null; @@ -32,9 +58,12 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { } } if (file_exists($path)) { + // database was created and written to file system $config['ENV']['PDOTEST_DSN'] = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$path;Uid=Admin"; - } -} + } // else: $config['ENV']['PDOTEST_DSN'] not set +} // else: $config['ENV']['PDOTEST_DSN'] not set +// test will be skipped. see SKIPIF section of long_columns.phpt + # other magic autodetection here, eg: for DB2 by inspecting env /* $USER = 'db2inst1'; diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt index 65ec2f96e90..e3430ded47d 100644 --- a/ext/pdo_odbc/tests/long_columns.phpt +++ b/ext/pdo_odbc/tests/long_columns.phpt @@ -3,9 +3,44 @@ PDO ODBC "long" columns --SKIPIF-- --FILE-- " ex: SET PDOTEST_DSN=odbc:accdb12 +// -note: on Windows, " is included in environment variable +// +// easy way to compile: +// configure --disable-all --enable-cli --enable-zts --enable-pdo --with-pdo-odbc --enable-debug +// configure --disable-all --eanble-cli --enable-pdo --with-pdo-odbc=unixODBC,/usr,/usr --with-unixODBC=/usr --enable-debug +// + require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); @@ -20,27 +55,86 @@ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CL $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998, 3999, 4000); +// the driver reads columns in blocks of 255 bytes and then reassembles those blocks into a single buffer. +// test sizes around 255 to make sure that the reassembly works (and that the column is split into 255 byte blocks by the database) +// also, test sizes below 255 to make sure that they work - and are not treated as a long column (should be read in a single read) +$sizes = array(32, 53, 64, 79, 128, 253, 254, 255, 256, 257, 258, 1022, 1023, 1024, 1025, 1026, 510, 511, 512, 513, 514, 1278, 1279, 1280, 1281, 1282, 2046, 2047, 2048, 2049, 2050, 1534, 1535, 1536, 1537, 1538, 3070, 3071, 3072, 3073, 3074, 3998, 3999, 4000); -$db->beginTransaction(); -$insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)'); -foreach ($sizes as $num) { - $insert->execute(array($num, str_repeat('i', $num))); +function alpha_repeat($len) { + // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled + $out = ""; + while (strlen($out) < $len) { + $out .= "abcdefghijklmnopqrstuvwxyz"; + } + return substr($out, 0, $len); } -$insert = null; -$db->commit(); +// don't use Prepared Statements. that fails on MS SQL server (works with Access, MyODBC), which is a separate failure, feature/code-path from what +// this test does - nice to be able to test using MS SQL server +foreach ($sizes as $num) { + $text = alpha_repeat($num); + $db->exec("INSERT INTO TEST VALUES($num, '$text')"); +} + +// verify data foreach ($db->query('SELECT id, data from TEST') as $row) { - $expect = str_repeat('i', $row[0]); + $expect = alpha_repeat($row[0]); if (strcmp($expect, $row[1])) { echo "Failed on size $row[id]:\n"; printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); - echo bin2hex($expect) . "\n"; - echo bin2hex($row['data']) . "\n"; + echo ($expect) . "\n"; + echo ($row['data']) . "\n"; + } else { + echo "Passed on size $row[id]\n"; } } echo "Finished\n"; --EXPECT-- +Passed on size 32 +Passed on size 53 +Passed on size 64 +Passed on size 79 +Passed on size 128 +Passed on size 253 +Passed on size 254 +Passed on size 255 +Passed on size 256 +Passed on size 257 +Passed on size 258 +Passed on size 1022 +Passed on size 1023 +Passed on size 1024 +Passed on size 1025 +Passed on size 1026 +Passed on size 510 +Passed on size 511 +Passed on size 512 +Passed on size 513 +Passed on size 514 +Passed on size 1278 +Passed on size 1279 +Passed on size 1280 +Passed on size 1281 +Passed on size 1282 +Passed on size 2046 +Passed on size 2047 +Passed on size 2048 +Passed on size 2049 +Passed on size 2050 +Passed on size 1534 +Passed on size 1535 +Passed on size 1536 +Passed on size 1537 +Passed on size 1538 +Passed on size 3070 +Passed on size 3071 +Passed on size 3072 +Passed on size 3073 +Passed on size 3074 +Passed on size 3998 +Passed on size 3999 +Passed on size 4000 Finished + From 8b093dee214c1bf02e06eddf512c4a11ed028b3a Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Jul 2012 11:37:08 -0300 Subject: [PATCH 248/641] - Fixed bug #62564 (Extending MessageFormatter and adding property causes crash) --- ext/intl/msgformat/msgformat_class.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index d0138854eb0..8145a46f175 100755 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -60,6 +60,7 @@ zend_object_value MessageFormatter_object_create(zend_class_entry *ce TSRMLS_DC) intern = ecalloc( 1, sizeof(MessageFormatter_object) ); msgformat_data_init( &intern->mf_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, From 0bff7cfadd0177601cd7b7253b7311d3bd13fa45 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Jul 2012 12:16:16 -0300 Subject: [PATCH 249/641] - Fixed bug #62565 (Crashes due non-initialized internal properties_table) --- ext/intl/collator/collator_class.c | 1 + ext/intl/dateformat/dateformat_class.c | 1 + ext/intl/formatter/formatter_class.c | 1 + ext/intl/resourcebundle/resourcebundle_class.c | 1 + ext/intl/spoofchecker/spoofchecker_class.c | 1 + ext/standard/incomplete_class.c | 2 ++ 6 files changed, 7 insertions(+) diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c index de744dcefec..d1fa10ef2c7 100755 --- a/ext/intl/collator/collator_class.c +++ b/ext/intl/collator/collator_class.c @@ -67,6 +67,7 @@ zend_object_value Collator_object_create( intern = ecalloc( 1, sizeof(Collator_object) ); intl_error_init( COLLATOR_ERROR_P( intern ) TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index c66610f23b9..a9e06c147d8 100755 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -63,6 +63,7 @@ zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC intern = ecalloc( 1, sizeof(IntlDateFormatter_object) ); dateformat_data_init( &intern->datef_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); intern->date_type = 0; intern->time_type = 0; intern->calendar = 1; /* Gregorian calendar */ diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 8fcda643bf5..28af14e5dbb 100755 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -62,6 +62,7 @@ zend_object_value NumberFormatter_object_create(zend_class_entry *ce TSRMLS_DC) intern = ecalloc( 1, sizeof(NumberFormatter_object) ); formatter_data_init( &intern->nf_data TSRMLS_CC ); zend_object_std_init( &intern->zo, ce TSRMLS_CC ); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 1205450c4cb..23e9449a383 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -63,6 +63,7 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM rb = ecalloc( 1, sizeof(ResourceBundle_object) ); zend_object_std_init( (zend_object *) rb, ce TSRMLS_CC ); + object_properties_init((zend_object *) rb, ce); intl_error_init( INTL_DATA_ERROR_P(rb) TSRMLS_CC ); rb->me = NULL; diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 6c19fbb0f65..507a2ca98e5 100755 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -61,6 +61,7 @@ zend_object_value Spoofchecker_object_create( intern = ecalloc(1, sizeof(Spoofchecker_object)); intl_error_init(SPOOFCHECKER_ERROR_P(intern) TSRMLS_CC); zend_object_std_init(&intern->zo, ce TSRMLS_CC); + object_properties_init(&intern->zo, ce); retval.handle = zend_objects_store_put( intern, diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 0ca2f04cf7d..f6d3750e2b0 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -109,6 +109,8 @@ static zend_object_value php_create_incomplete_object(zend_class_entry *class_ty value = zend_objects_new(&object, class_type TSRMLS_CC); value.handlers = &php_incomplete_object_handlers; + object_properties_init(object, class_type); + return value; } From 9c2839306776bfb3cb68fb6c56f1ef926daa070e Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Jul 2012 12:27:44 -0300 Subject: [PATCH 250/641] - BFN --- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 3d91e502f8d..7f8704db7af 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,20 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.6 +- Core: + . Fixed bug #62565 (Crashes due non-initialized internal properties_table). + (Felipe) + - CURL: . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). (r.hampartsumyan@gmail.com, Laruence) - DateTime: . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + +- Intl: + . Fixed bug #62564 (Extending MessageFormatter and adding property causes + crash). (Felipe) - SimpleXML: . Implemented FR #55218 Get namespaces from current node. (Lonny) From 864575251ac85176b763a56b35c2da298e0d0fa7 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Jul 2012 13:13:31 -0300 Subject: [PATCH 251/641] - Fixed memory leak when extending DOMXPath --- ext/dom/xpath.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index de7b1fa32de..b5a31d7f92d 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -321,6 +321,7 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC) xmlDoc *docp = NULL; xmlXPathContextPtr ctx; int ret; + zval *tmp; ctx = (xmlXPathContextPtr) obj->ptr; @@ -329,10 +330,15 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC) } ALLOC_ZVAL(*retval); + tmp = *retval; if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, NULL, *retval, obj TSRMLS_CC))) { + FREE_ZVAL(tmp); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); return FAILURE; } + if (tmp != *retval) { + FREE_ZVAL(tmp); + } return SUCCESS; } /* }}} */ From 63f3962a9015cd119b028e4c6e3f5533fb9f38e0 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Jul 2012 15:15:11 -0300 Subject: [PATCH 252/641] - Fixed bug #62525 (sigabrt while converting floating point to string) --- main/snprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/snprintf.c b/main/snprintf.c index 46b146474ca..1e0e45510d3 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -94,7 +94,7 @@ static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, *decpt = 0; c = *p; zend_freedtoa(p); - return(c == 'I' ? "INF" : "NAN"); + return strdup((c == 'I' ? "INF" : "NAN")); } /* Make a local copy and adjust rve to be in terms of s */ if (pad && fmode) { From d12f8d67903e2c9775a0f2b647a9c29d61e02261 Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Sat, 14 Jul 2012 21:44:21 +0100 Subject: [PATCH 253/641] Removed Logo GUIDs and replaced with Data URIs and div hidden with JS - removed php_logo_guid() - removed php_egg_logo_guid() - removed php_real_logo_guid() - removed zend_logo_guid() - removed logo GUID handling - removed logo GUIDs from source - added logo data URIs instead for phpinfo() - added credits to phpinfo() page, but hidden by default --- UPGRADING | 7 + configure.in | 2 +- ext/standard/basic_functions.c | 16 - ext/standard/credits.c | 8 - ext/standard/info.c | 120 +-- ext/standard/info.h | 12 +- ext/standard/tests/php_logo_guid.phpt | 13 - ext/standard/tests/php_real_logo_guid.phpt | 12 - ext/standard/tests/zend_logo_guid.phpt | 12 - main/logos.h | 1080 -------------------- main/main.c | 14 - main/php_logos.c | 99 -- main/php_logos.h | 34 - main/php_variables.c | 17 - sapi/cli/php_cli_server.c | 50 +- sapi/cli/tests/php_cli_server_011.phpt | 41 - tests/basic/php_egg_logo_guid.phpt | 13 - tests/basic/php_logo_guid.phpt | 10 - tests/basic/php_real_logo_guid.phpt | 12 - tests/basic/zend_logo_guid.phpt | 13 - win32/build/config.w32 | 2 +- win32/php5dll.dsp | 8 - win32/php5dllts.dsp | 8 - 23 files changed, 64 insertions(+), 1539 deletions(-) delete mode 100644 ext/standard/tests/php_logo_guid.phpt delete mode 100644 ext/standard/tests/php_real_logo_guid.phpt delete mode 100644 ext/standard/tests/zend_logo_guid.phpt delete mode 100644 main/logos.h delete mode 100644 main/php_logos.c delete mode 100644 main/php_logos.h delete mode 100644 sapi/cli/tests/php_cli_server_011.phpt delete mode 100644 tests/basic/php_egg_logo_guid.phpt delete mode 100644 tests/basic/php_logo_guid.phpt delete mode 100644 tests/basic/php_real_logo_guid.phpt delete mode 100644 tests/basic/zend_logo_guid.phpt diff --git a/UPGRADING b/UPGRADING index 8b52be26d75..646419d7b8f 100755 --- a/UPGRADING +++ b/UPGRADING @@ -21,6 +21,9 @@ PHP X.Y UPGRADE NOTES ======================================== - Drop Windows XP and 2003 support. (Pierre) +- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and + zend_logo_guid() have been removed +- Removal of Logo GUIDs ======================================== 2. New Features @@ -89,6 +92,8 @@ PHP X.Y UPGRADE NOTES - IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone() instead. +- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and + zend_logo_guid() have been removed ======================================== 5. New Functions @@ -222,3 +227,5 @@ PHP X.Y UPGRADE NOTES ======================================== 11. Other Changes ======================================== + +- Logo GUIDs will no longer work diff --git a/configure.in b/configure.in index 96febdd9000..529ff58eb87 100644 --- a/configure.in +++ b/configure.in @@ -1443,7 +1443,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \ fopen_wrappers.c alloca.c php_scandir.c \ php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \ - network.c php_open_temporary_file.c php_logos.c \ + network.c php_open_temporary_file.c \ output.c getopt.c) PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 771108b8d83..690356c61b2 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1550,18 +1550,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0) ZEND_ARG_INFO(0, flag) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_php_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_php_real_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_php_egg_logo_guid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_zend_logo_guid, 0) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0) ZEND_END_ARG_INFO() @@ -2723,10 +2711,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(phpinfo, arginfo_phpinfo) PHP_FE(phpversion, arginfo_phpversion) PHP_FE(phpcredits, arginfo_phpcredits) - PHP_FE(php_logo_guid, arginfo_php_logo_guid) - PHP_FE(php_real_logo_guid, arginfo_php_real_logo_guid) - PHP_FE(php_egg_logo_guid, arginfo_php_egg_logo_guid) - PHP_FE(zend_logo_guid, arginfo_zend_logo_guid) PHP_FE(php_sapi_name, arginfo_php_sapi_name) PHP_FE(php_uname, arginfo_php_uname) PHP_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files) diff --git a/ext/standard/credits.c b/ext/standard/credits.c index e87cdcad8be..0f5d6d73511 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -27,10 +27,6 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ { - if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { - php_print_info_htmlhead(TSRMLS_C); - } - if (!sapi_module.phpinfo_as_text) { PUTS("

PHP Credits

\n"); } else { @@ -123,10 +119,6 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ CREDIT_LINE("Windows Infrastructure", "Alex Schoenmaker"); php_info_print_table_end(); } - - if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { - PUTS("\n"); - } } /* }}} */ diff --git a/ext/standard/info.c b/ext/standard/info.c index 07e152874a3..4f61b58d1fa 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -92,14 +92,6 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */ } /* }}} */ -static void php_info_print_request_uri(TSRMLS_D) /* {{{ */ -{ - if (SG(request_info).request_uri) { - php_info_print_html_esc(SG(request_info).request_uri, strlen(SG(request_info).request_uri)); - } -} -/* }}} */ - static int php_info_print(const char *str) /* {{{ */ { TSRMLS_FETCH(); @@ -671,7 +663,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (flag & PHP_INFO_GENERAL) { char *zend_version = get_zend_version(); char temp_api[10]; - char *logo_guid; php_uname = php_get_uname('a'); @@ -680,13 +671,18 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } if (expose_php && !sapi_module.phpinfo_as_text) { - php_info_print("\"PHP"); + time_t the_time; + struct tm *ta, tmbuf; + + the_time = time(NULL); + ta = php_localtime_r(&the_time, &tmbuf); + + php_info_print("tm_mon==3) && (ta->tm_mday==1)) { + php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" />"); + } else { + php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" />"); + } } if (!sapi_module.phpinfo_as_text) { @@ -789,8 +785,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_box_start(0); if (expose_php && !sapi_module.phpinfo_as_text) { php_info_print("\"Zend\n"); + php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" />\n"); } php_info_print("This program makes use of the Zend Scripting Language Engine:"); php_info_print(!sapi_module.phpinfo_as_text?"
":"\n"); @@ -805,11 +800,23 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { php_info_print_hr(); - php_info_print("

"); + php_info_print("\n"); + php_info_print("

"); php_info_print("PHP Credits"); php_info_print("

\n"); + php_info_print("
\n"); + php_print_credits(PHP_CREDITS_ALL, TSRMLS_C); + php_info_print("
\n"); } zend_ini_sort_entries(TSRMLS_C); @@ -1191,77 +1198,6 @@ PHP_FUNCTION(phpcredits) } /* }}} */ -/* {{{ php_logo_guid - */ -PHPAPI char *php_logo_guid(void) -{ - char *logo_guid; - - time_t the_time; - struct tm *ta, tmbuf; - - the_time = time(NULL); - ta = php_localtime_r(&the_time, &tmbuf); - - if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) { - logo_guid = PHP_EGG_LOGO_GUID; - } else { - logo_guid = PHP_LOGO_GUID; - } - - return estrdup(logo_guid); - -} -/* }}} */ - -/* {{{ proto string php_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRING(php_logo_guid(), 0); -} -/* }}} */ - -/* {{{ proto string php_real_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_real_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); -} -/* }}} */ - -/* {{{ proto string php_egg_logo_guid(void) - Return the special ID used to request the PHP logo in phpinfo screens*/ -PHP_FUNCTION(php_egg_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); -} -/* }}} */ - -/* {{{ proto string zend_logo_guid(void) - Return the special ID used to request the Zend logo in phpinfo screens*/ -PHP_FUNCTION(zend_logo_guid) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); -} -/* }}} */ - /* {{{ proto string php_sapi_name(void) Return the current SAPI module name */ PHP_FUNCTION(php_sapi_name) diff --git a/ext/standard/info.h b/ext/standard/info.h index fadde75eb6a..98185936649 100644 --- a/ext/standard/info.h +++ b/ext/standard/info.h @@ -50,19 +50,14 @@ #endif /* HAVE_CREDITS_DEFS */ -#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42" -#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42" -#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42" -#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000" +#define PHP_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOZqAH+CuDk3RyglKszN4qGky9PV57K01ENCWIOGuYKDs1JScpCSwsLE3qqs0ExLY1tcg93e7Ds4PG5xpWptnWFjjXV5sXt+teXm8JmcxoyNwbm62Wtrkk5Oa3F0qXp6o4iLvXJ0o3RzmI6QwVpbfuLj73t9raSl0G1wonJ2rJWWyLu92XR4roWIu5KVw9jZ6pKSxGRmkmtun6WozpSWxS4rL1NRaLO012xqjFxbdoqNv2ZolmhqmpyfyDEuOa6w05yczVVWeJ6hypaZxYGCr2dplz89ULy+2l5giZiZyIyOv4mKuldYfLa319XX6CIeIGxvns7Q5L/A3Hd7tHZ4p19efZmZzG5vmHN3riIeH////5COj1lWV8fGx+7u9dXU1fb2+oKAgayqq3Ryc/Hw8Z6cnePi40tISbm4uWdkZYmJtgD/AEdGX9/g7ZuczGlrnG9zp4yMuri52bi615qbzKeqz9vc65qcyWZkhGhniaeo0m5woIuLucbH4MfJ4WlsnJeYyyH5BAEAAGoALAAAAAB4AEMAAAf/gGqCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXlm0/bXOYnp+gP3l5Nj4acUwaGkwGPj4NMgRBPBhCLQtJIjkfGTkiLymgwqENGgx9TQVQUAN9fAxRUSpyrK90sbNCMy26HwgAFhYVVyglFgkZwcPrjCZxfC5sbBAQdS7JA9QysyIf/iwAEQgEQLDgN4LhpKxA8UbCCT87nkwZkoSdRTVBbAxgQ+KCRxIk8jUQskCKyZMoU6pceXJcBwkTduiAQeEIBStDRFzEFIQJFI4eL7gwQqcFy6NIk6K88iYGjCNHHoxYcsSDzp2Qfmh0AYEjBCMEWCgdSzbplRM6HiwBokDBiCkz/7AuMqGhQBMXdQoYSFK2r1+kHWAsUcCBgwM8CeQayhNlAJQCA3zk+LtyAYbLmDF8oJz0DQUFDtasUeBBsZo8Rvj0GcBkBueVH7JwmU2bS5fXSt0sWXPggIMQO91FYcCgAQLcKzFwwcK8uZnbyJN22F2kyJrSw374kGNEBQ8L0VeqINO8uZgC4ZVeeXAgQAAOcECZMMBEDgEA6VcWEFOeORkV+Sn1hgLu9XAHJnPQ4YMBMhwXoEpdmNEfFlwQ8KBSMazRQw8H7FHJDzI00EBJF6YEQBYTYpHFZiUm9UAAGwInSRsE7ONgiycpN6EZX+ColB9F0EADFZHYEQQBM4CH1P8HmTXZJItHqRDGhGJc0CSJLDHp5Jb4jYWCAzQIUMMjSGAQBJRHffBFFmy26eabWXRRQANdolQAGBOSAWebFwxg4UkL7Ckom10M0IBSQAgggAONzCAEBmIpRcByKVZqBhhcfAEgSl1sUWmKNGyhRRldkGjAlJ9OuAUYXnRxKFIjCOAEo4psI8SNSY2X6qdbeAFBlyfu+ikYY2AgxQB4CqtqGQMkNYITTuCQSAoitIBmUhDwp2yKYUBgEgZebJsiGrdd4Km45dHgRbNIrQEtdoX84ctkZX0hIbr9eQGglPjm2wCK/TZHQxl/HhWAEwIsYEg/9JIVW8DlbdHjnRAzp8X/BeFWjIUY0B3VgaxjEpICAh/UOdakO8I5xhnaTugFAZ1OyMWbY3CBRopaZIFqxHCWcca5E5aBJUsKQJsGId7gOpau/YnhLUoLNNAFeRNqwQDA/a2IEgYNfBFB1VloUTW7gBrwRbL9hWGAUjTMOsgfACCgZFnZ5rmpiVl83XQWGZfH40oQAN1czoIzd8baKn0wBs53H7UEtAqrIYIFJpNlr8wFpxS4qjpT+XRKMfd3RhY0BG3sSqGXp0XjLHUA7Q2CsJBQXw9POMa1J23eHxpZoN3cfyoFG3QZE9KQxVGpD846S0W4rUY4c5OFcn8R9MjS5f0RjrlK4BafxRmqXnAU/9blAa8UB070IEgFlDFdHhqfp1R72uQ3d7tK/Pa3Rdhjs4QB8dtTCgWgJYgVUKZu2VueSQwAvqD1rTnV04/vmAOGLBQOC4djCQOo1p/7CZCAKbgC+/yCvfJUiCXJY04EOre7+J0khVgIA+lMtxIAeG1C5CLLAJ0gCBQYsC/C6yDujkWp7PWuassLYnm8AMB0HU8/HCxPGBS4kh0KogMoGCFZdES9J6LkAwXwQun6Q4MxfOGCJ0xJ9yb0vfBxDwJinFD1KncUK6phIVpcWhSZQy4V+FEFEOjCGLQwRtENoH7M8SBK8sczsWWvC38EZBfK4EiZUXEl6FPf8zpwhb7sR/9VWghlKMVwrxSJ4QsEeKAKvWinCWKhghcUlSi1QMphia8szaPVB97Qgb5ESGNo+MICToVDF5rEXBOSYSEDdsqhSed1gkiBBN7wQ6UosV/NPJYrrbYSRGKBiRoDgzD78jgnRO55EujlWNbYLxqcYZxSQGZ/uPCqramSOW0MWATOcAFnss15gnjBCSTQSaUwUlxmIMMYBlCnGXbQn8TUH//wZQYZMoCOSSmaE45GiCGc4A1joZj+ZjlLMnBhDIVCU6BIGkpWnkQFXGDp6C4oBpaG0qQoZcAQpQMyQ6TgBCdQJ1JgyIUL0IMeBfgjAfxpEkAe9aiZA9QAnkqPQy6TOV7/MOpRk+pHAux0LAdL2CGSEIMToAAp10wkU30khQU0sTxZwChy3OUEeBkiAWUtaHLuuUK2sqQBDYxYx/JTTmkpogR5ZclB+WhMv0qBAZVsDhjQE6By0moRiDWrBKvGAMeqRHdSvCRlNHpZRpRgAjHoQB6lQNR6etYkeXPZ6aLTgQNAq7SNSABqJaDFtGJhDGv10QIWx0a5+oUIPYCWYSOhhCdMQLNS+N8Wpktd3r3WntSlLhgG+xoFyEoAMprEC0DghxjwFgAFoCo9EHddKaBXvRBwLWWIcDAnRICjlkiAG1D7htW2168nsK1yQfGCKfgBtar9r19RwAFZOaEI+AWF/xL04IYD91fBJTrBGhzcg/CygwUUPrAEzorh8BzhAIoSQA9gpxgWgGAHbnBDDKhZYsr4gQMBCJMAAsBi0wgiCSUgwg5gPAEa1zgpEyBQD4QkJrv6eBApSIAedEAEIbshqP7F8BuOgOMNLbkIeHjBkxfxAinr4Mxn3sFHSXzdHRxBAe2B0YYOcAMPjfkRL0DAFIgAgz77mQh++KhQ8zMBIjwANNVxj6JxEAI735kSIhjCnilA6UpT+gh9rnCg38BpTkvg058GKlCJcGm2iKY3B6hOEQJwABxsIDGPFkYKPlACEFgBKlB5gK53PZUlrAUIbGkLYQpjmNCcujdFUAAVbjgwBDHHWjEpUAICPOCBDWwgLb4GdrDbQmzDcIAKIxiBFaxQgmY/+9yLEEEaEHAVdLv73fCOd7wDAQA7AA==" +#define PHP_EGG_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOf/ABIZISAeIhwhLA8jRwYlVSUoLyIpNSkoKwkvbR4tRBUwVDMuNysxOx87Yg89gDo3RTI5SgBCkDg6PDY7RyBCcTxBQz9BVD9ETxxPkQ9SoktIYkROVkpNWDJSeilVhkxObEZTZQVevgBfxVZQZRxcn1BUYFNTc1FXWRZht1ZYVQBm0ghlzBhksVVafyNlqSpkn1hcZwBr2EVfhABs0lRdcF5adRJpyWBcaVlgYl5dh15efh5q0gdw3iFsxhBy2Rtxxhhx0Ttsn2BkigB45SxwtDFwq0dslGNoc1pqfRtz6GRmkypzwFZuiQl772psaWlpiiF25Ax94zB10BB+3iV44BR96yN71TJ5vit7zih73GluoDt6tk53nix66QOG+nBwl0l7r3F2cjOAzSKB9guI9SKC8HF1lW90pm93jTCC3SaE6zWC12F8knR6fHV5gzaC5SmH6ESC3y6H9kGGyiqJ8UuDzXx5oWV9v1aA0nl6qWmAnXl6tHJ8tV6AyVGGuS6K/EyHwyKO/D6J5T+K2SGQ9zqL3ziN9jaP6jmP8WaHwYGCsHqIkC6U/C2V9naFv0GS50mS2IGFuYeHnEWU4iyZ/16P2ISIr1iSz4mLiF2SxV+TvImLlmiSsnqPrIeLvzmc/kOa9Uaa74aNtHWRyXiSvk+a6YyNvIGQwo6OsImTnFib3lKd5l2d2kKi/WSd0k2h9zeo/1Gi8ZSUw5GVyn+czE2m/46bsY2ZyHugwUmr/12n8GCn6pieoGWn5Hekzpueq26n25yby1ms/ICk25ejrlGy/56iymav+V2y+2yv7Wex9KaopWG2/1e5/5Wu2H216265/HW3/qus0aavxWe+/66wvYy33YC4+Hi7+bO0uHPB/aq3wa6112vF/4e/9pfA27u31YDF/XnK/5PG77y/25TI/MDBxYbN/qvH7LfH2qPP+47V/57T/cPN2abT9c3M5Jna/77S7LrU57HV+KLg/7zd+tbb3dbb6a7l/sbh99Hi+Lrp++Pm7+Hx/P3//P///yH5BAEKAP8ALAAAAAB4AEMAAAj+AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLFoNpDIaxo8ePwaRJ4yaNHDhw5EySFCnNmEtjt2TJMmXKk01PpmbN+sgTZEly7+7de0eUaMqj4FaKfBlzps1IkfZI3cMnzx5Fnnb23MrQGLig/PgJHTvUZEtjNZ9CXcu2bVSpfPicOaOlrpY8ikxx3fvPGLd3YQOHfUdOWkw+jkaNEjVtquPHkCNLnVtXieUcSr7k5YvRK2DB9wrLctSnUi9dxYpRo6atEy/JsGM7pqskh+0WLXLY0csZYrC/QsOGNubplrNkxWq1Wp6rObNu53y5kU2dupbaLUxob5FHVu+Fxsj+kb3HzdTUc/TonWtWrLnqXMWaiQvnC031+7LPKMn+4YOGJ4p8Z1BJRA0ljSeQ1XMOPOt00wx7xYhDjWrinDNOEFzQwgd+HEamnwkahGiCHQL+QyBR4MgSWzjw0CNOM+4xKN868FhjhB/PqIMON844c8spp6zlSSSexIXYUx06pkULGlhggQZfcObVUdK8FRs70NCzDnvNUeNgN+vQ4w4XfvSizDHIQAMNM8LooosyaWqDDTbhhOPNnc9g88www/RIHH5nMOmkBiT2FNJRxuBXjzAMTghLK/IVAyY843TgAhaHIKIpIXDQgUgjhwjySCijllLKKrqssssuqaqaTDL+e57CYQ4WPPDAB7x15BdKxlgp2zi9JBPLOetQkwsssBTTYDPwwMMOBSRYgQghdMhRxrVl0AHHG9xuO0UWghRSyCOlTCJuIZNAoq4qwMh63xkm2LrAExiFNFKV96GzyyOICPNIOfRQs9wnucCjTTf07OMOBREAQQcZZXhRxcTYUmExFVFEkUUWaXTscRqhlDuIGGJA0ssoHGqhwQILWJCrRPZKo+J9z5xpCBnUNtrKJwTjc4426bHTQQQzVHFtFU00AUUXEw8BxRBUDBHFtnAIksYUVpOLzDGpTjLIIJA40mEOD7AcJczGtORrbJ48E8orn8jhhRyv4AMPMrBQAkv+M14ijI/QRHeBLdJdMA3F0jzwAIUPb2iKCBwbTwHHI6PqEoub6c6xYcoWHHCADhEF49LM1UWyCyigEMIIIYY0EY56xeycCzO5NAP0PoDPEDG2XSR9eBeHQ8GDD3CUk4862AgD+cZZwAHHIY/EEssqkGjeIR8aeD7CQ6L/eZ8jlWg6hxVkQFxFi8bunOze4tCDzzgNOFB0E9c2UcUYSRd++BA++JCFPm5wwjLKcQjnZcEHQJjcuB6BKl2oQmwdMoHnNNAQWdyiV/iJRB2yoAY1vOEFVbBWFegBD3HkYjmtaI+X4PG++PmgfnKIobXKEDWnDWF4abgHBwzgBG/AQXL+kANCGg6RBitYAQtrgMQqVgFBDrXgAAGgoEJkcou1xeYWdZjCFKKghiqQQAr4o0N61hG7T+gtF+IQBz7wYQ0FEG0M12IEz0DBM001QlNU8EEa2nEBA7QBG5ATxLeAgMRChGINP0jkD7AghkQ08T4tCEAAapCQWZhCFgi6zyjWIAhr2MIFQ5DaD4bQBUS4Dx7NeJQZYQGdfdDjGQOIQAzo14h5yCMf+ahHPfIhj3ZsQx7QgMMg2jEBAbQBecd4xSOIuIZmkguJWFDkJWiRJA1IslAFmQVOMkmdSFxiDYfQhz/8gYQodMFpwAsFPlzZjJ0xohVoPMc+4OEKAkSACnL+IMQxsnGBC3DgnyXgwAYusIFslGMV1SjmAU6AAzfwIh3YCMUkelEKcj0CXWuI5hzmYA0ryuYBATiAdwqSlvvwQRVYyMI8xumPVKTBaEgrwzHWCI/YMeKdxdBG+9jBBQJkoAqBQAQ2NlECGJSABjCgwVEDygBzeGMTEyiAAUrQTwYUIAzeCIUtiPGNZ+jCVI9Iww/EcAlX+OIWHDoDFLdHkFkQyaORuURKB5GCaoxTD4gog7WaMAZvjJE9rUjWg9JTKQKggAyMaEQ53FDUauAyl/r4RQkY0AZ+HOECASBGNX7BWAEAYBGlYAJBcRAGTGBiG8oQK1kzwQpSbK46JpD+5MuGBFfI3AELQKBCEAxQgHbYwwWNKB+22JEeF7WHldQIEzy8kQAEZOETO5sHDU5Qgm08QxiNgEMhzFGCAlTgHiWYgATycad52KKYJ3gGCATAgA1woJ8GwEQpevCDQQACEHMwqzPuA0Up/sOttX0MH3oAhBn4wAPTOAANNpEFMuyVfuxoETy6cSxJSXgdroglHGbXCnnQwA1HSIcyJhaFQqSjuwzYBgcYcIRywCENkPhFAQBwAmJ+Nh7TIAYaeAsMIPRADHPwwxKuAAhXkOIUpJNMJAMwUvMEeCoDtsEKVjADEhQgAAIggRrIUIXCNYEM7KARPNIHC3Gs48zhkIH+YUEhDIGlgwM3cIMtjlEFKrzhEe1Y8QIka4BFxEINgngGGjy7iGp4Fhe64Fo8DAAATkyhB1iYQxBcsAQiXGELW8iENcwjmTNIkl7/ePJUPLEEKatABTsAAgUSgAE43OxavVMDO85h5mZANxfJPbM3GoCANLyiGMyAxDQ4AINNWEMYhEDEIdTxiwsU4AhouIAAqoEINWTBGRAAAAC2MWgGJEOZj7hEAgDAhTSgAAtXeIELWMBuEpCACJl2RqIiY4EoCsSkgOjBCmIQgx34GwiF4CAhhHutRqwjjetABnRhQawzZ2IAGXiFMNqjilT8MxvooAYzoMGObBxhAgywBxL++oiODmahE4xmQDuyvQFtvCIUhfCDZzlxiB8sYQ5bIAG7WeBuF5CgCGDwAy6SLJUPBGAB967OKbBggx3wIAYq4PcOfBAFOljdwVXwAjPCcY5uSCgXyulGs8rRAQLUgRlsyoU30MCBEpjjHubYBjGcQGwIpOIeMJjABp5BBzVYAQmePcI0ZkwMbQgjFpDoxKHhIIYrXKEIL3gBEdTtbgz8HNOcgIwSJCmQ18LGE3MAwgpUwIMh8LvfPqBCsgcOMTLQ6WDnmBB75lOODDsgFhpnRivmAYK2X4AGE7hA8IvqhnhUY8Vt8IYa6FAHC2h7G0gAwAbkMQ49pYMGAJAAKwT+MYgrECEIHog8vOHt7hcUYQuZf8zmA/Df6owCC1OOOg/KUIWnx2AIjYCbIT5BBkNwHRoVcg7MkFPUcA7eUHZigAy0Iwy5IA8QAGdHAGJHAAMw4AbbMA+PIAkcMAG8UA5UoAaJwGgXkA7ZJgG8cIK8AAOYlQrmMgiWFgQyAAZbQAQu4AKRB35BEARbgAvqx3n/EBeyUQdSIAKoFgM+MARkoAZPFwWH8AqtMC37Bw3noCZmdg51Uid+AHG6gAwMWAu5sA0TcAMlwA+5VA/zEA/qcAyIUArtQAzEcA/XQAVwgAsW0Ge2IAEAwADvBVAX0AbPUAhgA29GgAZ2wARgAHn+JPACYLAhlsAFXOAr6ycQZ+B5kDEKPzADoxcDw/OBZaAGqfcKyAAKzNEKwhAOycMiB5cM4QAMCuAAk6ANtOOF0PALxOYG/XAMn9B3VmcI1vYK0VAO0QAKQwAH4xAP98APSMBb9rANqbAIbpAK1gU9I+MCWyADViEVXAAGL+ABMiAKsBGJP0iJjnEKYtB0UcdvPEAFj1MGQ6AGsRAO0KANasIMyKAM2nAMUpgMu6AKl0ABCPADCrgzlNAKi1UCJbAJ/SAMhlAG+1M+VJAtjUAIVMADnggEVkAKHCAAOOANwrAL3lAOyhAKhyAujQdvLeAYkZAJWwAGRgAGcGV0SPf+D3twBrBBCz+wbzvQb5rYjocACogQCsKgDcmgDXUiDtCADLrQC7twCYDgARRAAAhgA8sBC59wU69QDzTQdsSQD7kgQkNQBWRAB1FTOFUwAxTpAzbQA53AAABADNAACj8EB8o2koUwB5dABGBwkpDhB2DABeIoFfUmRZ4wF5FhCnNgAyIweudYenCgBqUQC6FwDMpwCZcQDuIgj/QoBhjgAAiAABGAAoeAQq1ACYxACbnQD8SQCr/AD+wACnJgOF0gB0l4Q1BABTuAhFQABGswaAXwDcIACm8ABEAgOWmALqswB98nBJEBhJ32aQIxC3MhjqfwAzbgA5mYOFDzBnD+AIqxIAzQoApqgg0AGA7FgJRr0ANWIIrKwTNVeVOtcA7lwA7qUA6toFdlADwhlIRwIDw8MAO46QOq4EvtgA1PSAVU9i1TAIjdRwQyQJMdsmQjJZOE+RiJgJgr4G85eYRcBAehoAxvogtzIJnHsHU/U570CAqUMJDtGQgsGghyEAipwQgLKTiFwwP0Y3VUUAVQwG/0wz9AEAq6IAwF6gMxMAPDmQZYMDLw9gFJsgf91VZa4KCOIQYhMGX+dkOpJwiv0ITSswu9sAXKoAxrwnVT2Aq0U5Us6gVj4AV/4AVuOgayWQZKMzFQwJD2Uwaf0nemN0sMOQPVyYSgoAZRMAT+MzADWWBESep9QWACSRJbAfAy/6AIUeoYjrAEISACiTkDVAAFHVQ1QJoqqpAJXHAJpRCPxGKFDLgzaKqmY7Cmc+OirZo099llWVcGhNAIPlkFQ5CTE8MDK2ADUfAKjaAGX9mffmoDRyQGRFAEMpAkahUAbAWlkyoVpmCpU9ZviVMFzgMKoTA9quAHIAABMgAJukAnVmh4yqGqjOCmavoHbeqmMeQFhuAFSUM/clAFt5o6N6QCsUkGUGCkbNYKXMY/MxACBktfiiql+AFSInUQplAXm3MLV2ChM8BvnKpsoCA9q8AKIBB8MNAJvYCU0BAOsEg7N0WagcCmf7CmcqP+pl4AMU3AA0nQBHNDBqCAq4SgBjwKMTxgA3Bws2QQCOwIBDZgsCGAAijAAkSgBNV0TQkhqVowFXOgb5m4A3KIOofQravgCv2EBlFxCqzwJtigDfIopGj6B4HgroHACHLQpoaAPxGTOE0gm4QgiohQBToLBS/bBf0JBy5KCOzoA/SFAkeLtCwQBEmyZJSkEHlQF1LhCjeZiUaoBoggCC9WCKWgCRNgBo7BB6OwC8rAdfLoTmzrru46BmjLqknjBUkws0GLq69QbVRQNLLZBLs6BNlSBVNjBT2AtL7LAi7AtE4kSf7FuHWRB7TAdIrJb4VKdVlwCLqgCRcQGZ+rU/D+eEJoOgaBsKauCqdkUK/1ijOgkAtwmUcvVD4xW3p0ADxRAASYerRLkAEZcLgRRLwP0bhaUK02UKinJzwW8wbQK72SMQracK4Tdyw8Q7ot6qJyUK9dVgafAAqxCwdRcIQvS69OYzQ8oAJWWqg2sAQukAFXcI3VcQb1Zm8QIamKMLGYuJMTmXocmgycML2S8QxXCA0a1x7tWQvIgAyyA13r6gVlkITQlSkV/JDcGzx1+nSh5KOEdAUukAj4oQQLIEmLGxGm8AWQ0AP7u2+lJ4eI8AqSKcCScQrnYIXUIAxww6JoGwitADe31go3VZVPyK2QY2CqI1zAMwR0QH+h9IH+U1CckxBk3ghbUHQAZzMRwcAKkXuhBna1r/AmmUDDNUyy2oAMuVCVbfsHhCAHhvAHMbS2awu7W3oIUmADWYAIrdAImlwGjdAIgWAIA2d1zyNRG8uD1KEEIBUAEgCpEjEOa4CJ+5Z6VysM9QgMG/CXUvEM2kANOCwMtcAIaXtT0iw3oMyilEAwuRAKoVBEaTC+ckzNN5VPrEctcNAIo7IKyYDLsKEFJzxJHjEIUubFX6nKbaIMwEADlgAbySMMbCIM0tyiN+WibhrL7vnGsaAMkDAIsXAMwgCUzQE30izN5UMHyQYqDJQMvgAbfPABUBQALvMRqmAFhXqbH6jKDo3+DL2ABJIgGXygDasskC1qCIbwogu8ttCVQuWpDZegCvdYCkRZtlXpYMJl0VGgbJfTC8DwGKjAByrz0QuQyB6RDGlQqM2rBuf8CpezC5xwBPy8xmRwzS4a0HLzou7phWhXjy/ACspQCshAlOGgxmgaCLOJt3J4CKai1L5CK55zAPPCFX/opzPgb1RXy6WwC5oAA9z0GL0Qzg7WtgtsCGlr0+8kDJYdJx6wBazQCw7NDNpQC+tJCSwqm4aAMbU8CaowCuahBR/wAH39AKC2F5NAtBc6dVQXBYJwKq4AA5bwl6uQOgHNrnJQzaBs1gMZ0bmgDcrQAAPgAZcgppg5MIb+cFMQcy1yuAZ9cAd7oAXxsgB9PQLYxBeQUGAVW7H9EwVTcNjAUAJfYBdS6gmlgAhBG7RuSgij3bY2nc21wIC58ArQoAsNoAAYAAbQIJ7Q0B7qKt9VkAXYLRc50Nos490W8ARa8R2qQJ3XqpPEk9DJgARmYBkgXheTeAd9sAZxoAbWPDdqet9yBE8nlAv/TQEUcAWqMLbNDM2fQDl4kN3bnQMmUCtlwzIT7su9AbnzvLw+MAXKgA3JwAZu4FZ5AOJSrgQifgYk3gd4YOLc4jgRLJqX45R2yQp8MgqOsCHX4eNNAuS28gA18AVEXiLleKmJqQIGlgXlus4wQBCmoAjAUT7lII4ZVO7eczHohG4X13EZ2hEiTrLotWIBbR4gJaIQl0C4mBp/SV4KSQkMOIAQ2pQHefAFthHqop4DuIEb2nHq2tEf/REirM7oJqADAFLhkc4QlI6pdH6kupAMu+0QlhQJdmAHX/AF2JEdqJ7qqq4BH6ADuBHseCHrs/4QkEu4iJlqFrkGk8AKrrABPEETkfDmz94RgEC4IWCkVpAG4eKlmiAB377uFeEKS4ACNvADQpQG5LILwMAE7J7vAhEQADs=" +#define ZEND_LOGO_DATA_URI "data:image/gif;base64,R0lGODlhcQBIANUAAA0NDgEDBgIFCS5EXhUdJwUPGgQKER0rOgABAgkZKiZpqxhDbQ0kOwobLQkZKSNgnSBXjh1PghpGchQ2Vx1NfAoaKiJYjQoYJgsaKQECAzdQaS0/UTE1OQUPGAkaKh5ViiFclRpJdQocLSBZjh5UhhpIcw8qQxc+YwwgMwcVIQkaKQgXIwcZJTM6PwIEBRkaGjEyMv9mAP///8zMzMfHx7+/v6urq5KSknNzc1VVVTw8PDc3NyYmJgcHBwMDAwAAACwAAAAAcQBIAAAG/8CZcEgsGo/IpHJ5/DGf0KiU+Ks6p9Kr0KrFer9GbReM7IrJ6O95Zt262durUy5uD8/rtL58h7vlf3+AcHlsdoR7iU12eIhzbXVVfpOTgGOKiWNrkpKUhZ99iJijl4d5kFSdXKmdb6OvsFOXsbS1oba4ubq7vL1DNjg6ODW+xVg3OTw/AisCOMbQSsA6AD8FDAsjIwwv0d5DNcnLIhMU2uclPzbf3jwC2Ofx585MwTfssD8n8vwjKDpLcggo8OMZPkw8GPSTN6HKCxg5hhHJ8WOCv4IHFeEwsDAeiQULJjBYUQXGM4oWtTU0mDGNjR/mOi48gcJKynMrW+oBcFNmP/8SJnri/JFDJ5kaL0T4XLqwYVGjWGy8MFCCqVWGRKFKsQGgAImrYIc+1bqEq9ewaEc0vEc2CdKzacOmY9vWxjoiMAx81Sajr9+/MhaE2Iu2hAAexPraJUbGxo3HkB/f/XKjCgBhwH5kOwcYsAoU5dKSMIBYSN8cOSZvxRGjtevXOnREZDwFhogSE1AYqKIwXl8VBlKoUNHXgAEUJwhfJVGgtGkZsek+Afa6uvUY0bFUjEdhgnJtIUwwmLDAb4cU3tM2pz2jb/YnN67Lr/4eSuWYPkmEGDyiL4MODITgm1+CkdBZgSh00xkMOkiHRHzWxSahDvNJyN4SG6HV1wSfJcf/GWAMdObfCQv8IOILDUoj34QTrhgbS0zAgEJYfqGgQnp8yXACA8N9NkFfHQRX4wl+6cADDH2h6KBdz7jIYosRShjFdmD5B6CAH/JIHkgh9JUCeuXJAOBpPDTYF4MO4mDCAU5KmMMNxNDAWpSx2QdTlTJwiNxeIhbYnwzDZeMlcTLAAAOc7qVIxAsVsrjkdRNCkeFVNd5ImIgqmCDgbyoICiihZd5gQ189KDoDDTcYcN1lE+JAgxE2QCrlEzLi+V+Af+4XpnHCafpnoL8SWugNOwD5gqg4oMbDCtahkAGD9RUBIX2xjbUElUyJ6BcDJoQJ2AldfuppoCJe0IEOB5hw/wIEKFRQnQgesJrDhUTI+iJ8d2arbXGdjhDub6BxOm6nJvzVwMEMSCDBAw+AwIAHr3kgQgdl5vAqEjXYq4NqSeAgAFjd2djjyL7qJ9JwDCQXnq/+mqBpCQXsWIEHKVPwQcMgOOyAaw4k0EAKGCmhsbVKVLbCBFUtte+GC+ylH5df6cffCFIbKAMJJ5A4GARcdz2BA2CH3YAIDABA7y8aO1g0NeOEttDSgLJMowwuh9D13VwDFTbYCZjQMEBIDO3FNACY0NFvwY3M72ZoLWCACRTgLfnXYTPwAQgKmFAUDjjQ1SbHtfXWz29gggSSSHKHRcIKJkAAguR4R/C1CJFD8P+AAiykABoCQrQJoxc4FHC4uPLod+DUfxI4mF8O/AhYgXj/JdjNEUSgwAMY1ECDxjpcDEZl330IrDzapvyViCn7FUD5yXXdWcqXg3D7CdPCNqHaWNSA7YDPIw+kkH1BTo3OA6QA9UUAIvhfCoZEAgj0ZUdhA03tRvAAEvhuDzpQCj8wJTcvgamAVgqYDIQTpgIkcIQfFFOAHCgDBjTPdFvj2gPaRDQy4CBf5JMBr4bTQeINinTe+U0BCiYDBzSgL2BbAAtT4IA+xbBrIODe2cDwghltEIVb8p8PPyWwPxlAAERsgAeQ6AAlklFEDtAUFKNIp9iADlXJQs2bbuA9Jdz/ED/i69eHwgUsTvkFPVb7QQUk0BcPNLGIZWRhEsPFqzTazXUzbKOphBCrNnaujkUwS/jgFqItkqszCKDdGRFpRlJa7VuDiaQliVBJ7t0LVl0JX/K0ZYAuCuyUfrEGBUaZREUmEgL/KiJoIqBKagljCPUz5pN+N4MaxLIj4RmZNINSN/BUE2s86gsADBABEJSgbit7ZDjzFgKRgC1lEJgPdiw2g2Ta70lvOkINeACXhTzNdPgUDAX24zR+asN4MjiSAS73AX5WjZxPhMA9Q/ABdbYGVY1aJuiGsBFZxqUjhhFGDlwgP4aN4HWwC2nXLOjQiLJIInbUy0Wt4pQa2IUH/ydQwARmKr8RiDSkJW3T/TCJMXpadKX/ZEBWKEqAFgDgBjCYgAJAetO75VSZjuKpEuYpgKQBlR8lYqZdhsCBhTG1qSR96pMkREcvUNWq/CBPXOixBA5QIGdN5dpTsTPWBkk1CmftR0N+YACkhUUEgJOGD0jwVa7l7LCvy2ld33TXKeQ1HiuxQQ5eUIUVoEBdS5kAAJ7gghM84G45Y9jtSgCCCHjAA2PzwGHqOqF4KuKxagkaJTmngxcIzycU+AH+iFADFCwVtCAgTwRQEIALQEAEIlBBB15QJtbKZrdpqAEMqhrbGiIThx0pgHWJgAMJ/NawDxhADzj3DBioSwQGAIfADpyLUloIpCbbHQJPlsIAGCxhBxa4HcM6at865qCcRFlsWXORA5MwIYMyWQADBBBfIdzgBRpAwVtvpzkjhCM1lHQMZKb4DY/xozsiEMAPeNDeJNDAMT/YwAkkwICJcpgsL9mMgglyGRxMlAmiAoCN2zIFeoZ4xK6NLo+nYIMX3XjISNZKEAAAOw==" BEGIN_EXTERN_C() PHP_FUNCTION(phpversion); PHP_FUNCTION(phpinfo); PHP_FUNCTION(phpcredits); -PHP_FUNCTION(php_logo_guid); -PHP_FUNCTION(php_real_logo_guid); -PHP_FUNCTION(zend_logo_guid); -PHP_FUNCTION(php_egg_logo_guid); PHP_FUNCTION(php_sapi_name); PHP_FUNCTION(php_uname); PHP_FUNCTION(php_ini_scanned_files); @@ -83,7 +78,6 @@ PHPAPI void php_info_print_box_start(int bg); PHPAPI void php_info_print_box_end(void); PHPAPI void php_info_print_hr(void); PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC); -PHPAPI char *php_logo_guid(void); PHPAPI char *php_get_uname(char mode); void register_phpinfo_constants(INIT_FUNC_ARGS); diff --git a/ext/standard/tests/php_logo_guid.phpt b/ext/standard/tests/php_logo_guid.phpt deleted file mode 100644 index c644b2893bb..00000000000 --- a/ext/standard/tests/php_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Check the output of the php_logo_guid() function ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 - diff --git a/ext/standard/tests/php_real_logo_guid.phpt b/ext/standard/tests/php_real_logo_guid.phpt deleted file mode 100644 index a9fa7d35d51..00000000000 --- a/ext/standard/tests/php_real_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing the undocumented function php_real_logo_guid() ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 diff --git a/ext/standard/tests/zend_logo_guid.phpt b/ext/standard/tests/zend_logo_guid.phpt deleted file mode 100644 index d26ed45e9e3..00000000000 --- a/ext/standard/tests/zend_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Checking the zend_logo_guid() functio ---CREDITS-- -Sebastian Schürmann -sschuermann@chip.de -Testfest 2009 Munich ---FILE-- - ---EXPECT-- -PHPE9568F35-D428-11d2-A769-00AA001ACF42 diff --git a/main/logos.h b/main/logos.h deleted file mode 100644 index 3b65cbbcf32..00000000000 --- a/main/logos.h +++ /dev/null @@ -1,1080 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif" - -static const unsigned char zend_logo[] = { - 71, 73, 70, 56, 57, 97, 113, 0, 72, 0, - 213, 0, 0, 13, 13, 14, 1, 3, 6, 2, - 5, 9, 46, 68, 94, 21, 29, 39, 5, 15, - 26, 4, 10, 17, 29, 43, 58, 0, 1, 2, - 9, 25, 42, 38, 105, 171, 24, 67, 109, 13, - 36, 59, 10, 27, 45, 9, 25, 41, 35, 96, - 157, 32, 87, 142, 29, 79, 130, 26, 70, 114, - 20, 54, 87, 29, 77, 124, 10, 26, 42, 34, - 88, 141, 10, 24, 38, 11, 26, 41, 1, 2, - 3, 55, 80, 105, 45, 63, 81, 49, 53, 57, - 5, 15, 24, 9, 26, 42, 30, 85, 138, 33, - 92, 149, 26, 73, 117, 10, 28, 45, 32, 89, - 142, 30, 84, 134, 26, 72, 115, 15, 42, 67, - 23, 62, 99, 12, 32, 51, 7, 21, 33, 9, - 26, 41, 8, 23, 35, 7, 25, 37, 51, 58, - 63, 2, 4, 5, 25, 26, 26, 49, 50, 50, - 255, 102, 0, 255, 255, 255, 204, 204, 204, 199, - 199, 199, 191, 191, 191, 171, 171, 171, 146, 146, - 146, 115, 115, 115, 85, 85, 85, 60, 60, 60, - 55, 55, 55, 38, 38, 38, 7, 7, 7, 3, - 3, 3, 0, 0, 0, 44, 0, 0, 0, 0, - 113, 0, 72, 0, 0, 6, 255, 192, 153, 112, - 72, 44, 26, 143, 200, 164, 114, 121, 252, 49, - 159, 208, 168, 148, 248, 171, 58, 167, 210, 171, - 208, 170, 197, 122, 191, 70, 109, 23, 140, 236, - 138, 201, 232, 239, 121, 102, 221, 186, 217, 219, - 171, 83, 46, 110, 15, 207, 235, 180, 190, 124, - 135, 187, 229, 127, 127, 128, 112, 121, 108, 118, - 132, 123, 137, 77, 118, 120, 136, 115, 109, 117, - 85, 126, 147, 147, 128, 99, 138, 137, 99, 107, - 146, 146, 148, 133, 159, 125, 136, 152, 163, 151, - 135, 121, 144, 84, 157, 92, 169, 157, 111, 163, - 175, 176, 83, 151, 177, 180, 181, 161, 182, 184, - 185, 186, 187, 188, 189, 67, 54, 56, 58, 56, - 53, 190, 197, 88, 55, 57, 60, 63, 2, 43, - 2, 56, 198, 208, 74, 192, 58, 0, 63, 5, - 12, 11, 35, 35, 12, 47, 209, 222, 67, 53, - 201, 203, 34, 19, 20, 218, 231, 37, 63, 54, - 223, 222, 60, 2, 216, 231, 241, 231, 206, 76, - 193, 55, 236, 176, 63, 39, 242, 252, 35, 40, - 58, 75, 114, 8, 40, 240, 227, 25, 62, 76, - 60, 24, 244, 147, 55, 161, 202, 11, 24, 57, - 134, 17, 201, 241, 99, 130, 191, 130, 7, 21, - 225, 48, 176, 48, 30, 137, 5, 11, 38, 48, - 88, 81, 5, 198, 51, 138, 22, 181, 53, 52, - 152, 49, 141, 141, 31, 230, 58, 46, 60, 129, - 194, 74, 202, 115, 43, 91, 234, 1, 112, 83, - 102, 63, 255, 18, 38, 122, 226, 252, 145, 67, - 39, 153, 26, 47, 68, 248, 92, 186, 176, 97, - 81, 163, 88, 108, 188, 48, 80, 130, 169, 85, - 134, 68, 161, 74, 177, 1, 160, 0, 137, 171, - 96, 135, 62, 213, 186, 132, 171, 215, 176, 104, - 71, 52, 188, 71, 54, 9, 210, 179, 105, 195, - 166, 99, 219, 214, 198, 58, 34, 48, 12, 124, - 213, 38, 163, 175, 223, 191, 50, 22, 132, 216, - 139, 182, 132, 0, 30, 196, 250, 218, 37, 70, - 198, 198, 141, 199, 144, 31, 223, 253, 114, 163, - 10, 0, 97, 192, 126, 100, 59, 7, 24, 176, - 10, 20, 229, 210, 146, 48, 128, 88, 72, 223, - 28, 57, 38, 111, 197, 17, 163, 181, 235, 215, - 58, 116, 68, 100, 60, 5, 134, 136, 18, 19, - 80, 24, 168, 162, 48, 94, 95, 21, 6, 82, - 168, 80, 209, 215, 128, 1, 20, 39, 8, 95, - 37, 81, 160, 180, 105, 25, 177, 233, 62, 1, - 246, 186, 186, 245, 24, 209, 177, 84, 140, 71, - 97, 130, 114, 109, 33, 76, 48, 152, 176, 192, - 111, 135, 20, 222, 211, 54, 167, 61, 163, 111, - 246, 39, 55, 174, 203, 175, 254, 30, 74, 229, - 152, 62, 73, 132, 24, 60, 162, 47, 131, 14, - 12, 132, 224, 155, 95, 130, 145, 208, 89, 129, - 40, 116, 211, 25, 12, 58, 72, 135, 68, 124, - 214, 197, 38, 161, 14, 243, 73, 200, 222, 18, - 27, 161, 213, 215, 4, 159, 37, 199, 255, 25, - 96, 12, 116, 230, 223, 9, 11, 252, 32, 226, - 11, 13, 74, 35, 223, 132, 19, 174, 24, 27, - 75, 76, 192, 128, 66, 88, 126, 161, 160, 66, - 122, 124, 201, 112, 2, 3, 195, 125, 54, 65, - 95, 29, 4, 87, 227, 9, 126, 233, 192, 3, - 12, 125, 161, 232, 160, 93, 207, 184, 200, 98, - 139, 17, 74, 24, 197, 118, 96, 249, 7, 160, - 128, 31, 242, 72, 30, 72, 33, 244, 149, 2, - 122, 229, 201, 0, 224, 105, 60, 52, 216, 23, - 131, 14, 226, 96, 194, 1, 78, 74, 152, 195, - 13, 196, 208, 192, 90, 148, 177, 217, 7, 83, - 149, 50, 112, 136, 220, 94, 34, 22, 216, 159, - 12, 195, 101, 227, 37, 113, 50, 192, 0, 3, - 156, 238, 165, 72, 196, 11, 21, 178, 184, 228, - 117, 19, 66, 145, 225, 85, 53, 222, 72, 152, - 136, 42, 152, 32, 224, 111, 42, 8, 10, 40, - 161, 101, 222, 96, 67, 95, 61, 40, 58, 3, - 13, 55, 24, 112, 221, 101, 19, 226, 64, 131, - 17, 54, 64, 42, 229, 19, 50, 226, 249, 95, - 128, 127, 238, 23, 166, 113, 194, 105, 250, 103, - 160, 191, 18, 90, 232, 13, 59, 0, 249, 130, - 168, 56, 160, 198, 195, 10, 214, 161, 144, 1, - 131, 245, 21, 1, 33, 125, 177, 141, 181, 4, - 149, 76, 137, 232, 23, 3, 38, 132, 9, 216, - 9, 93, 126, 234, 105, 160, 34, 94, 208, 129, - 14, 7, 152, 112, 255, 2, 4, 40, 84, 80, - 157, 8, 30, 176, 154, 195, 133, 68, 200, 250, - 34, 124, 119, 102, 171, 109, 113, 157, 142, 16, - 238, 111, 160, 113, 58, 110, 167, 38, 252, 213, - 192, 193, 12, 72, 32, 193, 3, 15, 128, 192, - 128, 7, 175, 121, 32, 66, 7, 101, 230, 240, - 42, 18, 53, 216, 171, 131, 106, 73, 224, 32, - 0, 88, 221, 217, 216, 227, 200, 190, 234, 39, - 210, 112, 12, 36, 23, 158, 175, 254, 154, 160, - 105, 9, 5, 236, 88, 129, 7, 41, 83, 240, - 65, 195, 32, 56, 236, 128, 107, 14, 36, 208, - 64, 10, 24, 41, 161, 177, 181, 74, 84, 182, - 194, 4, 85, 45, 181, 239, 134, 11, 236, 165, - 31, 151, 95, 233, 199, 223, 8, 82, 27, 40, - 3, 9, 39, 144, 56, 24, 4, 92, 119, 61, - 129, 3, 96, 135, 221, 128, 8, 12, 0, 64, - 239, 47, 26, 59, 88, 52, 53, 227, 132, 182, - 208, 210, 128, 178, 76, 163, 12, 46, 135, 208, - 245, 221, 92, 3, 21, 54, 216, 9, 152, 208, - 48, 64, 72, 12, 237, 197, 52, 0, 152, 208, - 209, 111, 193, 141, 204, 239, 102, 104, 45, 96, - 128, 9, 20, 224, 45, 249, 215, 97, 51, 240, - 1, 8, 10, 152, 80, 20, 14, 56, 208, 213, - 38, 199, 181, 245, 214, 207, 111, 96, 130, 4, - 146, 72, 114, 135, 69, 194, 10, 38, 64, 0, - 130, 228, 120, 71, 240, 181, 8, 145, 67, 240, - 255, 128, 2, 44, 164, 0, 26, 2, 66, 180, - 9, 163, 23, 56, 20, 112, 184, 184, 242, 232, - 119, 224, 212, 127, 18, 56, 152, 95, 14, 252, - 8, 88, 129, 120, 255, 37, 216, 205, 17, 68, - 160, 192, 3, 24, 212, 64, 131, 198, 58, 92, - 12, 70, 101, 223, 125, 8, 172, 60, 218, 166, - 252, 149, 136, 41, 251, 21, 64, 249, 201, 117, - 221, 89, 202, 151, 131, 112, 251, 9, 211, 194, - 54, 161, 218, 88, 212, 128, 237, 128, 207, 35, - 15, 164, 144, 125, 65, 78, 141, 206, 3, 164, - 0, 245, 69, 0, 34, 248, 95, 10, 134, 68, - 2, 8, 244, 101, 71, 97, 3, 77, 237, 70, - 240, 0, 18, 248, 110, 15, 58, 80, 10, 63, - 48, 37, 55, 47, 129, 169, 128, 86, 10, 152, - 12, 132, 19, 166, 2, 36, 112, 132, 31, 20, - 83, 128, 28, 40, 3, 6, 52, 207, 116, 91, - 227, 218, 3, 218, 68, 52, 50, 224, 32, 95, - 228, 147, 1, 175, 134, 211, 65, 226, 13, 138, - 116, 222, 249, 77, 1, 10, 38, 3, 7, 52, - 160, 47, 96, 91, 0, 11, 83, 224, 128, 62, - 197, 176, 107, 32, 224, 222, 217, 192, 240, 130, - 25, 109, 16, 133, 91, 242, 159, 15, 63, 37, - 176, 63, 25, 64, 0, 68, 108, 128, 7, 144, - 232, 0, 37, 146, 81, 68, 14, 208, 20, 20, - 163, 72, 167, 216, 128, 14, 85, 201, 66, 205, - 155, 110, 224, 61, 37, 220, 255, 16, 63, 226, - 235, 215, 135, 194, 5, 44, 78, 249, 5, 61, - 86, 251, 65, 5, 36, 208, 23, 15, 52, 177, - 136, 101, 100, 97, 18, 195, 197, 171, 52, 218, - 205, 117, 51, 108, 163, 169, 132, 16, 171, 54, - 118, 174, 142, 69, 48, 75, 248, 224, 22, 162, - 45, 146, 171, 51, 8, 160, 221, 25, 17, 105, - 70, 82, 90, 237, 91, 131, 137, 164, 37, 137, - 80, 73, 238, 221, 11, 86, 93, 9, 95, 242, - 180, 101, 128, 46, 10, 236, 148, 126, 177, 6, - 5, 70, 153, 68, 69, 38, 18, 2, 255, 42, - 34, 104, 34, 160, 74, 106, 9, 99, 8, 245, - 51, 230, 147, 126, 55, 131, 26, 196, 178, 35, - 225, 25, 153, 52, 131, 82, 55, 240, 84, 19, - 107, 60, 234, 11, 0, 12, 16, 1, 16, 148, - 160, 110, 43, 123, 100, 56, 243, 22, 2, 145, - 128, 45, 101, 16, 152, 15, 118, 44, 54, 131, - 100, 218, 239, 73, 111, 58, 66, 13, 120, 0, - 151, 133, 60, 205, 116, 248, 20, 12, 5, 246, - 227, 52, 126, 106, 195, 120, 50, 56, 146, 1, - 46, 247, 1, 126, 86, 141, 156, 79, 132, 192, - 61, 67, 240, 1, 117, 182, 6, 85, 141, 90, - 38, 232, 134, 176, 17, 89, 198, 165, 35, 134, - 17, 70, 14, 92, 32, 63, 134, 141, 224, 117, - 176, 11, 105, 215, 44, 232, 208, 136, 178, 72, - 34, 118, 212, 203, 69, 173, 226, 148, 26, 216, - 133, 7, 255, 39, 80, 192, 4, 102, 42, 191, - 17, 136, 52, 164, 37, 109, 211, 253, 48, 137, - 49, 122, 90, 116, 165, 255, 100, 64, 86, 40, - 74, 128, 22, 0, 224, 6, 48, 152, 128, 2, - 64, 122, 211, 187, 229, 84, 153, 142, 226, 169, - 18, 230, 41, 128, 164, 1, 149, 31, 37, 98, - 166, 93, 134, 192, 129, 133, 49, 181, 169, 36, - 125, 234, 147, 36, 68, 71, 47, 80, 213, 170, - 252, 32, 79, 92, 232, 177, 4, 14, 80, 32, - 103, 77, 229, 218, 83, 177, 51, 214, 6, 73, - 53, 10, 103, 237, 71, 67, 126, 96, 0, 164, - 133, 69, 4, 128, 147, 134, 15, 72, 240, 85, - 174, 229, 236, 176, 175, 203, 105, 93, 223, 116, - 215, 41, 228, 53, 30, 43, 177, 65, 14, 94, - 80, 133, 21, 160, 64, 93, 75, 153, 0, 0, - 158, 224, 130, 19, 60, 224, 110, 57, 99, 216, - 237, 74, 0, 130, 8, 120, 192, 3, 99, 243, - 192, 97, 234, 58, 161, 120, 42, 226, 177, 106, - 9, 26, 37, 57, 167, 131, 23, 8, 207, 39, - 20, 248, 1, 254, 136, 80, 3, 20, 44, 21, - 180, 32, 32, 79, 4, 80, 16, 128, 11, 64, - 64, 4, 34, 80, 65, 7, 94, 80, 38, 214, - 202, 102, 183, 105, 168, 1, 12, 170, 26, 219, - 26, 34, 19, 135, 29, 41, 128, 117, 137, 128, - 3, 9, 252, 214, 176, 15, 24, 64, 15, 56, - 247, 12, 24, 168, 75, 4, 6, 0, 135, 192, - 14, 156, 139, 82, 90, 8, 164, 38, 219, 29, - 2, 79, 150, 194, 0, 24, 44, 97, 7, 22, - 184, 29, 195, 58, 106, 223, 58, 230, 160, 156, - 68, 89, 108, 89, 115, 145, 3, 147, 48, 33, - 131, 50, 89, 0, 3, 4, 16, 95, 33, 220, - 224, 5, 26, 64, 193, 91, 111, 167, 57, 35, - 132, 35, 53, 148, 116, 12, 100, 166, 248, 13, - 143, 241, 163, 59, 34, 16, 192, 15, 120, 208, - 222, 36, 208, 192, 49, 63, 216, 192, 9, 36, - 192, 128, 137, 114, 152, 44, 47, 217, 140, 130, - 9, 114, 25, 28, 76, 148, 9, 162, 2, 128, - 141, 219, 50, 5, 122, 134, 120, 196, 174, 141, - 46, 143, 167, 96, 131, 23, 221, 120, 200, 72, - 214, 74, 16, 0, 0, 59 }; - -static const unsigned char php_logo[] = { - 71, 73, 70, 56, 57, 97, 120, 0, 67, 0, - 230, 106, 0, 127, 130, 184, 57, 55, 71, 40, - 37, 42, 204, 205, 226, 161, 164, 203, 211, 213, - 231, 178, 180, 212, 67, 66, 88, 131, 134, 185, - 130, 131, 179, 82, 82, 114, 144, 146, 194, 194, - 196, 222, 170, 172, 208, 76, 75, 99, 91, 92, - 131, 221, 222, 236, 59, 56, 60, 110, 113, 165, - 106, 109, 157, 97, 99, 141, 117, 121, 177, 123, - 126, 181, 229, 230, 240, 153, 156, 198, 140, 141, - 193, 185, 186, 217, 107, 107, 146, 78, 78, 107, - 113, 116, 169, 122, 122, 163, 136, 139, 189, 114, - 116, 163, 116, 115, 152, 142, 144, 193, 90, 91, - 126, 226, 227, 239, 123, 125, 173, 164, 165, 208, - 109, 112, 162, 114, 118, 172, 149, 150, 200, 187, - 189, 217, 116, 120, 174, 133, 136, 187, 146, 149, - 195, 216, 217, 234, 146, 146, 196, 100, 102, 146, - 107, 110, 159, 165, 168, 206, 148, 150, 197, 46, - 43, 47, 83, 81, 104, 179, 180, 215, 108, 106, - 140, 92, 91, 118, 138, 141, 191, 102, 104, 150, - 104, 106, 154, 156, 159, 200, 49, 46, 57, 174, - 176, 211, 156, 156, 205, 85, 86, 120, 158, 161, - 202, 150, 153, 197, 129, 130, 175, 103, 105, 151, - 63, 61, 80, 188, 190, 218, 94, 96, 137, 152, - 153, 200, 140, 142, 191, 137, 138, 186, 87, 88, - 124, 182, 183, 215, 213, 215, 232, 34, 30, 32, - 108, 111, 158, 206, 208, 228, 191, 192, 220, 119, - 123, 180, 118, 120, 167, 95, 94, 125, 153, 153, - 204, 110, 111, 152, 115, 119, 174, 34, 30, 31, - 255, 255, 255, 144, 142, 143, 89, 86, 87, 199, - 198, 199, 238, 238, 245, 213, 212, 213, 246, 246, - 250, 130, 128, 129, 172, 170, 171, 116, 114, 115, - 241, 240, 241, 158, 156, 157, 227, 226, 227, 75, - 72, 73, 185, 184, 185, 103, 100, 101, 137, 137, - 182, 0, 255, 0, 71, 70, 95, 223, 224, 237, - 155, 156, 204, 105, 107, 156, 111, 115, 167, 140, - 140, 186, 184, 185, 217, 184, 186, 215, 154, 155, - 204, 167, 170, 207, 219, 220, 235, 154, 156, 201, - 102, 100, 132, 104, 103, 137, 167, 168, 210, 110, - 112, 160, 139, 139, 185, 198, 199, 224, 199, 201, - 225, 105, 108, 156, 151, 152, 203, 33, 249, 4, - 1, 0, 0, 106, 0, 44, 0, 0, 0, 0, - 120, 0, 67, 0, 0, 7, 255, 128, 106, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 150, 109, 63, 109, 115, 152, 158, 159, 160, - 63, 121, 121, 54, 62, 26, 113, 76, 26, 26, - 76, 6, 62, 62, 13, 50, 4, 65, 60, 24, - 66, 45, 11, 73, 34, 57, 31, 25, 57, 34, - 47, 41, 160, 194, 161, 13, 26, 12, 125, 77, - 5, 80, 80, 3, 125, 124, 12, 81, 81, 42, - 114, 172, 175, 116, 177, 179, 66, 51, 45, 186, - 31, 8, 0, 22, 22, 21, 87, 40, 37, 22, - 9, 25, 193, 195, 235, 140, 38, 113, 124, 46, - 108, 108, 16, 16, 117, 46, 201, 3, 212, 50, - 179, 34, 31, 254, 44, 0, 17, 8, 4, 64, - 176, 224, 55, 130, 225, 164, 172, 64, 241, 70, - 194, 9, 63, 59, 158, 76, 25, 146, 132, 157, - 69, 53, 65, 108, 12, 96, 67, 226, 130, 71, - 18, 36, 242, 53, 16, 178, 64, 138, 201, 147, - 40, 83, 170, 92, 121, 114, 92, 7, 9, 19, - 118, 232, 128, 65, 225, 8, 5, 43, 67, 68, - 92, 196, 20, 132, 9, 20, 142, 30, 47, 184, - 48, 66, 167, 5, 203, 163, 72, 147, 162, 188, - 242, 38, 6, 140, 35, 71, 30, 140, 88, 114, - 196, 131, 206, 157, 144, 126, 104, 116, 1, 129, - 35, 4, 35, 4, 88, 40, 29, 75, 54, 233, - 149, 19, 58, 30, 44, 1, 162, 64, 193, 136, - 41, 51, 255, 176, 46, 50, 161, 161, 64, 19, - 23, 117, 10, 24, 72, 82, 182, 175, 95, 164, - 29, 96, 44, 81, 192, 129, 131, 3, 60, 9, - 228, 26, 202, 19, 101, 0, 148, 2, 3, 124, - 228, 248, 187, 114, 1, 134, 203, 152, 49, 124, - 160, 156, 244, 13, 5, 5, 14, 214, 172, 81, - 224, 65, 177, 154, 60, 70, 248, 244, 25, 192, - 100, 6, 231, 149, 31, 178, 112, 153, 77, 155, - 75, 151, 215, 74, 221, 44, 89, 115, 224, 128, - 131, 16, 59, 221, 69, 97, 192, 160, 1, 2, - 220, 43, 49, 112, 193, 194, 188, 185, 153, 219, - 200, 147, 118, 216, 93, 164, 200, 154, 210, 195, - 126, 248, 144, 99, 68, 5, 15, 11, 209, 87, - 170, 32, 211, 188, 185, 152, 2, 225, 149, 94, - 121, 112, 32, 64, 0, 14, 112, 64, 153, 48, - 192, 68, 14, 1, 0, 233, 87, 22, 16, 83, - 158, 57, 25, 21, 249, 41, 245, 134, 2, 238, - 245, 112, 7, 38, 115, 208, 225, 131, 1, 50, - 28, 23, 160, 74, 93, 152, 209, 31, 22, 92, - 16, 240, 160, 82, 49, 172, 209, 67, 15, 7, - 236, 81, 201, 15, 50, 52, 208, 64, 73, 23, - 166, 4, 64, 22, 19, 98, 145, 197, 102, 37, - 38, 245, 64, 0, 27, 2, 39, 73, 27, 4, - 236, 227, 96, 139, 39, 41, 55, 161, 25, 95, - 224, 168, 148, 31, 69, 208, 64, 3, 21, 145, - 216, 17, 4, 1, 51, 128, 135, 212, 255, 7, - 153, 53, 217, 36, 139, 71, 169, 16, 198, 132, - 98, 92, 208, 36, 137, 44, 49, 233, 228, 150, - 248, 141, 133, 130, 3, 52, 8, 80, 195, 35, - 72, 96, 16, 4, 148, 71, 125, 240, 69, 22, - 108, 182, 233, 230, 155, 89, 116, 81, 64, 3, - 93, 162, 84, 0, 24, 19, 146, 1, 103, 155, - 23, 12, 96, 225, 73, 11, 236, 41, 40, 155, - 93, 12, 208, 128, 82, 64, 8, 32, 128, 3, - 141, 204, 32, 4, 6, 98, 41, 69, 192, 114, - 41, 86, 106, 6, 24, 92, 124, 1, 32, 74, - 93, 108, 81, 105, 138, 52, 108, 161, 69, 25, - 93, 144, 104, 192, 148, 159, 78, 184, 5, 24, - 94, 116, 113, 40, 82, 35, 8, 224, 4, 163, - 138, 108, 35, 196, 141, 73, 141, 151, 234, 167, - 91, 120, 1, 65, 151, 39, 238, 250, 41, 24, - 99, 96, 32, 197, 0, 120, 10, 171, 106, 25, - 3, 36, 53, 130, 19, 78, 224, 144, 72, 10, - 34, 180, 128, 102, 82, 16, 240, 167, 108, 138, - 97, 64, 96, 18, 6, 94, 108, 155, 34, 26, - 183, 93, 224, 169, 184, 229, 209, 224, 69, 179, - 72, 173, 1, 45, 118, 133, 252, 225, 203, 100, - 101, 125, 33, 33, 186, 253, 121, 1, 160, 148, - 248, 230, 219, 0, 138, 253, 54, 71, 67, 25, - 127, 30, 21, 128, 19, 2, 44, 96, 72, 63, - 244, 146, 21, 91, 192, 229, 109, 209, 227, 157, - 16, 51, 167, 197, 255, 5, 225, 86, 140, 133, - 24, 208, 29, 213, 129, 172, 99, 18, 146, 2, - 2, 31, 212, 57, 214, 164, 59, 194, 57, 198, - 25, 218, 78, 232, 5, 1, 157, 78, 200, 197, - 155, 99, 112, 129, 70, 138, 90, 100, 129, 106, - 196, 112, 150, 113, 198, 185, 19, 150, 129, 37, - 75, 10, 64, 155, 6, 33, 222, 224, 58, 150, - 174, 253, 137, 225, 45, 74, 11, 52, 208, 5, - 121, 19, 106, 193, 0, 192, 253, 173, 136, 18, - 6, 13, 124, 17, 65, 213, 89, 104, 81, 53, - 187, 128, 26, 240, 69, 178, 253, 133, 97, 128, - 82, 52, 204, 58, 200, 31, 0, 32, 160, 100, - 89, 217, 230, 185, 169, 137, 89, 124, 221, 116, - 22, 25, 151, 199, 227, 74, 16, 0, 221, 92, - 206, 130, 51, 119, 198, 218, 42, 125, 48, 6, - 206, 119, 31, 181, 4, 180, 10, 171, 33, 130, - 5, 38, 147, 101, 175, 204, 5, 167, 20, 184, - 170, 58, 83, 249, 116, 74, 49, 247, 119, 70, - 22, 52, 4, 109, 236, 74, 161, 151, 167, 69, - 227, 44, 117, 0, 237, 13, 130, 176, 144, 80, - 95, 15, 79, 56, 198, 181, 39, 109, 222, 31, - 26, 89, 160, 221, 220, 127, 42, 5, 27, 116, - 25, 19, 210, 144, 197, 81, 169, 15, 206, 58, - 75, 69, 184, 173, 70, 56, 115, 147, 133, 114, - 127, 17, 244, 200, 210, 229, 253, 17, 142, 185, - 74, 224, 22, 159, 197, 25, 170, 94, 112, 20, - 255, 214, 229, 1, 175, 20, 7, 78, 244, 32, - 72, 5, 148, 49, 93, 30, 26, 159, 167, 84, - 123, 218, 228, 55, 119, 187, 74, 252, 246, 183, - 69, 216, 99, 179, 132, 1, 241, 219, 83, 10, - 5, 160, 37, 136, 21, 80, 166, 110, 217, 91, - 158, 73, 12, 0, 190, 160, 245, 173, 57, 213, - 211, 143, 239, 152, 3, 134, 44, 20, 14, 11, - 135, 99, 9, 3, 168, 214, 159, 251, 9, 144, - 128, 41, 184, 2, 251, 252, 130, 189, 242, 84, - 136, 37, 201, 99, 78, 4, 58, 183, 187, 248, - 157, 36, 133, 88, 8, 3, 233, 76, 183, 18, - 0, 120, 109, 66, 228, 34, 203, 0, 157, 32, - 8, 20, 24, 176, 47, 194, 235, 32, 238, 142, - 69, 169, 236, 245, 174, 106, 203, 11, 98, 121, - 188, 0, 192, 116, 29, 79, 63, 28, 44, 79, - 24, 20, 184, 146, 29, 10, 162, 3, 40, 24, - 33, 89, 116, 68, 189, 39, 162, 228, 3, 5, - 240, 66, 233, 250, 67, 131, 49, 124, 225, 130, - 39, 76, 73, 247, 38, 244, 189, 240, 113, 15, - 2, 98, 156, 80, 245, 42, 119, 20, 43, 170, - 97, 33, 90, 92, 90, 20, 153, 67, 46, 21, - 248, 81, 5, 16, 232, 194, 24, 180, 48, 70, - 209, 13, 160, 126, 204, 241, 32, 74, 242, 199, - 51, 177, 101, 175, 11, 127, 4, 100, 23, 202, - 224, 72, 153, 81, 113, 37, 232, 83, 223, 243, - 58, 112, 133, 190, 236, 71, 255, 85, 90, 8, - 101, 40, 197, 112, 175, 20, 137, 225, 11, 4, - 120, 160, 10, 189, 104, 167, 9, 98, 161, 130, - 23, 20, 149, 40, 181, 64, 202, 97, 137, 175, - 44, 205, 163, 213, 7, 222, 208, 129, 190, 68, - 72, 99, 104, 248, 194, 2, 78, 133, 67, 23, - 154, 196, 92, 19, 146, 97, 33, 3, 118, 202, - 161, 73, 231, 117, 130, 72, 129, 4, 222, 240, - 67, 165, 40, 177, 95, 205, 60, 150, 43, 173, - 182, 18, 68, 98, 129, 137, 26, 3, 131, 48, - 251, 242, 56, 39, 68, 238, 121, 18, 232, 229, - 88, 214, 216, 47, 26, 156, 97, 156, 82, 64, - 102, 127, 184, 240, 170, 173, 169, 146, 57, 109, - 12, 88, 4, 206, 112, 1, 103, 178, 205, 121, - 130, 120, 193, 9, 36, 208, 73, 165, 48, 82, - 92, 102, 32, 195, 24, 6, 80, 167, 25, 118, - 208, 159, 196, 212, 31, 255, 240, 101, 6, 25, - 50, 128, 142, 73, 41, 154, 19, 142, 70, 136, - 33, 156, 224, 13, 99, 161, 152, 254, 102, 57, - 75, 50, 112, 97, 12, 133, 66, 83, 160, 72, - 26, 74, 86, 158, 68, 5, 92, 96, 233, 232, - 46, 40, 6, 150, 134, 210, 164, 40, 101, 192, - 16, 165, 3, 50, 67, 164, 224, 4, 39, 80, - 39, 82, 96, 200, 133, 11, 208, 131, 30, 5, - 248, 35, 1, 252, 105, 18, 64, 30, 245, 168, - 153, 3, 212, 0, 158, 74, 143, 67, 46, 147, - 57, 94, 255, 48, 234, 81, 147, 234, 71, 2, - 236, 116, 44, 7, 75, 216, 33, 146, 16, 131, - 19, 160, 0, 41, 215, 76, 36, 83, 125, 36, - 133, 5, 52, 177, 60, 89, 192, 40, 114, 220, - 229, 4, 120, 25, 34, 1, 101, 45, 104, 114, - 238, 185, 66, 182, 178, 164, 1, 13, 140, 88, - 199, 242, 83, 78, 105, 41, 162, 4, 121, 101, - 201, 65, 249, 104, 76, 191, 74, 129, 1, 149, - 108, 14, 24, 208, 19, 160, 114, 210, 106, 17, - 136, 53, 171, 4, 171, 198, 0, 199, 170, 68, - 119, 82, 188, 36, 101, 52, 122, 89, 70, 148, - 96, 2, 49, 232, 64, 30, 165, 64, 212, 122, - 122, 214, 36, 121, 115, 217, 233, 162, 211, 129, - 3, 64, 171, 180, 141, 72, 0, 106, 37, 160, - 197, 180, 98, 97, 12, 107, 245, 209, 2, 22, - 199, 70, 185, 250, 133, 8, 61, 128, 150, 97, - 35, 161, 132, 39, 76, 64, 179, 82, 248, 223, - 22, 166, 75, 93, 222, 189, 214, 158, 212, 165, - 46, 24, 6, 251, 26, 5, 200, 74, 0, 50, - 154, 196, 11, 64, 224, 135, 24, 240, 22, 0, - 5, 160, 42, 61, 16, 119, 93, 41, 160, 87, - 189, 16, 112, 45, 101, 136, 112, 48, 39, 68, - 128, 163, 150, 72, 128, 27, 80, 251, 134, 213, - 182, 215, 175, 39, 176, 173, 114, 65, 241, 130, - 41, 248, 1, 181, 170, 253, 175, 95, 81, 192, - 1, 89, 57, 161, 8, 248, 5, 133, 255, 18, - 244, 224, 134, 3, 247, 87, 193, 37, 58, 193, - 26, 28, 220, 131, 240, 178, 131, 5, 20, 62, - 176, 4, 206, 138, 225, 240, 28, 225, 0, 138, - 18, 64, 15, 96, 167, 24, 22, 128, 96, 7, - 110, 112, 67, 12, 168, 89, 98, 202, 248, 129, - 3, 1, 8, 147, 0, 2, 192, 98, 211, 8, - 34, 9, 37, 32, 194, 14, 96, 60, 1, 26, - 215, 56, 41, 19, 32, 80, 15, 132, 36, 38, - 187, 250, 120, 16, 41, 72, 128, 30, 116, 64, - 4, 33, 187, 33, 168, 254, 197, 240, 27, 142, - 128, 227, 13, 45, 185, 8, 120, 120, 193, 147, - 23, 241, 2, 41, 235, 224, 204, 103, 222, 193, - 71, 73, 124, 221, 29, 28, 65, 1, 237, 129, - 209, 134, 14, 112, 3, 15, 141, 249, 17, 47, - 64, 192, 20, 136, 0, 131, 62, 251, 153, 8, - 126, 248, 168, 80, 243, 51, 1, 34, 60, 0, - 52, 213, 113, 143, 162, 113, 16, 2, 59, 223, - 153, 18, 34, 24, 194, 158, 41, 64, 233, 74, - 83, 250, 8, 125, 174, 112, 160, 223, 192, 105, - 78, 75, 224, 211, 159, 6, 42, 80, 137, 112, - 105, 182, 136, 166, 55, 7, 168, 78, 17, 2, - 112, 0, 28, 108, 32, 49, 143, 22, 70, 10, - 62, 80, 2, 16, 88, 1, 42, 80, 121, 128, - 174, 119, 61, 149, 37, 172, 5, 8, 108, 105, - 11, 97, 10, 99, 152, 208, 156, 186, 55, 69, - 80, 0, 21, 110, 56, 48, 4, 49, 199, 90, - 49, 41, 80, 2, 2, 60, 224, 129, 13, 108, - 32, 45, 190, 6, 118, 176, 219, 66, 108, 195, - 112, 128, 10, 35, 24, 129, 21, 172, 80, 130, - 102, 63, 251, 220, 139, 16, 65, 26, 16, 112, - 21, 116, 187, 251, 221, 240, 142, 119, 188, 3, - 1, 0, 59, 0 }; - -static const unsigned char php_egg_logo[] = { - 71, 73, 70, 56, 57, 97, 120, 0, 67, 0, - 231, 255, 0, 18, 25, 33, 32, 30, 34, 28, - 33, 44, 15, 35, 71, 6, 37, 85, 37, 40, - 47, 34, 41, 53, 41, 40, 43, 9, 47, 109, - 30, 45, 68, 21, 48, 84, 51, 46, 55, 43, - 49, 59, 31, 59, 98, 15, 61, 128, 58, 55, - 69, 50, 57, 74, 0, 66, 144, 56, 58, 60, - 54, 59, 71, 32, 66, 113, 60, 65, 67, 63, - 65, 84, 63, 68, 79, 28, 79, 145, 15, 82, - 162, 75, 72, 98, 68, 78, 86, 74, 77, 88, - 50, 82, 122, 41, 85, 134, 76, 78, 108, 70, - 83, 101, 5, 94, 190, 0, 95, 197, 86, 80, - 101, 28, 92, 159, 80, 84, 96, 83, 83, 115, - 81, 87, 89, 22, 97, 183, 86, 88, 85, 0, - 102, 210, 8, 101, 204, 24, 100, 177, 85, 90, - 127, 35, 101, 169, 42, 100, 159, 88, 92, 103, - 0, 107, 216, 69, 95, 132, 0, 108, 210, 84, - 93, 112, 94, 90, 117, 18, 105, 201, 96, 92, - 105, 89, 96, 98, 94, 93, 135, 94, 94, 126, - 30, 106, 210, 7, 112, 222, 33, 108, 198, 16, - 114, 217, 27, 113, 198, 24, 113, 209, 59, 108, - 159, 96, 100, 138, 0, 120, 229, 44, 112, 180, - 49, 112, 171, 71, 108, 148, 99, 104, 115, 90, - 106, 125, 27, 115, 232, 100, 102, 147, 42, 115, - 192, 86, 110, 137, 9, 123, 239, 106, 108, 105, - 105, 105, 138, 33, 118, 228, 12, 125, 227, 48, - 117, 208, 16, 126, 222, 37, 120, 224, 20, 125, - 235, 35, 123, 213, 50, 121, 190, 43, 123, 206, - 40, 123, 220, 105, 110, 160, 59, 122, 182, 78, - 119, 158, 44, 122, 233, 3, 134, 250, 112, 112, - 151, 73, 123, 175, 113, 118, 114, 51, 128, 205, - 34, 129, 246, 11, 136, 245, 34, 130, 240, 113, - 117, 149, 111, 116, 166, 111, 119, 141, 48, 130, - 221, 38, 132, 235, 53, 130, 215, 97, 124, 146, - 116, 122, 124, 117, 121, 131, 54, 130, 229, 41, - 135, 232, 68, 130, 223, 46, 135, 246, 65, 134, - 202, 42, 137, 241, 75, 131, 205, 124, 121, 161, - 101, 125, 191, 86, 128, 210, 121, 122, 169, 105, - 128, 157, 121, 122, 180, 114, 124, 181, 94, 128, - 201, 81, 134, 185, 46, 138, 252, 76, 135, 195, - 34, 142, 252, 62, 137, 229, 63, 138, 217, 33, - 144, 247, 58, 139, 223, 56, 141, 246, 54, 143, - 234, 57, 143, 241, 102, 135, 193, 129, 130, 176, - 122, 136, 144, 46, 148, 252, 45, 149, 246, 118, - 133, 191, 65, 146, 231, 73, 146, 216, 129, 133, - 185, 135, 135, 156, 69, 148, 226, 44, 153, 255, - 94, 143, 216, 132, 136, 175, 88, 146, 207, 137, - 139, 136, 93, 146, 197, 95, 147, 188, 137, 139, - 150, 104, 146, 178, 122, 143, 172, 135, 139, 191, - 57, 156, 254, 67, 154, 245, 70, 154, 239, 134, - 141, 180, 117, 145, 201, 120, 146, 190, 79, 154, - 233, 140, 141, 188, 129, 144, 194, 142, 142, 176, - 137, 147, 156, 88, 155, 222, 82, 157, 230, 93, - 157, 218, 66, 162, 253, 100, 157, 210, 77, 161, - 247, 55, 168, 255, 81, 162, 241, 148, 148, 195, - 145, 149, 202, 127, 156, 204, 77, 166, 255, 142, - 155, 177, 141, 153, 200, 123, 160, 193, 73, 171, - 255, 93, 167, 240, 96, 167, 234, 152, 158, 160, - 101, 167, 228, 119, 164, 206, 155, 158, 171, 110, - 167, 219, 156, 155, 203, 89, 172, 252, 128, 164, - 219, 151, 163, 174, 81, 178, 255, 158, 162, 202, - 102, 175, 249, 93, 178, 251, 108, 175, 237, 103, - 177, 244, 166, 168, 165, 97, 182, 255, 87, 185, - 255, 149, 174, 216, 125, 181, 235, 110, 185, 252, - 117, 183, 254, 171, 172, 209, 166, 175, 197, 103, - 190, 255, 174, 176, 189, 140, 183, 221, 128, 184, - 248, 120, 187, 249, 179, 180, 184, 115, 193, 253, - 170, 183, 193, 174, 181, 215, 107, 197, 255, 135, - 191, 246, 151, 192, 219, 187, 183, 213, 128, 197, - 253, 121, 202, 255, 147, 198, 239, 188, 191, 219, - 148, 200, 252, 192, 193, 197, 134, 205, 254, 171, - 199, 236, 183, 199, 218, 163, 207, 251, 142, 213, - 255, 158, 211, 253, 195, 205, 217, 166, 211, 245, - 205, 204, 228, 153, 218, 255, 190, 210, 236, 186, - 212, 231, 177, 213, 248, 162, 224, 255, 188, 221, - 250, 214, 219, 221, 214, 219, 233, 174, 229, 254, - 198, 225, 247, 209, 226, 248, 186, 233, 251, 227, - 230, 239, 225, 241, 252, 253, 255, 252, 255, 255, - 255, 33, 249, 4, 1, 10, 0, 255, 0, 44, - 0, 0, 0, 0, 120, 0, 67, 0, 0, 8, - 254, 0, 255, 9, 28, 72, 176, 160, 193, 131, - 8, 19, 42, 92, 200, 176, 161, 195, 135, 16, - 35, 74, 156, 72, 177, 162, 197, 139, 22, 131, - 105, 12, 134, 177, 163, 199, 143, 193, 164, 73, - 227, 38, 141, 28, 56, 112, 228, 76, 146, 20, - 41, 205, 152, 75, 99, 183, 100, 201, 50, 101, - 202, 147, 77, 79, 166, 102, 205, 250, 200, 19, - 100, 73, 114, 239, 238, 221, 123, 71, 148, 104, - 202, 163, 224, 86, 138, 124, 25, 115, 166, 205, - 72, 145, 246, 72, 221, 195, 39, 207, 30, 69, - 158, 118, 246, 220, 202, 208, 24, 184, 160, 252, - 248, 9, 29, 59, 212, 100, 75, 99, 53, 159, - 66, 93, 203, 182, 109, 84, 169, 124, 248, 156, - 57, 163, 165, 174, 150, 60, 138, 76, 113, 221, - 251, 207, 24, 183, 119, 97, 3, 135, 125, 71, - 78, 90, 76, 62, 142, 70, 141, 18, 53, 109, - 170, 227, 199, 144, 35, 75, 157, 91, 87, 137, - 229, 28, 74, 190, 228, 229, 139, 209, 43, 96, - 193, 247, 10, 203, 114, 212, 167, 82, 47, 93, - 197, 138, 81, 163, 166, 173, 19, 47, 201, 176, - 99, 59, 166, 171, 36, 135, 237, 22, 45, 114, - 216, 209, 203, 25, 98, 176, 191, 66, 195, 134, - 54, 230, 233, 150, 179, 100, 197, 106, 181, 90, - 158, 171, 57, 179, 110, 231, 124, 185, 145, 77, - 157, 186, 150, 218, 45, 76, 104, 111, 145, 71, - 86, 239, 133, 198, 200, 254, 145, 189, 199, 205, - 212, 212, 115, 244, 232, 157, 107, 86, 172, 185, - 234, 92, 197, 154, 137, 11, 231, 11, 77, 245, - 251, 178, 207, 40, 201, 254, 225, 131, 134, 39, - 138, 124, 103, 80, 73, 68, 13, 37, 141, 39, - 144, 213, 115, 14, 60, 235, 116, 211, 12, 123, - 197, 136, 67, 141, 106, 226, 156, 51, 78, 16, - 92, 208, 194, 7, 126, 28, 70, 166, 159, 9, - 26, 132, 104, 130, 29, 2, 254, 67, 32, 81, - 224, 200, 18, 91, 56, 240, 208, 35, 78, 51, - 238, 49, 40, 223, 58, 240, 88, 99, 132, 31, - 207, 168, 131, 14, 55, 206, 56, 115, 203, 41, - 167, 172, 229, 73, 36, 158, 196, 133, 216, 83, - 29, 58, 166, 69, 11, 26, 88, 96, 129, 6, - 95, 112, 230, 213, 81, 210, 188, 21, 27, 59, - 208, 208, 179, 14, 123, 205, 81, 227, 96, 55, - 235, 208, 227, 14, 23, 126, 244, 162, 204, 49, - 200, 64, 3, 13, 51, 194, 232, 162, 139, 50, - 105, 106, 131, 13, 54, 225, 132, 227, 205, 157, - 207, 96, 243, 204, 48, 195, 244, 72, 28, 126, - 103, 48, 233, 164, 6, 36, 246, 20, 210, 81, - 198, 224, 87, 143, 48, 12, 78, 8, 75, 43, - 242, 21, 3, 38, 60, 227, 116, 224, 2, 22, - 135, 32, 162, 41, 33, 112, 208, 129, 72, 35, - 135, 8, 242, 72, 40, 163, 150, 82, 202, 42, - 186, 172, 178, 203, 46, 169, 170, 154, 76, 50, - 254, 123, 158, 194, 97, 14, 22, 60, 240, 192, - 7, 188, 117, 228, 23, 74, 198, 88, 41, 219, - 56, 189, 36, 19, 203, 57, 235, 80, 147, 11, - 44, 176, 20, 211, 96, 51, 240, 192, 195, 14, - 5, 36, 88, 129, 8, 33, 116, 200, 81, 198, - 181, 101, 208, 1, 199, 27, 220, 110, 59, 69, - 22, 130, 20, 82, 200, 35, 165, 76, 34, 110, - 33, 147, 64, 162, 174, 42, 192, 200, 122, 223, - 25, 38, 216, 186, 192, 19, 24, 133, 52, 82, - 149, 247, 161, 179, 203, 35, 136, 8, 243, 72, - 57, 244, 80, 179, 220, 39, 185, 192, 163, 77, - 55, 244, 236, 227, 14, 5, 17, 0, 65, 7, - 25, 101, 120, 81, 197, 196, 216, 82, 97, 49, - 21, 81, 68, 145, 69, 22, 105, 116, 236, 113, - 26, 161, 148, 59, 136, 24, 98, 64, 210, 203, - 40, 28, 106, 161, 193, 2, 11, 88, 144, 171, - 68, 246, 74, 163, 226, 125, 207, 156, 105, 8, - 25, 212, 54, 218, 202, 39, 4, 227, 115, 142, - 54, 233, 177, 211, 65, 4, 51, 84, 113, 109, - 21, 77, 52, 1, 69, 23, 19, 15, 1, 197, - 16, 84, 12, 17, 197, 182, 112, 8, 146, 198, - 20, 86, 147, 139, 204, 49, 169, 78, 50, 200, - 32, 144, 56, 210, 97, 14, 15, 176, 28, 37, - 204, 198, 180, 228, 107, 108, 158, 60, 19, 202, - 43, 159, 200, 225, 133, 28, 175, 224, 3, 15, - 50, 176, 80, 2, 75, 254, 51, 94, 34, 140, - 143, 208, 68, 119, 129, 45, 210, 93, 48, 13, - 197, 210, 60, 240, 0, 133, 15, 111, 104, 138, - 8, 28, 27, 79, 1, 199, 35, 163, 234, 18, - 139, 155, 233, 206, 177, 97, 202, 22, 28, 112, - 128, 14, 17, 5, 227, 210, 204, 213, 69, 178, - 11, 40, 160, 16, 194, 8, 33, 134, 52, 17, - 142, 122, 197, 236, 156, 11, 51, 185, 52, 3, - 244, 62, 128, 207, 16, 49, 182, 93, 36, 125, - 120, 23, 135, 67, 193, 131, 15, 112, 148, 147, - 143, 58, 216, 8, 3, 249, 198, 89, 192, 1, - 199, 33, 143, 196, 18, 203, 42, 144, 104, 222, - 33, 31, 26, 120, 62, 194, 67, 162, 255, 121, - 159, 35, 149, 104, 58, 135, 21, 100, 64, 92, - 69, 139, 198, 238, 156, 236, 222, 226, 208, 131, - 207, 56, 13, 56, 80, 116, 19, 215, 54, 81, - 197, 24, 73, 23, 126, 248, 16, 62, 248, 144, - 133, 62, 110, 112, 194, 50, 202, 113, 8, 231, - 101, 193, 7, 64, 152, 220, 184, 30, 129, 42, - 93, 168, 66, 108, 29, 50, 129, 231, 52, 208, - 16, 89, 220, 162, 87, 248, 137, 68, 29, 178, - 160, 6, 53, 188, 225, 5, 85, 176, 86, 21, - 232, 1, 15, 113, 228, 98, 57, 173, 104, 143, - 151, 224, 241, 190, 248, 249, 160, 126, 114, 136, - 161, 181, 202, 16, 53, 167, 13, 97, 120, 105, - 184, 7, 7, 12, 224, 4, 111, 192, 65, 114, - 254, 144, 3, 66, 26, 14, 145, 6, 43, 88, - 1, 11, 107, 128, 196, 42, 86, 1, 65, 14, - 181, 224, 0, 1, 160, 160, 66, 100, 114, 139, - 181, 197, 230, 22, 117, 152, 194, 20, 162, 160, - 134, 42, 144, 64, 10, 248, 163, 67, 122, 214, - 17, 187, 79, 232, 45, 23, 226, 16, 7, 62, - 240, 97, 13, 5, 16, 109, 12, 215, 98, 4, - 207, 64, 193, 51, 77, 53, 66, 83, 84, 240, - 65, 26, 218, 113, 1, 3, 180, 1, 27, 144, - 19, 196, 183, 128, 128, 196, 66, 132, 98, 13, - 63, 72, 228, 15, 176, 32, 134, 68, 52, 241, - 62, 45, 8, 64, 0, 106, 144, 144, 89, 152, - 66, 22, 8, 186, 207, 40, 214, 32, 8, 107, - 216, 194, 5, 67, 144, 218, 15, 134, 208, 5, - 68, 184, 15, 30, 205, 120, 148, 25, 97, 1, - 157, 125, 208, 227, 25, 3, 136, 64, 12, 232, - 215, 136, 121, 200, 35, 31, 249, 168, 71, 61, - 242, 33, 143, 118, 108, 67, 30, 208, 128, 195, - 32, 218, 49, 1, 1, 180, 1, 121, 199, 120, - 197, 35, 136, 184, 134, 102, 146, 11, 137, 88, - 80, 228, 37, 104, 145, 36, 13, 72, 178, 80, - 5, 153, 5, 78, 50, 73, 157, 72, 92, 98, - 13, 135, 208, 135, 63, 252, 129, 132, 40, 116, - 193, 105, 192, 11, 5, 62, 92, 217, 140, 157, - 49, 162, 21, 104, 60, 199, 62, 224, 225, 10, - 2, 68, 128, 10, 114, 254, 32, 196, 49, 178, - 113, 129, 11, 112, 224, 159, 37, 224, 192, 6, - 46, 176, 129, 108, 148, 99, 21, 213, 40, 230, - 1, 78, 128, 3, 55, 240, 34, 29, 216, 8, - 197, 36, 122, 81, 10, 114, 61, 2, 93, 107, - 136, 230, 28, 230, 96, 13, 43, 202, 230, 1, - 1, 56, 128, 119, 10, 146, 150, 251, 240, 65, - 21, 88, 200, 194, 60, 198, 233, 143, 84, 164, - 193, 104, 72, 43, 195, 49, 214, 8, 143, 216, - 49, 226, 157, 197, 208, 70, 251, 216, 193, 5, - 2, 100, 160, 10, 129, 64, 4, 54, 54, 81, - 2, 24, 148, 128, 6, 48, 160, 193, 81, 3, - 202, 0, 115, 120, 99, 19, 19, 40, 128, 1, - 74, 208, 79, 6, 20, 32, 12, 222, 8, 133, - 45, 136, 241, 141, 103, 232, 194, 84, 143, 72, - 195, 15, 196, 112, 9, 87, 248, 226, 22, 28, - 58, 3, 20, 183, 71, 144, 89, 16, 201, 163, - 145, 185, 68, 74, 7, 145, 130, 106, 140, 83, - 15, 136, 40, 131, 181, 154, 48, 6, 111, 140, - 145, 61, 173, 72, 214, 131, 210, 83, 41, 2, - 160, 128, 12, 140, 104, 68, 57, 220, 80, 212, - 106, 224, 50, 151, 250, 248, 69, 9, 24, 208, - 6, 126, 28, 225, 2, 1, 32, 70, 53, 126, - 193, 88, 1, 0, 96, 17, 165, 96, 2, 65, - 113, 16, 6, 76, 96, 98, 27, 202, 16, 43, - 89, 51, 193, 10, 82, 108, 174, 58, 38, 144, - 254, 228, 203, 134, 4, 87, 200, 220, 1, 11, - 64, 160, 66, 16, 12, 80, 128, 118, 216, 195, - 5, 141, 40, 31, 182, 216, 145, 30, 23, 181, - 135, 149, 212, 8, 19, 60, 188, 145, 0, 4, - 100, 225, 19, 59, 155, 7, 13, 78, 80, 130, - 109, 60, 67, 24, 141, 128, 67, 33, 204, 81, - 130, 2, 84, 224, 30, 37, 152, 128, 4, 242, - 113, 167, 121, 216, 162, 152, 39, 120, 6, 8, - 4, 192, 128, 13, 112, 160, 159, 6, 192, 68, - 41, 122, 240, 131, 65, 0, 2, 16, 115, 48, - 171, 51, 238, 3, 69, 41, 254, 195, 173, 181, - 125, 12, 31, 122, 0, 132, 25, 248, 192, 3, - 211, 56, 0, 13, 54, 145, 5, 50, 236, 149, - 126, 236, 104, 17, 60, 186, 113, 44, 73, 73, - 120, 29, 174, 136, 37, 28, 102, 215, 10, 121, - 208, 192, 13, 71, 72, 135, 50, 38, 22, 133, - 66, 164, 163, 187, 12, 216, 6, 7, 24, 112, - 132, 114, 192, 33, 13, 144, 248, 69, 1, 0, - 112, 2, 98, 126, 54, 30, 211, 32, 6, 26, - 120, 11, 12, 32, 244, 64, 12, 115, 240, 195, - 18, 174, 0, 8, 87, 144, 226, 20, 164, 147, - 76, 36, 3, 48, 82, 243, 4, 120, 42, 3, - 182, 193, 10, 86, 48, 3, 18, 20, 32, 0, - 2, 32, 129, 26, 200, 80, 133, 194, 53, 129, - 12, 236, 160, 17, 60, 210, 7, 11, 113, 172, - 227, 204, 225, 144, 129, 254, 97, 65, 33, 12, - 129, 165, 131, 3, 55, 112, 131, 45, 142, 81, - 5, 42, 188, 225, 17, 237, 88, 241, 2, 36, - 107, 128, 69, 196, 66, 13, 130, 120, 6, 26, - 60, 187, 136, 106, 120, 22, 23, 186, 224, 90, - 60, 12, 0, 0, 78, 76, 161, 7, 88, 152, - 67, 16, 92, 176, 4, 34, 92, 97, 11, 91, - 200, 132, 53, 204, 35, 153, 51, 72, 146, 94, - 255, 120, 242, 84, 60, 177, 4, 41, 171, 64, - 5, 59, 0, 2, 5, 18, 128, 1, 56, 220, - 236, 90, 189, 83, 3, 59, 206, 97, 230, 102, - 64, 55, 23, 201, 61, 179, 55, 26, 128, 128, - 52, 188, 162, 24, 204, 128, 196, 52, 56, 0, - 131, 77, 88, 67, 24, 132, 64, 196, 33, 212, - 241, 139, 11, 20, 224, 8, 104, 184, 128, 0, - 170, 129, 8, 53, 100, 193, 25, 16, 0, 0, - 0, 182, 49, 104, 6, 36, 67, 153, 143, 184, - 68, 2, 0, 192, 133, 52, 160, 0, 11, 87, - 120, 129, 11, 88, 192, 110, 18, 144, 128, 8, - 153, 118, 70, 162, 34, 99, 129, 40, 10, 196, - 164, 128, 232, 193, 10, 98, 16, 131, 29, 248, - 27, 8, 133, 224, 32, 33, 132, 123, 173, 70, - 172, 35, 141, 235, 64, 6, 116, 97, 65, 172, - 51, 103, 98, 0, 25, 120, 133, 48, 218, 163, - 138, 84, 252, 51, 27, 232, 160, 6, 51, 160, - 193, 142, 108, 28, 97, 2, 12, 176, 7, 18, - 254, 250, 136, 142, 14, 102, 161, 19, 140, 102, - 64, 59, 178, 189, 1, 109, 188, 34, 20, 133, - 240, 131, 103, 57, 113, 136, 31, 44, 97, 14, - 91, 32, 1, 187, 89, 224, 110, 23, 144, 160, - 8, 96, 240, 3, 46, 146, 44, 149, 15, 4, - 96, 1, 247, 174, 206, 41, 176, 96, 131, 29, - 240, 32, 6, 42, 224, 247, 14, 124, 16, 5, - 58, 88, 221, 193, 85, 240, 2, 51, 194, 113, - 142, 110, 72, 40, 23, 202, 233, 70, 179, 202, - 209, 1, 2, 212, 129, 25, 108, 202, 133, 55, - 208, 192, 129, 18, 152, 227, 30, 230, 216, 6, - 49, 156, 64, 108, 8, 164, 226, 30, 48, 152, - 192, 6, 158, 65, 7, 53, 88, 1, 9, 158, - 61, 194, 52, 102, 76, 12, 109, 8, 35, 22, - 144, 232, 196, 161, 225, 32, 134, 43, 92, 161, - 8, 47, 120, 1, 17, 212, 237, 110, 12, 252, - 28, 211, 156, 128, 140, 18, 36, 41, 144, 215, - 194, 198, 19, 115, 0, 194, 10, 84, 192, 131, - 33, 240, 187, 223, 62, 160, 66, 178, 7, 14, - 49, 50, 208, 233, 96, 231, 152, 16, 123, 230, - 83, 142, 12, 59, 32, 22, 26, 103, 70, 43, - 230, 1, 130, 182, 95, 128, 6, 19, 184, 64, - 240, 139, 234, 134, 120, 84, 99, 197, 109, 240, - 134, 26, 232, 80, 7, 11, 104, 123, 27, 72, - 0, 192, 6, 228, 49, 14, 61, 165, 131, 6, - 0, 144, 0, 43, 4, 254, 49, 136, 43, 16, - 33, 8, 30, 136, 60, 188, 225, 237, 238, 23, - 20, 97, 11, 153, 127, 204, 230, 3, 240, 223, - 234, 140, 2, 11, 83, 142, 58, 15, 202, 80, - 133, 167, 199, 96, 8, 141, 128, 155, 33, 62, - 65, 6, 67, 112, 29, 26, 21, 114, 14, 204, - 144, 83, 212, 112, 14, 222, 80, 118, 98, 128, - 12, 180, 35, 12, 185, 32, 15, 16, 0, 103, - 71, 0, 98, 71, 0, 3, 48, 224, 6, 219, - 48, 15, 143, 32, 9, 28, 48, 1, 188, 80, - 14, 84, 160, 6, 137, 192, 104, 23, 144, 14, - 217, 38, 1, 188, 112, 130, 188, 0, 3, 152, - 149, 10, 230, 50, 8, 150, 22, 4, 50, 0, - 6, 91, 64, 4, 46, 224, 2, 145, 7, 126, - 65, 16, 4, 91, 128, 11, 234, 199, 121, 255, - 16, 23, 178, 81, 7, 82, 32, 2, 168, 22, - 3, 62, 48, 4, 100, 160, 6, 79, 23, 5, - 135, 240, 10, 173, 48, 45, 251, 7, 13, 231, - 160, 38, 102, 118, 14, 117, 82, 39, 126, 0, - 113, 186, 128, 12, 12, 88, 11, 185, 176, 13, - 19, 112, 3, 37, 192, 15, 185, 84, 15, 243, - 16, 15, 234, 112, 12, 136, 80, 10, 237, 64, - 12, 196, 112, 15, 215, 64, 5, 112, 128, 11, - 22, 208, 103, 182, 32, 1, 0, 192, 0, 239, - 5, 80, 23, 208, 6, 207, 80, 8, 96, 3, - 111, 70, 128, 6, 118, 192, 4, 96, 0, 121, - 254, 36, 240, 2, 96, 176, 33, 150, 192, 5, - 92, 224, 43, 235, 39, 16, 103, 224, 121, 144, - 49, 10, 63, 48, 3, 163, 23, 3, 195, 243, - 129, 101, 160, 6, 169, 247, 10, 200, 0, 10, - 204, 209, 10, 194, 16, 14, 201, 195, 34, 7, - 151, 12, 225, 0, 12, 10, 224, 0, 147, 160, - 13, 180, 227, 133, 208, 240, 11, 196, 230, 6, - 253, 112, 12, 159, 208, 119, 86, 103, 8, 214, - 246, 10, 209, 80, 14, 209, 0, 10, 67, 0, - 7, 227, 16, 15, 247, 192, 15, 72, 192, 91, - 246, 176, 13, 169, 176, 8, 110, 144, 10, 214, - 5, 61, 35, 227, 2, 91, 32, 3, 86, 33, - 21, 92, 0, 6, 47, 224, 1, 50, 32, 10, - 176, 17, 137, 63, 72, 137, 142, 113, 10, 98, - 208, 116, 81, 199, 111, 60, 64, 5, 143, 83, - 6, 67, 160, 6, 177, 16, 14, 208, 160, 13, - 106, 194, 12, 200, 160, 12, 218, 112, 12, 82, - 152, 12, 187, 160, 10, 151, 64, 1, 8, 240, - 3, 10, 184, 51, 148, 208, 10, 139, 85, 2, - 37, 176, 9, 253, 32, 12, 134, 80, 6, 251, - 83, 62, 84, 144, 45, 141, 64, 8, 84, 192, - 3, 158, 8, 4, 86, 64, 10, 28, 32, 0, - 56, 224, 13, 194, 176, 11, 222, 80, 14, 202, - 16, 10, 135, 32, 46, 141, 7, 111, 45, 224, - 24, 145, 144, 9, 91, 0, 6, 70, 0, 6, - 112, 101, 116, 72, 247, 254, 15, 123, 112, 6, - 176, 65, 11, 63, 176, 111, 59, 208, 111, 154, - 216, 142, 135, 0, 10, 136, 16, 10, 194, 160, - 13, 201, 160, 13, 117, 34, 14, 208, 128, 12, - 186, 208, 11, 187, 112, 9, 128, 224, 1, 20, - 64, 0, 8, 96, 3, 203, 1, 11, 159, 112, - 83, 175, 80, 15, 52, 208, 118, 196, 144, 15, - 185, 32, 66, 67, 80, 5, 100, 64, 7, 81, - 83, 56, 85, 48, 3, 20, 233, 3, 54, 208, - 3, 157, 192, 0, 0, 64, 12, 208, 0, 10, - 63, 4, 7, 202, 54, 146, 133, 48, 7, 151, - 64, 4, 96, 112, 146, 144, 225, 7, 96, 192, - 5, 226, 40, 21, 245, 38, 69, 158, 48, 23, - 145, 97, 10, 115, 96, 3, 34, 48, 122, 231, - 88, 122, 112, 160, 6, 165, 16, 11, 161, 112, - 12, 202, 112, 9, 151, 16, 14, 226, 32, 143, - 244, 40, 6, 24, 224, 0, 8, 128, 0, 17, - 128, 2, 135, 128, 66, 173, 64, 9, 140, 64, - 9, 185, 208, 15, 196, 144, 10, 191, 192, 15, - 236, 0, 10, 114, 96, 56, 93, 32, 7, 73, - 120, 67, 80, 64, 5, 59, 128, 132, 84, 0, - 4, 107, 48, 104, 5, 240, 13, 194, 0, 10, - 111, 0, 4, 64, 32, 57, 105, 128, 46, 171, - 48, 7, 223, 39, 4, 145, 1, 132, 157, 246, - 105, 2, 49, 11, 115, 33, 142, 167, 240, 3, - 54, 224, 3, 153, 152, 56, 80, 243, 6, 112, - 254, 0, 138, 177, 32, 12, 208, 160, 10, 106, - 130, 13, 0, 24, 14, 197, 128, 148, 107, 208, - 3, 86, 32, 138, 202, 193, 51, 85, 121, 83, - 173, 112, 14, 229, 192, 14, 234, 80, 14, 173, - 160, 87, 101, 0, 60, 33, 148, 132, 112, 32, - 60, 60, 48, 3, 184, 233, 3, 170, 224, 75, - 237, 128, 13, 79, 72, 5, 84, 246, 45, 83, - 0, 136, 221, 71, 4, 50, 64, 147, 29, 178, - 100, 35, 37, 147, 132, 249, 24, 137, 128, 152, - 43, 224, 111, 57, 121, 132, 92, 4, 7, 161, - 160, 12, 111, 162, 11, 115, 32, 153, 199, 176, - 117, 63, 83, 158, 244, 8, 10, 148, 48, 144, - 237, 25, 8, 44, 26, 8, 114, 16, 8, 169, - 193, 8, 11, 41, 56, 133, 195, 3, 244, 99, - 117, 84, 80, 5, 80, 192, 111, 244, 195, 63, - 64, 16, 10, 186, 32, 12, 5, 234, 3, 49, - 48, 3, 195, 153, 6, 88, 48, 50, 240, 246, - 1, 73, 178, 7, 253, 213, 86, 90, 224, 160, - 142, 33, 6, 33, 48, 101, 254, 118, 67, 169, - 39, 8, 175, 208, 132, 210, 179, 11, 189, 176, - 5, 202, 160, 12, 107, 194, 117, 83, 216, 10, - 180, 83, 149, 44, 234, 5, 99, 224, 5, 127, - 224, 5, 110, 58, 6, 178, 89, 6, 74, 51, - 49, 80, 192, 144, 246, 83, 6, 159, 210, 119, - 166, 55, 75, 12, 57, 3, 213, 201, 132, 160, - 160, 6, 81, 48, 4, 254, 51, 48, 3, 89, - 96, 68, 73, 234, 125, 65, 96, 2, 73, 18, - 91, 1, 240, 50, 255, 160, 8, 81, 234, 24, - 142, 176, 4, 33, 32, 2, 137, 57, 3, 84, - 0, 5, 29, 84, 53, 64, 154, 42, 170, 144, - 9, 92, 112, 9, 165, 16, 143, 196, 98, 133, - 12, 184, 51, 104, 170, 166, 99, 176, 166, 115, - 227, 162, 173, 154, 52, 247, 217, 101, 89, 87, - 6, 132, 208, 8, 62, 89, 5, 67, 144, 147, - 19, 195, 3, 43, 96, 3, 81, 240, 10, 141, - 160, 6, 95, 217, 159, 126, 106, 3, 71, 36, - 6, 68, 80, 4, 50, 144, 36, 106, 21, 0, - 108, 5, 165, 147, 42, 21, 166, 96, 169, 83, - 214, 111, 137, 83, 5, 206, 3, 10, 161, 48, - 61, 170, 224, 7, 32, 0, 1, 50, 0, 9, - 186, 64, 39, 86, 104, 120, 202, 161, 170, 140, - 224, 166, 106, 250, 7, 109, 234, 166, 49, 228, - 5, 134, 224, 5, 73, 67, 63, 114, 80, 5, - 183, 154, 58, 55, 164, 2, 177, 73, 6, 80, - 96, 164, 108, 214, 10, 92, 198, 63, 51, 16, - 2, 6, 75, 95, 138, 42, 165, 248, 1, 82, - 34, 117, 16, 166, 80, 23, 155, 115, 11, 87, - 96, 161, 51, 192, 111, 156, 170, 108, 160, 32, - 61, 171, 192, 10, 32, 16, 124, 48, 208, 9, - 189, 128, 148, 208, 16, 14, 176, 72, 59, 55, - 69, 154, 129, 192, 166, 127, 176, 166, 114, 163, - 254, 166, 94, 0, 49, 77, 192, 3, 73, 208, - 4, 115, 67, 6, 160, 128, 171, 132, 160, 6, - 60, 10, 49, 60, 96, 3, 112, 112, 179, 100, - 16, 8, 236, 8, 4, 54, 96, 176, 33, 128, - 2, 40, 192, 2, 68, 160, 4, 213, 116, 77, - 9, 33, 169, 90, 48, 21, 115, 160, 111, 153, - 184, 3, 114, 136, 58, 135, 208, 173, 171, 224, - 10, 253, 132, 6, 81, 113, 10, 172, 240, 38, - 216, 160, 13, 242, 40, 164, 104, 250, 7, 129, - 224, 174, 129, 192, 8, 114, 208, 166, 134, 128, - 63, 17, 147, 56, 77, 32, 155, 132, 32, 138, - 136, 80, 5, 58, 11, 5, 47, 219, 5, 253, - 9, 7, 46, 74, 8, 236, 232, 3, 244, 133, - 2, 71, 139, 180, 44, 16, 4, 73, 178, 100, - 148, 164, 16, 121, 80, 23, 82, 225, 10, 55, - 153, 137, 70, 168, 6, 136, 32, 8, 47, 86, - 8, 165, 160, 9, 19, 96, 6, 142, 193, 7, - 163, 176, 11, 202, 192, 117, 242, 232, 78, 108, - 235, 174, 238, 58, 6, 104, 203, 170, 73, 227, - 5, 73, 48, 179, 65, 139, 171, 175, 80, 109, - 84, 80, 52, 178, 217, 4, 187, 58, 4, 217, - 82, 5, 83, 99, 5, 61, 128, 180, 190, 203, - 2, 46, 192, 180, 78, 36, 73, 254, 197, 184, - 117, 145, 7, 180, 192, 116, 138, 201, 111, 133, - 74, 117, 89, 112, 8, 186, 160, 9, 23, 16, - 25, 159, 171, 83, 240, 254, 120, 66, 104, 58, - 6, 129, 176, 166, 174, 10, 167, 100, 80, 175, - 245, 138, 51, 160, 144, 11, 112, 153, 71, 47, - 84, 62, 49, 91, 122, 116, 0, 60, 81, 0, - 4, 152, 122, 180, 75, 144, 1, 25, 112, 184, - 17, 68, 188, 15, 209, 184, 90, 80, 173, 54, - 80, 168, 167, 39, 60, 22, 243, 6, 208, 43, - 189, 146, 49, 10, 218, 112, 174, 19, 119, 44, - 60, 67, 186, 45, 234, 162, 114, 80, 175, 93, - 86, 6, 159, 0, 10, 177, 11, 7, 81, 112, - 132, 47, 75, 175, 78, 99, 52, 60, 160, 2, - 86, 90, 168, 54, 176, 4, 46, 144, 1, 87, - 112, 141, 213, 113, 6, 245, 102, 111, 16, 33, - 169, 138, 48, 177, 152, 184, 147, 19, 153, 122, - 28, 154, 12, 156, 48, 189, 146, 241, 12, 87, - 8, 13, 26, 215, 30, 237, 89, 11, 200, 128, - 12, 178, 3, 93, 235, 234, 5, 101, 144, 132, - 208, 149, 41, 21, 252, 144, 220, 27, 60, 117, - 250, 116, 161, 228, 163, 132, 116, 5, 46, 144, - 8, 248, 161, 4, 11, 32, 73, 139, 27, 17, - 166, 240, 5, 144, 208, 3, 251, 187, 111, 165, - 39, 135, 136, 240, 10, 146, 41, 192, 146, 113, - 10, 231, 96, 133, 212, 32, 12, 112, 195, 162, - 104, 27, 8, 173, 0, 55, 183, 214, 10, 55, - 85, 149, 79, 200, 173, 144, 99, 96, 170, 35, - 92, 192, 51, 4, 116, 64, 127, 161, 244, 129, - 254, 83, 80, 156, 147, 16, 100, 222, 8, 91, - 80, 116, 0, 103, 51, 17, 193, 192, 10, 145, - 123, 161, 6, 118, 181, 175, 240, 38, 153, 64, - 195, 53, 76, 178, 218, 128, 12, 185, 80, 149, - 109, 251, 7, 132, 32, 7, 134, 240, 7, 49, - 180, 182, 107, 11, 187, 91, 122, 8, 82, 96, - 3, 89, 128, 8, 173, 208, 8, 154, 92, 6, - 141, 208, 8, 129, 96, 8, 3, 103, 117, 207, - 35, 81, 27, 203, 131, 212, 161, 4, 32, 21, - 0, 18, 0, 169, 18, 49, 14, 107, 128, 137, - 251, 150, 122, 87, 43, 12, 245, 8, 12, 27, - 240, 151, 82, 241, 12, 218, 64, 13, 56, 44, - 12, 181, 192, 8, 105, 123, 83, 210, 44, 55, - 160, 204, 162, 148, 64, 48, 185, 16, 10, 161, - 80, 68, 105, 48, 190, 114, 76, 205, 55, 149, - 79, 172, 71, 45, 112, 208, 8, 163, 178, 10, - 201, 128, 203, 176, 161, 5, 39, 60, 73, 30, - 49, 8, 82, 230, 197, 95, 169, 202, 109, 162, - 12, 192, 64, 3, 150, 0, 27, 201, 35, 12, - 108, 34, 12, 210, 220, 162, 55, 229, 162, 110, - 26, 203, 238, 249, 198, 177, 160, 12, 144, 48, - 8, 177, 112, 12, 194, 0, 148, 205, 1, 55, - 210, 44, 205, 229, 67, 7, 201, 6, 42, 12, - 148, 12, 190, 0, 27, 124, 240, 1, 80, 20, - 0, 46, 243, 17, 170, 96, 5, 133, 122, 155, - 31, 168, 202, 14, 141, 254, 12, 189, 128, 4, - 146, 32, 25, 124, 160, 13, 171, 44, 144, 45, - 106, 8, 134, 240, 162, 11, 188, 182, 208, 149, - 66, 229, 169, 13, 151, 160, 10, 247, 88, 10, - 68, 89, 182, 85, 233, 96, 194, 101, 209, 81, - 160, 108, 151, 211, 11, 192, 240, 24, 168, 192, - 7, 42, 243, 209, 11, 144, 200, 30, 145, 12, - 105, 80, 168, 205, 171, 6, 231, 252, 10, 151, - 179, 11, 156, 112, 4, 252, 188, 198, 100, 112, - 205, 46, 26, 208, 114, 243, 162, 238, 233, 133, - 104, 87, 143, 47, 192, 10, 202, 80, 10, 200, - 64, 148, 225, 160, 198, 104, 26, 8, 179, 137, - 183, 114, 120, 8, 166, 162, 212, 190, 66, 43, - 158, 115, 0, 243, 194, 21, 127, 232, 167, 51, - 224, 111, 84, 87, 203, 165, 176, 11, 154, 0, - 3, 220, 244, 24, 189, 16, 206, 14, 214, 182, - 11, 108, 8, 105, 107, 211, 239, 36, 12, 150, - 29, 39, 30, 176, 5, 172, 208, 11, 14, 205, - 12, 218, 80, 11, 235, 73, 9, 44, 42, 155, - 134, 128, 49, 181, 60, 9, 170, 48, 10, 230, - 161, 5, 31, 240, 0, 125, 253, 0, 160, 182, - 23, 147, 64, 180, 23, 58, 117, 84, 23, 5, - 130, 112, 42, 174, 0, 3, 150, 240, 151, 171, - 144, 58, 1, 205, 174, 114, 80, 205, 160, 108, - 214, 3, 25, 209, 185, 160, 13, 202, 208, 0, - 3, 224, 1, 151, 32, 166, 152, 57, 48, 134, - 254, 112, 83, 16, 115, 45, 114, 184, 6, 125, - 112, 7, 123, 160, 5, 241, 178, 0, 125, 61, - 2, 216, 196, 23, 144, 80, 96, 21, 91, 177, - 253, 19, 5, 83, 112, 216, 192, 80, 2, 95, - 96, 23, 82, 234, 9, 165, 128, 8, 65, 27, - 180, 110, 74, 8, 163, 221, 182, 54, 157, 205, - 181, 192, 128, 185, 240, 10, 208, 160, 11, 13, - 160, 0, 24, 0, 6, 208, 32, 158, 208, 208, - 30, 234, 42, 223, 85, 144, 5, 216, 45, 23, - 57, 208, 218, 44, 227, 221, 22, 240, 4, 90, - 241, 29, 170, 64, 157, 215, 170, 147, 196, 147, - 208, 201, 128, 4, 102, 96, 25, 32, 94, 23, - 147, 120, 7, 125, 176, 6, 113, 160, 6, 214, - 60, 55, 106, 122, 223, 114, 4, 79, 39, 148, - 11, 255, 77, 1, 20, 112, 5, 170, 48, 182, - 205, 12, 205, 159, 64, 57, 120, 144, 221, 219, - 157, 3, 38, 80, 43, 101, 195, 50, 19, 238, - 203, 189, 1, 185, 243, 188, 188, 62, 48, 5, - 202, 128, 13, 201, 192, 6, 110, 224, 86, 121, - 0, 226, 82, 174, 4, 34, 126, 6, 36, 222, - 7, 120, 96, 226, 220, 226, 56, 17, 44, 154, - 151, 227, 148, 118, 201, 10, 124, 50, 10, 142, - 176, 33, 215, 225, 227, 77, 2, 228, 182, 242, - 0, 53, 240, 5, 68, 94, 34, 229, 120, 169, - 137, 169, 2, 6, 150, 5, 229, 186, 206, 48, - 64, 16, 166, 160, 8, 192, 81, 62, 229, 32, - 142, 25, 84, 238, 222, 115, 49, 232, 132, 110, - 23, 215, 113, 25, 218, 17, 34, 78, 178, 232, - 181, 98, 1, 109, 30, 32, 37, 162, 16, 151, - 64, 184, 152, 26, 127, 73, 94, 10, 73, 9, - 12, 56, 128, 16, 218, 148, 7, 121, 240, 5, - 182, 17, 234, 162, 158, 3, 184, 129, 27, 218, - 113, 234, 218, 209, 31, 253, 17, 34, 172, 206, - 232, 38, 160, 3, 0, 82, 225, 145, 206, 16, - 148, 142, 169, 116, 126, 164, 186, 144, 12, 187, - 237, 16, 150, 20, 9, 118, 96, 7, 95, 240, - 5, 216, 145, 29, 168, 158, 234, 170, 174, 1, - 31, 160, 3, 184, 17, 236, 120, 33, 235, 179, - 254, 16, 144, 75, 184, 136, 153, 106, 22, 185, - 6, 147, 192, 10, 174, 176, 1, 60, 65, 19, - 145, 240, 230, 207, 222, 17, 128, 64, 184, 33, - 96, 164, 86, 144, 6, 225, 226, 165, 154, 32, - 1, 223, 190, 238, 21, 225, 10, 75, 128, 2, - 54, 240, 3, 66, 148, 6, 228, 178, 11, 192, - 192, 4, 236, 158, 239, 2, 17, 16, 0, 59}; - diff --git a/main/main.c b/main/main.c index cc04b1317e9..5eb9947fe7a 100644 --- a/main/main.c +++ b/main/main.c @@ -86,7 +86,6 @@ #include "php_content_types.h" #include "php_ticks.h" -#include "php_logos.h" #include "php_streams.h" #include "php_open_temporary_file.h" @@ -2157,14 +2156,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod return FAILURE; } - /* initialize registry for images to be used in phpinfo() - (this uses configuration parameters from php.ini) - */ - if (php_init_info_logos() == FAILURE) { - php_printf("PHP: Unable to initialize info phpinfo logos.\n"); - return FAILURE; - } - zuv.html_errors = 1; zuv.import_use_extension = ".php"; php_startup_auto_globals(TSRMLS_C); @@ -2348,7 +2339,6 @@ void php_module_shutdown(TSRMLS_D) /* Destroys filter & transport registries too */ php_shutdown_stream_wrappers(module_number TSRMLS_CC); - php_shutdown_info_logos(); UNREGISTER_INI_ENTRIES(); /* close down the ini config */ @@ -2396,10 +2386,6 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) int retval = 0; EG(exit_status) = 0; - if (php_handle_special_queries(TSRMLS_C)) { - zend_file_handle_dtor(primary_file TSRMLS_CC); - return 0; - } #ifndef HAVE_BROKEN_GETCWD # define OLD_CWD_SIZE 4096 old_cwd = do_alloca(OLD_CWD_SIZE, use_heap); diff --git a/main/php_logos.c b/main/php_logos.c deleted file mode 100644 index 3689f71e953..00000000000 --- a/main/php_logos.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Hartmut Holzgraefe | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "php.h" -#include "logos.h" -#include "php_logos.h" -#include "ext/standard/info.h" -#include "SAPI.h" - -typedef struct _php_info_logo { - const char *mimetype; - int mimelen; - const unsigned char *data; - int size; -} php_info_logo; - -static HashTable phpinfo_logo_hash; - -PHPAPI int php_register_info_logo(char *logo_string, const char *mimetype, const unsigned char *data, int size) -{ - php_info_logo info_logo; - - info_logo.mimetype = mimetype; - info_logo.mimelen = strlen(mimetype); - info_logo.data = data; - info_logo.size = size; - - return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL); -} - -PHPAPI int php_unregister_info_logo(char *logo_string) -{ - return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string)); -} - -int php_init_info_logos(void) -{ - if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE) - return FAILURE; - - php_register_info_logo(PHP_LOGO_GUID , "image/gif", php_logo , sizeof(php_logo)); - php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo)); - php_register_info_logo(ZEND_LOGO_GUID , "image/gif", zend_logo , sizeof(zend_logo)); - - return SUCCESS; -} - -int php_shutdown_info_logos(void) -{ - zend_hash_destroy(&phpinfo_logo_hash); - return SUCCESS; -} - -#define CONTENT_TYPE_HEADER "Content-Type: " -int php_info_logos(const char *logo_string TSRMLS_DC) -{ - php_info_logo *logo_image; - char *content_header; - int len; - - if(FAILURE==zend_hash_find(&phpinfo_logo_hash, (char *) logo_string, strlen(logo_string), (void **)&logo_image)) - return 0; - - len = sizeof(CONTENT_TYPE_HEADER) - 1 + logo_image->mimelen; - content_header = emalloc(len + 1); - memcpy(content_header, CONTENT_TYPE_HEADER, sizeof(CONTENT_TYPE_HEADER) - 1); - memcpy(content_header + sizeof(CONTENT_TYPE_HEADER) - 1 , logo_image->mimetype, logo_image->mimelen); - content_header[len] = '\0'; - sapi_add_header(content_header, len, 0); - - PHPWRITE((char*)logo_image->data, logo_image->size); - return 1; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/main/php_logos.h b/main/php_logos.h deleted file mode 100644 index b9e1144c031..00000000000 --- a/main/php_logos.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#ifndef _PHP_LOGOS_H -#define _PHP_LOGOS_H - -BEGIN_EXTERN_C() -PHPAPI int php_register_info_logo(char *logo_string, const char *mimetype, const unsigned char *data, int size); -PHPAPI int php_unregister_info_logo(char *logo_string); -END_EXTERN_C() - -int php_init_info_logos(void); -int php_shutdown_info_logos(void); -int php_info_logos(const char *logo_string TSRMLS_DC); - -#endif /* _PHP_LOGOS_H */ diff --git a/main/php_variables.c b/main/php_variables.c index 427966170c8..9952bd80bc8 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -27,7 +27,6 @@ #include "php_globals.h" #include "php_content_types.h" #include "SAPI.h" -#include "php_logos.h" #include "zend_globals.h" /* for systems that need to override reading of environment variables */ @@ -532,22 +531,6 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) } /* }}} */ -/* {{{ php_handle_special_queries - */ -PHPAPI int php_handle_special_queries(TSRMLS_D) -{ - if (PG(expose_php) && SG(request_info).query_string && SG(request_info).query_string[0] == '=') { - if (php_info_logos(SG(request_info).query_string + 1 TSRMLS_CC)) { - return 1; - } else if (!strcmp(SG(request_info).query_string + 1, PHP_CREDITS_GUID)) { - php_print_credits(PHP_CREDITS_ALL TSRMLS_CC); - return 1; - } - } - return 0; -} -/* }}} */ - /* {{{ php_register_server_variables */ static inline void php_register_server_variables(TSRMLS_D) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 876c57a34d4..05c2cdabc32 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1944,40 +1944,38 @@ static int php_cli_server_request_shutdown(php_cli_server *server, php_cli_serve static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) /* {{{ */ { int decline = 0; - if (!php_handle_special_queries(TSRMLS_C)) { - zend_file_handle zfd; - char *old_cwd; + zend_file_handle zfd; + char *old_cwd; - ALLOCA_FLAG(use_heap) - old_cwd = do_alloca(MAXPATHLEN, use_heap); - old_cwd[0] = '\0'; - php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); + ALLOCA_FLAG(use_heap) + old_cwd = do_alloca(MAXPATHLEN, use_heap); + old_cwd[0] = '\0'; + php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); - zfd.type = ZEND_HANDLE_FILENAME; - zfd.filename = server->router; - zfd.handle.fp = NULL; - zfd.free_filename = 0; - zfd.opened_path = NULL; + zfd.type = ZEND_HANDLE_FILENAME; + zfd.filename = server->router; + zfd.handle.fp = NULL; + zfd.free_filename = 0; + zfd.opened_path = NULL; - zend_try { - zval *retval = NULL; - if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { - if (retval) { - decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); - zval_ptr_dtor(&retval); - } - } else { - decline = 1; + zend_try { + zval *retval = NULL; + if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { + if (retval) { + decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); + zval_ptr_dtor(&retval); } - } zend_end_try(); - - if (old_cwd[0] != '\0') { - php_ignore_value(VCWD_CHDIR(old_cwd)); + } else { + decline = 1; } + } zend_end_try(); - free_alloca(old_cwd, use_heap); + if (old_cwd[0] != '\0') { + php_ignore_value(VCWD_CHDIR(old_cwd)); } + free_alloca(old_cwd, use_heap); + return decline; } /* }}} */ diff --git a/sapi/cli/tests/php_cli_server_011.phpt b/sapi/cli/tests/php_cli_server_011.phpt deleted file mode 100644 index a957a8ed4c0..00000000000 --- a/sapi/cli/tests/php_cli_server_011.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Bug #60180 ($_SERVER["PHP_SELF"] incorrect) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -okey diff --git a/tests/basic/php_egg_logo_guid.phpt b/tests/basic/php_egg_logo_guid.phpt deleted file mode 100644 index b3c5d7bdfd2..00000000000 --- a/tests/basic/php_egg_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Testing php_egg_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F36-D428-11d2-A769-00AA001ACF42 - ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/php_logo_guid.phpt b/tests/basic/php_logo_guid.phpt deleted file mode 100644 index b5724a96abe..00000000000 --- a/tests/basic/php_logo_guid.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Testing php_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 ---CREDITS-- -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/php_real_logo_guid.phpt b/tests/basic/php_real_logo_guid.phpt deleted file mode 100644 index 2b9003a3506..00000000000 --- a/tests/basic/php_real_logo_guid.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing php_real_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F34-D428-11d2-A769-00AA001ACF42 ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/tests/basic/zend_logo_guid.phpt b/tests/basic/zend_logo_guid.phpt deleted file mode 100644 index 23ca0165ae6..00000000000 --- a/tests/basic/zend_logo_guid.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Testing zend_logo_guid() function ---FILE-- - ---EXPECT-- -PHPE9568F35-D428-11d2-A769-00AA001ACF42 - ---CREDITS-- -Jason Easter -PHPUG Würzburg -Testfest 2009 2009-06-20 \ No newline at end of file diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 1a4b834be42..be9402a3fec 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -368,7 +368,7 @@ if (VCVERS == 1200) { ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \ php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \ - php_open_temporary_file.c php_logos.c output.c internal_functions.c php_sprintf.c"); + php_open_temporary_file.c output.c internal_functions.c php_sprintf.c"); ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c"); // Newer versions have it diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp index 2216d7dfe6e..cc56f538af1 100644 --- a/win32/php5dll.dsp +++ b/win32/php5dll.dsp @@ -164,10 +164,6 @@ SOURCE=..\main\php_ini.c # End Source File # Begin Source File -SOURCE=..\main\php_logos.c -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.c # End Source File # Begin Source File @@ -288,10 +284,6 @@ SOURCE=..\main\php_ini.h # End Source File # Begin Source File -SOURCE=..\main\php_logos.h -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.h # End Source File # Begin Source File diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp index a8e93ec5e77..3755ea79f96 100644 --- a/win32/php5dllts.dsp +++ b/win32/php5dllts.dsp @@ -201,10 +201,6 @@ SOURCE=..\main\php_ini.c # End Source File # Begin Source File -SOURCE=..\main\php_logos.c -# End Source File -# Begin Source File - SOURCE=..\main\php_open_temporary_file.c # End Source File # Begin Source File @@ -317,10 +313,6 @@ SOURCE=..\main\php_ini.h # End Source File # Begin Source File -SOURCE=..\main\php_logos.h -# End Source File -# Begin Source File - SOURCE=..\main\php_main.h # End Source File # Begin Source File From 92d2aeb234146978ef1175767579ce3eb30d37fd Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Sat, 14 Jul 2012 21:55:11 +0100 Subject: [PATCH 254/641] Fixed small misalignment in prev commit --- ext/standard/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/info.c b/ext/standard/info.c index 4f61b58d1fa..b27468e3ebb 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -809,7 +809,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print(" document.getElementById('credits').style.display = 'block';\n"); php_info_print(" document.getElementById('revealcredits').style.display = 'none';\n"); php_info_print(" };\n"); - php_info_print(" };\n"); + php_info_print(" };\n"); php_info_print("}());\n"); php_info_print("

"); php_info_print("PHP Credits"); From 582514d4c7b216dbdc7a8429962cf3e5776206f0 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 10 Jul 2012 18:12:13 -0700 Subject: [PATCH 255/641] fix for bug#18556 - use simple tolower() function for internal things --- Zend/zend_operators.c | 92 ++++++++++++++++++++++++++++++++++++++++--- ext/standard/string.c | 6 +-- 2 files changed, 89 insertions(+), 9 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f9686251fef..8805eb21e56 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -42,6 +42,43 @@ static _locale_t current_locale = NULL; #define TYPE_PAIR(t1,t2) (((t1) << 4) | (t2)) +static unsigned char tolower_map[256] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x5b,0x5c,0x5d,0x5e,0x5f, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, +0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, +0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, +0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, +0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, +0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, +0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff +}; + +#define zend_tolower_ascii(c) (tolower_map[(c)]) + +/** + * Functions using locale lowercase: + zend_binary_strncasecmp_l + zend_binary_strcasecmp_l + zend_binary_zval_strcasecmp + zend_binary_zval_strncasecmp + string_compare_function_ex + string_case_compare_function + * Functions using ascii lowercase: + zend_str_tolower_copy + zend_str_tolower_dup + zend_str_tolower + zend_binary_strcasecmp + zend_binary_strncasecmp + */ + ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ { int retval; @@ -1908,7 +1945,7 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned in register unsigned char *end = str + length; while (str < end) { - *result++ = zend_tolower((int)*str++); + *result++ = zend_tolower_ascii((int)*str++); } *result = '\0'; @@ -1928,7 +1965,7 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ register unsigned char *end = p + length; while (p < end) { - *p = zend_tolower((int)*p); + *p = zend_tolower_ascii((int)*p); p++; } } @@ -1975,6 +2012,49 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u return 0; } + len = MIN(len1, len2); + while (len--) { + c1 = zend_tolower_ascii((int)*(unsigned char *)s1++); + c2 = zend_tolower_ascii((int)*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + + return len1 - len2; +} +/* }}} */ + +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +{ + int len; + int c1, c2; + + if (s1 == s2) { + return 0; + } + len = MIN(length, MIN(len1, len2)); + while (len--) { + c1 = zend_tolower_ascii((int)*(unsigned char *)s1++); + c2 = zend_tolower_ascii((int)*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + + return MIN(length, len1) - MIN(length, len2); +} +/* }}} */ + +ZEND_API int zend_binary_strcasecmp_l(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ +{ + int len; + int c1, c2; + + if (s1 == s2) { + return 0; + } + len = MIN(len1, len2); while (len--) { c1 = zend_tolower((int)*(unsigned char *)s1++); @@ -1988,7 +2068,7 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u } /* }}} */ -ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ { int len; int c1, c2; @@ -2023,13 +2103,13 @@ ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); + return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ @@ -2064,7 +2144,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ } else if (ret2!=IS_DOUBLE) { if (oflow1) { ZVAL_LONG(result, oflow1); - return; + return; } dval2 = (double) lval2; } else if (dval1 == dval2 && !zend_finite(dval1)) { diff --git a/ext/standard/string.c b/ext/standard/string.c index 9a64376c27e..e5da0a4fb97 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | - | Stig Sæther Bakken | + | Stig S�ther Bakken | | Zeev Suraski | +----------------------------------------------------------------------+ */ @@ -132,7 +132,7 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t * size_t i, j; result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); - + for (i = j = 0; i < oldlen; i++) { result[j++] = hexconvtab[old[i] >> 4]; result[j++] = hexconvtab[old[i] & 15]; @@ -5376,7 +5376,7 @@ PHP_FUNCTION(substr_compare) if (!cs) { RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } else { - RETURN_LONG(zend_binary_strncasecmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); } } /* }}} */ From c164e6b5a37b668a016846060d8e039d6af32ae5 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 10 Jul 2012 21:47:56 -0700 Subject: [PATCH 256/641] add test --- Zend/tests/bug18556.phpt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Zend/tests/bug18556.phpt diff --git a/Zend/tests/bug18556.phpt b/Zend/tests/bug18556.phpt new file mode 100644 index 00000000000..a9fbb592285 --- /dev/null +++ b/Zend/tests/bug18556.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #18556 (Setting locale to 'tr_TR' lowercases class names) +--FILE-- +foo = "Foo"; + } +} + +echo "Instantiating an infoBlob with a lowercase i\n"; +$foobar = new infoBlob(); +echo $foobar->foo; +echo "\nInstantiating an InfoBlob with an uppercase I\n"; +$foobar = new InfoBlob(); +echo $foobar->foo; +echo "\n"; +setlocale(LC_ALL, "tr_TR.utf8"); +foreach(get_declared_classes() as $class) +{ + if(!class_exists($class)) + echo "$class No Longer Exists!\n"; +} +echo "Done.\n"; +?> +--EXPECT-- +Instantiating an infoBlob with a lowercase i +Foo +Instantiating an InfoBlob with an uppercase I +Foo +Done. From 3b0573363a187e75414df72a0f3fe5c6f6c1be03 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 10 Jul 2012 22:31:24 -0700 Subject: [PATCH 257/641] fix comment --- ext/standard/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index e5da0a4fb97..6cc7659edd8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | - | Stig S�ther Bakken | + | Stig Sæther Bakken | | Zeev Suraski | +----------------------------------------------------------------------+ */ @@ -132,7 +132,7 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t * size_t i, j; result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); - + for (i = j = 0; i < oldlen; i++) { result[j++] = hexconvtab[old[i] >> 4]; result[j++] = hexconvtab[old[i] & 15]; From bd340b729622d74205ab6847d8009aa879c5529b Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 14 Jul 2012 15:03:51 -0700 Subject: [PATCH 258/641] add NEWS/UPGRADING --- NEWS | 1 + UPGRADING | 2 ++ UPGRADING.INTERNALS | 29 ++++++++++++++++++++++++++++- Zend/tests/bug18556.phpt | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 37e443d25e9..eb4b7dfe7bd 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ PHP NEWS - Core: . Added boolval(). (Jille Timmermans). + . Fixed bug #18556 (Engine uses locale rules to handle class names). (Stas) . Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence). . Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected). (srgoogleguy, Gustavo) diff --git a/UPGRADING b/UPGRADING index 8b52be26d75..d598996f30d 100755 --- a/UPGRADING +++ b/UPGRADING @@ -21,6 +21,8 @@ PHP X.Y UPGRADE NOTES ======================================== - Drop Windows XP and 2003 support. (Pierre) +- All internal case insensitivity handling for class, fucntion and constant + names is done according to ASCII rules, current locale settings are ignored. ======================================== 2. New Features diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 015c752ad06..90c7a4394fd 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,7 @@ UPGRADE NOTES - PHP X.Y 1. Internal API changes a. Streams pooling API + b. Lowercasing and locales 2. Build system changes a. Unix build system changes @@ -26,6 +27,32 @@ PHPAPI int php_stream_context_set_link(php_stream_context *context, PHPAPI int php_stream_context_del_link(php_stream_context *context, php_stream *stream); + b. Lowercasing and locales + +The lowercasing functions in zend_operators.c were split into those that do +lowercasing according to locale rules and those that do ASCII lowercasing. +ASCII: + + zend_str_tolower_copy + zend_str_tolower_dup + zend_str_tolower + zend_binary_strcasecmp + zend_binary_strncasecmp + +Locale-based: + zend_binary_strncasecmp_l + zend_binary_strcasecmp_l + zend_binary_zval_strcasecmp + zend_binary_zval_strncasecmp + string_compare_function_ex + string_case_compare_function + +Internal engine lowercasing will be using ASCII-only rules. User-facing functions, +such as strcasecmp, will be using locale rules. + +Two new functions - zend_binary_strncasecmp_l and zend_binary_strcasecmp_l - added as +locale-based counterparts to zend_binary_strcasecmp and zend_binary_strncasecmp. + ======================== 2. Build system changes ======================== @@ -34,5 +61,5 @@ PHPAPI int php_stream_context_del_link(php_stream_context *context, - b. Windows build system changes - - + - Drop Windows XP and 2003 support. diff --git a/Zend/tests/bug18556.phpt b/Zend/tests/bug18556.phpt index a9fbb592285..036abb2ada8 100644 --- a/Zend/tests/bug18556.phpt +++ b/Zend/tests/bug18556.phpt @@ -25,6 +25,7 @@ foreach(get_declared_classes() as $class) { if(!class_exists($class)) echo "$class No Longer Exists!\n"; + } echo "Done.\n"; ?> From ee6540ad092ce2f2aedb2e677b292b58acdca9be Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Sat, 14 Jul 2012 23:20:45 +0100 Subject: [PATCH 259/641] Removed now-unnecessary expose_php checks for logo --- ext/standard/info.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ext/standard/info.c b/ext/standard/info.c index b27468e3ebb..a63fd4c5c51 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -652,7 +652,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) { char **env, *tmp1, *tmp2; char *php_uname; - int expose_php = INI_INT("expose_php"); if (!sapi_module.phpinfo_as_text) { php_print_info_htmlhead(TSRMLS_C); @@ -670,7 +669,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_box_start(1); } - if (expose_php && !sapi_module.phpinfo_as_text) { + if (!sapi_module.phpinfo_as_text) { time_t the_time; struct tm *ta, tmbuf; @@ -783,7 +782,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) /* Zend Engine */ php_info_print_box_start(0); - if (expose_php && !sapi_module.phpinfo_as_text) { + if (!sapi_module.phpinfo_as_text) { php_info_print("\"Zend\n"); } @@ -798,7 +797,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) efree(php_uname); } - if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) { + if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { php_info_print_hr(); php_info_print("\n"); From 626effcf1736f7f14e1c01ec52d62a55cf70cd9d Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 15 Jul 2012 15:35:16 -0700 Subject: [PATCH 271/641] typo --- UPGRADING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index d598996f30d..6cfd47bfaf7 100755 --- a/UPGRADING +++ b/UPGRADING @@ -21,7 +21,7 @@ PHP X.Y UPGRADE NOTES ======================================== - Drop Windows XP and 2003 support. (Pierre) -- All internal case insensitivity handling for class, fucntion and constant +- All internal case insensitivity handling for class, function and constant names is done according to ASCII rules, current locale settings are ignored. ======================================== From 88f7f3c00fba1aea5e5ca7d0f01b31bc2e8bf275 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Tue, 17 Jul 2012 10:04:56 +0100 Subject: [PATCH 272/641] Do not unload shared extensions when checking for leaks --- run-tests.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run-tests.php b/run-tests.php index 302167a6e5c..cfc562ebc15 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1478,8 +1478,10 @@ TEST $file if ($leak_check) { $env['USE_ZEND_ALLOC'] = '0'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 1; } else { $env['USE_ZEND_ALLOC'] = '1'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 0; } junit_start_timer($shortname); @@ -1746,6 +1748,7 @@ TEST $file if ($leak_check) { $env['USE_ZEND_ALLOC'] = '0'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 1; if ($valgrind_version >= 330) { /* valgrind 3.3.0+ doesn't have --log-file-exactly option */ @@ -1756,6 +1759,7 @@ TEST $file } else { $env['USE_ZEND_ALLOC'] = '1'; + $env['ZEND_DONT_UNLOAD_MODULES'] = 0; } if ($DETAILED) echo " From 85f077cea13b3cb4927453b8a2f8ce51a9461bbb Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 17 Jul 2012 13:24:27 +0200 Subject: [PATCH 273/641] Add support by yielding by-reference --- ...n_ref_generator_iterated_by_ref_error.phpt | 13 + .../errors/yield_const_by_ref_error.phpt | 16 + ...ld_non_ref_function_call_by_ref_error.phpt | 20 + .../generators/generator_method_by_ref.phpt | 44 + Zend/tests/generators/yield_by_reference.phpt | 32 + .../yield_ref_function_call_by_reference.phpt | 24 + Zend/zend_compile.c | 12 +- Zend/zend_generators.c | 8 +- Zend/zend_vm_def.h | 81 +- Zend/zend_vm_execute.h | 1935 +++++++++++++---- 10 files changed, 1746 insertions(+), 439 deletions(-) create mode 100644 Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt create mode 100644 Zend/tests/generators/errors/yield_const_by_ref_error.phpt create mode 100644 Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt create mode 100644 Zend/tests/generators/generator_method_by_ref.phpt create mode 100644 Zend/tests/generators/yield_by_reference.phpt create mode 100644 Zend/tests/generators/yield_ref_function_call_by_reference.phpt diff --git a/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt new file mode 100644 index 00000000000..5d1a9e34841 --- /dev/null +++ b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt @@ -0,0 +1,13 @@ +--TEST-- +Non-ref generators cannot be iterated by-ref +--FILE-- + +--EXPECTF-- +Fatal error: You can only iterate a generator by-reference if it declared that it yields by-reference in %s on line %d diff --git a/Zend/tests/generators/errors/yield_const_by_ref_error.phpt b/Zend/tests/generators/errors/yield_const_by_ref_error.phpt new file mode 100644 index 00000000000..37ce1450db1 --- /dev/null +++ b/Zend/tests/generators/errors/yield_const_by_ref_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +A notice is thrown when yielding a constant value by reference +--FILE-- +current()); + +?> +--EXPECTF-- +Notice: Only variable references should be yielded by reference in %s on line %d +string(3) "foo" diff --git a/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt new file mode 100644 index 00000000000..2487149eefa --- /dev/null +++ b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt @@ -0,0 +1,20 @@ +--TEST-- +Yielding the result of a non-ref function call throw a notice +--FILE-- +current()); + +?> +--EXPECTF-- +Notice: Only variable references should be yielded by reference in %s on line %d +string(3) "bar" diff --git a/Zend/tests/generators/generator_method_by_ref.phpt b/Zend/tests/generators/generator_method_by_ref.phpt new file mode 100644 index 00000000000..108c2133f63 --- /dev/null +++ b/Zend/tests/generators/generator_method_by_ref.phpt @@ -0,0 +1,44 @@ +--TEST-- +Generator methods can yield by reference +--FILE-- +data = $data; + } + + public function getData() { + return $this->data; + } + + public function *&getIterator() { + foreach ($this->data as $key => &$value) { + yield $key => $value; + } + } +} + +$test = new Test([1, 2, 3, 4, 5]); +foreach ($test as &$value) { + $value *= -1; +} + +var_dump($test->getData()); + +?> +--EXPECT-- +array(5) { + [0]=> + int(-1) + [1]=> + int(-2) + [2]=> + int(-3) + [3]=> + int(-4) + [4]=> + &int(-5) +} diff --git a/Zend/tests/generators/yield_by_reference.phpt b/Zend/tests/generators/yield_by_reference.phpt new file mode 100644 index 00000000000..86dd419bd64 --- /dev/null +++ b/Zend/tests/generators/yield_by_reference.phpt @@ -0,0 +1,32 @@ +--TEST-- +Generators can yield by-reference +--FILE-- + &$value) { + yield $key => $value; + } +} + +$array = [1, 2, 3, 4, 5]; +$iter = iter($array); +foreach ($iter as &$value) { + $value *= -1; +} +var_dump($array); + +?> +--EXPECT-- +array(5) { + [0]=> + int(-1) + [1]=> + int(-2) + [2]=> + int(-3) + [3]=> + int(-4) + [4]=> + &int(-5) +} diff --git a/Zend/tests/generators/yield_ref_function_call_by_reference.phpt b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt new file mode 100644 index 00000000000..88f72eabd12 --- /dev/null +++ b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt @@ -0,0 +1,24 @@ +--TEST-- +The result of a by-ref function call can be yielded just fine +--FILE-- + +--EXPECT-- +string(3) "bar" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 35ff2bbf522..9264fde8e29 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2615,12 +2615,16 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ zend_op *opline; int start_op_number, end_op_number; + /* For generators the & modifier applies to the yielded values, not the + * return value. */ + zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR); + if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) && expr != NULL) { zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); } if (do_end_vparse) { - if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(expr)) { + if (returns_reference && !zend_is_function_or_method_call(expr)) { zend_do_end_variable_parse(expr, BP_VAR_W, 0 TSRMLS_CC); } else { zend_do_end_variable_parse(expr, BP_VAR_R, 0 TSRMLS_CC); @@ -2645,7 +2649,7 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) ? ZEND_RETURN_BY_REF : ZEND_RETURN; + opline->opcode = returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN; if (expr) { SET_NODE(opline->op1, expr); @@ -2676,6 +2680,10 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC if (value) { SET_NODE(opline->op1, value); + + if (zend_is_function_or_method_call(value)) { + opline->extended_value = ZEND_RETURNS_FUNCTION; + } } else { SET_UNUSED(opline->op1); } diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index bccbb48ca41..20ab9b16c68 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -661,12 +661,12 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob zend_generator_iterator *iterator; zend_generator *generator; - if (by_ref) { - zend_error(E_ERROR, "By reference iteration of generators is currently not supported"); - } - generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + if (by_ref && !(generator->execute_data->op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) { + zend_error(E_ERROR, "You can only iterate a generator by-reference if it declared that it yields by-reference"); + } + iterator = emalloc(sizeof(zend_generator_iterator)); iterator->intern.funcs = &zend_generator_iterator_functions; iterator->intern.data = (void *) generator; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 015263f52f5..4be644a3327 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5316,6 +5316,7 @@ ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -5332,30 +5333,74 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE /* Set the new yielded value */ if (OP1_TYPE != IS_UNUSED) { - zend_free_op free_op1; - zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = GET_OP1_ZVAL_PTR(BP_VAR_R); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!IS_OP1_TMP_FREE()) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!IS_OP1_TMP_FREE()) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); + + if (OP1_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + FREE_OP1_IF_VAR(); + } + } else { + zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); + + /* Consts, temporary variables and references need copying */ + if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!IS_OP1_TMP_FREE()) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + FREE_OP1_IF_VAR(); } - - FREE_OP1_IF_VAR(); } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 29b6d7c500c..b1bcd74d233 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4118,6 +4118,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -4133,29 +4134,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { + zval *value, *copy; - zval *value = opline->op1.zv; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = opline->op1.zv; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -4759,6 +4803,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -4774,29 +4819,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { + zval *value, *copy; - zval *value = opline->op1.zv; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = opline->op1.zv; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -5725,6 +5813,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -5740,29 +5829,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { + zval *value, *copy; - zval *value = opline->op1.zv; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = opline->op1.zv; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -6386,6 +6518,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -6401,29 +6534,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { + zval *value, *copy; - zval *value = opline->op1.zv; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = opline->op1.zv; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -7086,6 +7262,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -7101,29 +7278,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { + zval *value, *copy; - zval *value = opline->op1.zv; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = opline->op1.zv; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CONST == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = opline->op1.zv; + + /* Consts, temporary variables and references need copying */ + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -9093,6 +9313,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -9109,29 +9330,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -9734,6 +9998,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -9750,29 +10015,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -10700,6 +11008,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -10716,29 +11025,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -11227,6 +11579,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -11243,29 +11596,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -11865,6 +12261,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -11881,29 +12278,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!1) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!1) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -15729,6 +16169,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -15745,30 +16186,74 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -17757,6 +18242,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -17773,30 +18259,74 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -20165,6 +20695,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -20181,30 +20712,74 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -21252,6 +21827,7 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -21268,30 +21844,74 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -23329,6 +23949,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE + zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -23345,30 +23966,74 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { - zend_free_op free_op1; - zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { + zval *value, *copy; - /* Consts, temporary variables and references need copying */ - if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_VAR == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } + } else { + zval *value = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } - - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -24766,6 +25431,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -24781,29 +25447,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) { + zval *value, *copy; - zval *value = NULL; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = NULL; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -26025,6 +26734,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -26040,29 +26750,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) { + zval *value, *copy; - zval *value = NULL; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = NULL; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -27284,6 +28037,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -27299,29 +28053,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) { + zval *value, *copy; - zval *value = NULL; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = NULL; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -27655,6 +28452,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -27670,29 +28468,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) { + zval *value, *copy; - zval *value = NULL; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = NULL; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -28911,6 +29752,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -28926,29 +29768,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) { + zval *value, *copy; - zval *value = NULL; + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = NULL; + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = NULL; + + if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_UNUSED == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = NULL; + + /* Consts, temporary variables and references need copying */ + if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -32376,6 +33261,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -32391,29 +33277,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { + zval *value, *copy; - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC); + + if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -34274,6 +35203,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -34289,29 +35219,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { + zval *value, *copy; - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC); + + if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -36551,6 +37524,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -36566,29 +37540,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { + zval *value, *copy; - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC); + + if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -37498,6 +38515,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -37513,29 +38531,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { + zval *value, *copy; - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC); + + if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); @@ -39444,6 +40505,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS { USE_OPLINE + /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -39459,29 +40521,72 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { + /* Constants and temporary variables aren't yieldable by reference, + * but we still allow them with a notice. */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { + zval *value, *copy; - zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); - /* Consts, temporary variables and references need copying */ - if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR - || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) - ) { - zval *copy; + value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); - ALLOC_ZVAL(copy); - INIT_PZVAL_COPY(copy, value); + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } - /* Temporary variables don't need ctor copying */ - if (!0) { - zval_copy_ctor(copy); + generator->value = copy; + } else { + zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->op1.var TSRMLS_CC); + + if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) { + zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference"); + } + + /* If a function call result is yielded and the function did + * not return by reference we throw a notice. */ + if (IS_CV == IS_VAR && !Z_ISREF_PP(value_ptr) + && !(opline->extended_value == ZEND_RETURNS_FUNCTION + && EX_T(opline->op1.var).var.fcall_returned_reference) + && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { + zend_error(E_NOTICE, "Only variable references should be yielded by reference"); + + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } else { + SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr); + Z_ADDREF_PP(value_ptr); + generator->value = *value_ptr; + } + + } + } else { + zval *value = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + + /* Consts, temporary variables and references need copying */ + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR + || (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) + ) { + zval *copy; + + ALLOC_ZVAL(copy); + INIT_PZVAL_COPY(copy, value); + + /* Temporary variables don't need ctor copying */ + if (!0) { + zval_copy_ctor(copy); + } + + generator->value = copy; + } else { + Z_ADDREF_P(value); + generator->value = value; } - generator->value = copy; - } else { - Z_ADDREF_P(value); - generator->value = value; } - } else { /* If no value was specified yield null */ Z_ADDREF(EG(uninitialized_zval)); From bd39495332f12f074ef0916280c446a3c37704b4 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Tue, 17 Jul 2012 17:50:05 +0200 Subject: [PATCH 274/641] Fix for bug #62379 was missing in 5.3 --- ext/pdo/tests/pdo_test.inc | 12 ++- ext/pdo_odbc/odbc_stmt.c | 79 ++++++++----------- ext/pdo_odbc/tests/common.phpt | 45 +++++++++-- ext/pdo_odbc/tests/long_columns.phpt | 114 ++++++++++++++++++++++++--- 4 files changed, 185 insertions(+), 65 deletions(-) diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc index bbaeb71af7e..a46e67d8915 100644 --- a/ext/pdo/tests/pdo_test.inc +++ b/ext/pdo/tests/pdo_test.inc @@ -67,13 +67,19 @@ class PDOTest { } static function test_factory($file) { - $data = file_get_contents($file); - $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); - $config = eval($data); + $config = self::get_config($file); foreach ($config['ENV'] as $k => $v) { putenv("$k=$v"); } return self::factory(); } + + static function get_config($file) { + $data = file_get_contents($file); + $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data); + $config = eval($data); + + return $config; + } } ?> \ No newline at end of file diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 4e039d2a740..e700ef8c3ce 100755 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -633,58 +633,49 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l } if (rc == SQL_SUCCESS_WITH_INFO) { - /* promote up to a bigger buffer */ - - if (C->fetched_len != SQL_NO_TOTAL) { - /* use size suggested by the driver, if it knows it */ - buf = emalloc(C->fetched_len + 1); - memcpy(buf, C->data, C->fetched_len); - buf[C->fetched_len] = 0; - used = C->fetched_len; - } else { - buf = estrndup(C->data, 256); - used = 255; /* not 256; the driver NUL terminated the buffer */ - } + /* this is a 'long column' + + read the column in 255 byte blocks until the end of the column is reached, reassembling those blocks + in order into the output buffer + + this loop has to work whether or not SQLGetData() provides the total column length. + calling SQLDescribeCol() or other, specifically to get the column length, then doing a single read + for that size would be slower except maybe for extremely long columns.*/ + char *buf2; + buf2 = emalloc(256); + buf = estrndup(C->data, 256); + used = 255; /* not 256; the driver NUL terminated the buffer */ + do { C->fetched_len = 0; - rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, - buf + used, alloced - used, - &C->fetched_len); - - if (rc == SQL_NO_DATA) { - /* we got the lot */ - break; - } else if (rc != SQL_SUCCESS) { - pdo_odbc_stmt_error("SQLGetData"); - if (rc != SQL_SUCCESS_WITH_INFO) { - break; - } - } - - if (C->fetched_len == SQL_NO_TOTAL) { - used += alloced - used; + /* read block. 256 bytes => 255 bytes are actually read, the last 1 is NULL */ + rc = SQLGetData(S->stmt, colno+1, SQL_C_CHAR, buf2, 256, &C->fetched_len); + + /* resize output buffer and reassemble block */ + if (rc==SQL_SUCCESS_WITH_INFO) { + /* point 5, in section "Retrieving Data with SQLGetData" in http://msdn.microsoft.com/en-us/library/windows/desktop/ms715441(v=vs.85).aspx + states that if SQL_SUCCESS_WITH_INFO, fetched_len will be > 255 (greater than buf2's size) + (if a driver fails to follow that and wrote less than 255 bytes to buf2, this will AV or read garbage into buf) */ + buf = erealloc(buf, used + 255+1); + memcpy(buf + used, buf2, 255); + used = used + 255; + } else if (rc==SQL_SUCCESS) { + buf = erealloc(buf, used + C->fetched_len+1); + memcpy(buf + used, buf2, C->fetched_len); + used = used + C->fetched_len; } else { - used += C->fetched_len; - } - - if (rc == SQL_SUCCESS) { - /* this was the final fetch */ + /* includes SQL_NO_DATA */ break; } - - /* we need to fetch another chunk; resize the - * buffer */ - alloced *= 2; - buf = erealloc(buf, alloced); + } while (1); - - /* size down */ - if (used < alloced - 1024) { - alloced = used+1; - buf = erealloc(buf, used+1); - } + + efree(buf2); + + /* NULL terminate the buffer once, when finished, for use with the rest of PHP */ buf[used] = '\0'; + *ptr = buf; *caller_frees = 1; *len = used; diff --git a/ext/pdo_odbc/tests/common.phpt b/ext/pdo_odbc/tests/common.phpt index f64da1a438e..276f2b78e3d 100644 --- a/ext/pdo_odbc/tests/common.phpt +++ b/ext/pdo_odbc/tests/common.phpt @@ -2,17 +2,40 @@ ODBC --SKIPIF-- +if (!extension_loaded('pdo_odbc')) print 'skip'; +if (substr(PHP_OS, 0, 3) == 'WIN' && + false === getenv('PDOTEST_DSN') && + false === getenv('PDO_ODBC_TEST_DSN') && + !extension_loaded('com_dotnet')) { + die('skip - either PDOTEST_DSN or com_dotnet extension is needed to setup the connection'); +} --REDIRECTTEST-- # magic auto-configuration $config = array( - 'TESTS' => 'ext/pdo/tests' + 'TESTS' => 'ext/pdo/tests', + 'ENV' => array() ); - -if (false !== getenv('PDO_ODBC_TEST_DSN')) { - # user set them from their shell +// try loading PDO driver using ENV vars and if none given, and on Windows, try using MS Access +// and if not, skip the test +// +// try to use common PDO env vars, instead of PDO_ODBC specific +if (false !== getenv('PDOTEST_DSN')) { + // user should have to set PDOTEST_DSN so that: + // 1. test is skipped if user doesn't want to test it, even if they have MS Access installed + // 2. it detects if ODBC driver is not installed - to avoid test bug + // 3. it detects if ODBC driver is installed - so test will be run + // 4. so a specific ODBC driver can be tested - if system has multiple ODBC drivers + + $config['ENV']['PDOTEST_DSN'] = getenv('PDOTEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDOTEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDOTEST_PASS'); + if (false !== getenv('PDOTEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDOTEST_ATTR'); + } +} else if (false !== getenv('PDO_ODBC_TEST_DSN')) { + // user set these from their shell instead $config['ENV']['PDOTEST_DSN'] = getenv('PDO_ODBC_TEST_DSN'); $config['ENV']['PDOTEST_USER'] = getenv('PDO_ODBC_TEST_USER'); $config['ENV']['PDOTEST_PASS'] = getenv('PDO_ODBC_TEST_PASS'); @@ -20,10 +43,13 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_ODBC_TEST_ATTR'); } } elseif (preg_match('/^WIN/i', PHP_OS)) { - # on windows, try to create a temporary MS access database + // on Windows and user didn't set PDOTEST_DSN, try this as a fallback: + // check if MS Access DB is installed, and if yes, try using it. create a temporary MS access database. + // $path = realpath(dirname(__FILE__)) . '\pdo_odbc.mdb'; if (!file_exists($path)) { try { + // try to create database $adox = new COM('ADOX.Catalog'); $adox->Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' . $path); $adox = null; @@ -32,9 +58,12 @@ if (false !== getenv('PDO_ODBC_TEST_DSN')) { } } if (file_exists($path)) { + // database was created and written to file system $config['ENV']['PDOTEST_DSN'] = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$path;Uid=Admin"; - } -} + } // else: $config['ENV']['PDOTEST_DSN'] not set +} // else: $config['ENV']['PDOTEST_DSN'] not set +// test will be skipped. see SKIPIF section of long_columns.phpt + # other magic autodetection here, eg: for DB2 by inspecting env /* $USER = 'db2inst1'; diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt index 65ec2f96e90..e3430ded47d 100644 --- a/ext/pdo_odbc/tests/long_columns.phpt +++ b/ext/pdo_odbc/tests/long_columns.phpt @@ -3,9 +3,44 @@ PDO ODBC "long" columns --SKIPIF-- --FILE-- " ex: SET PDOTEST_DSN=odbc:accdb12 +// -note: on Windows, " is included in environment variable +// +// easy way to compile: +// configure --disable-all --enable-cli --enable-zts --enable-pdo --with-pdo-odbc --enable-debug +// configure --disable-all --eanble-cli --enable-pdo --with-pdo-odbc=unixODBC,/usr,/usr --with-unixODBC=/usr --enable-debug +// + require 'ext/pdo/tests/pdo_test.inc'; $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); @@ -20,27 +55,86 @@ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CL $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998, 3999, 4000); +// the driver reads columns in blocks of 255 bytes and then reassembles those blocks into a single buffer. +// test sizes around 255 to make sure that the reassembly works (and that the column is split into 255 byte blocks by the database) +// also, test sizes below 255 to make sure that they work - and are not treated as a long column (should be read in a single read) +$sizes = array(32, 53, 64, 79, 128, 253, 254, 255, 256, 257, 258, 1022, 1023, 1024, 1025, 1026, 510, 511, 512, 513, 514, 1278, 1279, 1280, 1281, 1282, 2046, 2047, 2048, 2049, 2050, 1534, 1535, 1536, 1537, 1538, 3070, 3071, 3072, 3073, 3074, 3998, 3999, 4000); -$db->beginTransaction(); -$insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)'); -foreach ($sizes as $num) { - $insert->execute(array($num, str_repeat('i', $num))); +function alpha_repeat($len) { + // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled + $out = ""; + while (strlen($out) < $len) { + $out .= "abcdefghijklmnopqrstuvwxyz"; + } + return substr($out, 0, $len); } -$insert = null; -$db->commit(); +// don't use Prepared Statements. that fails on MS SQL server (works with Access, MyODBC), which is a separate failure, feature/code-path from what +// this test does - nice to be able to test using MS SQL server +foreach ($sizes as $num) { + $text = alpha_repeat($num); + $db->exec("INSERT INTO TEST VALUES($num, '$text')"); +} + +// verify data foreach ($db->query('SELECT id, data from TEST') as $row) { - $expect = str_repeat('i', $row[0]); + $expect = alpha_repeat($row[0]); if (strcmp($expect, $row[1])) { echo "Failed on size $row[id]:\n"; printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data'])); - echo bin2hex($expect) . "\n"; - echo bin2hex($row['data']) . "\n"; + echo ($expect) . "\n"; + echo ($row['data']) . "\n"; + } else { + echo "Passed on size $row[id]\n"; } } echo "Finished\n"; --EXPECT-- +Passed on size 32 +Passed on size 53 +Passed on size 64 +Passed on size 79 +Passed on size 128 +Passed on size 253 +Passed on size 254 +Passed on size 255 +Passed on size 256 +Passed on size 257 +Passed on size 258 +Passed on size 1022 +Passed on size 1023 +Passed on size 1024 +Passed on size 1025 +Passed on size 1026 +Passed on size 510 +Passed on size 511 +Passed on size 512 +Passed on size 513 +Passed on size 514 +Passed on size 1278 +Passed on size 1279 +Passed on size 1280 +Passed on size 1281 +Passed on size 1282 +Passed on size 2046 +Passed on size 2047 +Passed on size 2048 +Passed on size 2049 +Passed on size 2050 +Passed on size 1534 +Passed on size 1535 +Passed on size 1536 +Passed on size 1537 +Passed on size 1538 +Passed on size 3070 +Passed on size 3071 +Passed on size 3072 +Passed on size 3073 +Passed on size 3074 +Passed on size 3998 +Passed on size 3999 +Passed on size 4000 Finished + From b47d6b32ba8d6dc1b9d1fc91a83eef29a28363c5 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Tue, 17 Jul 2012 23:01:20 +0800 Subject: [PATCH 275/641] Fix test fails: ext/standard/tests/general_functions/bug27678.phpt After commit 3e62aae1, number_format() returns string with length, but _php_math_number_format_ex_len() didn't set string length on nan and inf. This cause segfault when destruct the return value. --- ext/standard/math.c | 4 ++++ ext/standard/tests/general_functions/bug27678.phpt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/standard/math.c b/ext/standard/math.c index b3e8c6f086c..6e934a3857a 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1120,6 +1120,10 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d); if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { + if (result_len) { + *result_len = tmplen; + } + return tmpbuf; } diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt index 5db5890a1ce..6f95509e14e 100644 --- a/ext/standard/tests/general_functions/bug27678.phpt +++ b/ext/standard/tests/general_functions/bug27678.phpt @@ -6,9 +6,11 @@ Bug #27678 (number_format() crashes with large numbers) number_format(1e80, 0, '', ' '); number_format(1e300, 0, '', ' '); number_format(1e320, 0, '', ' '); -number_format(1e1000, 0, '', ' '); +$num = number_format(1e1000, 0, '', ' '); +var_dump(strlen($num) == 3); // $num == 'inf' echo "Done\n"; ?> --EXPECT-- +bool(true) Done From c7614a8c19d5d1f366ec219e745760ea2133e5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Tue, 17 Jul 2012 23:12:25 +0200 Subject: [PATCH 276/641] NEWS for b47d6b32 --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b3dcec7deab..8dc740cbae2 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.6 - Core: + . Fixed bug in number_format() when the number was not finite. See pull + request #134. (Reeze Xia) . Fixed bug #62565 (Crashes due non-initialized internal properties_table). (Felipe) @@ -22,7 +24,7 @@ PHP NEWS crash). (Felipe) - Reflection: - . Implemented FR ##61602 (Allow access to name of constant used as default + . Implemented FR #61602 (Allow access to name of constant used as default value). (reeze.xia@gmail.com) - SimpleXML: From c7c939b5d8b2a8e2d7d72bf83c031005e93cd3fe Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 18:00:09 +0800 Subject: [PATCH 277/641] Bug doesn't exists in any release --- NEWS | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 8dc740cbae2..9da5717dd32 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,6 @@ PHP NEWS ?? ??? 2012, PHP 5.4.6 - Core: - . Fixed bug in number_format() when the number was not finite. See pull - request #134. (Reeze Xia) . Fixed bug #62565 (Crashes due non-initialized internal properties_table). (Felipe) @@ -17,7 +15,7 @@ PHP NEWS - Fileinfo: . Fixed bug #61964 (finfo_open with directory causes invalid free). - (reeze.xia@gmail.com) + (reeze.xia@gmail.com) - Intl: . Fixed bug #62564 (Extending MessageFormatter and adding property causes From cea3f0f3635179c052ba2d13d889a82b5a327ddb Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 18:50:42 +0800 Subject: [PATCH 278/641] fix test All input characters that are not a-z, A-Z or 0-9 will be converted to their "URL escaped" version see http://curl.haxx.se/libcurl/c/curl_escape.html --- ext/curl/tests/curl_escape.phpt | Bin 553 -> 557 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ext/curl/tests/curl_escape.phpt b/ext/curl/tests/curl_escape.phpt index 7c90fb98883249b398707037da94d7ad8dd3db4f..9a11e61b82581c0aad8673d3b3dce639066abbff 100644 GIT binary patch delta 42 vcmZ3vXW)PDMl${Gff4hjFOT9Rbxk0BR3!_FE7_C$SBa8{DRRH0Op$vB>(^b From 25be12a3bcd4a56a094d28b73cdc5cee68970bf3 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 19:06:27 +0800 Subject: [PATCH 279/641] Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode) --- NEWS | 3 +++ ext/mysqlnd/mysqlnd_debug.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9da5717dd32..280eb1ff15d 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ PHP NEWS . Fixed bug #62564 (Extending MessageFormatter and adding property causes crash). (Felipe) +- MySQLnd: + . Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode). (Laruence) + - Reflection: . Implemented FR #61602 (Allow access to name of constant used as default value). (reeze.xia@gmail.com) diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index 5c77b42459b..044a7d6807d 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -516,9 +516,11 @@ enum mysqlnd_debug_parser_state static void MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const mode) { - unsigned int mode_len = strlen(mode), i; + unsigned int mode_len, i; enum mysqlnd_debug_parser_state state = PARSER_WAIT_MODIFIER; + mode_len = mode? strlen(mode) : 0; + self->flags = 0; self->nest_level_limit = 0; if (self->file_name && self->file_name != mysqlnd_debug_default_trace_file) { From 8238c6a4c815220045322ac3c524b98613639f97 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 19:19:31 +0800 Subject: [PATCH 280/641] test script for bug #61697 --- ext/spl/tests/bug61697.phpt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ext/spl/tests/bug61697.phpt diff --git a/ext/spl/tests/bug61697.phpt b/ext/spl/tests/bug61697.phpt new file mode 100644 index 00000000000..d95caef9785 --- /dev/null +++ b/ext/spl/tests/bug61697.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #61697 (spl_autoload_functions returns lambda functions incorrectly) +--XFAIL-- +Bug #61697 not fixed yet +--FILE-- + +--EXPECTF-- +Array +( +) From 41a9c681a0a8b27ab121d2a4649fccd16c97cadd Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 19:21:25 +0800 Subject: [PATCH 281/641] fix test, the key may be a float value --- ext/standard/tests/file/realpath_cache.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt index 92d6fc5b2a3..2dac21ec4b1 100644 --- a/ext/standard/tests/file/realpath_cache.phpt +++ b/ext/standard/tests/file/realpath_cache.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(4) { ["key"]=> - %s(%d) + %s(%s) ["is_dir"]=> bool(true) ["realpath"]=> From 282a6659aab94133bb9f95148b2540018333a8ca Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 19:25:22 +0800 Subject: [PATCH 282/641] fix test (dos2unix, typo) --- .../tests/general_functions/uniqid_basic.phpt | 145 +++++++++--------- 1 file changed, 72 insertions(+), 73 deletions(-) diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 9a9c5733272..2da832b8ed2 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -1,73 +1,72 @@ ---TEST-- -Test uniqid() function : basic functionality ---FILE-- - -===DONE=== ---EXPECTF-- -*** Testing uniqid() : basic functionality *** - -uniqid() without a prefix -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - - -uniqid() with a prefix -string(18) "99999%s" -string(28) "99999%s.%s" -string(18) "99999%s" - -string(18) "999994%s" -string(28) "999994%s.%s" -string(18) "999994%s" - -string(17) "1050%s" -string(27) "1050%s.%s" -string(17) "1050%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -string(14) "1%s" -string(24) "1%s.%s" -string(14) "1%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -===DONE=== - \ No newline at end of file +--TEST-- +Test uniqid() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing uniqid() : basic functionality *** + +uniqid() without a prefix +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + + +uniqid() with a prefix +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(17) "1050%s" +string(27) "1050%s.%s" +string(17) "1050%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +string(14) "1%s" +string(24) "1%s.%s" +string(14) "1%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +===DONE=== From 11d05589282a7f9c795a0af77dcd2b3cc0a158ce Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 19:47:54 +0800 Subject: [PATCH 283/641] skip for ZTS --- ext/standard/tests/general_functions/debug_zval_dump_o.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt index dd4b5142a12..78f0f03003a 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -1,5 +1,7 @@ --TEST-- Test debug_zval_dump() function : working on objects +--SKIPIF-- + Date: Wed, 18 Jul 2012 19:50:30 +0800 Subject: [PATCH 284/641] Fix test (no charset outputed) --- sapi/cgi/tests/apache_request_headers.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt index 3dc3580c21c..881b6bb171c 100644 --- a/sapi/cgi/tests/apache_request_headers.phpt +++ b/sapi/cgi/tests/apache_request_headers.phpt @@ -31,7 +31,7 @@ echo "Done\n"; ?> --EXPECTF-- X-Powered-By: PHP/%s -Content-type: text/html; charset=UTF-8 +Content-type: text/%s Array ( From 2d9d2cadadf0fdf12a01b4a689d0554e1450904f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 20:16:27 +0800 Subject: [PATCH 285/641] Fixed bug #62597 (segfault in php_stream_wrapper_log_error with ZTS build) --- NEWS | 4 ++++ ext/standard/file.c | 1 + 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 280eb1ff15d..34b48d9c1e2 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,10 @@ PHP NEWS . Fixed bug #61527 (ArrayIterator gives misleading notice on next() when moved to the end). (reeze.xia@gmail.com) +- Streams: + . Fixed bug #62597 (segfault in php_stream_wrapper_log_error with ZTS build). + (Laruence) + ?? ??? 2012, PHP 5.4.5 - Core: diff --git a/ext/standard/file.c b/ext/standard/file.c index 7d01d313507..cce0143fff8 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -161,6 +161,7 @@ static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) FG(pclose_ret) = 0; FG(user_stream_current_filename) = NULL; FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE; + FG(wrapper_errors) = NULL; } static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) From b81b8bf77d75d719a9785f71796e56ad2b676147 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 21:45:37 +0800 Subject: [PATCH 286/641] this initialization is unnecessary anymore after commit 2d9d2cadadf0fdf12a01b4a689d0554e1450904f --- ext/standard/basic_functions.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a5637db50d7..e6de34e5fd0 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3719,8 +3719,6 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */ /* Default to global filters only */ FG(stream_filters) = NULL; - FG(wrapper_errors) = NULL; - return SUCCESS; } /* }}} */ From 94a0f8722b1f480f2cd8c0fc044cff40f2418607 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 18 Jul 2012 22:35:03 +0800 Subject: [PATCH 287/641] Revert "fix test" This reverts commit cea3f0f3635179c052ba2d13d889a82b5a327ddb. seems the behavior is different between certain versions --- ext/curl/tests/curl_escape.phpt | Bin 557 -> 553 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ext/curl/tests/curl_escape.phpt b/ext/curl/tests/curl_escape.phpt index 9a11e61b82581c0aad8673d3b3dce639066abbff..7c90fb98883249b398707037da94d7ad8dd3db4f 100644 GIT binary patch delta 38 scmZ3>vXW)PDMl${Gff4hjFOT9Rbxk0BR3!_FE7_C$SBa8{DRRH0Op$vB>(^b delta 42 vcmZ3 Date: Fri, 20 Jul 2012 00:49:50 +0200 Subject: [PATCH 288/641] Remove asterix modifier (*) for generators Generators are now automatically detected by the presence of a `yield` expression in their body. This removes the ZEND_SUSPEND_AND_RETURN_GENERATOR opcode. Instead additional checks for ZEND_ACC_GENERATOR are added to the fcall_common helper and zend_call_function. This also adds a new function zend_generator_create_zval, which handles the actual creation of the generator zval from an op array. I feel like I should deglobalize the zend_create_execute_data_from_op_array code a bit. It currently changes EG(current_execute_data) and EG(opline_ptr) which is somewhat confusing (given the name). --- .../generators/auto_incrementing_keys.phpt | 2 +- Zend/tests/generators/backtrace.phpt | 3 +- Zend/tests/generators/clone.phpt | 2 +- Zend/tests/generators/clone_with_foreach.phpt | 2 +- Zend/tests/generators/clone_with_stack.phpt | 2 +- .../generators/clone_with_symbol_table.phpt | 2 +- Zend/tests/generators/clone_with_this.phpt | 4 +- .../generators/close_inside_generator.phpt | 2 +- Zend/tests/generators/dynamic_call.phpt | 2 +- .../errors/generator_cannot_return_error.phpt | 3 +- ...n_ref_generator_iterated_by_ref_error.phpt | 2 +- .../errors/yield_const_by_ref_error.phpt | 2 +- .../yield_in_normal_function_error.phpt | 12 - ...ld_non_ref_function_call_by_ref_error.phpt | 2 +- .../errors/yield_outside_function_error.phpt | 2 +- Zend/tests/generators/func_get_args.phpt | 3 +- Zend/tests/generators/generator_close.phpt | 2 +- Zend/tests/generators/generator_method.phpt | 2 +- .../generators/generator_method_by_ref.phpt | 2 +- .../generator_returns_generator.phpt | 6 +- Zend/tests/generators/generator_send.phpt | 2 +- ...nerator_throwing_during_function_call.phpt | 2 +- .../generator_throwing_exception.phpt | 2 +- .../tests/generators/generator_with_keys.phpt | 2 +- .../generators/no_foreach_var_leaks.phpt | 2 +- Zend/tests/generators/send_after_close.phpt | 8 +- .../generators/send_returns_current.phpt | 2 +- .../tests/generators/unused_return_value.phpt | 2 +- Zend/tests/generators/xrange.phpt | 2 +- Zend/tests/generators/yield_by_reference.phpt | 2 +- .../yield_during_function_call.phpt | 2 +- .../generators/yield_during_method_call.phpt | 2 +- .../yield_ref_function_call_by_reference.phpt | 2 +- .../tests/generators/yield_without_value.phpt | 2 +- Zend/zend_compile.c | 38 +-- Zend/zend_compile.h | 5 +- Zend/zend_execute.h | 1 + Zend/zend_execute_API.c | 9 +- Zend/zend_generators.c | 53 +++- Zend/zend_generators.h | 1 + Zend/zend_language_parser.y | 27 +-- Zend/zend_vm_def.h | 109 +-------- Zend/zend_vm_execute.h | 228 ++++++++---------- Zend/zend_vm_execute.skl | 2 +- Zend/zend_vm_opcodes.h | 5 +- 45 files changed, 247 insertions(+), 324 deletions(-) delete mode 100644 Zend/tests/generators/errors/yield_in_normal_function_error.phpt diff --git a/Zend/tests/generators/auto_incrementing_keys.phpt b/Zend/tests/generators/auto_incrementing_keys.phpt index 623f2d813d4..acfb2f2ce00 100644 --- a/Zend/tests/generators/auto_incrementing_keys.phpt +++ b/Zend/tests/generators/auto_incrementing_keys.phpt @@ -3,7 +3,7 @@ Generator keys are auto-incrementing by default --FILE-- 'rab'; diff --git a/Zend/tests/generators/backtrace.phpt b/Zend/tests/generators/backtrace.phpt index 77976f93244..5f665b7e4ac 100644 --- a/Zend/tests/generators/backtrace.phpt +++ b/Zend/tests/generators/backtrace.phpt @@ -7,8 +7,9 @@ function f1() { debug_print_backtrace(); } -function *f2($arg1, $arg2) { +function f2($arg1, $arg2) { f1(); + yield; // force generator } function f3($gen) { diff --git a/Zend/tests/generators/clone.phpt b/Zend/tests/generators/clone.phpt index 94c4c6364e7..36811dfe6e7 100644 --- a/Zend/tests/generators/clone.phpt +++ b/Zend/tests/generators/clone.phpt @@ -3,7 +3,7 @@ Generators can be cloned --FILE-- foo = 'bar'; yield; // interrupt var_dump($this->foo); diff --git a/Zend/tests/generators/close_inside_generator.phpt b/Zend/tests/generators/close_inside_generator.phpt index 41a91c9fc7b..1df64bf6b1a 100644 --- a/Zend/tests/generators/close_inside_generator.phpt +++ b/Zend/tests/generators/close_inside_generator.phpt @@ -3,7 +3,7 @@ Calling close() during the exectution of the generator --FILE-- ---EXPECTF-- -Fatal error: The "yield" expression can only be used inside a generator function in %s on line %d diff --git a/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt index 2487149eefa..4b8563331c6 100644 --- a/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt +++ b/Zend/tests/generators/errors/yield_non_ref_function_call_by_ref_error.phpt @@ -7,7 +7,7 @@ function foo() { return "bar"; } -function *&gen() { +function &gen() { yield foo(); } diff --git a/Zend/tests/generators/errors/yield_outside_function_error.phpt b/Zend/tests/generators/errors/yield_outside_function_error.phpt index 5f47e753665..f999c1c03bf 100644 --- a/Zend/tests/generators/errors/yield_outside_function_error.phpt +++ b/Zend/tests/generators/errors/yield_outside_function_error.phpt @@ -7,4 +7,4 @@ yield "Test"; ?> --EXPECTF-- -Fatal error: The "yield" expression can only be used inside a generator function in %s on line %d +Fatal error: The "yield" expression can only be used inside a function in %s on line %d diff --git a/Zend/tests/generators/func_get_args.phpt b/Zend/tests/generators/func_get_args.phpt index 7ce7fb002f0..f8d3fa7c146 100644 --- a/Zend/tests/generators/func_get_args.phpt +++ b/Zend/tests/generators/func_get_args.phpt @@ -3,8 +3,9 @@ func_get_args() can be used inside generator functions --FILE-- close() --FILE-- data = $data; } - public function *getIterator() { + public function getIterator() { foreach ($this->data as $value) { yield $value; } diff --git a/Zend/tests/generators/generator_method_by_ref.phpt b/Zend/tests/generators/generator_method_by_ref.phpt index 108c2133f63..cfe52fe67ff 100644 --- a/Zend/tests/generators/generator_method_by_ref.phpt +++ b/Zend/tests/generators/generator_method_by_ref.phpt @@ -14,7 +14,7 @@ class Test implements IteratorAggregate { return $this->data; } - public function *&getIterator() { + public function &getIterator() { foreach ($this->data as $key => &$value) { yield $key => $value; } diff --git a/Zend/tests/generators/generator_returns_generator.phpt b/Zend/tests/generators/generator_returns_generator.phpt index a3e2b29468f..ad332a3be92 100644 --- a/Zend/tests/generators/generator_returns_generator.phpt +++ b/Zend/tests/generators/generator_returns_generator.phpt @@ -3,12 +3,14 @@ A generator function returns a Generator object --FILE-- diff --git a/Zend/tests/generators/generator_send.phpt b/Zend/tests/generators/generator_send.phpt index 11ac37f846e..074d8153897 100644 --- a/Zend/tests/generators/generator_send.phpt +++ b/Zend/tests/generators/generator_send.phpt @@ -3,7 +3,7 @@ Values can be sent back to the generator --FILE-- current($array); diff --git a/Zend/tests/generators/no_foreach_var_leaks.phpt b/Zend/tests/generators/no_foreach_var_leaks.phpt index 36ab91bb15a..62743895ebc 100644 --- a/Zend/tests/generators/no_foreach_var_leaks.phpt +++ b/Zend/tests/generators/no_foreach_var_leaks.phpt @@ -3,7 +3,7 @@ foreach() (and other) variables aren't leaked on premature close --FILE-- send("Test"); +$gen->send('foo'); +$gen->send('bar'); ?> -===DONE=== --EXPECT-- -===DONE=== +string(3) "foo" diff --git a/Zend/tests/generators/send_returns_current.phpt b/Zend/tests/generators/send_returns_current.phpt index d3a4afd53a3..fc260c0af0c 100644 --- a/Zend/tests/generators/send_returns_current.phpt +++ b/Zend/tests/generators/send_returns_current.phpt @@ -3,7 +3,7 @@ $generator->send() returns the yielded value --FILE-- &$value) { yield $key => $value; } diff --git a/Zend/tests/generators/yield_during_function_call.phpt b/Zend/tests/generators/yield_during_function_call.phpt index 9727b8fd33e..21071f9fb4a 100644 --- a/Zend/tests/generators/yield_during_function_call.phpt +++ b/Zend/tests/generators/yield_during_function_call.phpt @@ -3,7 +3,7 @@ --FILE-- b(yield); } diff --git a/Zend/tests/generators/yield_ref_function_call_by_reference.phpt b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt index 88f72eabd12..e371affd92c 100644 --- a/Zend/tests/generators/yield_ref_function_call_by_reference.phpt +++ b/Zend/tests/generators/yield_ref_function_call_by_reference.phpt @@ -7,7 +7,7 @@ function &nop(&$var) { return $var; } -function *&gen(&$var) { +function &gen(&$var) { yield nop($var); } diff --git a/Zend/tests/generators/yield_without_value.phpt b/Zend/tests/generators/yield_without_value.phpt index dc467a83bd1..510c755bd3f 100644 --- a/Zend/tests/generators/yield_without_value.phpt +++ b/Zend/tests/generators/yield_without_value.phpt @@ -3,7 +3,7 @@ yield can be used without a value --FILE-- u.constant.value.str.val; @@ -1553,9 +1553,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n CG(interactive) = orig_interactive; op_array.function_name = name; - if (is_generator) { - op_array.fn_flags |= ZEND_ACC_GENERATOR; - } if (return_reference) { op_array.fn_flags |= ZEND_ACC_RETURN_REFERENCE; } @@ -1754,7 +1751,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n } /* }}} */ -void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int is_generator, int return_reference, int is_static TSRMLS_DC) /* {{{ */ +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC) /* {{{ */ { znode function_name; zend_op_array *current_op_array = CG(active_op_array); @@ -1764,7 +1761,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to function_name.op_type = IS_CONST; ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1, 1); - zend_do_begin_function_declaration(function_token, &function_name, 0, is_generator, return_reference, NULL TSRMLS_CC); + zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC); result->op_type = IS_TMP_VAR; result->u.op.var = get_temporary_variable(current_op_array); @@ -2670,10 +2667,12 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC { zend_op *opline; - if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { - zend_error(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a generator function"); + if (!CG(active_op_array)->function_name) { + zend_error(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a function"); } + CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_YIELD; @@ -2704,10 +2703,12 @@ void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC) /* {{{ { zend_op *opline; - if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { - zend_error(E_COMPILE_ERROR, "The \"yield*\" expression can only be used inside a generator function"); + if (!CG(active_op_array)->function_name) { + zend_error(E_COMPILE_ERROR, "The \"yield*\" expression can only be used inside a function"); } + CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_DELEGATE_YIELD; @@ -2721,23 +2722,6 @@ void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC) /* {{{ } /* }}} */ -void zend_do_suspend_if_generator(TSRMLS_D) /* {{{ */ -{ - zend_op *opline; - - // we only suspend execution if the current function is a generator - if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { - return; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_SUSPEND_AND_RETURN_GENERATOR; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} -/* }}} */ - static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ { int try_catch_offset = CG(active_op_array)->last_try_catch++; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index d0587d1faa4..c4355e0dde0 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -478,7 +478,7 @@ void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC); void zend_do_add_variable(znode *result, const znode *op1, const znode *op2 TSRMLS_DC); int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier); -void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int is_generator, int return_reference, znode *fn_flags_znode TSRMLS_DC); +void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC); void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC); void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, const znode *initialization, znode *class_type, zend_bool pass_by_reference TSRMLS_DC); int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC); @@ -492,10 +492,9 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC); void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC); -void zend_do_suspend_if_generator(TSRMLS_D); void zend_do_handle_exception(TSRMLS_D); -void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int is_generator, int return_reference, int is_static TSRMLS_DC); +void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC); void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 92160b54eb0..4cfc52b6a3b 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -55,6 +55,7 @@ ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_pt void init_executor(TSRMLS_D); void shutdown_executor(TSRMLS_D); void shutdown_destructors(TSRMLS_D); +zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC); ZEND_API void execute(zend_op_array *op_array TSRMLS_DC); ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC); ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 1deee2a86c8..fb0c18b27cc 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -31,6 +31,7 @@ #include "zend_extensions.h" #include "zend_exceptions.h" #include "zend_closures.h" +#include "zend_generators.h" #include "zend_vm.h" #include "zend_float.h" #ifdef HAVE_SYS_TIME_H @@ -955,7 +956,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS EG(return_value_ptr_ptr) = fci->retval_ptr_ptr; EG(active_op_array) = (zend_op_array *) EX(function_state).function; original_opline_ptr = EG(opline_ptr); - zend_execute(EG(active_op_array) TSRMLS_CC); + + if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) { + *fci->retval_ptr_ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + } else { + zend_execute(EG(active_op_array) TSRMLS_CC); + } + if (!fci->symbol_table && EG(active_symbol_table)) { if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { zend_hash_destroy(EG(active_symbol_table)); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 20ab9b16c68..b164fb835e5 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -315,6 +315,56 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM } /* }}} */ +/* Requires globals EG(scope), EG(current_scope), EG(This), + * EG(active_symbol_table) and EG(current_execute_data). */ +zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ +{ + zval *return_value; + zend_generator *generator; + + /* Create new execution context. We have to back up and restore + * EG(current_execute_data) and EG(opline_ptr) here because the function + * modifies it. */ + zend_execute_data *current_execute_data = EG(current_execute_data); + zend_op **opline_ptr = EG(opline_ptr); + zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC); + EG(current_execute_data) = current_execute_data; + EG(opline_ptr) = opline_ptr; + + ALLOC_INIT_ZVAL(return_value); + object_init_ex(return_value, zend_ce_generator); + + if (EG(This)) { + Z_ADDREF_P(EG(This)); + } + + /* Back up executor globals. */ + execute_data->current_scope = EG(scope); + execute_data->current_called_scope = EG(called_scope); + execute_data->symbol_table = EG(active_symbol_table); + execute_data->current_this = EG(This); + + /* Save execution context in generator object. */ + generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); + generator->execute_data = execute_data; + + /* We have to add another stack frame so the generator function shows + * up in backtraces and func_get_all() can access the function + * arguments. */ + execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data)); + if (EG(current_execute_data)) { + memcpy(execute_data->prev_execute_data, EG(current_execute_data), sizeof(zend_execute_data)); + execute_data->prev_execute_data->function_state.arguments = zend_copy_arguments(EG(current_execute_data)->function_state.arguments); + } else { + memset(execute_data->prev_execute_data, 0, sizeof(zend_execute_data)); + execute_data->prev_execute_data->function_state.function = (zend_function *) op_array; + execute_data->prev_execute_data->function_state.arguments = NULL; + } + + return return_value; +} +/* }}} */ + static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* {{{ */ { zend_error(E_RECOVERABLE_ERROR, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated"); @@ -377,9 +427,6 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ * set the prev_execute_data of that prev_execute_data :) */ generator->execute_data->prev_execute_data->prev_execute_data = original_execute_data; - /* Go to next opcode (we don't want to run the last one again) */ - generator->execute_data->opline++; - /* Resume execution */ execute_ex(generator->execute_data TSRMLS_CC); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 73d85287a70..d67ea4137bf 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -55,6 +55,7 @@ typedef struct _zend_generator { extern ZEND_API zend_class_entry *zend_ce_generator; void zend_register_generator_ce(TSRMLS_D); +zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_CC); void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC); END_EXTERN_C() diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 02aa694c6eb..b705d60d9a5 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -360,11 +360,6 @@ class_declaration_statement: unticked_class_declaration_statement { DO_TICKS(); } ; -is_generator: - /* empty */ { $$.op_type = 0; } - | '*' { $$.op_type = 1; } -; - is_reference: /* empty */ { $$.op_type = ZEND_RETURN_VAL; } | '&' { $$.op_type = ZEND_RETURN_REF; } @@ -372,8 +367,8 @@ is_reference: unticked_function_declaration_statement: - function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $2.op_type, $3.op_type, NULL TSRMLS_CC); } - '(' parameter_list ')' { zend_do_suspend_if_generator(TSRMLS_C); } + function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); } + '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } ; @@ -584,9 +579,9 @@ class_statement: variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';' | class_constant_declaration ';' | trait_use_statement - | method_modifiers function is_generator is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $3.op_type, $4.op_type, &$1 TSRMLS_CC); } - '(' parameter_list ')' { zend_do_suspend_if_generator(TSRMLS_C); } - method_body { zend_do_abstract_method(&$5, &$1, &$11 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } + | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } + '(' parameter_list ')' + method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } ; trait_use_statement: @@ -805,12 +800,12 @@ expr_without_variable: | T_YIELD { zend_do_yield(&$$, NULL, NULL TSRMLS_CC); } | T_YIELD expr { zend_do_yield(&$$, &$2, NULL TSRMLS_CC); } | T_YIELD '*' expr { zend_do_delegate_yield(&$$, &$3 TSRMLS_CC); } - | function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, $3.op_type, 0 TSRMLS_CC); } - '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } - '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } - | T_STATIC function is_generator is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, $4.op_type, 1 TSRMLS_CC); } - '(' parameter_list ')' lexical_vars { zend_do_suspend_if_generator(TSRMLS_C); } - '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $5; } + | function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); } + '(' parameter_list ')' lexical_vars + '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $3; } + | T_STATIC function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); } + '(' parameter_list ')' lexical_vars + '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $4; } ; combined_scalar_offset: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 4be644a3327..e8b89a6db5b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2705,7 +2705,11 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; } - if (EXPECTED(zend_execute == execute)) { + if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) { + if (RETURN_VALUE_USED(opline)) { + EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + } + } else if (EXPECTED(zend_execute == execute)) { if (EXPECTED(EG(exception) == NULL)) { ZEND_VM_ENTER(); } @@ -5218,102 +5222,7 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(159, ZEND_SUSPEND_AND_RETURN_GENERATOR, ANY, ANY) -{ - zend_bool nested = EX(nested); - zend_execute_data *prev_execute_data = EX(prev_execute_data); - - if (EG(return_value_ptr_ptr)) { - zval *return_value; - zend_generator *generator; - - ALLOC_INIT_ZVAL(return_value); - object_init_ex(return_value, zend_ce_generator); - - *EG(return_value_ptr_ptr) = return_value; - - /* back up some executor globals */ - SAVE_OPLINE(); - - EX(current_scope) = EG(scope); - EX(current_called_scope) = EG(called_scope); - - if (EG(This)) { - Z_ADDREF_P(EG(This)); - } - EX(current_this) = EG(This); - - /* back up the execution context */ - generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); - generator->execute_data = execute_data; - - /* We have to add another stack frame so the generator function shows - * up in backtraces and func_get_all() can access the function - * arguments. */ - EX(prev_execute_data) = emalloc(sizeof(zend_execute_data)); - if (prev_execute_data) { - memcpy(EX(prev_execute_data), prev_execute_data, sizeof(zend_execute_data)); - EX(prev_execute_data)->function_state.arguments = zend_copy_arguments(prev_execute_data->function_state.arguments); - } else { - memset(EX(prev_execute_data), 0, sizeof(zend_execute_data)); - EX(prev_execute_data)->function_state.function = (zend_function *) EX(op_array); - EX(prev_execute_data)->function_state.arguments = NULL; - } - } - - /* restore the previous execution context */ - EG(current_execute_data) = prev_execute_data; - - /* if there is no return value pointer we are responsible for freeing the - * execution data */ - if (!EG(return_value_ptr_ptr)) { - if (!EG(active_symbol_table)) { - zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); - } else { - zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); - } - efree(execute_data); - } - - - /* Happens whenever the function is invoked using call_user_function, - * e.g. when doing a dynamic function call using call_user_func(). */ - if (!nested) { - EG(opline_ptr) = NULL; - ZEND_VM_RETURN(); - } - - /* Free $this and stack arguments */ - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - - zend_vm_stack_clear_multiple(TSRMLS_C); - - /* Bring back the previous execution context */ - execute_data = EG(current_execute_data); - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - EG(active_symbol_table) = EX(symbol_table); - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - LOAD_REGS(); - LOAD_OPLINE(); - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); -} - -ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) +ZEND_VM_HANDLER(159, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) { USE_OPLINE zend_free_op free_op1; @@ -5454,6 +5363,10 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -5461,7 +5374,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE ZEND_VM_RETURN(); } -ZEND_VM_HANDLER(161, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) +ZEND_VM_HANDLER(160, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) { ZEND_VM_NEXT_OPCODE(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index b1bcd74d233..0fcae113baa 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -339,7 +339,7 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o #define EX_Ts() EX(Ts) -static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { +zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { zend_execute_data *execute_data; /* @@ -689,7 +689,11 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; } - if (EXPECTED(zend_execute == execute)) { + if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) { + if (RETURN_VALUE_USED(opline)) { + EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC); + } + } else if (EXPECTED(zend_execute == execute)) { if (EXPECTED(EG(exception) == NULL)) { ZEND_VM_ENTER(); } @@ -1201,101 +1205,6 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } -static int ZEND_FASTCALL ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_bool nested = EX(nested); - zend_execute_data *prev_execute_data = EX(prev_execute_data); - - if (EG(return_value_ptr_ptr)) { - zval *return_value; - zend_generator *generator; - - ALLOC_INIT_ZVAL(return_value); - object_init_ex(return_value, zend_ce_generator); - - *EG(return_value_ptr_ptr) = return_value; - - /* back up some executor globals */ - SAVE_OPLINE(); - - EX(current_scope) = EG(scope); - EX(current_called_scope) = EG(called_scope); - - if (EG(This)) { - Z_ADDREF_P(EG(This)); - } - EX(current_this) = EG(This); - - /* back up the execution context */ - generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC); - generator->execute_data = execute_data; - - /* We have to add another stack frame so the generator function shows - * up in backtraces and func_get_all() can access the function - * arguments. */ - EX(prev_execute_data) = emalloc(sizeof(zend_execute_data)); - if (prev_execute_data) { - memcpy(EX(prev_execute_data), prev_execute_data, sizeof(zend_execute_data)); - EX(prev_execute_data)->function_state.arguments = zend_copy_arguments(prev_execute_data->function_state.arguments); - } else { - memset(EX(prev_execute_data), 0, sizeof(zend_execute_data)); - EX(prev_execute_data)->function_state.function = (zend_function *) EX(op_array); - EX(prev_execute_data)->function_state.arguments = NULL; - } - } - - /* restore the previous execution context */ - EG(current_execute_data) = prev_execute_data; - - /* if there is no return value pointer we are responsible for freeing the - * execution data */ - if (!EG(return_value_ptr_ptr)) { - if (!EG(active_symbol_table)) { - zend_free_compiled_variables(EX_CVs(), execute_data->op_array->last_var); - } else { - zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC); - } - efree(execute_data); - } - - - /* Happens whenever the function is invoked using call_user_function, - * e.g. when doing a dynamic function call using call_user_func(). */ - if (!nested) { - EG(opline_ptr) = NULL; - ZEND_VM_RETURN(); - } - - /* Free $this and stack arguments */ - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - - zend_vm_stack_clear_multiple(TSRMLS_C); - - /* Bring back the previous execution context */ - execute_data = EG(current_execute_data); - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - EG(active_symbol_table) = EX(symbol_table); - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - LOAD_REGS(); - LOAD_OPLINE(); - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); -} - static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -4252,6 +4161,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -4937,6 +4850,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -5948,6 +5865,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -6652,6 +6573,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -7396,6 +7321,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -9448,6 +9377,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -10133,6 +10066,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -11144,6 +11081,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -11714,6 +11655,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -12396,6 +12341,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -16306,6 +16255,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -18379,6 +18332,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -20833,6 +20790,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -21964,6 +21925,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -24086,6 +24051,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -25565,6 +25534,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -26868,6 +26841,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -28172,6 +28149,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -28586,6 +28567,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -29886,6 +29871,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -33395,6 +33384,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -35337,6 +35330,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -37659,6 +37656,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -38649,6 +38650,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -40639,6 +40644,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS Z_ADDREF(EG(uninitialized_zval)); AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); + /* We increment to the next op, so we are at the correct position when the + * generator is resumed. */ + ZEND_VM_INC_OPCODE(); + /* The GOTO VM uses a local opline variable. We need to set the opline * variable in execute_data so we don't resume at an old position. */ SAVE_OPLINE(); @@ -44630,31 +44639,6 @@ void zend_init_opcodes_handlers(void) ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, - ZEND_SUSPEND_AND_RETURN_GENERATOR_SPEC_HANDLER, ZEND_YIELD_SPEC_CONST_CONST_HANDLER, ZEND_YIELD_SPEC_CONST_TMP_HANDLER, ZEND_YIELD_SPEC_CONST_VAR_HANDLER, diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index e77c7cb3c63..909ec8ad7a7 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -1,6 +1,6 @@ {%DEFINES%} -static zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { +zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) { zend_execute_data *execute_data; /* diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 46a711d1793..87fabfc2acc 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -159,6 +159,5 @@ #define ZEND_SEPARATE 156 #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 -#define ZEND_SUSPEND_AND_RETURN_GENERATOR 159 -#define ZEND_YIELD 160 -#define ZEND_DELEGATE_YIELD 161 +#define ZEND_YIELD 159 +#define ZEND_DELEGATE_YIELD 160 From 612c2490b7973d71d472860ade48d7ab342b5911 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 20 Jul 2012 17:38:39 +0200 Subject: [PATCH 289/641] Move a variable --- Zend/zend_vm_def.h | 3 +- Zend/zend_vm_execute.h | 75 ++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e8b89a6db5b..6b8425558c9 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5225,7 +5225,6 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -5242,6 +5241,8 @@ ZEND_VM_HANDLER(159, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE /* Set the new yielded value */ if (OP1_TYPE != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0fcae113baa..9a9917fede2 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4027,7 +4027,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -4043,6 +4042,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -4716,7 +4717,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -4732,6 +4732,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -5730,7 +5732,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -5746,6 +5747,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -6439,7 +6442,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -6455,6 +6457,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -7187,7 +7191,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -7203,6 +7206,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A /* Set the new yielded value */ if (IS_CONST != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -9242,7 +9247,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -9259,6 +9263,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -9931,7 +9937,6 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -9948,6 +9953,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -10945,7 +10952,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -10962,6 +10968,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -11520,7 +11528,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -11537,6 +11544,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -12206,7 +12215,6 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -12223,6 +12231,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_TMP_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -16118,7 +16128,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -16135,6 +16144,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -18195,7 +18206,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -18212,6 +18222,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -20652,7 +20664,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -20669,6 +20680,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -21788,7 +21801,6 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -21805,6 +21817,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -23914,7 +23928,6 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_free_op free_op1; /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -23931,6 +23944,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_VAR != IS_UNUSED) { + zend_free_op free_op1; + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -25400,7 +25415,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -25416,6 +25430,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -26707,7 +26723,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -26723,6 +26738,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -28014,7 +28031,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -28030,6 +28046,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -28433,7 +28451,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -28449,6 +28466,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -29737,7 +29756,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -29753,6 +29771,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_UNUSED != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -33250,7 +33270,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -33266,6 +33285,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -35196,7 +35217,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -35212,6 +35232,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -37521,7 +37543,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -37537,6 +37558,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -38516,7 +38539,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -38532,6 +38554,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ @@ -40510,7 +40534,6 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS { USE_OPLINE - /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); @@ -40526,6 +40549,8 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* Set the new yielded value */ if (IS_CV != IS_UNUSED) { + + if (EX(op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) { /* Constants and temporary variables aren't yieldable by reference, * but we still allow them with a notice. */ From 1f70a4c5fea97aa577aa5d9ee5f33d91d70e690d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 20 Jul 2012 17:40:04 +0200 Subject: [PATCH 290/641] Add some more tests --- Zend/tests/generators/fibonacci.phpt | 36 +++++++++++++++++++ Zend/tests/generators/generator_closure.phpt | 20 +++++++++++ .../generator_closure_with_this.phpt | 20 +++++++++++ .../generators/generator_static_method.phpt | 29 +++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 Zend/tests/generators/fibonacci.phpt create mode 100644 Zend/tests/generators/generator_closure.phpt create mode 100644 Zend/tests/generators/generator_closure_with_this.phpt create mode 100644 Zend/tests/generators/generator_static_method.phpt diff --git a/Zend/tests/generators/fibonacci.phpt b/Zend/tests/generators/fibonacci.phpt new file mode 100644 index 00000000000..35b31352ff3 --- /dev/null +++ b/Zend/tests/generators/fibonacci.phpt @@ -0,0 +1,36 @@ +--TEST-- +Creating an infinite fibonacci list using a generator +--FILE-- + 1000) break; + + var_dump($n); +} + +?> +--EXPECT-- +int(1) +int(2) +int(3) +int(5) +int(8) +int(13) +int(21) +int(34) +int(55) +int(89) +int(144) +int(233) +int(377) +int(610) +int(987) diff --git a/Zend/tests/generators/generator_closure.phpt b/Zend/tests/generators/generator_closure.phpt new file mode 100644 index 00000000000..bf80066015f --- /dev/null +++ b/Zend/tests/generators/generator_closure.phpt @@ -0,0 +1,20 @@ +--TEST-- +Closures can be generators +--FILE-- + +--EXPECT-- +int(1) +int(2) +int(3) diff --git a/Zend/tests/generators/generator_closure_with_this.phpt b/Zend/tests/generators/generator_closure_with_this.phpt new file mode 100644 index 00000000000..d5a4861e804 --- /dev/null +++ b/Zend/tests/generators/generator_closure_with_this.phpt @@ -0,0 +1,20 @@ +--TEST-- +Non-static closures can be generators +--FILE-- +getGenFactory(); +var_dump($genFactory()->current()); + +?> +--EXPECT-- +object(Test)#1 (0) { +} diff --git a/Zend/tests/generators/generator_static_method.phpt b/Zend/tests/generators/generator_static_method.phpt new file mode 100644 index 00000000000..cd9b450a76c --- /dev/null +++ b/Zend/tests/generators/generator_static_method.phpt @@ -0,0 +1,29 @@ +--TEST-- +A static method can be a generator +--FILE-- + +--EXPECT-- +string(4) "Test" +string(12) "ExtendedTest" +int(1) +int(2) +int(3) From 683b4f7a2be0479182f229cf84f502d19bd792d9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 00:46:32 +0800 Subject: [PATCH 291/641] merge 9eb5cb6571698ca1c623ad3e02c8727c4b0c9a09 to 5.3 --- ext/standard/tests/file/umask_variation3.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/tests/file/umask_variation3.phpt b/ext/standard/tests/file/umask_variation3.phpt index 1483dc430e5..cb34294fea6 100644 --- a/ext/standard/tests/file/umask_variation3.phpt +++ b/ext/standard/tests/file/umask_variation3.phpt @@ -110,7 +110,7 @@ foreach($inputs as $key =>$value) { echo "\n--$key--\n"; umask(0); var_dump(umask($value)); - var_dump( umask()); + var_dump(umask() & 0777); }; ?> From a6f1533789b897d3b8930b437164e81e0a0f4c72 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 02:56:28 +0800 Subject: [PATCH 292/641] Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression) --- NEWS | 4 ++++ ext/zlib/php_zlib.h | 1 + ext/zlib/zlib.c | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 34b48d9c1e2..9cd089c1bf0 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,10 @@ PHP NEWS . Fixed bug #62597 (segfault in php_stream_wrapper_log_error with ZTS build). (Laruence) +- Zlib: + . Fixed bug #55544 (ob_gzhandler always conflicts with + zlib.output_compression). (Laruence) + ?? ??? 2012, PHP 5.4.5 - Core: diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 3d8c90cbf50..449dfed0620 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -52,6 +52,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) int compression_coding; long output_compression; long output_compression_level; + long output_compression_default; char *output_handler; php_zlib_context *ob_gzhandler; ZEND_END_MODULE_GLOBALS(zlib); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index c6e2e0cf8bf..9cd1f378862 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -890,6 +890,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression) status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + ZLIBG(output_compression) = ZLIBG(output_compression_default); if (stage == PHP_INI_STAGE_RUNTIME && int_value) { if (!php_output_handler_started(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME) TSRMLS_CC)) { php_zlib_output_compression_start(TSRMLS_C); @@ -914,7 +915,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler) /* {{{ INI */ PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals) + STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression_default, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdateLong, output_compression_level, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL, OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals) PHP_INI_END() @@ -958,6 +959,7 @@ static PHP_MSHUTDOWN_FUNCTION(zlib) static PHP_RINIT_FUNCTION(zlib) { ZLIBG(compression_coding) = 0; + ZLIBG(output_compression) = ZLIBG(output_compression_default); php_zlib_output_compression_start(TSRMLS_C); From 0c996613c0173708381f4bfcd28d2441360bc701 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 22:45:16 +0800 Subject: [PATCH 293/641] Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault) --- NEWS | 2 ++ ext/spl/spl_iterators.c | 2 ++ ext/spl/tests/bug62616.phpt | 15 +++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 ext/spl/tests/bug62616.phpt diff --git a/NEWS b/NEWS index 9cd089c1bf0..8ae6931b6ee 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ PHP NEWS . Implemented FR #55218 Get namespaces from current node. (Lonny) - SPL: + . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance + gives Segmentation fault). (Laruence, Gustavo) . Fixed bug #61527 (ArrayIterator gives misleading notice on next() when moved to the end). (reeze.xia@gmail.com) diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 19a68f6372f..e5dc030730e 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1289,6 +1289,8 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *met *object_ptr = intern->inner.zobject; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key TSRMLS_CC); } + } else { + *object_ptr = intern->inner.zobject; } } return function_handler; diff --git a/ext/spl/tests/bug62616.phpt b/ext/spl/tests/bug62616.phpt new file mode 100644 index 00000000000..4e4be94491e --- /dev/null +++ b/ext/spl/tests/bug62616.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault) +--FILE-- +count()); + +$ii = new IteratorIterator($ai); + +var_dump($ii->count()); +?> +--EXPECTF-- +int(2) +int(2) From cc30524c89fa2255944dc3c70f8d41a6c23faa2a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 23:26:18 +0800 Subject: [PATCH 294/641] Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault) --- NEWS | 4 ++++ ext/spl/spl_iterators.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 902185cffe9..e6b51a91403 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS - DateTime: . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) +- SPL: + . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance + gives Segmentation fault). (Laruence, Gustavo) + 14 Jun 2012, PHP 5.3.14 - CLI SAPI: diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index eecd483ba77..a46b7d4e48d 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1287,6 +1287,8 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *met *object_ptr = intern->inner.zobject; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC); } + } else { + *object_ptr = intern->inner.zobject; } } return function_handler; From ead076bac613bc69d83ab65be2efb68feada912c Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 23:27:09 +0800 Subject: [PATCH 295/641] Fix test failed --- .../tests/general_functions/uniqid_basic.phpt | 145 +++++++++--------- 1 file changed, 72 insertions(+), 73 deletions(-) diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 9a9c5733272..2da832b8ed2 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -1,73 +1,72 @@ ---TEST-- -Test uniqid() function : basic functionality ---FILE-- - -===DONE=== ---EXPECTF-- -*** Testing uniqid() : basic functionality *** - -uniqid() without a prefix -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - - -uniqid() with a prefix -string(18) "99999%s" -string(28) "99999%s.%s" -string(18) "99999%s" - -string(18) "999994%s" -string(28) "999994%s.%s" -string(18) "999994%s" - -string(17) "1050%s" -string(27) "1050%s.%s" -string(17) "1050%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -string(14) "1%s" -string(24) "1%s.%s" -string(14) "1%s" - -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - -===DONE=== - \ No newline at end of file +--TEST-- +Test uniqid() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing uniqid() : basic functionality *** + +uniqid() without a prefix +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + + +uniqid() with a prefix +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(18) "99999%s" +string(28) "99999%s.%s" +string(18) "99999%s" + +string(17) "1050%s" +string(27) "1050%s.%s" +string(17) "1050%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +string(14) "1%s" +string(24) "1%s.%s" +string(14) "1%s" + +string(13) "%s" +string(23) "%s.%s" +string(13) "%s" + +===DONE=== From 777b6679a41abe40c4211c2f2a906a5218680872 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 21 Jul 2012 23:30:32 +0800 Subject: [PATCH 296/641] missed the test script --- ext/spl/tests/bug62616.phpt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ext/spl/tests/bug62616.phpt diff --git a/ext/spl/tests/bug62616.phpt b/ext/spl/tests/bug62616.phpt new file mode 100644 index 00000000000..4e4be94491e --- /dev/null +++ b/ext/spl/tests/bug62616.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault) +--FILE-- +count()); + +$ii = new IteratorIterator($ai); + +var_dump($ii->count()); +?> +--EXPECTF-- +int(2) +int(2) From 80748631aa1c4193cbc68f8854d82e7a57817fe2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 21 Jul 2012 21:05:46 +0200 Subject: [PATCH 297/641] Require parenthesis around yield expressions If yield is used in an expression context parenthesis are now required. This ensures that the code is unambiguos. Yield statements can still be used without parenthesis (which should be the most common case). Also yield expressions without value can be used without parenthesis, too (this should be the most common case for coroutines). If the yield expression is used in a context where parenthesis are required anyway, no additional parenthesis have to be inserted. Examples: // Statements don't need parenthesis yield $foo; yield $foo => $bar; // Yield without value doesn't need parenthesis either $data = yield; // Parentheses don't have to be duplicated foo(yield $bar); if (yield $bar) { ... } // But we have to use parentheses here $foo = (yield $bar); This commit also fixes an issue with by-ref passing of $foo[0] like variables. They previously weren't properly fetched for write. Additionally this fixes valgrind warnings which were caused by access to uninitialized memory in zend_is_function_or_method_call(). --- .../generators/send_returns_current.phpt | 2 +- .../generators/yield_array_offset_by_ref.phpt | 26 ++++++ .../generators/yield_in_parenthesis.phpt | 23 +++++ Zend/zend_compile.c | 12 ++- Zend/zend_compile.h | 2 +- Zend/zend_language_parser.y | 91 ++++++++++--------- 6 files changed, 109 insertions(+), 47 deletions(-) create mode 100644 Zend/tests/generators/yield_array_offset_by_ref.phpt create mode 100644 Zend/tests/generators/yield_in_parenthesis.phpt diff --git a/Zend/tests/generators/send_returns_current.phpt b/Zend/tests/generators/send_returns_current.phpt index fc260c0af0c..27ba74bc1bd 100644 --- a/Zend/tests/generators/send_returns_current.phpt +++ b/Zend/tests/generators/send_returns_current.phpt @@ -6,7 +6,7 @@ $generator->send() returns the yielded value function reverseEchoGenerator() { $data = yield; while (true) { - $data = yield strrev($data); + $data = (yield strrev($data)); } } diff --git a/Zend/tests/generators/yield_array_offset_by_ref.phpt b/Zend/tests/generators/yield_array_offset_by_ref.phpt new file mode 100644 index 00000000000..544108e64d8 --- /dev/null +++ b/Zend/tests/generators/yield_array_offset_by_ref.phpt @@ -0,0 +1,26 @@ +--TEST-- +Array offsets can be yielded by reference +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + &int(-1) + [1]=> + int(2) + [2]=> + int(3) +} diff --git a/Zend/tests/generators/yield_in_parenthesis.phpt b/Zend/tests/generators/yield_in_parenthesis.phpt new file mode 100644 index 00000000000..4a603f4cc1a --- /dev/null +++ b/Zend/tests/generators/yield_in_parenthesis.phpt @@ -0,0 +1,23 @@ +--TEST-- +No additional parenthesis are required around yield if they are already present +--FILE-- +func(yield $foo); + new Foo(yield $foo); +} + +echo "Done"; + +?> +--EXPECT-- +Done diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e030f94c78b..51fc8c3e5be 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2663,7 +2663,7 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC) /* {{{ */ +void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC) /* {{{ */ { zend_op *opline; @@ -2673,6 +2673,14 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; + if (is_variable) { + if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(value)) { + zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC); + } else { + zend_do_end_variable_parse(value, BP_VAR_R, 0 TSRMLS_CC); + } + } + opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_YIELD; @@ -2680,7 +2688,7 @@ void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC if (value) { SET_NODE(opline->op1, value); - if (zend_is_function_or_method_call(value)) { + if (is_variable && zend_is_function_or_method_call(value)) { opline->extended_value = ZEND_RETURNS_FUNCTION; } } else { diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index c4355e0dde0..1972f85c667 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -490,7 +490,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); -void zend_do_yield(znode *result, const znode *value, const znode *key TSRMLS_DC); +void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC); void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index b705d60d9a5..e5f31b5d149 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -278,10 +278,10 @@ statement: unticked_statement: '{' inner_statement_list '}' - | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); } - | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); } - | T_WHILE '(' { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); } - | T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.op.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); } + | T_IF parenthesis_expr { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } statement { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); } + | T_IF parenthesis_expr ':' { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); } + | T_WHILE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr { zend_do_while_cond(&$3, &$$ TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$4 TSRMLS_CC); } + | T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE { $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr ';' { zend_do_do_while_end(&$1, &$4, &$6 TSRMLS_CC); } | T_FOR '(' for_expr @@ -291,7 +291,7 @@ unticked_statement: for_expr ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); } for_statement { zend_do_for_end(&$7 TSRMLS_CC); } - | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); } + | T_SWITCH parenthesis_expr { zend_do_switch_cond(&$2 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$4 TSRMLS_CC); } | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); } | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); } | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); } @@ -299,7 +299,7 @@ unticked_statement: | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); } | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); } | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); } - | T_YIELD expr T_DOUBLE_ARROW expr ';' { zend_do_yield(&$$, &$4, &$2 TSRMLS_CC); } + | yield_expr ';' { $$ = $1; } | T_GLOBAL global_var_list ';' | T_STATIC static_var_list ';' | T_ECHO echo_expr_list ';' @@ -484,13 +484,13 @@ while_statement: elseif_list: /* empty */ - | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); } + | elseif_list T_ELSEIF parenthesis_expr { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } statement { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); } ; new_elseif_list: /* empty */ - | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); } + | new_elseif_list T_ELSEIF parenthesis_expr ':' { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); } ; @@ -533,8 +533,9 @@ optional_class_type: function_call_parameter_list: - non_empty_function_call_parameter_list { $$ = $1; } - | /* empty */ { Z_LVAL($$.u.constant) = 0; } + '(' ')' { Z_LVAL($$.u.constant) = 0; } + | '(' non_empty_function_call_parameter_list ')' { $$ = $2; } + | '(' yield_expr ')' { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); } ; @@ -774,7 +775,7 @@ expr_without_variable: | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); } | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); } | expr T_INSTANCEOF class_name_reference { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); } - | '(' expr ')' { $$ = $2; } + | parenthesis_expr { $$ = $1; } | new_expr { $$ = $1; } | '(' new_expr ')' { $$ = $2; } instance_call { $$ = $5; } | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); } @@ -797,8 +798,9 @@ expr_without_variable: | combined_scalar { $$ = $1; } | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } - | T_YIELD { zend_do_yield(&$$, NULL, NULL TSRMLS_CC); } - | T_YIELD expr { zend_do_yield(&$$, &$2, NULL TSRMLS_CC); } + | T_YIELD { zend_do_yield(&$$, NULL, NULL, 0 TSRMLS_CC); } + /*| T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); } + | T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); }*/ | T_YIELD '*' expr { zend_do_delegate_yield(&$$, &$3 TSRMLS_CC); } | function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars @@ -808,6 +810,13 @@ expr_without_variable: '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $4; } ; +yield_expr: + T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); } + | T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); } + | T_YIELD expr T_DOUBLE_ARROW expr_without_variable { zend_do_yield(&$$, &$4, &$2, 0 TSRMLS_CC); } + | T_YIELD expr T_DOUBLE_ARROW variable { zend_do_yield(&$$, &$4, &$2, 1 TSRMLS_CC); } +; + combined_scalar_offset: combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } | combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } @@ -834,30 +843,22 @@ lexical_var_list: ; function_call: - namespace_name '(' { $2.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | T_NAMESPACE T_NS_SEPARATOR namespace_name '(' { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $4.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(&$1, &$$, &$6, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | T_NS_SEPARATOR namespace_name '(' { $3.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$6, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_without_objects '(' { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); } - function_call_parameter_list ')' - { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + | T_NAMESPACE T_NS_SEPARATOR namespace_name { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $$.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$5, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + | T_NS_SEPARATOR namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(&$2, &$$, &$4, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { $$.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$5, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(NULL, &$$, &$5, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$3, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} ; class_name: @@ -902,7 +903,7 @@ dynamic_class_name_variable_property: exit_expr: /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } - | '(' expr ')' { $$ = $2; } + | parenthesis_expr { $$ = $1; } ; backticks_expr: @@ -913,8 +914,8 @@ backticks_expr: ctor_arguments: - /* empty */ { Z_LVAL($$.u.constant)=0; } - | '(' function_call_parameter_list ')' { $$ = $2; } + /* empty */ { Z_LVAL($$.u.constant) = 0; } + | function_call_parameter_list { $$ = $1; } ; @@ -986,6 +987,11 @@ expr: | expr_without_variable { $$ = $1; } ; +parenthesis_expr: + '(' expr ')' { $$ = $2; } + | '(' yield_expr ')' { $$ = $2; } +; + r_variable: variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$ = $1; } @@ -1025,9 +1031,8 @@ array_method_dereference: ; method: - '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); } - function_call_parameter_list ')' - { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } + { zend_do_pop_object(&$$ TSRMLS_CC); zend_do_begin_method_call(&$$ TSRMLS_CC); } + function_call_parameter_list { zend_do_end_function_call(&$1, &$$, &$2, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } ; method_or_not: From 29a0efccef0ea3843e1b68546bdc255d5b901746 Mon Sep 17 00:00:00 2001 From: Sherif Ramadan Date: Sat, 21 Jul 2012 19:38:03 -0400 Subject: [PATCH 298/641] Fixes mcrypt_ecb not issuing an E_DEPRECATED level notice, despite having been deprecated for some time. Please reference bug #62374 as well. --- ext/mcrypt/mcrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index c5739395891..20a0f73b187 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -238,7 +238,7 @@ ZEND_END_ARG_INFO() /* }}} */ const zend_function_entry mcrypt_functions[] = { /* {{{ */ - PHP_FE(mcrypt_ecb, arginfo_mcrypt_ecb) + PHP_DEP_FE(mcrypt_ecb, arginfo_mcrypt_ecb) PHP_FE(mcrypt_cbc, arginfo_mcrypt_cbc) PHP_FE(mcrypt_cfb, arginfo_mcrypt_cfb) PHP_FE(mcrypt_ofb, arginfo_mcrypt_ofb) From 2f0775b999e7859275c614a3d2d8edd1506e0d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 22 Jul 2012 03:54:03 +0200 Subject: [PATCH 299/641] Added IntlDateFormatter::formatObject(). Refactor To better support IntlCalendar, added this function: string IntlDateFormatter::formatObject(IntlCalendar|DateTime $obj [, array|int|string $format = null [, string $locale = null). $format is either of the constants IntlDateFormatter::FULL, etc., in which case this format applies to both the date and the time, an array in the form array($dateFormat, $timeFormat), or a string with the SimpleDateFormat pattern. This uses both the Calendar type and the timezone of the passed object to configure the formatter (a GregorianCalendar is forced for DateTime). Some stuff was moved around and slighlt modified to allow for more code reuse. --- ext/intl/calendar/calendar_methods.cpp | 3 + ext/intl/common/common_date.cpp | 208 ++++++++++++++-- ext/intl/common/common_date.h | 13 +- ext/intl/config.m4 | 1 + ext/intl/config.w32 | 1 + ext/intl/dateformat/dateformat_class.c | 8 + ext/intl/dateformat/dateformat_format.c | 9 +- .../dateformat/dateformat_format_object.cpp | 230 ++++++++++++++++++ .../dateformat/dateformat_format_object.h | 19 ++ ext/intl/msgformat/msgformat_helpers.cpp | 10 +- ext/intl/php_intl.c | 9 + ext/intl/tests/dateformat_format.phpt | 10 +- .../dateformat_formatObject_calendar.phpt | 41 ++++ .../dateformat_formatObject_datetime.phpt | 34 +++ .../tests/dateformat_formatObject_error.phpt | 74 ++++++ ext/intl/tests/msgfmt_format_error5.phpt | 1 + ext/intl/timezone/timezone_class.cpp | 75 +----- ext/intl/timezone/timezone_class.h | 1 - ext/intl/timezone/timezone_methods.cpp | 3 + 19 files changed, 634 insertions(+), 116 deletions(-) create mode 100644 ext/intl/dateformat/dateformat_format_object.cpp create mode 100644 ext/intl/dateformat/dateformat_format_object.h create mode 100644 ext/intl/tests/dateformat_formatObject_calendar.phpt create mode 100644 ext/intl/tests/dateformat_formatObject_datetime.phpt create mode 100644 ext/intl/tests/dateformat_formatObject_error.phpt diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 8562a2d69ea..f59edaa25e3 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -23,7 +23,10 @@ #include #include #include + #include "../intl_convertcpp.h" +#include "../common/common_date.h" + extern "C" { #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 812a196ed0f..ee998818d98 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -25,13 +25,162 @@ extern "C" { #include } -U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) -{ - double rv = NAN; - long lv; - int type; +#ifndef INFINITY +#define INFINITY (DBL_MAX+DBL_MAX) +#endif - if (U_FAILURE(*status)) { +#ifndef NAN +#define NAN (INFINITY-INFINITY) +#endif + +/* {{{ timezone_convert_datetimezone + * The timezone in DateTime and DateTimeZone is not unified. */ +U_CFUNC TimeZone *timezone_convert_datetimezone(int type, + void *object, + int is_datetime, + intl_error *outside_error, + const char *func TSRMLS_DC) +{ + char *id = NULL, + offset_id[] = "GMT+00:00"; + int id_len = 0; + char *message; + TimeZone *timeZone; + + switch (type) { + case TIMELIB_ZONETYPE_ID: + id = is_datetime + ? ((php_date_obj*)object)->time->tz_info->name + : ((php_timezone_obj*)object)->tzi.tz->name; + id_len = strlen(id); + break; + case TIMELIB_ZONETYPE_OFFSET: { + int offset_mins = is_datetime + ? -((php_date_obj*)object)->time->z + : -(int)((php_timezone_obj*)object)->tzi.utc_offset, + hours = offset_mins / 60, + minutes = offset_mins - hours * 60; + minutes *= minutes > 0 ? 1 : -1; + + if (offset_mins <= -24 * 60 || offset_mins >= 24 * 60) { + spprintf(&message, 0, "%s: object has an time zone offset " + "that's too large", func); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return NULL; + } + + id = offset_id; + id_len = slprintf(id, sizeof(offset_id), "GMT%+03d:%02d", + hours, minutes); + break; + } + case TIMELIB_ZONETYPE_ABBR: + id = is_datetime + ? ((php_date_obj*)object)->time->tz_abbr + : ((php_timezone_obj*)object)->tzi.z.abbr; + id_len = strlen(id); + break; + } + + UnicodeString s = UnicodeString(id, id_len, US_INV); + timeZone = TimeZone::createTimeZone(s); +#if U_ICU_VERSION_MAJOR_NUM >= 49 + if (*timeZone == TimeZone::getUnknown()) { +#else + UnicodeString resultingId; + timeZone->getID(resultingId); + if (resultingId == UnicodeString("Etc/Unknown", -1, US_INV) + || resultingId == UnicodeString("GMT", -1, US_INV)) { +#endif + spprintf(&message, 0, "%s: time zone id '%s' " + "extracted from ext/date DateTimeZone not recognized", func, id); + intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + delete timeZone; + return NULL; + } + return timeZone; +} +/* }}} */ + +U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, + intl_error *err, const char *func TSRMLS_DC) +{ + zval retval; + zval *zfuncname; + char *message; + + if (err && U_FAILURE(err->code)) { + return FAILURE; + } + + if (millis) { + *millis = NAN; + } + if (tz) { + *tz = NULL; + } + + if (millis) { + INIT_ZVAL(retval); + MAKE_STD_ZVAL(zfuncname); + ZVAL_STRING(zfuncname, "getTimestamp", 1); + if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) + != SUCCESS || Z_TYPE(retval) != IS_LONG) { + spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " + "object", func); + intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, + message, 1 TSRMLS_CC); + efree(message); + zval_ptr_dtor(&zfuncname); + return FAILURE; + } + + *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + zval_ptr_dtor(&zfuncname); + } + + if (tz) { + php_date_obj *datetime; + datetime = (php_date_obj*)zend_object_store_get_object(z TSRMLS_CC); + if (!datetime->time) { + spprintf(&message, 0, "%s: the DateTime object is not properly " + "initialized", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return FAILURE; + } + if (!datetime->time->is_localtime) { + *tz = TimeZone::getGMT()->clone(); + } else { + *tz = timezone_convert_datetimezone(datetime->time->zone_type, + datetime, 1, NULL, func TSRMLS_CC); + if (*tz == NULL) { + spprintf(&message, 0, "%s: could not convert DateTime's " + "time zone", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + return FAILURE; + } + } + } + + return SUCCESS; +} + +U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) +{ + double rv = NAN; + long lv; + int type; + char *message; + + if (err && U_FAILURE(err->code)) { return NAN; } @@ -43,7 +192,12 @@ U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) } else if (type == IS_LONG) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { - *status = U_ILLEGAL_ARGUMENT_ERROR; + spprintf(&message, 0, "%s: string '%s' is not numeric, " + "which would be required for it to be a valid date", func, + Z_STRVAL_P(z)); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); } break; case IS_LONG: @@ -54,33 +208,41 @@ U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC) break; case IS_OBJECT: if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce() TSRMLS_CC)) { - zval retval; - zval *zfuncname; - INIT_ZVAL(retval); - MAKE_STD_ZVAL(zfuncname); - ZVAL_STRING(zfuncname, "getTimestamp", 1); - if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_LONG) { - *status = U_INTERNAL_PROGRAM_ERROR; - } else { - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); - } - zval_ptr_dtor(&zfuncname); + intl_datetime_decompose(z, &rv, NULL, err, func TSRMLS_CC); } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr TSRMLS_CC)) { Calendar_object *co = (Calendar_object *) zend_object_store_get_object(z TSRMLS_CC ); if (co->ucal == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; + spprintf(&message, 0, "%s: IntlCalendar object is not properly " + "constructed", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); } else { - rv = (double)co->ucal->getTime(*status); + UErrorCode status = UErrorCode(); + rv = (double)co->ucal->getTime(status); + if (U_FAILURE(status)) { + spprintf(&message, 0, "%s: call to internal " + "Calendar::getTime() has failed", func); + intl_errors_set(err, status, message, 1 TSRMLS_CC); + efree(message); + } } } else { /* TODO: try with cast(), get() to obtain a number */ - *status = U_ILLEGAL_ARGUMENT_ERROR; + spprintf(&message, 0, "%s: invalid object type for date/time " + "(only IntlCalendar and DateTime permitted)", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); } break; default: - *status = U_ILLEGAL_ARGUMENT_ERROR; + spprintf(&message, 0, "%s: invalid PHP type for date", func); + intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, + message, 1 TSRMLS_CC); + efree(message); + break; } return rv; diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h index cfa14d1a583..d2396cbf5af 100644 --- a/ext/intl/common/common_date.h +++ b/ext/intl/common/common_date.h @@ -21,9 +21,20 @@ U_CDECL_BEGIN #include +#include "../intl_error.h" U_CDECL_END -U_CFUNC double intl_zval_to_millis(zval *z, UErrorCode *status TSRMLS_DC); +#ifdef __cplusplus + +#include + +U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func TSRMLS_DC); +U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, + intl_error *err, const char *func TSRMLS_DC); + +#endif + +U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC); #endif /* COMMON_DATE_H */ diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 8598161e2b8..c33f47fbdc0 100755 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -52,6 +52,7 @@ if test "$PHP_INTL" != "no"; then dateformat/dateformat_attr.c \ dateformat/dateformat_data.c \ dateformat/dateformat_format.c \ + dateformat/dateformat_format_object.cpp \ dateformat/dateformat_parse.c \ dateformat/dateformat_create.cpp \ dateformat/dateformat_attrcpp.cpp \ diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 index d57c7f3a334..851436480d9 100755 --- a/ext/intl/config.w32 +++ b/ext/intl/config.w32 @@ -62,6 +62,7 @@ if (PHP_INTL != "no") { dateformat_class.c \ dateformat_attr.c \ dateformat_format.c \ + dateformat_format_object.cpp \ dateformat_parse.c \ dateformat_data.c \ dateformat_attrcpp.cpp \ diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index fda67f1b700..809a1c60c9b 100755 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -19,6 +19,7 @@ #include "php_intl.h" #include "dateformat_data.h" #include "dateformat_format.h" +#include "dateformat_format_object.h" #include "dateformat_parse.h" #include "dateformat.h" #include "dateformat_attr.h" @@ -120,6 +121,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format, 0, 0, 0) ZEND_ARG_INFO(0, array) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format_object, 0, 0, 1) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, locale) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_intldateformatter_getdatetype, 0) ZEND_END_ARG_INFO() @@ -170,6 +177,7 @@ static zend_function_entry IntlDateFormatter_class_functions[] = { PHP_NAMED_FE( setLenient, ZEND_FN( datefmt_set_lenient ), arginfo_intldateformatter_setlenient ) PHP_NAMED_FE( isLenient, ZEND_FN( datefmt_is_lenient ), arginfo_intldateformatter_getdatetype ) PHP_NAMED_FE( format, ZEND_FN( datefmt_format ), arginfo_intldateformatter_format ) + PHP_ME_MAPPING( formatObject, datefmt_format_object, arginfo_intldateformatter_format_object, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_NAMED_FE( parse, ZEND_FN( datefmt_parse), datefmt_parse_args ) PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), datefmt_parse_args ) PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_intldateformatter_getdatetype ) diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 468a3d7748d..d5a17f91cd3 100755 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -175,10 +175,11 @@ PHP_FUNCTION(datefmt_format) timestamp = internal_get_timestamp(dfo, hash_arr TSRMLS_CC); INTL_METHOD_CHECK_STATUS(dfo, "datefmt_format: date formatting failed") } else { - timestamp = intl_zval_to_millis(zarg, - &INTL_DATA_ERROR_CODE(dfo) TSRMLS_CC); - INTL_METHOD_CHECK_STATUS(dfo, "datefmt_format: could not convert input " - "into a date") + timestamp = intl_zval_to_millis(zarg, INTL_DATA_ERROR_P(dfo), + "datefmt_format" TSRMLS_CC); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + RETURN_FALSE; + } } internal_format( dfo, timestamp, return_value TSRMLS_CC); diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp new file mode 100644 index 00000000000..e8981faa267 --- /dev/null +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -0,0 +1,230 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ +*/ + +#include "../intl_cppshims.h" + +#include +#include +#include +#include +#include + +#include "../intl_convertcpp.h" + +extern "C" { +#include "../php_intl.h" +#include "../locale/locale.h" +#define USE_CALENDAR_POINTER 1 +#include "../calendar/calendar_class.h" +#include +#include "../common/common_date.h" +} + +static const DateFormat::EStyle valid_styles[] = { + DateFormat::kNone, + DateFormat::kFull, + DateFormat::kLong, + DateFormat::kMedium, + DateFormat::kShort, + DateFormat::kFullRelative, + DateFormat::kLongRelative, + DateFormat::kMediumRelative, + DateFormat::kShortRelative, +}; + +static bool valid_format(zval **z) { + if (Z_TYPE_PP(z) == IS_LONG) { + long lval = Z_LVAL_PP(z); + for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { + if ((long)valid_styles[i] == lval) { + return true; + } + } + } + + return false; +} + +U_CFUNC PHP_FUNCTION(datefmt_format_object) +{ + zval *object, + **format = NULL; + const char *locale_str = NULL; + int locale_len; + bool pattern = false; + UDate date; + TimeZone *timeZone = NULL; + UErrorCode status = U_ZERO_ERROR; + DateFormat *df = NULL; + Calendar *cal = NULL; + DateFormat::EStyle dateStyle = DateFormat::kDefault, + timeStyle = DateFormat::kDefault; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|Zs!", + &object, &format, &locale_str, &locale_len) == FAILURE) { + RETURN_FALSE; + } + + if (!locale_str) { + locale_str = intl_locale_get_default(TSRMLS_C); + } + + if (format == NULL || Z_TYPE_PP(format) == IS_NULL) { + //nothing + } else if (Z_TYPE_PP(format) == IS_ARRAY) { + HashTable *ht = Z_ARRVAL_PP(format); + HashPosition pos = {0}; + zval **z; + if (zend_hash_num_elements(ht) != 2) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; if array, it must have " + "two elements", 0 TSRMLS_CC); + RETURN_FALSE; + } + + zend_hash_internal_pointer_reset_ex(ht, &pos); + zend_hash_get_current_data_ex(ht, (void**)&z, &pos); + if (!valid_format(z)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; the date format (first " + "element of the array) is not valid", 0 TSRMLS_CC); + RETURN_FALSE; + } + dateStyle = (DateFormat::EStyle)Z_LVAL_PP(z); + + zend_hash_move_forward_ex(ht, &pos); + zend_hash_get_current_data_ex(ht, (void**)&z, &pos); + if (!valid_format(z)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad format; the time format (" + "second element of the array) is not valid", 0 TSRMLS_CC); + RETURN_FALSE; + } + timeStyle = (DateFormat::EStyle)Z_LVAL_PP(z); + } else if (Z_TYPE_PP(format) == IS_LONG) { + if (!valid_format(format)) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: the date/time format type is invalid", + 0 TSRMLS_CC); + RETURN_FALSE; + } + dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_PP(format); + } else { + convert_to_string_ex(format); + if (Z_STRLEN_PP(format) == 0) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: the format is empty", 0 TSRMLS_CC); + RETURN_FALSE; + } + pattern = true; + } + + //there's no support for relative time in ICU yet + timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative); + + zend_class_entry *instance_ce = Z_OBJCE_P(object); + if (instanceof_function(instance_ce, Calendar_ce_ptr TSRMLS_CC)) { + Calendar *obj_cal = calendar_fetch_native_calendar(object TSRMLS_CC); + if (obj_cal == NULL) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "datefmt_format_object: bad IntlCalendar instance: " + "not initialized properly", 0 TSRMLS_CC); + RETURN_FALSE; + } + timeZone = obj_cal->getTimeZone().clone(); + date = obj_cal->getTime(status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: error obtaining instant from " + "IntlCalendar", 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + cal = obj_cal->clone(); + } else if (instanceof_function(instance_ce, php_date_get_date_ce() TSRMLS_CC)) { + if (intl_datetime_decompose(object, &date, &timeZone, NULL, + "datefmt_format_object" TSRMLS_CC) == FAILURE) { + RETURN_FALSE; + } + cal = new GregorianCalendar(Locale::createFromName(locale_str), status); + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: could not create GregorianCalendar", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } else { + intl_error_set(NULL, status, "datefmt_format_object: the passed object " + "must be an instance of either IntlCalendar or DateTime", + 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (pattern) { + df = new SimpleDateFormat( + UnicodeString(Z_STRVAL_PP(format), Z_STRLEN_PP(format), + UnicodeString::kInvariant), + Locale::createFromName(locale_str), + status); + + if (U_FAILURE(status)) { + intl_error_set(NULL, status, + "datefmt_format_object: could not create SimpleDateFormat", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } else { + df = DateFormat::createDateTimeInstance(dateStyle, timeStyle, + Locale::createFromName(locale_str)); + + if (df == NULL) { /* according to ICU sources, this should never happen */ + intl_error_set(NULL, status, + "datefmt_format_object: could not create DateFormat", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } + + //must be in this order (or have the cal adopt the tz) + df->adoptCalendar(cal); + cal = NULL; + df->adoptTimeZone(timeZone); + timeZone = NULL; + + { + UnicodeString result = UnicodeString(); + df->format(date, result); + + Z_TYPE_P(return_value) = IS_STRING; + if (intl_charFromString(result, &Z_STRVAL_P(return_value), + &Z_STRLEN_P(return_value), &status) == FAILURE) { + intl_error_set(NULL, status, + "datefmt_format_object: error converting result to UTF-8", + 0 TSRMLS_CC); + RETVAL_FALSE; + goto cleanup; + } + } + + +cleanup: + delete df; + delete timeZone; + delete cal; +} diff --git a/ext/intl/dateformat/dateformat_format_object.h b/ext/intl/dateformat/dateformat_format_object.h new file mode 100644 index 00000000000..d80ea87e0f8 --- /dev/null +++ b/ext/intl/dateformat/dateformat_format_object.h @@ -0,0 +1,19 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Gustavo Lopes | + +----------------------------------------------------------------------+ + */ + +#include + +PHP_FUNCTION(datefmt_format_object); diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index c8223190784..9ee1cdcfb0d 100755 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -43,14 +43,6 @@ extern "C" { #include "../timezone/timezone_class.h" } -#ifndef INFINITY -#define INFINITY (DBL_MAX+DBL_MAX) -#endif - -#ifndef NAN -#define NAN (INFINITY-INFINITY) -#endif - #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 #define HAS_MESSAGE_PATTERN 1 #endif @@ -549,7 +541,7 @@ retry_kint64: } case Formattable::kDate: { - double dd = intl_zval_to_millis(*elem, &err.code TSRMLS_CC); + double dd = intl_zval_to_millis(*elem, &err, "msgfmt_format" TSRMLS_CC); if (U_FAILURE(err.code)) { char *message, *key_char; int key_len; diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 59272db7127..f314870ac6f 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -62,6 +62,7 @@ #include "dateformat/dateformat_attr.h" #include "dateformat/dateformat_attrcpp.h" #include "dateformat/dateformat_format.h" +#include "dateformat/dateformat_format_object.h" #include "dateformat/dateformat_parse.h" #include "dateformat/dateformat_data.h" @@ -339,6 +340,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0) ZEND_ARG_INFO(0, array) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format_object, 0, 0, 1) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, locale) +ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3) ZEND_ARG_INFO(0, locale) ZEND_ARG_INFO(0, date_type) @@ -695,6 +703,7 @@ zend_function_entry intl_functions[] = { PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale ) PHP_FE( datefmt_format, arginfo_datefmt_format ) + PHP_FE( datefmt_format_object, arginfo_datefmt_format_object ) PHP_FE( datefmt_parse, datefmt_parse_args ) PHP_FE( datefmt_localtime , datefmt_parse_args ) PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code ) diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index d09de0e4396..8664eea3198 100755 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -399,24 +399,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: could not convert input into a date: U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt new file mode 100644 index 00000000000..03371a91ab6 --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt @@ -0,0 +1,41 @@ +--TEST-- +IntlDateFormatter::formatObject(): IntlCalendar tests +--SKIPIF-- +setTime(strtotime('2012-01-01 00:00:00')*1000.); +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; + +?> +==DONE== + +--EXPECT-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European Standard Time +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +06/02/1433 00:00:00 +Sunday, Safar 6, 1433 12:00:00 AM Western European Standard Time +==DONE== + diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt new file mode 100644 index 00000000000..bfc26cb80c9 --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -0,0 +1,34 @@ +--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- + +==DONE== + +--EXPECT-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European Standard Time +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +==DONE== + diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt new file mode 100644 index 00000000000..7aaf69e54e6 --- /dev/null +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -0,0 +1,74 @@ +--TEST-- +IntlDateFormatter::formatObject(): error conditions +--SKIPIF-- + +==DONE== + +--EXPECTF-- + +Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, integer given in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d +bool(false) + +Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: error calling ::getTimeStamp() on the object in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the date/time format type is invalid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; if array, it must have two elements in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the date format (first element of the array) is not valid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad format; the time format (second element of the array) is not valid in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d +bool(false) + +Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d +bool(false) +==DONE== + diff --git a/ext/intl/tests/msgfmt_format_error5.phpt b/ext/intl/tests/msgfmt_format_error5.phpt index 052d0efd116..ebbd4550e8f 100644 --- a/ext/intl/tests/msgfmt_format_error5.phpt +++ b/ext/intl/tests/msgfmt_format_error5.phpt @@ -20,6 +20,7 @@ $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array("foo" => new stdclass()))); --EXPECTF-- +Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted) in %s on line %d Warning: MessageFormatter::format(): The argument for key 'foo' cannot be used as a date or time in %s on line %d bool(false) diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 6e62c34f6d3..27cf41a4cf4 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -25,6 +25,8 @@ #include #include "../intl_convertcpp.h" +#include "../common/common_date.h" + extern "C" { #include "../intl_convert.h" #define USE_TIMEZONE_POINTER 1 @@ -54,79 +56,6 @@ U_CFUNC void timezone_object_construct(const TimeZone *zone, zval *object, int o } /* }}} */ -/* {{{ timezone_convert_datetimezone - * The timezone in DateTime and DateTimeZone is not unified. */ -U_CFUNC TimeZone *timezone_convert_datetimezone(int type, - void *object, - int is_datetime, - intl_error *outside_error, - const char *func TSRMLS_DC) -{ - char *id = NULL, - offset_id[] = "GMT+00:00"; - int id_len = 0; - char *message; - TimeZone *timeZone; - - switch (type) { - case TIMELIB_ZONETYPE_ID: - id = is_datetime - ? ((php_date_obj*)object)->time->tz_info->name - : ((php_timezone_obj*)object)->tzi.tz->name; - id_len = strlen(id); - break; - case TIMELIB_ZONETYPE_OFFSET: { - int offset_mins = is_datetime - ? -((php_date_obj*)object)->time->z - : -(int)((php_timezone_obj*)object)->tzi.utc_offset, - hours = offset_mins / 60, - minutes = offset_mins - hours * 60; - minutes *= minutes > 0 ? 1 : -1; - - if (offset_mins <= -24 * 60 || offset_mins >= 24 * 60) { - spprintf(&message, 0, "%s: object has an time zone offset " - "that's too large", func); - intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, - message, 1 TSRMLS_CC); - efree(message); - return NULL; - } - - id = offset_id; - id_len = slprintf(id, sizeof(offset_id), "GMT%+03d:%02d", - hours, minutes); - break; - } - case TIMELIB_ZONETYPE_ABBR: - id = is_datetime - ? ((php_date_obj*)object)->time->tz_abbr - : ((php_timezone_obj*)object)->tzi.z.abbr; - id_len = strlen(id); - break; - } - - UnicodeString s = UnicodeString(id, id_len, US_INV); - timeZone = TimeZone::createTimeZone(s); -#if U_ICU_VERSION_MAJOR_NUM >= 49 - if (*timeZone == TimeZone::getUnknown()) { -#else - UnicodeString resultingId; - timeZone->getID(resultingId); - if (resultingId == UnicodeString("Etc/Unknown", -1, US_INV) - || resultingId == UnicodeString("GMT", -1, US_INV)) { -#endif - spprintf(&message, 0, "%s: time zone id '%s' " - "extracted from ext/date DateTimeZone not recognized", func, id); - intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, - message, 1 TSRMLS_CC); - efree(message); - delete timeZone; - return NULL; - } - return timeZone; -} -/* }}} */ - /* {{{ timezone_convert_to_datetimezone * Convert from TimeZone to DateTimeZone object */ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h index 0d3c0edde47..a638f6dbf49 100644 --- a/ext/intl/timezone/timezone_class.h +++ b/ext/intl/timezone/timezone_class.h @@ -59,7 +59,6 @@ typedef struct { RETURN_FALSE; \ } -TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func TSRMLS_DC); zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, intl_error *outside_error, const char *func TSRMLS_DC); TimeZone *timezone_process_timezone_argument(zval **zv_timezone, intl_error *error, const char *func TSRMLS_DC); diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 1435679fe74..c35f0b87217 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -24,6 +24,9 @@ #include #include #include "intl_convertcpp.h" + +#include "../common/common_date.h" + extern "C" { #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" From 2498c90c71980168b5b9ac2fa006340b9460b1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 22 Jul 2012 04:13:17 +0200 Subject: [PATCH 300/641] Readded accidentally removed line --- ext/intl/dateformat/dateformat.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h index a5a747328f7..f11918b79f1 100755 --- a/ext/intl/dateformat/dateformat.h +++ b/ext/intl/dateformat/dateformat.h @@ -40,5 +40,6 @@ These are not necessary at this point of time #define CALENDAR_YEAR "tm_year" #define CALENDAR_WDAY "tm_wday" #define CALENDAR_YDAY "tm_yday" +#define CALENDAR_ISDST "tm_isdst" #endif // DATE_FORMATTER_H From 4203e0a5dfe83631b75c40c469224e7c94ec8c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 22 Jul 2012 04:26:49 +0200 Subject: [PATCH 301/641] Reflect changes made in merge 99e48d3 --- UPGRADING | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPGRADING b/UPGRADING index 6cfd47bfaf7..7d37f760002 100755 --- a/UPGRADING +++ b/UPGRADING @@ -91,6 +91,8 @@ PHP X.Y UPGRADE NOTES - IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are deprecated. Use IntlDateFormatter::setTimeZone() or datefmt_set_timezone() instead. +- IntlDateFormatter::format() and datefmt_format() now also accept an + IntlCalendar object for formatting. ======================================== 5. New Functions @@ -103,6 +105,7 @@ PHP X.Y UPGRADE NOTES - hash_pbkdf2() - Intl: + - datefmt_format_object() - datefmt_get_calendar_object() - datefmt_get_timezone() - datefmt_set_timezone() @@ -178,6 +181,7 @@ PHP X.Y UPGRADE NOTES - intltz_get_error_code() - intltz_get_error_message() + - IntlDateFormatter::formatObject() - IntlDateFormatter::getCalendarObject() - IntlDateFormatter::getTimeZone() - IntlDateFormatter::setTimeZone() From a88eca53f708602384cae147a8376352d5909d90 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 22 Jul 2012 19:20:23 +0800 Subject: [PATCH 302/641] Improve error message for ssl request --- sapi/cli/php_cli_server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 876c57a34d4..02f885484f5 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1618,7 +1618,11 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha client->parser.data = client; nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read); if (nbytes_consumed != nbytes_read) { - *errstr = estrdup("Malformed HTTP request"); + if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { + *errstr = estrdup("Unsupported SSL request"); + } else { + *errstr = estrdup("Malformed HTTP request"); + } return -1; } if (client->current_header_name) { From de80e3ce4b5b7a9ec0cfdd0778e77027a7ebfcc2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 22 Jul 2012 14:33:25 +0200 Subject: [PATCH 303/641] Remove reference restrictions from foreach foreach only allowed variables to be traversed by reference. This never really made sense because a) Expressions like array(&$a, &$b) can be meaningfully iterated by-ref b) Function calls can return by-ref (so they can also be meaningfully iterated) c) Iterators could at least in theory also be iterated by-ref (not sure if any iterator makes use of this) With by-ref generators the restriction makes even less sense, so I removed it altogether. --- Zend/tests/errmsg_043.phpt | 12 ---------- .../foreach_temp_array_expr_with_refs.phpt | 18 ++++++++++++++ Zend/tests/generators/yield_by_reference.phpt | 24 +++++++++++++------ Zend/zend_compile.c | 4 +--- Zend/zend_language_parser.y | 2 +- tests/lang/foreachLoop.008.phpt | 10 -------- 6 files changed, 37 insertions(+), 33 deletions(-) delete mode 100644 Zend/tests/errmsg_043.phpt create mode 100644 Zend/tests/foreach_temp_array_expr_with_refs.phpt delete mode 100644 tests/lang/foreachLoop.008.phpt diff --git a/Zend/tests/errmsg_043.phpt b/Zend/tests/errmsg_043.phpt deleted file mode 100644 index 3de8bc2062e..00000000000 --- a/Zend/tests/errmsg_043.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -errmsg: cannot create references to temp array ---FILE-- -&$v) { -} - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Cannot create references to elements of a temporary array expression in %s on line %d diff --git a/Zend/tests/foreach_temp_array_expr_with_refs.phpt b/Zend/tests/foreach_temp_array_expr_with_refs.phpt new file mode 100644 index 00000000000..8978b7b0114 --- /dev/null +++ b/Zend/tests/foreach_temp_array_expr_with_refs.phpt @@ -0,0 +1,18 @@ +--TEST-- +Temporary array expressions can be iterated by reference +--FILE-- + +--EXPECT-- +string(5) "a-foo" +string(5) "b-foo" diff --git a/Zend/tests/generators/yield_by_reference.phpt b/Zend/tests/generators/yield_by_reference.phpt index 5a6c169b3e2..dba0791c0d4 100644 --- a/Zend/tests/generators/yield_by_reference.phpt +++ b/Zend/tests/generators/yield_by_reference.phpt @@ -9,24 +9,34 @@ function &iter(array &$array) { } } -$array = [1, 2, 3, 4, 5]; +$array = [1, 2, 3]; $iter = iter($array); foreach ($iter as &$value) { $value *= -1; } var_dump($array); +$array = [1, 2, 3]; +foreach (iter($array) as &$value) { + $value *= -1; +} +var_dump($array); + ?> --EXPECT-- -array(5) { +array(3) { [0]=> int(-1) [1]=> int(-2) [2]=> - int(-3) - [3]=> - int(-4) - [4]=> - &int(-5) + &int(-3) +} +array(3) { + [0]=> + int(-1) + [1]=> + int(-2) + [2]=> + &int(-3) } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 51fc8c3e5be..f0648a2d977 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6317,9 +6317,7 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token if (value->EA & ZEND_PARSED_REFERENCE_VARIABLE) { assign_by_ref = 1; - if (!(opline-1)->extended_value) { - zend_error(E_COMPILE_ERROR, "Cannot create references to elements of a temporary array expression"); - } + /* Mark extended_value for assign-by-reference */ opline->extended_value |= ZEND_FE_FETCH_BYREF; CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index e5f31b5d149..4221752dbab 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -312,7 +312,7 @@ unticked_statement: foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); } | T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); } - variable foreach_optional_arg ')' { zend_check_writable_variable(&$6); zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); } + foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); } | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ diff --git a/tests/lang/foreachLoop.008.phpt b/tests/lang/foreachLoop.008.phpt deleted file mode 100644 index 787f43b8837..00000000000 --- a/tests/lang/foreachLoop.008.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Foreach loop tests - error case: reference to constant array, with key. ---FILE-- -&$v) { - var_dump($v); -} -?> ---EXPECTF-- -Fatal error: Cannot create references to elements of a temporary array expression in %s on line 2 From 94b2ccae9ce95c4c71bb8db8ce75dcdf26df7d7a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 22 Jul 2012 17:46:46 +0200 Subject: [PATCH 304/641] Fix throwing of exceptions within a generator If a generator threw an exception and was iterated using foreach (i.e. not manually) an infinite loop was triggered. The reason was that the exception was not properly rethrown using zend_throw_exception_internal. --- Zend/tests/generators/backtrace.phpt | 2 +- .../generator_throwing_in_foreach.phpt | 20 +++++++++++++++++++ Zend/zend_generators.c | 12 ++++++++--- Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 Zend/tests/generators/generator_throwing_in_foreach.phpt diff --git a/Zend/tests/generators/backtrace.phpt b/Zend/tests/generators/backtrace.phpt index 5f665b7e4ac..5fed1d467e6 100644 --- a/Zend/tests/generators/backtrace.phpt +++ b/Zend/tests/generators/backtrace.phpt @@ -22,6 +22,6 @@ f3($gen); ?> --EXPECTF-- #0 f1() called at [%s:%d] -#1 f2(foo, bar) called at [%s:%d] +#1 f2(foo, bar) #2 Generator->rewind() called at [%s:%d] #3 f3(Generator Object ()) called at [%s:%d] diff --git a/Zend/tests/generators/generator_throwing_in_foreach.phpt b/Zend/tests/generators/generator_throwing_in_foreach.phpt new file mode 100644 index 00000000000..dbf20c2ca1c --- /dev/null +++ b/Zend/tests/generators/generator_throwing_in_foreach.phpt @@ -0,0 +1,20 @@ +--TEST-- +Exceptions throwing by generators during foreach iteration are properly handled +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'foo' in %s:%d +Stack trace: +#0 %s(%d): gen() +#1 {main} + thrown in %s on line %d + diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index b164fb835e5..d7ffb3055a6 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -21,6 +21,7 @@ #include "zend.h" #include "zend_API.h" #include "zend_interfaces.h" +#include "zend_exceptions.h" #include "zend_generators.h" ZEND_API zend_class_entry *zend_ce_generator; @@ -352,12 +353,11 @@ zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ * up in backtraces and func_get_all() can access the function * arguments. */ execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data)); + memset(execute_data->prev_execute_data, 0, sizeof(zend_execute_data)); + execute_data->prev_execute_data->function_state.function = (zend_function *) op_array; if (EG(current_execute_data)) { - memcpy(execute_data->prev_execute_data, EG(current_execute_data), sizeof(zend_execute_data)); execute_data->prev_execute_data->function_state.arguments = zend_copy_arguments(EG(current_execute_data)->function_state.arguments); } else { - memset(execute_data->prev_execute_data, 0, sizeof(zend_execute_data)); - execute_data->prev_execute_data->function_state.function = (zend_function *) op_array; execute_data->prev_execute_data->function_state.arguments = NULL; } @@ -450,6 +450,12 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ memcpy(generator->backed_up_stack, generator->original_stack_top, generator->backed_up_stack_size); zend_vm_stack_free(generator->original_stack_top TSRMLS_CC); } + + /* If an exception was thrown in the generator we have to internally + * rethrow it in the parent scope. */ + if (UNEXPECTED(EG(exception) != NULL)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + } } } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 6b8425558c9..03768e8bd74 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5088,7 +5088,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) EX(old_error_reporting) = NULL; if (!catched) { - /* For generators skip the leave handler return directly */ + /* For generators skip the leave handler and return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 9a9917fede2..5ded3e39c7e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1151,7 +1151,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER EX(old_error_reporting) = NULL; if (!catched) { - /* For generators skip the leave handler return directly */ + /* For generators skip the leave handler and return directly */ if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); From 134089372b94de2e3e8c2a1aba4cbc415c803d67 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 22 Jul 2012 20:11:09 +0200 Subject: [PATCH 305/641] Throw error also for return occuring before yield Previously only an error was thrown when return occured after yield. Also returns before the first yield would fail for by-ref generators. Now the error message is handled in pass_two, so all returns are checked. --- .../generator_cannot_return_before_yield_error.phpt | 13 +++++++++++++ .../errors/generator_cannot_return_error.phpt | 2 +- Zend/zend_compile.c | 9 ++------- Zend/zend_opcode.c | 12 ++++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt diff --git a/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt b/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt new file mode 100644 index 00000000000..ad618d20ba2 --- /dev/null +++ b/Zend/tests/generators/errors/generator_cannot_return_before_yield_error.phpt @@ -0,0 +1,13 @@ +--TEST-- +Generators cannot return values (even before yield) +--FILE-- + +--EXPECTF-- +Fatal error: Generators cannot return values using "return" in %s on line 4 diff --git a/Zend/tests/generators/errors/generator_cannot_return_error.phpt b/Zend/tests/generators/errors/generator_cannot_return_error.phpt index 9a46bff5e66..51149062a7e 100644 --- a/Zend/tests/generators/errors/generator_cannot_return_error.phpt +++ b/Zend/tests/generators/errors/generator_cannot_return_error.phpt @@ -10,4 +10,4 @@ function gen() { ?> --EXPECTF-- -Fatal error: Generators cannot return values using "return" in %s on line %d +Fatal error: Generators cannot return values using "return" in %s on line 5 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f0648a2d977..483ff30ddc7 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2611,14 +2611,9 @@ void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */ { zend_op *opline; int start_op_number, end_op_number; + zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; - /* For generators the & modifier applies to the yielded values, not the - * return value. */ - zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR); - - if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) && expr != NULL) { - zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); - } + /* The error for use of return inside a generator is thrown in pass_two. */ if (do_end_vparse) { if (returns_reference && !zend_is_function_or_method_call(expr)) { diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 65fa85185ef..0042c372997 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -532,6 +532,18 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) case ZEND_JMP_SET_VAR: opline->op2.jmp_addr = &op_array->opcodes[opline->op2.opline_num]; break; + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + if (op_array->fn_flags & ZEND_ACC_GENERATOR) { + if (opline->op1_type != IS_CONST || Z_TYPE_P(opline->op1.zv) != IS_NULL) { + CG(zend_lineno) = opline->lineno; + zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); + } + if (opline->opcode == ZEND_RETURN_BY_REF) { + opline->opcode = ZEND_RETURN; + } + } + break; } ZEND_VM_SET_OPCODE_HANDLER(opline); opline++; From 99f93dd9a846e3d615ec61c734aca2e7ee256600 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 22 Jul 2012 20:19:07 +0200 Subject: [PATCH 306/641] Add T_YIELD in tokenizer_data.c Also had to fix up some tokenizer tests that were affected by the token number changes. --- .../tests/token_get_all_variation11.phpt | 4 ++-- .../tests/token_get_all_variation13.phpt | 2 +- .../tests/token_get_all_variation17.phpt | 2 +- .../tests/token_get_all_variation4.phpt | 4 ++-- .../tests/token_get_all_variation5.phpt | 22 +++++++++---------- .../tests/token_get_all_variation6.phpt | 4 ++-- .../tests/token_get_all_variation8.phpt | 2 +- ext/tokenizer/tokenizer_data.c | 2 ++ 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ext/tokenizer/tests/token_get_all_variation11.phpt b/ext/tokenizer/tests/token_get_all_variation11.phpt index ecc86177a4d..98d89961b77 100644 --- a/ext/tokenizer/tests/token_get_all_variation11.phpt +++ b/ext/tokenizer/tests/token_get_all_variation11.phpt @@ -130,7 +130,7 @@ array(49) { [6]=> array(3) { [0]=> - int(283) + int(%d) [1]=> string(2) "==" [2]=> @@ -273,7 +273,7 @@ array(49) { [27]=> array(3) { [0]=> - int(283) + int(%d) [1]=> string(2) "==" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation13.phpt b/ext/tokenizer/tests/token_get_all_variation13.phpt index 9b2f3bc94fb..6f85492a99a 100644 --- a/ext/tokenizer/tests/token_get_all_variation13.phpt +++ b/ext/tokenizer/tests/token_get_all_variation13.phpt @@ -1005,7 +1005,7 @@ array(145) { [122]=> array(3) { [0]=> - int(288) + int(%d) [1]=> string(10) "instanceof" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation17.phpt b/ext/tokenizer/tests/token_get_all_variation17.phpt index dccc4c9c23d..f71444bc1e8 100644 --- a/ext/tokenizer/tests/token_get_all_variation17.phpt +++ b/ext/tokenizer/tests/token_get_all_variation17.phpt @@ -145,7 +145,7 @@ array(81) { [14]=> array(3) { [0]=> - int(283) + int(%d) [1]=> string(2) "==" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation4.phpt b/ext/tokenizer/tests/token_get_all_variation4.phpt index 45e6f8afbde..6bc111efbac 100644 --- a/ext/tokenizer/tests/token_get_all_variation4.phpt +++ b/ext/tokenizer/tests/token_get_all_variation4.phpt @@ -339,7 +339,7 @@ array(89) { [38]=> array(3) { [0]=> - int(279) + int(%d) [1]=> string(2) "&&" [2]=> @@ -518,7 +518,7 @@ array(89) { [60]=> array(3) { [0]=> - int(278) + int(%d) [1]=> string(2) "||" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation5.phpt b/ext/tokenizer/tests/token_get_all_variation5.phpt index 0068f2866fb..681fb48e573 100644 --- a/ext/tokenizer/tests/token_get_all_variation5.phpt +++ b/ext/tokenizer/tests/token_get_all_variation5.phpt @@ -181,7 +181,7 @@ array(94) { [18]=> array(3) { [0]=> - int(277) + int(%d) [1]=> string(2) "+=" [2]=> @@ -238,7 +238,7 @@ array(94) { [25]=> array(3) { [0]=> - int(276) + int(%d) [1]=> string(2) "-=" [2]=> @@ -295,7 +295,7 @@ array(94) { [32]=> array(3) { [0]=> - int(275) + int(%d) [1]=> string(2) "*=" [2]=> @@ -352,7 +352,7 @@ array(94) { [39]=> array(3) { [0]=> - int(274) + int(%d) [1]=> string(2) "/=" [2]=> @@ -409,7 +409,7 @@ array(94) { [46]=> array(3) { [0]=> - int(272) + int(%d) [1]=> string(2) "%=" [2]=> @@ -466,7 +466,7 @@ array(94) { [53]=> array(3) { [0]=> - int(271) + int(%d) [1]=> string(2) "&=" [2]=> @@ -523,7 +523,7 @@ array(94) { [60]=> array(3) { [0]=> - int(270) + int(%d) [1]=> string(2) "|=" [2]=> @@ -580,7 +580,7 @@ array(94) { [67]=> array(3) { [0]=> - int(269) + int(%d) [1]=> string(2) "^=" [2]=> @@ -637,7 +637,7 @@ array(94) { [74]=> array(3) { [0]=> - int(267) + int(%d) [1]=> string(3) ">>=" [2]=> @@ -694,7 +694,7 @@ array(94) { [81]=> array(3) { [0]=> - int(268) + int(%d) [1]=> string(3) "<<=" [2]=> @@ -751,7 +751,7 @@ array(94) { [88]=> array(3) { [0]=> - int(273) + int(%d) [1]=> string(2) ".=" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation6.phpt b/ext/tokenizer/tests/token_get_all_variation6.phpt index 54936d0c89a..6213dab9d05 100644 --- a/ext/tokenizer/tests/token_get_all_variation6.phpt +++ b/ext/tokenizer/tests/token_get_all_variation6.phpt @@ -191,7 +191,7 @@ array(50) { [21]=> array(3) { [0]=> - int(287) + int(%d) [1]=> string(2) "<<" [2]=> @@ -277,7 +277,7 @@ array(50) { [32]=> array(3) { [0]=> - int(286) + int(%d) [1]=> string(2) ">>" [2]=> diff --git a/ext/tokenizer/tests/token_get_all_variation8.phpt b/ext/tokenizer/tests/token_get_all_variation8.phpt index 0cf1d634711..c80a5d0f04d 100644 --- a/ext/tokenizer/tests/token_get_all_variation8.phpt +++ b/ext/tokenizer/tests/token_get_all_variation8.phpt @@ -794,7 +794,7 @@ array(108) { [103]=> array(3) { [0]=> - int(289) + int(%d) [1]=> string(7) "(unset)" [2]=> diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index 85822f19940..85fa343db1e 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -108,6 +108,7 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); @@ -242,6 +243,7 @@ char *get_token_type_name(int token_type) case T_FUNCTION: return "T_FUNCTION"; case T_CONST: return "T_CONST"; case T_RETURN: return "T_RETURN"; + case T_YIELD: return "T_YIELD"; case T_TRY: return "T_TRY"; case T_CATCH: return "T_CATCH"; case T_THROW: return "T_THROW"; From ffa8461bfebebd8158cdb26ad5f3439c527545f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Sun, 22 Jul 2012 22:45:39 +0200 Subject: [PATCH 307/641] merge 5.3.15 NEWS --- NEWS | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index e6b51a91403..8f5512367a1 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.3.16 -?? ??? 2012, PHP 5.3.15 - (NEWS will be merged after release by johannes. Formerging changes to the - PHP-5.3.15 release branch talk to johannes) - - CURL: . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). (r.hampartsumyan@gmail.com, Laruence) @@ -17,6 +13,77 @@ PHP NEWS . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault). (Laruence, Gustavo) +19 Jul 2012, PHP 5.3.15 + +- Zend Engine: + . Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that + includes a semi-colon). (Pierrick) + +- COM: + . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) + +- Core: + . Fixed potential overflow in _php_stream_scandir, CVE-2012-2688. (Jason + Powell, Stas) + . Fixed bug #62432 (ReflectionMethod random corrupt memory on high + concurrent). (Johannes) + . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed + Salt). (Anthony Ferrara) + +- Fileinfo: + . Fixed magic file regex support. (Felipe) + +- FPM: + . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) + . Fixed bug #61295 (php-fpm should not fail with commented 'user' + for non-root start). (fat) + . Fixed bug #61026 (FPM pools can listen on the same address). (fat) + . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). + (fat) + . Fixed bug #62153 (when using unix sockets, multiples FPM instances + can be launched without errors). (fat) + . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) + . Fixed bug #61218 (FPM drops connection while receiving some binary values + in FastCGI requests). (fat) + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) + +- Intl: + . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) + . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called + twice). (Gustavo) + . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) + . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks + pattern). (Gustavo) + . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo) + +- JSON: + . Reverted fix for bug #61537. (Johannes) + +- Phar: + . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe) + +- Reflection: + . Fixed bug #62384 (Attempting to invoke a Closure more than once causes + segfault). (Felipe) + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) + +- SPL: + . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). + (Nikita Popov) + +- SQLite: + . Fixed open_basedir bypass, CVE-2012-3365. (Johannes, reported by Yury + Maryshev) + +- XML Writer: + . Fixed bug #62064 (memory leak in the XML Writer module). + (jean-pierre dot lozi at lip6 dot fr) + +- Zip: + . Upgraded libzip to 0.10.1 (Anatoliy) + 14 Jun 2012, PHP 5.3.14 - CLI SAPI: From 860b3ffe75a95f18ff3bf570c49c5004cb70cab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Sun, 22 Jul 2012 23:28:32 +0200 Subject: [PATCH 308/641] Fix Bug #62612 readline extension compilation fails --- NEWS | 4 ++++ sapi/cli/config.m4 | 2 ++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 8ae6931b6ee..883d9102b1d 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,10 @@ PHP NEWS - MySQLnd: . Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode). (Laruence) +- readline: + . Fixed bug #62612 (readline extension compilation fails with + sapi/cli/cli.h: No such file). (Johannes) + - Reflection: . Implemented FR #61602 (Allow access to name of constant used as default value). (reeze.xia@gmail.com) diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4 index 77fc5e9551c..cdfa1f7daff 100644 --- a/sapi/cli/config.m4 +++ b/sapi/cli/config.m4 @@ -44,5 +44,7 @@ if test "$PHP_CLI" != "no"; then PHP_SUBST(BUILD_CLI) PHP_OUTPUT(sapi/cli/php.1) + + PHP_INSTALL_HEADERS([sapi/cli/cli.h]) fi AC_MSG_RESULT($PHP_CLI) From b1a997e2a25d1f1422a237e12cff19a70a8eb317 Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Mon, 23 Jul 2012 00:11:00 +0100 Subject: [PATCH 309/641] OK, bye bye JavaScript, let's just include credits before license --- ext/standard/info.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/ext/standard/info.c b/ext/standard/info.c index 83126c13778..11da0680126 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -797,32 +797,6 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) efree(php_uname); } - if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { - php_info_print_hr(); - php_info_print("\n"); - php_info_print("

"); - php_info_print("PHP Credits"); - php_info_print("

\n"); - php_info_print("
\n"); - php_print_credits(PHP_CREDITS_ALL, TSRMLS_C); - php_info_print("
\n"); - } - zend_ini_sort_entries(TSRMLS_C); if (flag & PHP_INFO_CONFIGURATION) { @@ -904,6 +878,12 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_table_end(); } + + if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { + php_info_print_hr(); + php_print_credits(PHP_CREDITS_ALL, TSRMLS_C); + } + if (flag & PHP_INFO_LICENSE) { if (!sapi_module.phpinfo_as_text) { SECTION("PHP License"); @@ -937,6 +917,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print("questions about PHP licensing, please contact license@php.net.\n"); } } + if (!sapi_module.phpinfo_as_text) { php_info_print(""); } From f3f824823d5104babdf225d6f779f5be8677467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 25 Jun 2012 11:13:23 +0200 Subject: [PATCH 310/641] Duplicate test for ICU 49 The output in ICU < 49 actually seems wrong here; ICU 49 seems to fix the data. --- .../tests/locale_get_display_script2.phpt | 4 +- .../tests/locale_get_display_script3.phpt | 275 ++++++++++++++++++ 2 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 ext/intl/tests/locale_get_display_script3.phpt diff --git a/ext/intl/tests/locale_get_display_script2.phpt b/ext/intl/tests/locale_get_display_script2.phpt index 92652bde906..2b9e037b788 100644 --- a/ext/intl/tests/locale_get_display_script2.phpt +++ b/ext/intl/tests/locale_get_display_script2.phpt @@ -1,8 +1,8 @@ --TEST-- -locale_get_display_script() icu >= 4.8 +locale_get_display_script() icu = 4.8 --SKIPIF-- - += 0) print 'skip'; ?> --FILE-- = 49 +--SKIPIF-- + + +--FILE-- + +--EXPECT-- +locale='uk-ua_CALIFORNIA@currency=;currency=GRN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='root' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='uk@currency=EURO' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='Hindi' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='fr' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ja' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='i-enochian' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-Hant' +disp_locale=en : display_script=Traditional Han +disp_locale=fr : display_script=chinois traditionnel +disp_locale=de : display_script=Traditionelles Chinesisch +----------------- +locale='zh-Hans' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Cyrl' +disp_locale=en : display_script=Cyrillic +disp_locale=fr : display_script=cyrillique +disp_locale=de : display_script=Kyrillisch +----------------- +locale='sr-Latn' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='zh-Hans-CN' +disp_locale=en : display_script=Simplified Han +disp_locale=fr : display_script=chinois simplifié +disp_locale=de : display_script=Vereinfachtes Chinesisch +----------------- +locale='sr-Latn-CS' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sl-rozaj' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-1901' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-IT-nedis' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='sl-Latn-IT-nedis' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='de-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-US' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='es-419' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-CH-x-phonebk' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='az-Arab-x-AZE-derbend' +disp_locale=en : display_script=Arabic +disp_locale=fr : display_script=arabe +disp_locale=de : display_script=Arabisch +----------------- +locale='zh-min' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-min-nan-Hant-CN' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='x-whatever' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='qaa-Qaaa-QM-x-southern' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='sr-Latn-QM' +disp_locale=en : display_script=Latin +disp_locale=fr : display_script=latin +disp_locale=de : display_script=Lateinisch +----------------- +locale='sr-Qaaa-CS' +disp_locale=en : display_script=Qaaa +disp_locale=fr : display_script=Qaaa +disp_locale=de : display_script=Qaaa +----------------- +locale='en-US-u-islamCal' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='zh-CN-a-myExt-x-private' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='en-a-myExt-b-another' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='de-419-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='a-DE' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- +locale='ar-a-aaa-b-bbb-a-ccc' +disp_locale=en : display_script= +disp_locale=fr : display_script= +disp_locale=de : display_script= +----------------- From 0dfcc3e798cd54714f792bf7507c37b96146ee1b Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 23 Jul 2012 16:36:24 +0200 Subject: [PATCH 311/641] Add ini setting intl.explicit_cleanup This is to help with looking for leaks. If set to true, this ini setting forces a call to u_cleanup() on module shutdown. --- ext/intl/php_intl.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index d7ed9dc6e59..41a1d1c0af7 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -96,6 +96,7 @@ #include "common/common_enum.h" #include +#include #include #include "php_ini.h" @@ -852,16 +853,39 @@ zend_function_entry intl_functions[] = { }; /* }}} */ +static zend_bool explicit_cleanup = 0; + +static ZEND_INI_MH(OnExplicitCleanupUpdate) +{ + if (stage == PHP_INI_STAGE_STARTUP) { + if (new_value_length == 2 && strcasecmp("on", new_value) == 0) { + explicit_cleanup = (zend_bool)1; + } + else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) { + explicit_cleanup = (zend_bool)1; + } + else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) { + explicit_cleanup = (zend_bool)1; + } + else { + explicit_cleanup = (zend_bool)atoi(new_value); + } + return SUCCESS; + } else { + return FAILURE; + } +} + /* {{{ INI Settings */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals) STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals) STD_PHP_INI_ENTRY("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool, use_exceptions, zend_intl_globals, intl_globals) + PHP_INI_ENTRY_EX("intl.explicit_cleanup", "0", 0, OnExplicitCleanupUpdate, zend_ini_boolean_displayer_cb) PHP_INI_END() /* }}} */ - static PHP_GINIT_FUNCTION(intl); /* {{{ intl_module_entry */ @@ -1003,6 +1027,10 @@ PHP_MSHUTDOWN_FUNCTION( intl ) /* For the default locale php.ini setting */ UNREGISTER_INI_ENTRIES(); + if (explicit_cleanup) { + u_cleanup(); + } + return SUCCESS; } /* }}} */ From c052b9c99ac09069d3f7c8ca5904c499ec842336 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 23 Jul 2012 16:38:27 +0200 Subject: [PATCH 312/641] Do not fetch default locale once on minit or rinit The default locale is now requested to ICU when it's needed by using intl_get_default_locale(). --- ext/intl/collator/collator_create.c | 2 +- ext/intl/dateformat/dateformat_create.cpp | 4 ++-- ext/intl/formatter/formatter_main.c | 2 +- ext/intl/locale/locale_methods.c | 16 ++++++++-------- ext/intl/msgformat/msgformat.c | 2 +- ext/intl/msgformat/msgformat_format.c | 2 +- ext/intl/msgformat/msgformat_parse.c | 2 +- ext/intl/php_intl.c | 9 --------- 8 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 0f0cc193e4c..a3b70159f2a 100755 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -48,7 +48,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } /* Open ICU collator. */ diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index fef93e93d95..7fefbe7449c 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -40,7 +40,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { zval *object; - char *locale_str; + const char *locale_str; int locale_len = 0; Locale locale; long date_type = 0; @@ -72,7 +72,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); if (locale_len == 0) { - locale_str = INTL_G(default_locale); + locale_str = intl_locale_get_default(TSRMLS_C); } locale = Locale::createFromName(locale_str); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 8fa17560b89..96f1bcf2e31 100755 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -56,7 +56,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } /* Create an ICU number formatter. */ diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 936e3142ad9..d1a86d8ee27 100755 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -390,7 +390,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } /* Call ICU get */ @@ -496,7 +496,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } if( strcmp(tag_name, DISP_NAME) != 0 ){ @@ -518,7 +518,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME /* Check if disp_loc_name passed , if not use default locale */ if( !disp_loc_name){ - disp_loc_name = estrdup(INTL_G(default_locale)); + disp_loc_name = estrdup(intl_locale_get_default(TSRMLS_C)); free_loc_name = 1; } @@ -690,7 +690,7 @@ PHP_FUNCTION( locale_get_keywords ) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } /* Get the keywords */ @@ -1097,7 +1097,7 @@ PHP_FUNCTION(locale_parse) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } array_init( return_value ); @@ -1145,7 +1145,7 @@ PHP_FUNCTION(locale_get_all_variants) } if(loc_name_len == 0) { - loc_name = INTL_G(default_locale); + loc_name = intl_locale_get_default(TSRMLS_C); } @@ -1251,7 +1251,7 @@ PHP_FUNCTION(locale_filter_matches) } if(loc_range_len == 0) { - loc_range = INTL_G(default_locale); + loc_range = intl_locale_get_default(TSRMLS_C); } if( strcmp(loc_range,"*")==0){ @@ -1537,7 +1537,7 @@ PHP_FUNCTION(locale_lookup) } if(loc_range_len == 0) { - loc_range = INTL_G(default_locale); + loc_range = intl_locale_get_default(TSRMLS_C); } hash_arr = HASH_OF(arr); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 0a01204fae9..45e5c7158b9 100755 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -61,7 +61,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } if(locale_len == 0) { - locale = INTL_G(default_locale); + locale = intl_locale_get_default(TSRMLS_C); } #ifdef MSG_FORMAT_QUOTE_APOS diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 39652327b98..4b81cfe2b45 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -134,7 +134,7 @@ PHP_FUNCTION( msgfmt_format_message ) } if(slocale_len == 0) { - slocale = INTL_G(default_locale); + slocale = intl_locale_get_default(TSRMLS_C); } #ifdef MSG_FORMAT_QUOTE_APOS diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index f540b1d0c4a..413d3b1f15d 100755 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -126,7 +126,7 @@ PHP_FUNCTION( msgfmt_parse_message ) } if(slocale_len == 0) { - slocale = INTL_G(default_locale); + slocale = intl_locale_get_default(TSRMLS_C); } #ifdef MSG_FORMAT_QUOTE_APOS diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 41a1d1c0af7..38175ca54cc 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -1011,11 +1011,6 @@ PHP_MINIT_FUNCTION( intl ) /* Global error handling. */ intl_error_init( NULL TSRMLS_CC ); - /* Set the default_locale value */ - if( INTL_G(default_locale) == NULL ) { - INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ; - } - return SUCCESS; } /* }}} */ @@ -1039,10 +1034,6 @@ PHP_MSHUTDOWN_FUNCTION( intl ) */ PHP_RINIT_FUNCTION( intl ) { - /* Set the default_locale value */ - if( INTL_G(default_locale) == NULL ) { - INTL_G(default_locale) = pestrdup(uloc_getDefault(), 1) ; - } return SUCCESS; } /* }}} */ From d8d5f9a9f50a98e3a44218f8672a6516a9e8dfe7 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 23 Jul 2012 16:46:28 +0200 Subject: [PATCH 313/641] Fixed function name --- ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index f2a39ba0225..61fb5746829 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -29,7 +29,7 @@ static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) { return (RuleBasedBreakIterator*)bio->biter; } -static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) +static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) { zval *object = getThis(); char *rules; @@ -96,7 +96,7 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct) return_value = getThis(); //changes this to IS_NULL (without first destroying) if there's an error - _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); + _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); if (Z_TYPE_P(return_value) == IS_NULL) { zend_object_store_ctor_failed(&orig_this TSRMLS_CC); From 01004c6abb53ee235f7d76295c48c3082c998a5b Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 23 Jul 2012 16:51:28 +0200 Subject: [PATCH 314/641] Fixed leak in RuleBasedBreakIterator constructor The leak occurred in case of error. --- ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 61fb5746829..454e5249fde 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -70,6 +70,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) smart_str_free(&parse_error_str); intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC); efree(msg); + delete rbbi; RETURN_NULL(); } } else { // compiled @@ -78,6 +79,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) if (U_FAILURE(status)) { intl_error_set(NULL, status, "rbbi_create_instance: unable to " "create instance from compiled rules", 0 TSRMLS_CC); + delete rbbi; RETURN_NULL(); } #else From ae3a827bf9b14c88bb7d52a19ad74bf0f074dc73 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 23 Jul 2012 17:00:52 +0200 Subject: [PATCH 315/641] Leak caused by wrong and unreachable cleanup --- ext/intl/dateformat/dateformat_format.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index d5a17f91cd3..ffae15518b0 100755 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -108,6 +108,7 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, second, mday; UCalendar *pcal; + UDate result; intl_error *err = &dfo->datef_data.error; #define INTL_GET_ELEM(elem) \ @@ -137,10 +138,11 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, /* set the incoming values for the calendar */ ucal_setDateTime(pcal, year, month, mday, hour, minute, second, &INTL_DATA_ERROR_CODE(dfo)); /* actually, ucal_setDateTime cannot fail */ - + /* Fetch the timestamp from the UCalendar */ - return ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo)); - udat_close(pcal); + result = ucal_getMillis(pcal, &INTL_DATA_ERROR_CODE(dfo)); + ucal_close(pcal); + return result; } From c20b2ab0bd8eae770088fca9dff50da76c2117e4 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 24 Jul 2012 13:37:44 +0800 Subject: [PATCH 316/641] folders --- ext/zlib/zlib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 9cd1f378862..eac757bbc58 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -690,6 +690,7 @@ PHP_ZLIB_ENCODE_FUNC(zlib_encode, 0); /* {{{ proto binary zlib_decode(binary data[, int max_decoded_len]) Uncompress any raw/gzip/zlib encoded data */ PHP_ZLIB_DECODE_FUNC(zlib_decode, PHP_ZLIB_ENCODING_ANY); +/* }}} */ /* NOTE: The naming of these userland functions was quite unlucky */ /* {{{ proto binary gzdeflate(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) @@ -701,18 +702,22 @@ PHP_ZLIB_ENCODE_FUNC(gzdeflate, PHP_ZLIB_ENCODING_RAW); Encode data with the gzip encoding */ PHP_ZLIB_ENCODE_FUNC(gzencode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ + /* {{{ proto binary gzcompress(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) Encode data with the zlib encoding */ PHP_ZLIB_ENCODE_FUNC(gzcompress, PHP_ZLIB_ENCODING_DEFLATE); /* }}} */ + /* {{{ proto binary gzinflate(binary data[, int max_decoded_len]) Decode raw deflate encoded data */ PHP_ZLIB_DECODE_FUNC(gzinflate, PHP_ZLIB_ENCODING_RAW); /* }}} */ + /* {{{ proto binary gzdecode(binary data[, int max_decoded_len]) Decode gzip encoded data */ PHP_ZLIB_DECODE_FUNC(gzdecode, PHP_ZLIB_ENCODING_GZIP); /* }}} */ + /* {{{ proto binary gzuncompress(binary data[, int max_decoded_len]) Decode zlib encoded data */ PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE); @@ -967,12 +972,14 @@ static PHP_RINIT_FUNCTION(zlib) } /* }}} */ +/* {{{ PHP_RSHUTDOWN_FUNCTION */ static PHP_RSHUTDOWN_FUNCTION(zlib) { php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); return SUCCESS; } +/* }}} */ /* {{{ PHP_MINFO_FUNCTION */ static PHP_MINFO_FUNCTION(zlib) From 6126ac44b5348dc7aac9d2c67f8e927211dfee2f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 24 Jul 2012 13:39:46 +0800 Subject: [PATCH 317/641] correct the author name introduced in bb685512 --- ext/zlib/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index a0bec9c4c6b..eac757bbc58 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | - | Stefan R�hrich | + | Stefan Röhrich | | Zeev Suraski | | Jade Nicoletti | | Michael Wallner | From 4c1e2bbd6f744b4048d4e0540ecc5dbe005494fe Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 24 Jul 2012 14:43:53 +0800 Subject: [PATCH 318/641] Re-fix bug #55544 --- ext/zlib/php_zlib.h | 1 + ext/zlib/tests/bug55544.phpt | Bin 0 -> 361 bytes ext/zlib/zlib.c | 11 ++++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 ext/zlib/tests/bug55544.phpt diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 449dfed0620..ab673512fcd 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -55,6 +55,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) long output_compression_default; char *output_handler; php_zlib_context *ob_gzhandler; + zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt new file mode 100644 index 0000000000000000000000000000000000000000..ca4214a46fbb1c7a30c92cec6961f9f224036735 GIT binary patch literal 361 zcmZ{gK~97)6ox12!t@e0xB-(I7sF;0C&+Z1MuSAi#2sNug+^=}C>e(}(oHN^M zUbwQHOEAASFbRnvN8_=A_qPxDC)v9&G!EB>UL{GC`ayuBB*kIyupr^BS9DyNjU~Cq z`)ah5&?>n#hU2FQ2mLcn-j6549DaWtO+L>)ehzx~L0(~hfgfYD6-Z%D(+CSHb1sS* R975Jvy_-RwQl|DA_yxL1at8na literal 0 HcmV?d00001 diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index eac757bbc58..7ff2b30c4c4 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -263,6 +263,8 @@ static php_output_handler *php_zlib_output_handler_init(const char *handler_name ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; } + ZLIBG(handler_registered) = 1; + if ((h = php_output_handler_create_internal(handler_name, handler_name_len, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { php_output_handler_set_context(h, php_zlib_output_handler_context_init(TSRMLS_C), php_zlib_output_handler_context_dtor TSRMLS_CC); } @@ -964,9 +966,10 @@ static PHP_MSHUTDOWN_FUNCTION(zlib) static PHP_RINIT_FUNCTION(zlib) { ZLIBG(compression_coding) = 0; - ZLIBG(output_compression) = ZLIBG(output_compression_default); - - php_zlib_output_compression_start(TSRMLS_C); + if (!ZLIBG(handler_registered)) { + ZLIBG(output_compression) = ZLIBG(output_compression_default); + php_zlib_output_compression_start(TSRMLS_C); + } return SUCCESS; } @@ -976,6 +979,7 @@ static PHP_RINIT_FUNCTION(zlib) static PHP_RSHUTDOWN_FUNCTION(zlib) { php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); + ZLIBG(handler_registered) = 0; return SUCCESS; } @@ -1000,6 +1004,7 @@ static PHP_MINFO_FUNCTION(zlib) static ZEND_MODULE_GLOBALS_CTOR_D(zlib) { zlib_globals->ob_gzhandler = NULL; + zlib_globals->handler_registered = 0; } /* }}} */ From 9fe8c58130ac82d2b52b35a290b71569abe50d18 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 24 Jul 2012 14:45:13 +0800 Subject: [PATCH 319/641] binary compatibility --- ext/zlib/php_zlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index ab673512fcd..e895e0e4826 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -52,9 +52,9 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) int compression_coding; long output_compression; long output_compression_level; - long output_compression_default; char *output_handler; php_zlib_context *ob_gzhandler; + long output_compression_default; zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); From 45d596ea1e32792c7b7b7f28be220dea861b6708 Mon Sep 17 00:00:00 2001 From: Florian Anderiasch Date: Tue, 24 Jul 2012 13:15:16 +0200 Subject: [PATCH 320/641] Add optional depth parameter to json_encode #62369 --- ext/json/json.c | 10 +++++++++- ext/json/php_json.h | 1 + ext/json/tests/bug62369.phpt | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 ext/json/tests/bug62369.phpt diff --git a/ext/json/json.c b/ext/json/json.c index 96690477c94..dab423084c4 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -47,6 +47,7 @@ ZEND_DECLARE_MODULE_GLOBALS(json) ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, options) + ZEND_ARG_INFO(0, depth) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1) @@ -126,6 +127,7 @@ static PHP_GINIT_FUNCTION(json) { json_globals->encoder_depth = 0; json_globals->error_code = 0; + json_globals->encode_max_depth = 0; } /* }}} */ @@ -341,6 +343,9 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) } } + if (JSON_G(encoder_depth) > JSON_G(encode_max_depth)) { + JSON_G(error_code) = PHP_JSON_ERROR_DEPTH; + } --JSON_G(encoder_depth); json_pretty_print_char(buf, options, '\n' TSRMLS_CC); json_pretty_print_indent(buf, options TSRMLS_CC); @@ -702,13 +707,16 @@ static PHP_FUNCTION(json_encode) zval *parameter; smart_str buf = {0}; long options = 0; + long depth = JSON_PARSER_DEFAULT_DEPTH; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", ¶meter, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", ¶meter, &options, &depth) == FAILURE) { return; } JSON_G(error_code) = PHP_JSON_ERROR_NONE; + JSON_G(encode_max_depth) = depth; + php_json_encode(&buf, parameter, options TSRMLS_CC); if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) { diff --git a/ext/json/php_json.h b/ext/json/php_json.h index afeff3f6cc8..2b3cf5868ad 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -40,6 +40,7 @@ extern zend_module_entry json_module_entry; ZEND_BEGIN_MODULE_GLOBALS(json) int encoder_depth; int error_code; + int encode_max_depth; ZEND_END_MODULE_GLOBALS(json) #ifdef ZTS diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt new file mode 100644 index 00000000000..a5efd802c5e --- /dev/null +++ b/ext/json/tests/bug62369.phpt @@ -0,0 +1,34 @@ +--TEST-- +FR #62369 (Segfault on json_encode(deeply_nested_array) +--SKIPIF-- + +--FILE-- + Date: Tue, 24 Jul 2012 14:29:25 +0200 Subject: [PATCH 321/641] Add syslog support to mail.log #62356 Patch by Michael Orlitzky --- ext/standard/mail.c | 55 ++++++++++++++++++++++++++++++++++++--------- php.ini-development | 2 ++ php.ini-production | 2 ++ 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 36568c508e4..0bbdebcd456 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -39,6 +39,7 @@ #endif #endif +#include "php_syslog.h" #include "php_mail.h" #include "php_ini.h" #include "php_string.h" @@ -189,6 +190,37 @@ PHP_FUNCTION(mail) } /* }}} */ + +void php_mail_log_crlf_to_spaces(char *message) { + /* Find all instances of carriage returns or line feeds and + * replace them with spaces. Thus, a log line is always one line + * long + */ + char *p = message; + while ((p = strpbrk(p, "\r\n"))) { + *p = ' '; + } +} + +void php_mail_log_to_syslog(char *message) { + /* Write 'message' to syslog. */ +#ifdef HAVE_SYSLOG_H + php_syslog(LOG_NOTICE, "%s", message); +#endif +} + + +void php_mail_log_to_file(char *filename, char *message, size_t message_size) { + /* Write 'message' to the given file. */ + uint flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR; + php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL); + if (stream) { + php_stream_write(stream, message, message_size); + php_stream_close(stream); + } +} + + /* {{{ php_mail */ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC) @@ -216,19 +248,22 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (mail_log && *mail_log) { char *tmp; int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); - php_stream *stream = php_stream_open_wrapper(mail_log, "a", IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL); - if (hdr) { /* find all \r\n instances and replace them with spaces, so a log line is always one line long */ - char *p = tmp; - while ((p = strpbrk(p, "\r\n"))) { - *p = ' '; - } + if (hdr) { + php_mail_log_crlf_to_spaces(tmp); + } + + if (!strcmp(mail_log, "syslog")) { + /* Drop the final space when logging to syslog. */ + tmp[l - 1] = 0; + php_mail_log_to_syslog(tmp); + } + else { + /* Convert the final space to a newline when logging to file. */ tmp[l - 1] = '\n'; + php_mail_log_to_file(mail_log, tmp, l); } - if (stream) { - php_stream_write(stream, tmp, l); - php_stream_close(stream); - } + efree(tmp); } if (PG(mail_x_header)) { diff --git a/php.ini-development b/php.ini-development index 298cb06a727..4ff4192f6f8 100644 --- a/php.ini-development +++ b/php.ini-development @@ -1020,6 +1020,8 @@ mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = +; Log mail to syslog (Event Log on NT, not valid in Windows 95). +;mail.log = syslog [SQL] ; http://php.net/sql.safe-mode diff --git a/php.ini-production b/php.ini-production index d4c1261fcd0..814455bbbbb 100644 --- a/php.ini-production +++ b/php.ini-production @@ -1020,6 +1020,8 @@ mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = +; Log mail to syslog (Event Log on NT, not valid in Windows 95). +;mail.log = syslog [SQL] ; http://php.net/sql.safe-mode From f2cef8afc499ede08e935449030595933d070c5e Mon Sep 17 00:00:00 2001 From: Florian Anderiasch Date: Tue, 24 Jul 2012 14:46:19 +0200 Subject: [PATCH 322/641] Updated NES --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 883d9102b1d..0df69704f0b 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ PHP NEWS . Fixed bug #62564 (Extending MessageFormatter and adding property causes crash). (Felipe) +- Mail: + . Fixed bug #62356 (Add syslog support to mail.log). (Michael Orlitzky) + - MySQLnd: . Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode). (Laruence) From 54cba5aa91c58e2bcfa7957f72d5f4553c0dd265 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Tue, 24 Jul 2012 10:02:32 -0300 Subject: [PATCH 323/641] - Fixed ZTS build --- ext/standard/mail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 0bbdebcd456..364f7fc3999 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -210,7 +210,7 @@ void php_mail_log_to_syslog(char *message) { } -void php_mail_log_to_file(char *filename, char *message, size_t message_size) { +void php_mail_log_to_file(char *filename, char *message, size_t message_size TSRMLS_DC) { /* Write 'message' to the given file. */ uint flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR; php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL); @@ -261,7 +261,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char else { /* Convert the final space to a newline when logging to file. */ tmp[l - 1] = '\n'; - php_mail_log_to_file(mail_log, tmp, l); + php_mail_log_to_file(mail_log, tmp, l TSRMLS_CC); } efree(tmp); From f356be68c244dd0dd70894ac4a5c9b4e3a882e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Tue, 24 Jul 2012 15:13:02 +0200 Subject: [PATCH 324/641] ini intl.explicit_cleanup -> INTL_EXPLICIT_CLEANUP Added an environment variable and removed the ini setting intl.explicit_cleanup for calling u_cleanup() --- ext/intl/php_intl.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 38175ca54cc..78da0f5e32b 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -853,36 +853,11 @@ zend_function_entry intl_functions[] = { }; /* }}} */ -static zend_bool explicit_cleanup = 0; - -static ZEND_INI_MH(OnExplicitCleanupUpdate) -{ - if (stage == PHP_INI_STAGE_STARTUP) { - if (new_value_length == 2 && strcasecmp("on", new_value) == 0) { - explicit_cleanup = (zend_bool)1; - } - else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) { - explicit_cleanup = (zend_bool)1; - } - else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) { - explicit_cleanup = (zend_bool)1; - } - else { - explicit_cleanup = (zend_bool)atoi(new_value); - } - return SUCCESS; - } else { - return FAILURE; - } -} - - /* {{{ INI Settings */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals) STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals) STD_PHP_INI_ENTRY("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool, use_exceptions, zend_intl_globals, intl_globals) - PHP_INI_ENTRY_EX("intl.explicit_cleanup", "0", 0, OnExplicitCleanupUpdate, zend_ini_boolean_displayer_cb) PHP_INI_END() /* }}} */ @@ -1015,14 +990,18 @@ PHP_MINIT_FUNCTION( intl ) } /* }}} */ +#define EXPLICIT_CLEANUP_ENV_VAR "INTL_EXPLICIT_CLEANUP" + /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION( intl ) { + const char *cleanup; /* For the default locale php.ini setting */ UNREGISTER_INI_ENTRIES(); - if (explicit_cleanup) { + cleanup = getenv(EXPLICIT_CLEANUP_ENV_VAR); + if (cleanup != NULL && !(cleanup[0] == '0' && cleanup[1] == '\0')) { u_cleanup(); } From 5f224412fa6892645ca548ac75f20ff8743ed916 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 24 Jul 2012 16:28:49 -0700 Subject: [PATCH 325/641] Fix bug #62654 --- sapi/fpm/fpm/fpm_sockets.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index d24dcccc9af..f56b9cfbd14 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -455,11 +455,11 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) #endif -int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */ { int fd; - if (!sun || sun->sun_family != AF_UNIX) { + if (!sock || sock->sun_family != AF_UNIX) { return -1; } @@ -467,7 +467,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ return -1; } - if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + if (connect(fd, (struct sockaddr *)sock, socklen) == -1) { return -1; } From 0fbc8561e687689f796d95584cea1fa959eee83b Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 24 Jul 2012 16:28:49 -0700 Subject: [PATCH 326/641] Fix bug #62654 --- sapi/fpm/fpm/fpm_sockets.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index d24dcccc9af..f56b9cfbd14 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -455,11 +455,11 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) #endif -int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */ { int fd; - if (!sun || sun->sun_family != AF_UNIX) { + if (!sock || sock->sun_family != AF_UNIX) { return -1; } @@ -467,7 +467,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ return -1; } - if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + if (connect(fd, (struct sockaddr *)sock, socklen) == -1) { return -1; } From 5799ebdb0cafb2de1dbb18cfe780976c98dbaeac Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 24 Jul 2012 16:28:49 -0700 Subject: [PATCH 327/641] Fix bug #62654 --- sapi/fpm/fpm/fpm_sockets.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index d24dcccc9af..f56b9cfbd14 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -455,11 +455,11 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) #endif -int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */ { int fd; - if (!sun || sun->sun_family != AF_UNIX) { + if (!sock || sock->sun_family != AF_UNIX) { return -1; } @@ -467,7 +467,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ return -1; } - if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + if (connect(fd, (struct sockaddr *)sock, socklen) == -1) { return -1; } From ba568aaebb3f3c788a5551c016c0afafd7a5502e Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 26 Jul 2012 00:29:39 +0800 Subject: [PATCH 328/641] Fixed invalid read in CONST_STRING dereference, reported by Nikic --- Zend/zend_language_parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index e397fe138b9..c88e9a7c004 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -802,7 +802,7 @@ expr_without_variable: combined_scalar_offset: combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } | combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } - | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } + | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { $1.EA = 0; zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } combined_scalar: T_ARRAY '(' array_pair_list ')' { $$ = $3; } From b4b3a65f5518803c4a3bca34ac67e139b2547133 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 26 Jul 2012 12:40:47 +0800 Subject: [PATCH 329/641] Fixed bug #62661 (Interactive php-cli crashes if include() is used in auto_prepend_file) --- NEWS | 2 ++ Zend/zend.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 883d9102b1d..d4298495471 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.6 - Core: + . Fixed bug #62661 (Interactive php-cli crashes if include() is used in + auto_prepend_file). (Laruence) . Fixed bug #62565 (Crashes due non-initialized internal properties_table). (Felipe) diff --git a/Zend/zend.c b/Zend/zend.c index 37a1a27c7d6..18c4f11604c 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1261,6 +1261,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); + long orig_interactive = CG(interactive); va_start(files, file_count); for (i = 0; i < file_count; i++) { @@ -1268,6 +1269,15 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co if (!file_handle) { continue; } + + if (orig_interactive) { + if (file_handle->filename[0] != '-' || file_handle->filename[1]) { + CG(interactive) = 0; + } else { + CG(interactive) = 1; + } + } + EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC); if (file_handle->opened_path) { int dummy = 1; @@ -1309,12 +1319,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co va_end(files); EG(active_op_array) = orig_op_array; EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; + CG(interactive) = orig_interactive; return FAILURE; } } va_end(files); EG(active_op_array) = orig_op_array; EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; + CG(interactive) = orig_interactive; return SUCCESS; } From eae06100429f37e5297c432e99104daeeed13bad Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 26 Jul 2012 13:52:42 +0800 Subject: [PATCH 330/641] Fixed bug #62653: (unset($array[$float]) causes a crash) the reason why jpauli and I can not reproduce is (it's silly): I typo "USE_ZEND_ALLOC *&&* valgrind" at the first time, then I always ctrl+r and jpauli copied my command from the pastbin :) thanks --- NEWS | 2 ++ Zend/tests/bug62653.phpt | 33 +++++++++++++++++++++++++++++++++ Zend/zend_vm_def.h | 3 ++- Zend/zend_vm_execute.h | 36 ++++++++++++++++++++++++------------ 4 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 Zend/tests/bug62653.phpt diff --git a/NEWS b/NEWS index d4298495471..407b0528138 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Core: . Fixed bug #62661 (Interactive php-cli crashes if include() is used in auto_prepend_file). (Laruence) + . Fixed bug #62653: (unset($array[$float]) causes a crash). (Nikita Popov, + Laruence) . Fixed bug #62565 (Crashes due non-initialized internal properties_table). (Felipe) diff --git a/Zend/tests/bug62653.phpt b/Zend/tests/bug62653.phpt new file mode 100644 index 00000000000..cf5941c5b5a --- /dev/null +++ b/Zend/tests/bug62653.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #62653: unset($array[$float]) causes a crash +--FILE-- +"bar"); +$foo = "10.0000"; // gettype($foo) = "string" +$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double" +unset($array[$foo]); +print_r($array); + +$array = array("5"=>"bar"); +$foo = "5"; +unset($array[(float)$foo]); +print_r($array); + +$array = array("5"=>"bar"); +$foo = "5"; +$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double" +$name = "foo"; +unset($array[$$name]); +print_r($array); + +?> +--EXPECT-- +Array +( +) +Array +( +) +Array +( +) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 5a3ae495454..f5567ea990e 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3947,7 +3947,8 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - ZEND_VM_C_GOTO(num_index_dim); + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 1fb6e76cea4..78f3d8496d8 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -13917,7 +13917,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -15919,7 +15920,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -18131,7 +18133,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -21166,7 +21169,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -22504,7 +22508,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -23662,7 +23667,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -24820,7 +24826,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -26244,7 +26251,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -29498,7 +29506,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -31371,7 +31380,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -33453,7 +33463,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: @@ -36219,7 +36230,8 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ switch (Z_TYPE_P(offset)) { case IS_DOUBLE: hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_dim; + zend_hash_index_del(ht, hval); + break; case IS_RESOURCE: case IS_BOOL: case IS_LONG: From 302ad0d648376e072358a269432d3598302b62c0 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 26 Jul 2012 13:57:04 +0800 Subject: [PATCH 331/641] Fix test, committed in wrong folder --- Zend/tests/bug62653.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/bug62653.phpt b/Zend/tests/bug62653.phpt index cf5941c5b5a..96299f16ea4 100644 --- a/Zend/tests/bug62653.phpt +++ b/Zend/tests/bug62653.phpt @@ -14,7 +14,7 @@ unset($array[(float)$foo]); print_r($array); $array = array("5"=>"bar"); -$foo = "5"; +$foo = "10.0000"; $foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double" $name = "foo"; unset($array[$$name]); From 7d890eef82ab054c04458e676d63d2492cf20362 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 24 Jul 2012 17:44:45 -0700 Subject: [PATCH 332/641] update 5.4.5 date --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 407b0528138..7336376c3c0 100644 --- a/NEWS +++ b/NEWS @@ -53,7 +53,7 @@ PHP NEWS . Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression). (Laruence) -?? ??? 2012, PHP 5.4.5 +19 Jul 2012, PHP 5.4.5 - Core: . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed From 268740d9848d435054ce73a8cfe36b2b732cd1f7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 26 Jul 2012 17:07:24 +0200 Subject: [PATCH 333/641] Fix implementation of Iterator interface It looks like you have to implement the Iterator interface *before* assigning get_iterator. Otherwise the structure for user iterators isn't correctly zeroed out. Additionaly I'm setting class_entry->iterator_funcs.funcs now. Not sure if this is strictly necessary, but better safe than sorry ;) --- .../generator_in_multipleiterator.phpt | 37 +++++++++++++++++++ Zend/zend_generators.c | 4 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/generators/generator_in_multipleiterator.phpt diff --git a/Zend/tests/generators/generator_in_multipleiterator.phpt b/Zend/tests/generators/generator_in_multipleiterator.phpt new file mode 100644 index 00000000000..611dbc96527 --- /dev/null +++ b/Zend/tests/generators/generator_in_multipleiterator.phpt @@ -0,0 +1,37 @@ +--TEST-- +Generators work properly in MultipleIterator +--FILE-- +attachIterator(gen1()); +$it->attachIterator(gen2()); + +foreach ($it as $values) { + var_dump($values); +} + +?> +--EXPECT-- +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" +} +array(2) { + [0]=> + string(2) "aa" + [1]=> + string(2) "bb" +} diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index d7ffb3055a6..716b0a782ed 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -759,9 +759,11 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_generator->create_object = zend_generator_create; - zend_ce_generator->get_iterator = zend_generator_get_iterator; + /* get_iterator has to be assigned *after* implementing the inferface */ zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator); + zend_ce_generator->get_iterator = zend_generator_get_iterator; + zend_ce_generator->iterator_funcs.funcs = &zend_generator_iterator_functions; memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zend_generator_handlers.get_constructor = zend_generator_get_constructor; From ccffec74d070e862cae8d8752d716eabb53002b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 26 Jul 2012 23:37:02 +0200 Subject: [PATCH 334/641] Fix bug #62651: source level BC break Break for C++ extensions that don't wrap the includes of PHP libraries in extern "C" {. --- Zend/zend_string.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/zend_string.h b/Zend/zend_string.h index a61d2fb30d2..0a4738466d7 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -23,12 +23,14 @@ #include "zend.h" +BEGIN_EXTERN_C() ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); void zend_interned_strings_init(TSRMLS_D); void zend_interned_strings_dtor(TSRMLS_D); +END_EXTERN_C() #ifndef ZTS From edece6ec84484690d7ddf8fe971a48747059ba60 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Thu, 26 Jul 2012 19:13:42 -0400 Subject: [PATCH 335/641] Fixed bug #62615 (test ext/curl/tests/curl_escape.phpt failed). curl_easy_escape was modified in 5.21.2 to not escape "unreserved" characters so this test will fail on version older than 5.21.2 --- ext/curl/tests/curl_escape.phpt | Bin 553 -> 688 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ext/curl/tests/curl_escape.phpt b/ext/curl/tests/curl_escape.phpt index 7c90fb98883249b398707037da94d7ad8dd3db4f..e759144c8ac876d734a5a4ddd5c6be231f75b61a 100644 GIT binary patch delta 146 zcmZ3|%xdyqroP0k%TH&Q`%( S&&ZHn&qxVqOYO#c-i!bOZ828> delta 11 ScmdnMx{_tW{mp5NUW@=7w*)r; From 594397993dcbbf2fd90f6df23a2124c0239ec73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 26 Jul 2012 23:37:02 +0200 Subject: [PATCH 336/641] Fix bug #62651: source level BC break Break for C++ extensions that don't wrap the includes of PHP libraries in extern "C" {. --- Zend/zend_string.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/zend_string.h b/Zend/zend_string.h index a61d2fb30d2..0a4738466d7 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -23,12 +23,14 @@ #include "zend.h" +BEGIN_EXTERN_C() ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); void zend_interned_strings_init(TSRMLS_D); void zend_interned_strings_dtor(TSRMLS_D); +END_EXTERN_C() #ifndef ZTS From ef7286a42f0d85cc359f1d64678f859d6c3f832e Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 28 Jul 2012 00:50:45 +0800 Subject: [PATCH 337/641] Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php) It's not a big deal, just because lexer will read the char after cursor before leaving --- NEWS | 4 ++++ Zend/zend_language_scanner.c | 4 ++-- Zend/zend_language_scanner.l | 2 +- Zend/zend_language_scanner_defs.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 8f5512367a1..5aa35d7e20b 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.3.16 +- Core: + . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK + with run-test.php). (Laruence) + - CURL: . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). (r.hampartsumyan@gmail.com, Laruence) diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 1d0ada7a64d..e3fc576e910 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Feb 15 17:38:31 2012 */ +/* Generated by re2c 0.13.5 on Sat Jul 28 00:45:37 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -287,7 +287,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) zend_multibyte_set_filter(NULL TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+2); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 9b2e453dd65..266162747e0 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -285,7 +285,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) zend_multibyte_set_filter(NULL TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+2); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index adaedcf1aac..d1955a88ef8 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Feb 15 17:38:31 2012 */ +/* Generated by re2c 0.13.5 on Sat Jul 28 00:45:37 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { From b477a84026a39a58452af9676b4b74607e83e2f8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 28 Jul 2012 17:00:05 +0800 Subject: [PATCH 338/641] Fixed bug #60194 for eavl same reason here --- Zend/zend_language_scanner.c | 4 ++-- Zend/zend_language_scanner.l | 2 +- Zend/zend_language_scanner_defs.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index e3fc576e910..15a48fad8c6 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Jul 28 00:45:37 2012 */ +/* Generated by re2c 0.13.5 on Sat Jul 28 16:59:07 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -445,7 +445,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D zend_multibyte_set_filter(CG(internal_encoding) TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+2); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 266162747e0..c92bf2b107e 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -443,7 +443,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D zend_multibyte_set_filter(CG(internal_encoding) TSRMLS_CC); if (!SCNG(input_filter)) { - SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1); + SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+2); memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1); SCNG(script_filtered_size) = SCNG(script_org_size); } else { diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index d1955a88ef8..02a2a39500a 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sat Jul 28 00:45:37 2012 */ +/* Generated by re2c 0.13.5 on Sat Jul 28 16:59:07 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { From 068fc008c6828c2e045064a831ecb90136c6365b Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 28 Jul 2012 19:05:13 -0300 Subject: [PATCH 339/641] - Fixed bug #57933 (Wrong table type used in phpinfo output) patch by: selsky at columbia dot edu --- ext/fileinfo/fileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 36c5e392ebc..0c82898e438 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -271,7 +271,7 @@ ZEND_GET_MODULE(fileinfo) PHP_MINFO_FUNCTION(fileinfo) { php_info_print_table_start(); - php_info_print_table_header(2, "fileinfo support", "enabled"); + php_info_print_table_row(2, "fileinfo support", "enabled"); php_info_print_table_row(2, "version", PHP_FILEINFO_VERSION); php_info_print_table_end(); } From 015ee3b2c88d3e7bf984c7414b4de6c2a465b6a9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 29 Jul 2012 12:17:43 +0800 Subject: [PATCH 340/641] Skip test while zend_mm is disabled --- Zend/tests/bug55509.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index b78fceb0da5..5268789df67 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -5,6 +5,12 @@ Bug #55509 (segfault on x86_64 using more than 2G memory) if (PHP_INT_SIZE == 4) { die('skip Not for 32-bits OS'); } + +$zend_mm_enabled = getenv("USE_ZEND_ALLOC"); +if ($zend_mm_enabled === "0") { + die("skip Zend MM disabled"); +} + if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); // check the available memory if (PHP_OS == 'Linux') { From 880a6cee0068e980fd1eed735675d9b7d37968a0 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 29 Jul 2012 13:25:31 +0800 Subject: [PATCH 341/641] Skip test while zend mm is disabled --- ext/oci8/tests/pecl_bug10194.phpt | 3 +++ ext/oci8/tests/pecl_bug10194_blob_64.phpt | 3 +++ tests/lang/bug45392.phpt | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt index 9947e15dbcf..3c1c7887c2f 100644 --- a/ext/oci8/tests/pecl_bug10194.phpt +++ b/ext/oci8/tests/pecl_bug10194.phpt @@ -5,6 +5,9 @@ PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=10M diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt index 45788a41b43..e1a4cc034e2 100644 --- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -6,6 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=6M diff --git a/tests/lang/bug45392.phpt b/tests/lang/bug45392.phpt index ae84cd9d1dd..78876c7c803 100644 --- a/tests/lang/bug45392.phpt +++ b/tests/lang/bug45392.phpt @@ -2,6 +2,11 @@ Bug #45392 (ob_start()/ob_end_clean() and memory_limit) --INI-- display_errors=stderr +--SKIPIF-- + Date: Sun, 29 Jul 2012 14:30:01 +0800 Subject: [PATCH 342/641] Sike test while there is no zend mm max_size guard --- ext/standard/tests/streams/bug61115-1.phpt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/standard/tests/streams/bug61115-1.phpt b/ext/standard/tests/streams/bug61115-1.phpt index 89374e73537..99e2f7929ca 100644 --- a/ext/standard/tests/streams/bug61115-1.phpt +++ b/ext/standard/tests/streams/bug61115-1.phpt @@ -1,5 +1,11 @@ --TEST-- Bug #61115: Stream related segfault on fatal error in php_stream_context_del_link - variation 1 +--SKIPIF-- + --FILE-- Date: Sun, 29 Jul 2012 23:35:06 +0800 Subject: [PATCH 343/641] Fix test failed due to new feature introduced in 45d596ea --- ext/json/json.c | 2 +- ext/json/tests/json_encode_error.phpt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ext/json/json.c b/ext/json/json.c index dab423084c4..e4bb8a5d4be 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -700,7 +700,7 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, /* }}} */ -/* {{{ proto string json_encode(mixed data [, int options]) +/* {{{ proto string json_encode(mixed data [, int options[, int depth]]) Returns the JSON representation of a value */ static PHP_FUNCTION(json_encode) { diff --git a/ext/json/tests/json_encode_error.phpt b/ext/json/tests/json_encode_error.phpt index d130dd960c5..547c8bef17b 100644 --- a/ext/json/tests/json_encode_error.phpt +++ b/ext/json/tests/json_encode_error.phpt @@ -34,7 +34,5 @@ Warning: json_encode() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing json_encode() function with more than expected no. of arguments -- - -Warning: json_encode() expects at most 2 parameters, 3 given in %s on line %d -NULL +string(5) ""abc"" ===Done=== From 9762609cecd8eb138906a8f371e2746ee042e5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 30 Jul 2012 10:25:17 +0200 Subject: [PATCH 344/641] Remove executable bit from files --- ext/intl/CREDITS | 0 ext/intl/TODO | 0 ext/intl/collator/collator.c | 0 ext/intl/collator/collator.h | 0 ext/intl/collator/collator_attr.c | 0 ext/intl/collator/collator_attr.h | 0 ext/intl/collator/collator_class.c | 0 ext/intl/collator/collator_class.h | 0 ext/intl/collator/collator_compare.c | 0 ext/intl/collator/collator_compare.h | 0 ext/intl/collator/collator_convert.c | 0 ext/intl/collator/collator_convert.h | 0 ext/intl/collator/collator_create.c | 0 ext/intl/collator/collator_create.h | 0 ext/intl/collator/collator_error.c | 0 ext/intl/collator/collator_error.h | 0 ext/intl/collator/collator_is_numeric.c | 0 ext/intl/collator/collator_is_numeric.h | 0 ext/intl/collator/collator_locale.c | 0 ext/intl/collator/collator_locale.h | 0 ext/intl/collator/collator_sort.c | 0 ext/intl/collator/collator_sort.h | 0 ext/intl/common/common_error.c | 0 ext/intl/common/common_error.h | 0 ext/intl/config.m4 | 0 ext/intl/config.w32 | 0 ext/intl/dateformat/dateformat.c | 0 ext/intl/dateformat/dateformat.h | 0 ext/intl/dateformat/dateformat_attr.c | 0 ext/intl/dateformat/dateformat_attr.h | 0 ext/intl/dateformat/dateformat_class.c | 0 ext/intl/dateformat/dateformat_class.h | 0 ext/intl/dateformat/dateformat_data.c | 0 ext/intl/dateformat/dateformat_data.h | 0 ext/intl/dateformat/dateformat_format.c | 0 ext/intl/dateformat/dateformat_format.h | 0 ext/intl/dateformat/dateformat_parse.c | 0 ext/intl/dateformat/dateformat_parse.h | 0 ext/intl/doc/Tutorial.txt | 0 ext/intl/doc/collator_api.php | 0 ext/intl/doc/common_api.php | 0 ext/intl/doc/datefmt_api.php | 0 ext/intl/doc/formatter_api.php | 0 ext/intl/doc/grapheme_api.php | 0 ext/intl/doc/locale_api.php | 0 ext/intl/doc/msgfmt_api.php | 0 ext/intl/doc/normalizer_api.php | 0 ext/intl/formatter/formatter.c | 0 ext/intl/formatter/formatter.h | 0 ext/intl/formatter/formatter_attr.c | 0 ext/intl/formatter/formatter_attr.h | 0 ext/intl/formatter/formatter_class.c | 0 ext/intl/formatter/formatter_class.h | 0 ext/intl/formatter/formatter_data.c | 0 ext/intl/formatter/formatter_data.h | 0 ext/intl/formatter/formatter_format.c | 0 ext/intl/formatter/formatter_format.h | 0 ext/intl/formatter/formatter_main.c | 0 ext/intl/formatter/formatter_main.h | 0 ext/intl/formatter/formatter_parse.c | 0 ext/intl/formatter/formatter_parse.h | 0 ext/intl/grapheme/grapheme.h | 0 ext/intl/grapheme/grapheme_string.c | 0 ext/intl/grapheme/grapheme_util.c | 0 ext/intl/grapheme/grapheme_util.h | 0 ext/intl/intl_common.h | 0 ext/intl/intl_convert.c | 0 ext/intl/intl_convert.h | 0 ext/intl/intl_data.h | 0 ext/intl/intl_error.c | 0 ext/intl/intl_error.h | 0 ext/intl/locale/locale.c | 0 ext/intl/locale/locale.h | 0 ext/intl/locale/locale_class.c | 0 ext/intl/locale/locale_class.h | 0 ext/intl/locale/locale_methods.c | 0 ext/intl/locale/locale_methods.h | 0 ext/intl/msgformat/msgformat.c | 0 ext/intl/msgformat/msgformat.h | 0 ext/intl/msgformat/msgformat_attr.c | 0 ext/intl/msgformat/msgformat_attr.h | 0 ext/intl/msgformat/msgformat_class.c | 0 ext/intl/msgformat/msgformat_class.h | 0 ext/intl/msgformat/msgformat_data.c | 0 ext/intl/msgformat/msgformat_data.h | 0 ext/intl/msgformat/msgformat_format.c | 0 ext/intl/msgformat/msgformat_format.h | 0 ext/intl/msgformat/msgformat_helpers.cpp | 0 ext/intl/msgformat/msgformat_helpers.h | 0 ext/intl/msgformat/msgformat_parse.c | 0 ext/intl/msgformat/msgformat_parse.h | 0 ext/intl/normalizer/normalizer.c | 0 ext/intl/normalizer/normalizer.h | 0 ext/intl/normalizer/normalizer_class.c | 0 ext/intl/normalizer/normalizer_class.h | 0 ext/intl/normalizer/normalizer_normalize.c | 0 ext/intl/normalizer/normalizer_normalize.h | 0 ext/intl/php_intl.c | 0 ext/intl/php_intl.h | 0 ext/intl/resourcebundle/TODO | 0 ext/intl/tests/_files/es-bundle.txt | 0 ext/intl/tests/_files/res_index.txt | 0 ext/intl/tests/_files/resourcebundle.txt | 0 ext/intl/tests/_files/resourcebundle/es.res | Bin ext/intl/tests/_files/resourcebundle/res_index.res | Bin ext/intl/tests/_files/resourcebundle/root.res | Bin ext/intl/tests/badargs.phpt | 0 ext/intl/tests/bug12887.phpt | 0 ext/intl/tests/bug14562.phpt | 0 ext/intl/tests/collation_customization.phpt | 0 ext/intl/tests/collator_asort.phpt | 0 ext/intl/tests/collator_compare.phpt | 0 ext/intl/tests/collator_create.phpt | 0 ext/intl/tests/collator_get_error_code.phpt | 0 ext/intl/tests/collator_get_error_message.phpt | 0 ext/intl/tests/collator_get_locale.phpt | 0 ext/intl/tests/collator_get_set_attribute.phpt | 0 ext/intl/tests/collator_get_set_strength.phpt | 0 ext/intl/tests/collator_get_sort_key.phpt | 0 ext/intl/tests/collator_sort.phpt | 0 ext/intl/tests/collator_sort_with_sort_keys.phpt | 0 ext/intl/tests/dateformat_clone.phpt | 0 ext/intl/tests/dateformat_format.phpt | 0 ext/intl/tests/dateformat_format_parse.phpt | 0 ext/intl/tests/dateformat_get_datetype.phpt | 0 ext/intl/tests/dateformat_get_locale.phpt | 0 ext/intl/tests/dateformat_get_set_calendar.phpt | 0 ext/intl/tests/dateformat_get_set_pattern.phpt | 0 ext/intl/tests/dateformat_get_timetype.phpt | 0 ext/intl/tests/dateformat_get_timezone_id.phpt | 0 ext/intl/tests/dateformat_is_set_lenient.phpt | 0 ext/intl/tests/dateformat_localtime.phpt | 0 ext/intl/tests/dateformat_parse.phpt | 0 .../tests/dateformat_parse_localtime_parsepos.phpt | 0 .../tests/dateformat_parse_timestamp_parsepos.phpt | 0 ext/intl/tests/dateformat_set_timezone_id.phpt | 0 ext/intl/tests/formatter_clone.phpt | 0 ext/intl/tests/formatter_fail.phpt | 0 ext/intl/tests/formatter_format.phpt | 0 ext/intl/tests/formatter_format_conv.phpt | 0 ext/intl/tests/formatter_format_currency.phpt | 0 ext/intl/tests/formatter_get_error.phpt | 0 ext/intl/tests/formatter_get_locale.phpt | 0 ext/intl/tests/formatter_get_set_attribute.phpt | 0 ext/intl/tests/formatter_get_set_pattern.phpt | 0 ext/intl/tests/formatter_get_set_symbol.phpt | 0 .../tests/formatter_get_set_text_attribute.phpt | 0 ext/intl/tests/formatter_parse.phpt | 0 ext/intl/tests/formatter_parse_currency.phpt | 0 ext/intl/tests/grapheme.phpt | 0 ext/intl/tests/idn.phpt | 0 ext/intl/tests/intl_error_name.phpt | 0 ext/intl/tests/intl_get_error_code.phpt | 0 ext/intl/tests/intl_get_error_message.phpt | 0 ext/intl/tests/intl_is_failure.phpt | 0 ext/intl/tests/locale_accept.phpt | 0 ext/intl/tests/locale_compose_locale.phpt | 0 ext/intl/tests/locale_filter_matches.phpt | 0 ext/intl/tests/locale_get_all_variants.phpt | 0 ext/intl/tests/locale_get_default.phpt | 0 ext/intl/tests/locale_get_display_language.phpt | 0 ext/intl/tests/locale_get_display_name.phpt | 0 ext/intl/tests/locale_get_display_region.phpt | 0 ext/intl/tests/locale_get_display_script.phpt | 0 ext/intl/tests/locale_get_display_variant.phpt | 0 ext/intl/tests/locale_get_keywords.phpt | 0 ext/intl/tests/locale_get_primary_language.phpt | 0 ext/intl/tests/locale_get_region.phpt | 0 ext/intl/tests/locale_get_script.phpt | 0 ext/intl/tests/locale_lookup.phpt | 0 ext/intl/tests/locale_parse_locale.phpt | 0 ext/intl/tests/locale_set_default.phpt | 0 ext/intl/tests/msgfmt_clone.phpt | 0 ext/intl/tests/msgfmt_fail.phpt | 0 ext/intl/tests/msgfmt_format.phpt | 0 ext/intl/tests/msgfmt_get_error.phpt | 0 ext/intl/tests/msgfmt_get_locale.phpt | 0 ext/intl/tests/msgfmt_get_set_pattern.phpt | 0 ext/intl/tests/msgfmt_parse.phpt | 0 ext/intl/tests/normalizer_normalize.phpt | 0 ext/intl/tests/regression_sort_and_cow.phpt | 0 ext/intl/tests/regression_sort_eq.phpt | 0 ext/intl/tests/regression_sortwsk_and_cow.phpt | 0 ext/intl/tests/regression_sortwsk_eq.phpt | 0 ext/intl/tests/resourcebundle.build | 0 ext/intl/tests/resourcebundle_locales.phpt | 0 ext/intl/tests/ut_common.inc | 0 187 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 ext/intl/CREDITS mode change 100755 => 100644 ext/intl/TODO mode change 100755 => 100644 ext/intl/collator/collator.c mode change 100755 => 100644 ext/intl/collator/collator.h mode change 100755 => 100644 ext/intl/collator/collator_attr.c mode change 100755 => 100644 ext/intl/collator/collator_attr.h mode change 100755 => 100644 ext/intl/collator/collator_class.c mode change 100755 => 100644 ext/intl/collator/collator_class.h mode change 100755 => 100644 ext/intl/collator/collator_compare.c mode change 100755 => 100644 ext/intl/collator/collator_compare.h mode change 100755 => 100644 ext/intl/collator/collator_convert.c mode change 100755 => 100644 ext/intl/collator/collator_convert.h mode change 100755 => 100644 ext/intl/collator/collator_create.c mode change 100755 => 100644 ext/intl/collator/collator_create.h mode change 100755 => 100644 ext/intl/collator/collator_error.c mode change 100755 => 100644 ext/intl/collator/collator_error.h mode change 100755 => 100644 ext/intl/collator/collator_is_numeric.c mode change 100755 => 100644 ext/intl/collator/collator_is_numeric.h mode change 100755 => 100644 ext/intl/collator/collator_locale.c mode change 100755 => 100644 ext/intl/collator/collator_locale.h mode change 100755 => 100644 ext/intl/collator/collator_sort.c mode change 100755 => 100644 ext/intl/collator/collator_sort.h mode change 100755 => 100644 ext/intl/common/common_error.c mode change 100755 => 100644 ext/intl/common/common_error.h mode change 100755 => 100644 ext/intl/config.m4 mode change 100755 => 100644 ext/intl/config.w32 mode change 100755 => 100644 ext/intl/dateformat/dateformat.c mode change 100755 => 100644 ext/intl/dateformat/dateformat.h mode change 100755 => 100644 ext/intl/dateformat/dateformat_attr.c mode change 100755 => 100644 ext/intl/dateformat/dateformat_attr.h mode change 100755 => 100644 ext/intl/dateformat/dateformat_class.c mode change 100755 => 100644 ext/intl/dateformat/dateformat_class.h mode change 100755 => 100644 ext/intl/dateformat/dateformat_data.c mode change 100755 => 100644 ext/intl/dateformat/dateformat_data.h mode change 100755 => 100644 ext/intl/dateformat/dateformat_format.c mode change 100755 => 100644 ext/intl/dateformat/dateformat_format.h mode change 100755 => 100644 ext/intl/dateformat/dateformat_parse.c mode change 100755 => 100644 ext/intl/dateformat/dateformat_parse.h mode change 100755 => 100644 ext/intl/doc/Tutorial.txt mode change 100755 => 100644 ext/intl/doc/collator_api.php mode change 100755 => 100644 ext/intl/doc/common_api.php mode change 100755 => 100644 ext/intl/doc/datefmt_api.php mode change 100755 => 100644 ext/intl/doc/formatter_api.php mode change 100755 => 100644 ext/intl/doc/grapheme_api.php mode change 100755 => 100644 ext/intl/doc/locale_api.php mode change 100755 => 100644 ext/intl/doc/msgfmt_api.php mode change 100755 => 100644 ext/intl/doc/normalizer_api.php mode change 100755 => 100644 ext/intl/formatter/formatter.c mode change 100755 => 100644 ext/intl/formatter/formatter.h mode change 100755 => 100644 ext/intl/formatter/formatter_attr.c mode change 100755 => 100644 ext/intl/formatter/formatter_attr.h mode change 100755 => 100644 ext/intl/formatter/formatter_class.c mode change 100755 => 100644 ext/intl/formatter/formatter_class.h mode change 100755 => 100644 ext/intl/formatter/formatter_data.c mode change 100755 => 100644 ext/intl/formatter/formatter_data.h mode change 100755 => 100644 ext/intl/formatter/formatter_format.c mode change 100755 => 100644 ext/intl/formatter/formatter_format.h mode change 100755 => 100644 ext/intl/formatter/formatter_main.c mode change 100755 => 100644 ext/intl/formatter/formatter_main.h mode change 100755 => 100644 ext/intl/formatter/formatter_parse.c mode change 100755 => 100644 ext/intl/formatter/formatter_parse.h mode change 100755 => 100644 ext/intl/grapheme/grapheme.h mode change 100755 => 100644 ext/intl/grapheme/grapheme_string.c mode change 100755 => 100644 ext/intl/grapheme/grapheme_util.c mode change 100755 => 100644 ext/intl/grapheme/grapheme_util.h mode change 100755 => 100644 ext/intl/intl_common.h mode change 100755 => 100644 ext/intl/intl_convert.c mode change 100755 => 100644 ext/intl/intl_convert.h mode change 100755 => 100644 ext/intl/intl_data.h mode change 100755 => 100644 ext/intl/intl_error.c mode change 100755 => 100644 ext/intl/intl_error.h mode change 100755 => 100644 ext/intl/locale/locale.c mode change 100755 => 100644 ext/intl/locale/locale.h mode change 100755 => 100644 ext/intl/locale/locale_class.c mode change 100755 => 100644 ext/intl/locale/locale_class.h mode change 100755 => 100644 ext/intl/locale/locale_methods.c mode change 100755 => 100644 ext/intl/locale/locale_methods.h mode change 100755 => 100644 ext/intl/msgformat/msgformat.c mode change 100755 => 100644 ext/intl/msgformat/msgformat.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_attr.c mode change 100755 => 100644 ext/intl/msgformat/msgformat_attr.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_class.c mode change 100755 => 100644 ext/intl/msgformat/msgformat_class.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_data.c mode change 100755 => 100644 ext/intl/msgformat/msgformat_data.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_format.c mode change 100755 => 100644 ext/intl/msgformat/msgformat_format.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_helpers.cpp mode change 100755 => 100644 ext/intl/msgformat/msgformat_helpers.h mode change 100755 => 100644 ext/intl/msgformat/msgformat_parse.c mode change 100755 => 100644 ext/intl/msgformat/msgformat_parse.h mode change 100755 => 100644 ext/intl/normalizer/normalizer.c mode change 100755 => 100644 ext/intl/normalizer/normalizer.h mode change 100755 => 100644 ext/intl/normalizer/normalizer_class.c mode change 100755 => 100644 ext/intl/normalizer/normalizer_class.h mode change 100755 => 100644 ext/intl/normalizer/normalizer_normalize.c mode change 100755 => 100644 ext/intl/normalizer/normalizer_normalize.h mode change 100755 => 100644 ext/intl/php_intl.c mode change 100755 => 100644 ext/intl/php_intl.h mode change 100755 => 100644 ext/intl/resourcebundle/TODO mode change 100755 => 100644 ext/intl/tests/_files/es-bundle.txt mode change 100755 => 100644 ext/intl/tests/_files/res_index.txt mode change 100755 => 100644 ext/intl/tests/_files/resourcebundle.txt mode change 100755 => 100644 ext/intl/tests/_files/resourcebundle/es.res mode change 100755 => 100644 ext/intl/tests/_files/resourcebundle/res_index.res mode change 100755 => 100644 ext/intl/tests/_files/resourcebundle/root.res mode change 100755 => 100644 ext/intl/tests/badargs.phpt mode change 100755 => 100644 ext/intl/tests/bug12887.phpt mode change 100755 => 100644 ext/intl/tests/bug14562.phpt mode change 100755 => 100644 ext/intl/tests/collation_customization.phpt mode change 100755 => 100644 ext/intl/tests/collator_asort.phpt mode change 100755 => 100644 ext/intl/tests/collator_compare.phpt mode change 100755 => 100644 ext/intl/tests/collator_create.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_error_code.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_error_message.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_locale.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_set_attribute.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_set_strength.phpt mode change 100755 => 100644 ext/intl/tests/collator_get_sort_key.phpt mode change 100755 => 100644 ext/intl/tests/collator_sort.phpt mode change 100755 => 100644 ext/intl/tests/collator_sort_with_sort_keys.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_clone.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_format.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_format_parse.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_datetype.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_locale.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_set_calendar.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_set_pattern.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_timetype.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_get_timezone_id.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_is_set_lenient.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_localtime.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_parse.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_parse_localtime_parsepos.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt mode change 100755 => 100644 ext/intl/tests/dateformat_set_timezone_id.phpt mode change 100755 => 100644 ext/intl/tests/formatter_clone.phpt mode change 100755 => 100644 ext/intl/tests/formatter_fail.phpt mode change 100755 => 100644 ext/intl/tests/formatter_format.phpt mode change 100755 => 100644 ext/intl/tests/formatter_format_conv.phpt mode change 100755 => 100644 ext/intl/tests/formatter_format_currency.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_error.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_locale.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_set_attribute.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_set_pattern.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_set_symbol.phpt mode change 100755 => 100644 ext/intl/tests/formatter_get_set_text_attribute.phpt mode change 100755 => 100644 ext/intl/tests/formatter_parse.phpt mode change 100755 => 100644 ext/intl/tests/formatter_parse_currency.phpt mode change 100755 => 100644 ext/intl/tests/grapheme.phpt mode change 100755 => 100644 ext/intl/tests/idn.phpt mode change 100755 => 100644 ext/intl/tests/intl_error_name.phpt mode change 100755 => 100644 ext/intl/tests/intl_get_error_code.phpt mode change 100755 => 100644 ext/intl/tests/intl_get_error_message.phpt mode change 100755 => 100644 ext/intl/tests/intl_is_failure.phpt mode change 100755 => 100644 ext/intl/tests/locale_accept.phpt mode change 100755 => 100644 ext/intl/tests/locale_compose_locale.phpt mode change 100755 => 100644 ext/intl/tests/locale_filter_matches.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_all_variants.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_default.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_display_language.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_display_name.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_display_region.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_display_script.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_display_variant.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_keywords.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_primary_language.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_region.phpt mode change 100755 => 100644 ext/intl/tests/locale_get_script.phpt mode change 100755 => 100644 ext/intl/tests/locale_lookup.phpt mode change 100755 => 100644 ext/intl/tests/locale_parse_locale.phpt mode change 100755 => 100644 ext/intl/tests/locale_set_default.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_clone.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_fail.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_format.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_get_error.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_get_locale.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_get_set_pattern.phpt mode change 100755 => 100644 ext/intl/tests/msgfmt_parse.phpt mode change 100755 => 100644 ext/intl/tests/normalizer_normalize.phpt mode change 100755 => 100644 ext/intl/tests/regression_sort_and_cow.phpt mode change 100755 => 100644 ext/intl/tests/regression_sort_eq.phpt mode change 100755 => 100644 ext/intl/tests/regression_sortwsk_and_cow.phpt mode change 100755 => 100644 ext/intl/tests/regression_sortwsk_eq.phpt mode change 100755 => 100644 ext/intl/tests/resourcebundle.build mode change 100755 => 100644 ext/intl/tests/resourcebundle_locales.phpt mode change 100755 => 100644 ext/intl/tests/ut_common.inc diff --git a/ext/intl/CREDITS b/ext/intl/CREDITS old mode 100755 new mode 100644 diff --git a/ext/intl/TODO b/ext/intl/TODO old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_create.h b/ext/intl/collator/collator_create.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c old mode 100755 new mode 100644 diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h old mode 100755 new mode 100644 diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c old mode 100755 new mode 100644 diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h old mode 100755 new mode 100644 diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 old mode 100755 new mode 100644 diff --git a/ext/intl/config.w32 b/ext/intl/config.w32 old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_format.h b/ext/intl/dateformat/dateformat_format.h old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c old mode 100755 new mode 100644 diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/doc/Tutorial.txt b/ext/intl/doc/Tutorial.txt old mode 100755 new mode 100644 diff --git a/ext/intl/doc/collator_api.php b/ext/intl/doc/collator_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/common_api.php b/ext/intl/doc/common_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/datefmt_api.php b/ext/intl/doc/datefmt_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/formatter_api.php b/ext/intl/doc/formatter_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/grapheme_api.php b/ext/intl/doc/grapheme_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/locale_api.php b/ext/intl/doc/locale_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/msgfmt_api.php b/ext/intl/doc/msgfmt_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/doc/normalizer_api.php b/ext/intl/doc/normalizer_api.php old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter.h b/ext/intl/formatter/formatter.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_main.h b/ext/intl/formatter/formatter_main.h old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c old mode 100755 new mode 100644 diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c old mode 100755 new mode 100644 diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c old mode 100755 new mode 100644 diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c old mode 100755 new mode 100644 diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c old mode 100755 new mode 100644 diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_format.h b/ext/intl/msgformat/msgformat_format.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c old mode 100755 new mode 100644 diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c old mode 100755 new mode 100644 diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h old mode 100755 new mode 100644 diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c old mode 100755 new mode 100644 diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h old mode 100755 new mode 100644 diff --git a/ext/intl/resourcebundle/TODO b/ext/intl/resourcebundle/TODO old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/es-bundle.txt b/ext/intl/tests/_files/es-bundle.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/res_index.txt b/ext/intl/tests/_files/res_index.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle.txt b/ext/intl/tests/_files/resourcebundle.txt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/es.res b/ext/intl/tests/_files/resourcebundle/es.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/res_index.res b/ext/intl/tests/_files/resourcebundle/res_index.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/_files/resourcebundle/root.res b/ext/intl/tests/_files/resourcebundle/root.res old mode 100755 new mode 100644 diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collation_customization.phpt b/ext/intl/tests/collation_customization.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_compare.phpt b/ext/intl/tests/collator_compare.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_create.phpt b/ext/intl/tests/collator_create.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_error_code.phpt b/ext/intl/tests/collator_get_error_code.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_error_message.phpt b/ext/intl/tests/collator_get_error_message.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_locale.phpt b/ext/intl/tests/collator_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_set_attribute.phpt b/ext/intl/tests/collator_get_set_attribute.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_set_strength.phpt b/ext/intl/tests/collator_get_set_strength.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/collator_sort_with_sort_keys.phpt b/ext/intl/tests/collator_sort_with_sort_keys.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_clone.phpt b/ext/intl/tests/dateformat_clone.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_set_pattern.phpt b/ext/intl/tests/dateformat_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_localtime.phpt b/ext/intl/tests/dateformat_localtime.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse.phpt b/ext/intl/tests/dateformat_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt b/ext/intl/tests/dateformat_parse_localtime_parsepos.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt b/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/dateformat_set_timezone_id.phpt b/ext/intl/tests/dateformat_set_timezone_id.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_clone.phpt b/ext/intl/tests/formatter_clone.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format.phpt b/ext/intl/tests/formatter_format.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format_conv.phpt b/ext/intl/tests/formatter_format_conv.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_format_currency.phpt b/ext/intl/tests/formatter_format_currency.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_error.phpt b/ext/intl/tests/formatter_get_error.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_locale.phpt b/ext/intl/tests/formatter_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_symbol.phpt b/ext/intl/tests/formatter_get_set_symbol.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_parse.phpt b/ext/intl/tests/formatter_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/formatter_parse_currency.phpt b/ext/intl/tests/formatter_parse_currency.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/idn.phpt b/ext/intl/tests/idn.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_error_name.phpt b/ext/intl/tests/intl_error_name.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/intl_is_failure.phpt b/ext/intl/tests/intl_is_failure.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_filter_matches.phpt b/ext/intl/tests/locale_filter_matches.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_default.phpt b/ext/intl/tests/locale_get_default.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_name.phpt b/ext/intl/tests/locale_get_display_name.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_region.phpt b/ext/intl/tests/locale_get_display_region.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_script.phpt b/ext/intl/tests/locale_get_display_script.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_display_variant.phpt b/ext/intl/tests/locale_get_display_variant.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_keywords.phpt b/ext/intl/tests/locale_get_keywords.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_region.phpt b/ext/intl/tests/locale_get_region.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_get_script.phpt b/ext/intl/tests/locale_get_script.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_parse_locale.phpt b/ext/intl/tests/locale_parse_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_clone.phpt b/ext/intl/tests/msgfmt_clone.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_fail.phpt b/ext/intl/tests/msgfmt_fail.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_get_error.phpt b/ext/intl/tests/msgfmt_get_error.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_get_locale.phpt b/ext/intl/tests/msgfmt_get_locale.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_get_set_pattern.phpt b/ext/intl/tests/msgfmt_get_set_pattern.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sort_and_cow.phpt b/ext/intl/tests/regression_sort_and_cow.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sort_eq.phpt b/ext/intl/tests/regression_sort_eq.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sortwsk_and_cow.phpt b/ext/intl/tests/regression_sortwsk_and_cow.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/regression_sortwsk_eq.phpt b/ext/intl/tests/regression_sortwsk_eq.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build old mode 100755 new mode 100644 diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc old mode 100755 new mode 100644 From 7e3e1837c8e60ad87e9b7aee6cb306a843f5c784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 30 Jul 2012 10:27:41 +0200 Subject: [PATCH 345/641] Limit test to ICU 49 --- ext/intl/tests/bug62070.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/intl/tests/bug62070.phpt b/ext/intl/tests/bug62070.phpt index a466b05c242..3ab0078d709 100644 --- a/ext/intl/tests/bug62070.phpt +++ b/ext/intl/tests/bug62070.phpt @@ -4,6 +4,8 @@ Bug #62070: Collator::getSortKey() returns garbage = 49 only'); --FILE-- Date: Mon, 30 Jul 2012 10:32:27 +0200 Subject: [PATCH 346/641] Remove executable bit from files --- ext/intl/spoofchecker/spoofchecker.c | 0 ext/intl/spoofchecker/spoofchecker.h | 0 ext/intl/spoofchecker/spoofchecker_class.c | 0 ext/intl/spoofchecker/spoofchecker_class.h | 0 ext/intl/spoofchecker/spoofchecker_create.c | 0 ext/intl/spoofchecker/spoofchecker_create.h | 0 ext/intl/spoofchecker/spoofchecker_main.c | 0 ext/intl/spoofchecker/spoofchecker_main.h | 0 ext/intl/tests/spoofchecker_001.phpt | 0 ext/intl/tests/spoofchecker_002.phpt | 0 ext/intl/tests/spoofchecker_003.phpt | 0 ext/intl/tests/spoofchecker_004.phpt | 0 12 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker.c mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker.h mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_class.c mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_class.h mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_create.c mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_create.h mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_main.c mode change 100755 => 100644 ext/intl/spoofchecker/spoofchecker_main.h mode change 100755 => 100644 ext/intl/tests/spoofchecker_001.phpt mode change 100755 => 100644 ext/intl/tests/spoofchecker_002.phpt mode change 100755 => 100644 ext/intl/tests/spoofchecker_003.phpt mode change 100755 => 100644 ext/intl/tests/spoofchecker_004.phpt diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c old mode 100755 new mode 100644 diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_001.phpt b/ext/intl/tests/spoofchecker_001.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_002.phpt b/ext/intl/tests/spoofchecker_002.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_003.phpt b/ext/intl/tests/spoofchecker_003.phpt old mode 100755 new mode 100644 diff --git a/ext/intl/tests/spoofchecker_004.phpt b/ext/intl/tests/spoofchecker_004.phpt old mode 100755 new mode 100644 From 86ca788cc753fca581275cd7dc9d7013a2720777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 30 Jul 2012 11:04:10 +0200 Subject: [PATCH 347/641] Fix test title and limit it to ICU >= 4.8 --- ext/intl/tests/resourcebundle_null_mandatory_args.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt index 8fde61bd215..17fab6d630a 100644 --- a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt +++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt @@ -1,11 +1,13 @@ --TEST-- -IntlCalendar::setTime() basic test +ResourceBundle constructor bundle accepts NULL for first two arguments --INI-- date.timezone=Atlantic/Azores --SKIPIF-- = 4.8 only'); --FILE-- Date: Mon, 30 Jul 2012 21:50:13 +0300 Subject: [PATCH 348/641] Fix crashes with filenames that don't contain directory separator - generated files like scanners/parsers. --- ext/mysqlnd/mysqlnd_alloc.c | 54 +++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 65423e44fa2..e681d338568 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -81,9 +81,11 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -116,9 +118,10 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", - strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno,persistent); + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -154,8 +157,10 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE TSRMLS_CC)); #if PHP_DEBUG @@ -189,9 +194,10 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); TRACE_ALLOC_INF_FMT("file=%-15s line=%4d persistent=%u", - strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno, persistent); + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno, persistent); #if PHP_DEBUG /* -1 is also "true" */ @@ -228,8 +234,10 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size); #if PHP_DEBUG @@ -263,8 +271,10 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL #if PHP_DEBUG long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent); #if PHP_DEBUG @@ -297,8 +307,10 @@ void _mysqlnd_efree(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_efree_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { @@ -322,8 +334,10 @@ void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_pefree_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p persistent=%u", ptr, persistent); if (ptr) { @@ -351,8 +365,10 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_malloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -384,8 +400,10 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_calloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); #if PHP_DEBUG /* -1 is also "true" */ @@ -417,8 +435,10 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) #if PHP_DEBUG long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_realloc_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE TSRMLS_CC)); @@ -450,8 +470,10 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) { size_t free_amount = 0; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_free_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p", ptr); if (ptr) { @@ -479,8 +501,10 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi { char * ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_pestrndup_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p", ptr); ret = (persistent) ? __zend_malloc(REAL_SIZE(length + 1)) : _emalloc(REAL_SIZE(length + 1) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC); @@ -511,8 +535,10 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME smart_str tmp_str = {0, 0, 0}; const char * p = ptr; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); + char * fn = NULL; TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR) + 1, __zend_orig_lineno); + TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", + (fn = strrchr(__zend_orig_filename, PHP_DIR_SEPARATOR))? fn + 1:__zend_orig_filename, __zend_orig_lineno); TRACE_ALLOC_INF_FMT("ptr=%p", ptr); do { smart_str_appendc(&tmp_str, *p); From 645f84e41bbda22c7a19326cd1a7df7994678976 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 31 Jul 2012 10:49:13 +0800 Subject: [PATCH 349/641] Test for bug #62680 --- Zend/tests/bug62680.phpt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Zend/tests/bug62680.phpt diff --git a/Zend/tests/bug62680.phpt b/Zend/tests/bug62680.phpt new file mode 100644 index 00000000000..804dece4157 --- /dev/null +++ b/Zend/tests/bug62680.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #62680 (Function isset() throws fatal error on set array if non-existent key depth >= 3) +--XFAIL-- +see https://bugs.php.net/62680 +--FILE-- + +--EXPECT-- +bool(false) +bool(false) From 572d6437bc84123e8971e2f35b4fdf14e1e0e5f5 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 31 Jul 2012 10:51:18 +0800 Subject: [PATCH 350/641] expect pass for 5.4 --- Zend/tests/bug62680.phpt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Zend/tests/bug62680.phpt b/Zend/tests/bug62680.phpt index 804dece4157..e2a2366e7a9 100644 --- a/Zend/tests/bug62680.phpt +++ b/Zend/tests/bug62680.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #62680 (Function isset() throws fatal error on set array if non-existent key depth >= 3) ---XFAIL-- -see https://bugs.php.net/62680 --FILE-- Date: Tue, 31 Jul 2012 22:42:28 +0800 Subject: [PATCH 351/641] Implemented FR #62700 (have the console output 'Listening on http://localhost:8000') --- NEWS | 4 ++++ sapi/cli/php_cli_server.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7336376c3c0..5a5fda71aa1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.6 +- CLI Server: + . Implemented FR #62700 (have the console output 'Listening on + http://localhost:8000'). (pascal.chevrel@free.fr) + - Core: . Fixed bug #62661 (Interactive php-cli crashes if include() is used in auto_prepend_file). (Laruence) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 02f885484f5..e80ab68f806 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2407,7 +2407,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ php_localtime_r(&tv.tv_sec, &tm); php_asctime_r(&tm, buf); printf("PHP %s Development Server started at %s" - "Listening on %s\n" + "Listening on http://%s\n" "Document root is %s\n" "Press Ctrl-C to quit.\n", PHP_VERSION, buf, server_bind_address, document_root); From 4d6bae896df6cc13424ed91deb2b02d33df159aa Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 30 Jul 2012 00:23:53 -0700 Subject: [PATCH 352/641] skip tests if ibase not present --- ext/pdo_firebird/tests/bug_47415.phpt | 1 + ext/pdo_firebird/tests/bug_48877.phpt | 1 + ext/pdo_firebird/tests/bug_53280.phpt | 1 + ext/pdo_firebird/tests/connect.phpt | 1 + ext/pdo_firebird/tests/ddl.phpt | 1 + ext/pdo_firebird/tests/execute.phpt | 1 + ext/pdo_firebird/tests/rowCount.phpt | 1 + 7 files changed, 7 insertions(+) diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index cedc2c45b25..12cd782f267 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -2,6 +2,7 @@ Bug #47415 PDO_Firebird segfaults when passing lowercased column name to bindColumn() --SKIPIF-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --FILE-- + --INI-- ibase.timestampformat=%Y-%m-%d %H:%M:%S --FILE-- diff --git a/ext/pdo_firebird/tests/rowCount.phpt b/ext/pdo_firebird/tests/rowCount.phpt index 3d7f71c83b6..1a009508e00 100644 --- a/ext/pdo_firebird/tests/rowCount.phpt +++ b/ext/pdo_firebird/tests/rowCount.phpt @@ -2,6 +2,7 @@ PDO_Firebird: rowCount --SKIPIF-- + --FILE-- Date: Tue, 31 Jul 2012 21:51:46 -0700 Subject: [PATCH 353/641] sync NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 5a5fda71aa1..3fbbe7cc791 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ PHP NEWS Laruence) . Fixed bug #62565 (Crashes due non-initialized internal properties_table). (Felipe) + . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK + with run-test.php). (Laruence) - CURL: . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). From 10642aa9e4f1eb694a8f7b514cc234cb24545744 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 1 Aug 2012 20:23:30 +0800 Subject: [PATCH 354/641] Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) --- NEWS | 4 ++++ ext/reflection/php_reflection.c | 4 +--- ext/reflection/tests/bug62715.phpt | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 ext/reflection/tests/bug62715.phpt diff --git a/NEWS b/NEWS index 5aa35d7e20b..b836d4f6800 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS - DateTime: . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) +- Reflection: + . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong + result). (Laruence) + - SPL: . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault). (Laruence, Gustavo) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e98652ba232..23c90449811 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2379,9 +2379,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) { RETURN_FALSE; } - if (param->offset < param->required) { - RETURN_FALSE; - } + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { RETURN_FALSE; diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt new file mode 100644 index 00000000000..721d484c713 --- /dev/null +++ b/ext/reflection/tests/bug62715.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) +--FILE-- +getParameters() as $p) { + var_dump($p->isDefaultValueAvailable()); +} + +?> +--EXPECT-- +bool(true) +bool(true) +bool(false) From 7398029e0676964b7b16219c1a9696d3a7c345c9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 1 Aug 2012 20:24:53 +0800 Subject: [PATCH 355/641] update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 3fbbe7cc791..a84e756d5b6 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,8 @@ PHP NEWS sapi/cli/cli.h: No such file). (Johannes) - Reflection: + . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong + result). (Laruence) . Implemented FR #61602 (Allow access to name of constant used as default value). (reeze.xia@gmail.com) From 36100060b31ba85d5c70669168cfd418522884ce Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 1 Aug 2012 23:54:01 +0800 Subject: [PATCH 356/641] Sleep a little bit more, in some slow machine (like gcov), it will take a little more time to setup server --- sapi/cli/tests/php_cli_server.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 3479cd0bd0d..40c53619957 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -38,7 +38,7 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' // it might not be listening yet...need to wait until fsockopen() call returns $i = 0; - while (($i++ < 5) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) { + while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) { usleep(10000); } From ce92857131e24bf1c06b798b424367c6ce9dabcd Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 1 Aug 2012 12:21:35 -0700 Subject: [PATCH 357/641] fix NEWS --- NEWS | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index a84e756d5b6..084f3cd0bb7 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2012, PHP 5.4.7 + +- Reflection: + . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong + result). (Laruence) + ?? ??? 2012, PHP 5.4.6 - CLI Server: @@ -39,8 +45,6 @@ PHP NEWS sapi/cli/cli.h: No such file). (Johannes) - Reflection: - . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong - result). (Laruence) . Implemented FR #61602 (Allow access to name of constant used as default value). (reeze.xia@gmail.com) From 433089ccb4d4747a01d522e8678664ff17584615 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 12:30:07 +0800 Subject: [PATCH 358/641] Fixed bug #62716 (munmap() is called with the incorrect length) --- NEWS | 2 ++ Zend/zend_stream.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b836d4f6800..97fc6d626d6 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.3.16 - Core: + . Fixed bug #62716 (munmap() is called with the incorrect length). + (slangley@google.com) . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php). (Laruence) diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 5a02ecdfaef..bc5206c12c7 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -79,7 +79,7 @@ static size_t zend_stream_stdio_fsizer(void *handle TSRMLS_DC) /* {{{ */ static void zend_stream_unmap(zend_stream *stream TSRMLS_DC) { /* {{{ */ #if HAVE_MMAP if (stream->mmap.map) { - munmap(stream->mmap.map, stream->mmap.len); + munmap(stream->mmap.map, stream->mmap.len + ZEND_MMAP_AHEAD); } else #endif if (stream->mmap.buf) { From cd896d69d90c70fd13efec315fd8b1f6647497b9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 12:52:11 +0800 Subject: [PATCH 359/641] Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()) --- NEWS | 5 ++++- ext/pdo/pdo_dbh.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 97fc6d626d6..05a80eb6e70 100644 --- a/NEWS +++ b/NEWS @@ -13,7 +13,10 @@ PHP NEWS (r.hampartsumyan@gmail.com, Laruence) - DateTime: - . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) + +- PDO: + . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) - Reflection: . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 6b3ba3bb1ba..4035b2b910a 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -694,7 +694,7 @@ static PHP_METHOD(PDO, inTransaction) } PDO_CONSTRUCT_CHECK; - RETURN_LONG(dbh->in_txn); + RETURN_BOOL(dbh->in_txn); } /* }}} */ From 53c8612fe780a80fde64da118587e6096b16b595 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 12:55:05 +0800 Subject: [PATCH 360/641] Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()) --- NEWS | 3 +++ ext/pdo/pdo_dbh.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 084f3cd0bb7..6b0d2d94be5 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.7 +- PDO: + . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) + - Reflection: . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result). (Laruence) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index b4f383c94f0..acdc0dd90d6 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -700,7 +700,7 @@ static PHP_METHOD(PDO, inTransaction) RETURN_BOOL(dbh->in_txn); } - RETURN_LONG(dbh->methods->in_transaction(dbh TSRMLS_CC)); + RETURN_BOOL(dbh->methods->in_transaction(dbh TSRMLS_CC)); } /* }}} */ From 81369bcc2027f455d3ff8ead6d884159f2194cfd Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 2 Aug 2012 11:44:15 +0100 Subject: [PATCH 361/641] make default_exception_ce and error_exception_ce static --- Zend/zend_exceptions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 7bb7792a4c8..787e66bfe99 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -29,8 +29,8 @@ #include "zend_vm.h" #include "zend_dtrace.h" -zend_class_entry *default_exception_ce; -zend_class_entry *error_exception_ce; +static zend_class_entry *default_exception_ce; +static zend_class_entry *error_exception_ce; static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); From aa8eabddd662fe286c08af014384692e03c093a9 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 2 Aug 2012 11:44:15 +0100 Subject: [PATCH 362/641] make default_exception_ce and error_exception_ce static --- Zend/zend_exceptions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 7bb7792a4c8..787e66bfe99 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -29,8 +29,8 @@ #include "zend_vm.h" #include "zend_dtrace.h" -zend_class_entry *default_exception_ce; -zend_class_entry *error_exception_ce; +static zend_class_entry *default_exception_ce; +static zend_class_entry *error_exception_ce; static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); From 9a690859f6491dd5c14dfd6c907a5563c8aedd17 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 19:14:06 +0800 Subject: [PATCH 363/641] fix test due to float value --- ext/standard/tests/file/realpath_cache.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt index 92d6fc5b2a3..0eb9dc519a9 100644 --- a/ext/standard/tests/file/realpath_cache.phpt +++ b/ext/standard/tests/file/realpath_cache.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(4) { ["key"]=> - %s(%d) + %s(%f) ["is_dir"]=> bool(true) ["realpath"]=> From 2b6ac9e1a0ce6efddba9d513b99a67f8e5d43764 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 19:31:34 +0800 Subject: [PATCH 364/641] Fix test, wrong exepct rule used --- ext/intl/tests/bug59597_64.phpt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/intl/tests/bug59597_64.phpt b/ext/intl/tests/bug59597_64.phpt index 4b96bf72e97..eb70995a255 100644 --- a/ext/intl/tests/bug59597_64.phpt +++ b/ext/intl/tests/bug59597_64.phpt @@ -15,7 +15,6 @@ $value = $formatter->parse('2147483650', \NumberFormatter::TYPE_INT64); var_dump($value); ?> ---EXPECTREGEX-- +--EXPECT-- int(2147483647) int(2147483650) - From 49b202f2cfe04d577671b685b7c0d3a096a433c7 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 22:16:46 +0800 Subject: [PATCH 365/641] Fixed bug that can not get default value of parameter if it's not `optional` --- ext/reflection/php_reflection.c | 4 ---- ext/reflection/tests/bug62715.phpt | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 23c90449811..593a0506b01 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2406,10 +2406,6 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); return; } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); - return; - } precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt index 721d484c713..feb67f614be 100644 --- a/ext/reflection/tests/bug62715.phpt +++ b/ext/reflection/tests/bug62715.phpt @@ -10,8 +10,15 @@ foreach ($r->getParameters() as $p) { var_dump($p->isDefaultValueAvailable()); } +foreach ($r->getParameters() as $p) { + if ($p->isDefaultValueAvailable()) { + var_dump($p->getDefaultValue()); + } +} ?> --EXPECT-- bool(true) bool(true) bool(false) +NULL +int(0) From 170ee90bf962d288bdcf6cf0c8c4a2a30c5c1ba2 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 22:28:04 +0800 Subject: [PATCH 366/641] Fixed bug that can not get default value of parameter if it's not `optional` --- ext/reflection/php_reflection.c | 7 +------ .../ReflectionParameter_DefaultValueConstant_error.phpt | 4 +--- ext/reflection/tests/bug62715.phpt | 7 +++++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7e80deaac60..6656f58c65e 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1477,11 +1477,6 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO return NULL; } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); - return NULL; - } - return param; } /* }}} */ @@ -1497,7 +1492,7 @@ static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error: Failed to retrieve the default value"); return NULL; } diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt index 984b06efe22..a2c2d245829 100644 --- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt +++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt @@ -18,8 +18,6 @@ foreach($reflect->getParameters() as $param) { } } ?> -==DONE== --EXPECT-- -Parameter is not optional +Internal error: Failed to retrieve the default value CONST_TEST_1 -==DONE== diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt index 721d484c713..feb67f614be 100644 --- a/ext/reflection/tests/bug62715.phpt +++ b/ext/reflection/tests/bug62715.phpt @@ -10,8 +10,15 @@ foreach ($r->getParameters() as $p) { var_dump($p->isDefaultValueAvailable()); } +foreach ($r->getParameters() as $p) { + if ($p->isDefaultValueAvailable()) { + var_dump($p->getDefaultValue()); + } +} ?> --EXPECT-- bool(true) bool(true) bool(false) +NULL +int(0) From d1f0662e4d587754742891f0a179551d8f36674f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 23:03:38 +0800 Subject: [PATCH 367/641] Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value) The fix is make 5.4 behavior consistent with 5.3 --- NEWS | 4 ++++ sapi/cli/php_cli.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 6b0d2d94be5..623a791b4e7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.7 +- Core: + . Fixed bug #62725 (Calling exit() in a shutdown function does not return + the exit value). (Laruence) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 2cdd1aac6d3..f9bf3ee60bd 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1167,15 +1167,15 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } zend_end_try(); out: - if (exit_status == 0) { - exit_status = EG(exit_status); - } if (request_started) { php_request_shutdown((void *) 0); } if (translated_path) { free(translated_path); } + if (exit_status == 0) { + exit_status = EG(exit_status); + } return exit_status; err: sapi_deactivate(TSRMLS_C); From 03a1fcabf31210d3f304bfacf5096ce43c2b8f93 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 4 Aug 2012 10:41:26 +0800 Subject: [PATCH 368/641] Fixed bug #62744 (dangling pointers made by zend_disable_class) the test will be added while commit the fix for #62737 --- NEWS | 1 + Zend/zend_API.c | 13 ++++++------- Zend/zend_API.h | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 05a80eb6e70..c22d7c2fd42 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2012, PHP 5.3.16 - Core: + . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 6d2ccd2c69f..16a940dcac3 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2342,16 +2342,16 @@ static const zend_function_entry disabled_class_new[] = { ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ { - zend_class_entry disabled_class; + zend_class_entry **disabled_class; zend_str_tolower(class_name, class_name_length); - if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) { + if (zend_hash_find(CG(class_table), class_name, class_name_length+1, (void **)&disabled_class)==FAILURE) { return FAILURE; } - INIT_OVERLOADED_CLASS_ENTRY_EX(disabled_class, class_name, class_name_length, disabled_class_new, NULL, NULL, NULL, NULL, NULL); - disabled_class.create_object = display_disabled_class; - disabled_class.name_length = class_name_length; - zend_register_internal_class(&disabled_class TSRMLS_CC); + INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL); + (*disabled_class)->create_object = display_disabled_class; + (*disabled_class)->builtin_functions = disabled_class_new; + zend_hash_clean(&((*disabled_class)->function_table)); return SUCCESS; } /* }}} */ @@ -2425,7 +2425,6 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca } /* }}} */ - static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, int strict_class, char **error TSRMLS_DC) /* {{{ */ { zend_class_entry *ce_org = fcc->calling_scope; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0a2a5955572..ddd84fa5847 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -170,6 +170,11 @@ typedef struct _zend_fcall_info_cache { int _len = class_name_len; \ class_container.name = zend_strndup(class_name, _len); \ class_container.name_length = _len; \ + INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ + } + +#define INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ + { \ class_container.builtin_functions = functions; \ class_container.constructor = NULL; \ class_container.destructor = NULL; \ From f4a315fce2658a5338486e17ee11d77bd3dcb14b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 4 Aug 2012 11:03:21 +0800 Subject: [PATCH 369/641] This becomes useless, since we have set that in the INIT macro --- Zend/zend_API.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 16a940dcac3..56182138a89 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2350,7 +2350,6 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_ } INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL); (*disabled_class)->create_object = display_disabled_class; - (*disabled_class)->builtin_functions = disabled_class_new; zend_hash_clean(&((*disabled_class)->function_table)); return SUCCESS; } From 228c2886869e7f50a272f163cb3b765a65fd40eb Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 5 Aug 2012 12:40:59 +0800 Subject: [PATCH 370/641] Fix 126 tests failed of phar when --enable-zend-multibyte --- ext/phar/tests/008.phpt | 2 ++ ext/phar/tests/009.phpt | 1 + ext/phar/tests/010.phpt | 1 + ext/phar/tests/011.phpt | 1 + ext/phar/tests/012.phpt | 1 + ext/phar/tests/018.phpt | 3 ++- ext/phar/tests/019b.phpt | 1 + ext/phar/tests/019c.phpt | 1 + ext/phar/tests/020.phpt | 3 ++- ext/phar/tests/021.phpt | 3 ++- ext/phar/tests/022.phpt | 1 + ext/phar/tests/028.phpt | 1 + ext/phar/tests/cache_list/copyonwrite1.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite10.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite11.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite12.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite13.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite14.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite15.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite16.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite17.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite18.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite19.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite2.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite20.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite21.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite22.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite23.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite24.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite25.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite3.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite4.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite4a.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite5.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite6.phar.phpt | 1 + ext/phar/tests/cache_list/copyonwrite7.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite8.phar.phpt | 3 ++- ext/phar/tests/cache_list/copyonwrite9.phar.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller1.phpt | 1 + ext/phar/tests/cache_list/frontcontroller10.phpt | 1 + ext/phar/tests/cache_list/frontcontroller11.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller12.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller13.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller14.phpt | 1 + ext/phar/tests/cache_list/frontcontroller15.phpt | 1 + ext/phar/tests/cache_list/frontcontroller16.phpt | 1 + ext/phar/tests/cache_list/frontcontroller17.phpt | 1 + ext/phar/tests/cache_list/frontcontroller18.phpt | 1 + ext/phar/tests/cache_list/frontcontroller19.phpt | 1 + ext/phar/tests/cache_list/frontcontroller2.phpt | 1 + ext/phar/tests/cache_list/frontcontroller20.phpt | 1 + ext/phar/tests/cache_list/frontcontroller21.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller22.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller23.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller24.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller25.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller26.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller27.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller28.phpt | 1 + ext/phar/tests/cache_list/frontcontroller29.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller3.phpt | 1 + ext/phar/tests/cache_list/frontcontroller30.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller31.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller32.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller33.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller34.phpt | 1 + ext/phar/tests/cache_list/frontcontroller4.phpt | 1 + ext/phar/tests/cache_list/frontcontroller5.phpt | 1 + ext/phar/tests/cache_list/frontcontroller6.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller7.phpt | 1 + ext/phar/tests/cache_list/frontcontroller8.phpt | 3 ++- ext/phar/tests/cache_list/frontcontroller9.phpt | 3 ++- ext/phar/tests/delete.phpt | 3 ++- ext/phar/tests/fatal_error_webphar.phpt | 3 ++- ext/phar/tests/file_get_contents.phpt | 3 ++- ext/phar/tests/fopen.phpt | 3 ++- ext/phar/tests/front.phar.phpt | 1 + ext/phar/tests/frontcontroller1.phpt | 2 ++ ext/phar/tests/frontcontroller10.phpt | 1 + ext/phar/tests/frontcontroller12.phpt | 3 ++- ext/phar/tests/frontcontroller13.phpt | 3 ++- ext/phar/tests/frontcontroller14.phpt | 2 ++ ext/phar/tests/frontcontroller15.phpt | 1 + ext/phar/tests/frontcontroller16.phpt | 1 + ext/phar/tests/frontcontroller17.phpt | 2 ++ ext/phar/tests/frontcontroller18.phpt | 2 ++ ext/phar/tests/frontcontroller19.phpt | 2 ++ ext/phar/tests/frontcontroller2.phpt | 1 + ext/phar/tests/frontcontroller20.phpt | 2 ++ ext/phar/tests/frontcontroller21.phpt | 3 ++- ext/phar/tests/frontcontroller22.phpt | 3 ++- ext/phar/tests/frontcontroller23.phpt | 3 ++- ext/phar/tests/frontcontroller24.phpt | 3 ++- ext/phar/tests/frontcontroller25.phpt | 3 ++- ext/phar/tests/frontcontroller26.phpt | 4 +++- ext/phar/tests/frontcontroller27.phpt | 3 ++- ext/phar/tests/frontcontroller28.phpt | 1 + ext/phar/tests/frontcontroller29.phpt | 3 ++- ext/phar/tests/frontcontroller3.phpt | 1 + ext/phar/tests/frontcontroller30.phpt | 4 +++- ext/phar/tests/frontcontroller31.phpt | 3 ++- ext/phar/tests/frontcontroller32.phpt | 3 ++- ext/phar/tests/frontcontroller33.phpt | 3 ++- ext/phar/tests/frontcontroller34.phpt | 1 + ext/phar/tests/frontcontroller4.phpt | 2 ++ ext/phar/tests/frontcontroller5.phpt | 2 ++ ext/phar/tests/frontcontroller6.phpt | 4 +++- ext/phar/tests/frontcontroller7.phpt | 2 ++ ext/phar/tests/frontcontroller8.phpt | 4 +++- ext/phar/tests/frontcontroller9.phpt | 3 ++- ext/phar/tests/include_path_advanced.phpt | 3 ++- ext/phar/tests/mounteddir.phpt | 1 + ext/phar/tests/opendir.phpt | 3 ++- ext/phar/tests/phar_gzip.phpt | 3 ++- ext/phar/tests/phar_magic.phpt | 1 + ext/phar/tests/phar_mount.phpt | 3 ++- ext/phar/tests/readfile.phpt | 3 ++- ext/phar/tests/rename.phpt | 3 ++- ext/phar/tests/rename_dir.phpt | 1 + ext/phar/tests/rename_dir_and_mount.phpt | 1 + ext/phar/tests/rmdir.phpt | 1 + ext/phar/tests/security.phpt | 3 ++- ext/phar/tests/stat.phpt | 3 ++- ext/phar/tests/withphar.phpt | 2 ++ ext/phar/tests/withphar_web.phpt | 2 ++ ext/phar/tests/zip/notphar.phpt | 1 + 126 files changed, 217 insertions(+), 75 deletions(-) diff --git a/ext/phar/tests/008.phpt b/ext/phar/tests/008.phpt index 664ffea5cb4..bede8ba1c1c 100644 --- a/ext/phar/tests/008.phpt +++ b/ext/phar/tests/008.phpt @@ -2,6 +2,8 @@ Phar::mapPhar truncated manifest (not enough for manifest length) --SKIPIF-- +--INI-- +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- ")) die("skip pre-unicode version of P ?> --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- ")) die("skip pre-unicode version of P ?> --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- ")) die("skip pre-unicode version of P ?> --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- int(-1) -} \ No newline at end of file +} diff --git a/ext/phar/tests/021.phpt b/ext/phar/tests/021.phpt index bfd65769521..af062dbcf13 100644 --- a/ext/phar/tests/021.phpt +++ b/ext/phar/tests/021.phpt @@ -4,6 +4,7 @@ Phar: stream stat --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- int(-1) -} \ No newline at end of file +} diff --git a/ext/phar/tests/022.phpt b/ext/phar/tests/022.phpt index 20c24a02143..934add47216 100644 --- a/ext/phar/tests/022.phpt +++ b/ext/phar/tests/022.phpt @@ -4,6 +4,7 @@ Phar: stream stat --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.require_hash=0 +detect_unicode=0 --FILE-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write.phar --EXPECT-- hi changed -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite10.phar.phpt b/ext/phar/tests/cache_list/copyonwrite10.phar.phpt index 3d5b7fe7841..959c6e0a946 100644 --- a/ext/phar/tests/cache_list/copyonwrite10.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite10.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 10 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite10.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -21,4 +22,4 @@ __HALT_COMPILER(); ?> " -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite11.phar.phpt b/ext/phar/tests/cache_list/copyonwrite11.phar.phpt index 65388163dc5..f48df3776d4 100644 --- a/ext/phar/tests/cache_list/copyonwrite11.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite11.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 11 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite11.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -19,4 +20,4 @@ echo "ok\n"; __HALT_COMPILER(); ?> " 6685 -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite12.phar.phpt b/ext/phar/tests/cache_list/copyonwrite12.phar.phpt index 40b544191d1..ef5d02ccc8b 100644 --- a/ext/phar/tests/cache_list/copyonwrite12.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite12.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 12 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite12.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -21,4 +22,4 @@ array(2) { ["hash_type"]=> string(3) "MD5" } -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite13.phar.phpt b/ext/phar/tests/cache_list/copyonwrite13.phar.phpt index fc47174d2bd..bd49565c836 100644 --- a/ext/phar/tests/cache_list/copyonwrite13.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite13.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 13 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite13.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -12,4 +13,4 @@ files/write13.phar --EXPECTF-- bool(false) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite14.phar.phpt b/ext/phar/tests/cache_list/copyonwrite14.phar.phpt index 11201ac989d..9b4a65c54c2 100644 --- a/ext/phar/tests/cache_list/copyonwrite14.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite14.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 14 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite14.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -12,4 +13,4 @@ files/write14.phar --EXPECTF-- bool(true) bool(false) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite15.phar.phpt b/ext/phar/tests/cache_list/copyonwrite15.phar.phpt index 6e46289227d..545201e3894 100644 --- a/ext/phar/tests/cache_list/copyonwrite15.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite15.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 15 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite15.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write15.phar --EXPECTF-- bool(false) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite16.phar.phpt b/ext/phar/tests/cache_list/copyonwrite16.phar.phpt index f17784c355f..5cc9cb415a8 100644 --- a/ext/phar/tests/cache_list/copyonwrite16.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite16.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 16 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite16.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write16.phar --EXPECTF-- bool(true) bool(false) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite17.phar.phpt b/ext/phar/tests/cache_list/copyonwrite17.phar.phpt index 158c049b147..74dc6619c16 100644 --- a/ext/phar/tests/cache_list/copyonwrite17.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite17.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 17 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite17.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write17.phar --EXPECTF-- NULL %string|unicode%(2) "hi" -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite18.phar.phpt b/ext/phar/tests/cache_list/copyonwrite18.phar.phpt index 3e65f5a124f..03112c18bed 100644 --- a/ext/phar/tests/cache_list/copyonwrite18.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite18.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 18 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite18.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write18.phar --EXPECTF-- 100666 100444 -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite19.phar.phpt b/ext/phar/tests/cache_list/copyonwrite19.phar.phpt index 6e03554d96c..23fe5879a92 100644 --- a/ext/phar/tests/cache_list/copyonwrite19.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite19.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 19 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite19.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write19.phar --EXPECTF-- string(2) "hi" %string|unicode%(3) "hi2" -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite2.phar.phpt b/ext/phar/tests/cache_list/copyonwrite2.phar.phpt index 8d21c813a4e..9246a630c69 100644 --- a/ext/phar/tests/cache_list/copyonwrite2.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite2.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 2 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite2.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -14,4 +15,4 @@ bool(true) string(2) "hi" bool(true) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite20.phar.phpt b/ext/phar/tests/cache_list/copyonwrite20.phar.phpt index acce57415c6..10c56342e95 100644 --- a/ext/phar/tests/cache_list/copyonwrite20.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite20.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 20 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite20.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write20.phar --EXPECTF-- string(2) "hi" NULL -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite21.phar.phpt b/ext/phar/tests/cache_list/copyonwrite21.phar.phpt index 8960ea7171f..409273db6c6 100644 --- a/ext/phar/tests/cache_list/copyonwrite21.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite21.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 21 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite21.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -12,4 +13,4 @@ files/write21.phar --EXPECTF-- bool(false) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite22.phar.phpt b/ext/phar/tests/cache_list/copyonwrite22.phar.phpt index 7cba216395f..9e7ad6c741c 100644 --- a/ext/phar/tests/cache_list/copyonwrite22.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite22.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 22 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite22.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -12,4 +13,4 @@ files/write22.phar --EXPECTF-- bool(true) bool(false) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite23.phar.phpt b/ext/phar/tests/cache_list/copyonwrite23.phar.phpt index 292e5af668f..28412928b63 100644 --- a/ext/phar/tests/cache_list/copyonwrite23.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite23.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 23 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite23.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -14,4 +15,4 @@ bool(true) bool(false) bool(false) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite24.phar.phpt b/ext/phar/tests/cache_list/copyonwrite24.phar.phpt index 69197f2b4b9..3aaba359f5f 100644 --- a/ext/phar/tests/cache_list/copyonwrite24.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite24.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 24 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite24.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -12,4 +13,4 @@ files/write24.phar --EXPECTF-- bool(false) bool(true) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite25.phar.phpt b/ext/phar/tests/cache_list/copyonwrite25.phar.phpt index b661cb61c1b..73a1d7648a5 100644 --- a/ext/phar/tests/cache_list/copyonwrite25.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite25.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 25 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite25.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- @@ -13,4 +14,4 @@ files/write25.phar bool(false) bool(true) --FILE_EXTERNAL-- @@ -13,4 +14,4 @@ bool(true) bool(true) bool(false) bool(false) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite4.phar.phpt b/ext/phar/tests/cache_list/copyonwrite4.phar.phpt index 20ff78e2824..f29a8d6247f 100644 --- a/ext/phar/tests/cache_list/copyonwrite4.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite4.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 4 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite4.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -12,4 +13,4 @@ files/write4.phar bool(false) bool(true) string(2) "hi" -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite4a.phpt b/ext/phar/tests/cache_list/copyonwrite4a.phpt index 1945e31f16a..1b50c4204a9 100644 --- a/ext/phar/tests/cache_list/copyonwrite4a.phpt +++ b/ext/phar/tests/cache_list/copyonwrite4a.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 4a [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite4.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE-- @@ -17,4 +18,4 @@ var_dump(file_exists('phar://' . dirname(__FILE__) . '/files/write4.phar/testit. bool(false) bool(true) string(2) "hi" -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/cache_list/copyonwrite5.phar.phpt b/ext/phar/tests/cache_list/copyonwrite5.phar.phpt index 89990a7af1f..6f48dfa63d9 100644 --- a/ext/phar/tests/cache_list/copyonwrite5.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite5.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 5 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite5.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -24,4 +25,4 @@ array(2) { phar://%scopyonwrite5.phar.php%cfile1 file1 phar://%scopyonwrite5.phar.php%cfile2 file2 phar://%scopyonwrite5.phar.php%chi hi -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite6.phar.phpt b/ext/phar/tests/cache_list/copyonwrite6.phar.phpt index 661fef42c1d..ceea8508bd0 100644 --- a/ext/phar/tests/cache_list/copyonwrite6.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite6.phar.phpt @@ -5,6 +5,7 @@ default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite6.phar.php phar.readonly=0 open_basedir= +detect_unicode=0 --SKIPIF-- diff --git a/ext/phar/tests/cache_list/copyonwrite7.phar.phpt b/ext/phar/tests/cache_list/copyonwrite7.phar.phpt index d6faded9cc3..57658dddd97 100644 --- a/ext/phar/tests/cache_list/copyonwrite7.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite7.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 7 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite7.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write7.phar --EXPECT-- bool(true) bool(false) -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite8.phar.phpt b/ext/phar/tests/cache_list/copyonwrite8.phar.phpt index 7217d336e2d..71aa0b01be2 100644 --- a/ext/phar/tests/cache_list/copyonwrite8.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite8.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 8 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite8.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -11,4 +12,4 @@ files/write8.phar --EXPECTF-- string(%s) "%scopyonwrite8.phar.php" hi -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/copyonwrite9.phar.phpt b/ext/phar/tests/cache_list/copyonwrite9.phar.phpt index ffda9565bd0..b2437776a10 100644 --- a/ext/phar/tests/cache_list/copyonwrite9.phar.phpt +++ b/ext/phar/tests/cache_list/copyonwrite9.phar.phpt @@ -4,6 +4,7 @@ Phar: copy-on-write test 9 [cache_list] default_charset=UTF-8 phar.cache_list={PWD}/copyonwrite9.phar.php phar.readonly=0 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -20,4 +21,4 @@ __HALT_COMPILER(); ?> " -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/cache_list/frontcontroller1.phpt b/ext/phar/tests/cache_list/frontcontroller1.phpt index d0d5552f167..91a5c9ea7d6 100644 --- a/ext/phar/tests/cache_list/frontcontroller1.phpt +++ b/ext/phar/tests/cache_list/frontcontroller1.phpt @@ -2,6 +2,7 @@ Phar front controller other --INI-- phar.cache_list={PWD}/frontcontroller1.php [cache_list] +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller10.phpt b/ext/phar/tests/cache_list/frontcontroller10.phpt index 00177d4ff55..7c94da116cb 100644 --- a/ext/phar/tests/cache_list/frontcontroller10.phpt +++ b/ext/phar/tests/cache_list/frontcontroller10.phpt @@ -3,6 +3,7 @@ Phar front controller rewrite access denied [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller10.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller11.phpt b/ext/phar/tests/cache_list/frontcontroller11.phpt index 25b147e1940..e4912844de6 100644 --- a/ext/phar/tests/cache_list/frontcontroller11.phpt +++ b/ext/phar/tests/cache_list/frontcontroller11.phpt @@ -3,6 +3,7 @@ Phar front controller mime type extension is not a string [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller11.php +detect_unicode=0 --SKIPIF-- @@ -19,4 +20,4 @@ Fatal error: Uncaught exception 'PharException' with message 'Key of MIME type o Stack trace: #0 %sfrontcontroller11.php(2): Phar::webPhar('whatever', 'index.php', '', Array) #1 {main} - thrown in %sfrontcontroller11.php on line 2 \ No newline at end of file + thrown in %sfrontcontroller11.php on line 2 diff --git a/ext/phar/tests/cache_list/frontcontroller12.phpt b/ext/phar/tests/cache_list/frontcontroller12.phpt index cfc7d0e43a0..c98a84027a5 100644 --- a/ext/phar/tests/cache_list/frontcontroller12.phpt +++ b/ext/phar/tests/cache_list/frontcontroller12.phpt @@ -3,6 +3,7 @@ Phar front controller mime type unknown int [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller12.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -18,4 +19,4 @@ Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type Stack trace: #0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', '', Array) #1 {main} - thrown in %sfrontcontroller12.php on line 2 \ No newline at end of file + thrown in %sfrontcontroller12.php on line 2 diff --git a/ext/phar/tests/cache_list/frontcontroller13.phpt b/ext/phar/tests/cache_list/frontcontroller13.phpt index e6c9dee4aec..deb02c25db0 100644 --- a/ext/phar/tests/cache_list/frontcontroller13.phpt +++ b/ext/phar/tests/cache_list/frontcontroller13.phpt @@ -3,6 +3,7 @@ Phar front controller mime type not string/int [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller13.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -18,4 +19,4 @@ Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type Stack trace: #0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', '', Array) #1 {main} - thrown in %sfrontcontroller13.php on line 2 \ No newline at end of file + thrown in %sfrontcontroller13.php on line 2 diff --git a/ext/phar/tests/cache_list/frontcontroller14.phpt b/ext/phar/tests/cache_list/frontcontroller14.phpt index bbd9637d242..bc214141f4c 100644 --- a/ext/phar/tests/cache_list/frontcontroller14.phpt +++ b/ext/phar/tests/cache_list/frontcontroller14.phpt @@ -2,6 +2,7 @@ Phar front controller mime type override, other [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller14.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller15.phpt b/ext/phar/tests/cache_list/frontcontroller15.phpt index d142a5d7428..22fed0af57b 100644 --- a/ext/phar/tests/cache_list/frontcontroller15.phpt +++ b/ext/phar/tests/cache_list/frontcontroller15.phpt @@ -3,6 +3,7 @@ Phar front controller mime type override, Phar::PHPS [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller15.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller16.phpt b/ext/phar/tests/cache_list/frontcontroller16.phpt index 10bebdccef1..4294c3d3263 100644 --- a/ext/phar/tests/cache_list/frontcontroller16.phpt +++ b/ext/phar/tests/cache_list/frontcontroller16.phpt @@ -3,6 +3,7 @@ Phar front controller mime type override, Phar::PHP [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller16.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller17.phpt b/ext/phar/tests/cache_list/frontcontroller17.phpt index 35d3ae4e9cf..47688e7b6a1 100644 --- a/ext/phar/tests/cache_list/frontcontroller17.phpt +++ b/ext/phar/tests/cache_list/frontcontroller17.phpt @@ -2,6 +2,7 @@ Phar front controller mime type unknown [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller17.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller18.phpt b/ext/phar/tests/cache_list/frontcontroller18.phpt index 5e94bf6ff5e..8982706e5fe 100644 --- a/ext/phar/tests/cache_list/frontcontroller18.phpt +++ b/ext/phar/tests/cache_list/frontcontroller18.phpt @@ -2,6 +2,7 @@ Phar front controller $_SERVER munging failure [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller18.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller19.phpt b/ext/phar/tests/cache_list/frontcontroller19.phpt index bed0b1df31c..0e5e8f1d075 100644 --- a/ext/phar/tests/cache_list/frontcontroller19.phpt +++ b/ext/phar/tests/cache_list/frontcontroller19.phpt @@ -2,6 +2,7 @@ Phar front controller $_SERVER munging failure 2 [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller19.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller2.phpt b/ext/phar/tests/cache_list/frontcontroller2.phpt index 67ccfc1e047..2cf18f823c0 100644 --- a/ext/phar/tests/cache_list/frontcontroller2.phpt +++ b/ext/phar/tests/cache_list/frontcontroller2.phpt @@ -3,6 +3,7 @@ Phar front controller PHP test [cache_list] --INI-- default_charset=UTF-8 phar.cache_list=frontcontroller2.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller20.phpt b/ext/phar/tests/cache_list/frontcontroller20.phpt index bf333c773cf..b5499b1ef55 100644 --- a/ext/phar/tests/cache_list/frontcontroller20.phpt +++ b/ext/phar/tests/cache_list/frontcontroller20.phpt @@ -2,6 +2,7 @@ Phar front controller $_SERVER munging failure 3 [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller20.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller21.phpt b/ext/phar/tests/cache_list/frontcontroller21.phpt index 829f2986e99..6d514891df3 100644 --- a/ext/phar/tests/cache_list/frontcontroller21.phpt +++ b/ext/phar/tests/cache_list/frontcontroller21.phpt @@ -3,6 +3,7 @@ Phar front controller $_SERVER munging success [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller21.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -22,4 +23,4 @@ string(18) "/index.php?test=hi" string(32) "/frontcontroller21.php/index.php" string(22) "/frontcontroller21.php" string(%d) "%sfrontcontroller21.php" -string(40) "/frontcontroller21.php/index.php?test=hi" \ No newline at end of file +string(40) "/frontcontroller21.php/index.php?test=hi" diff --git a/ext/phar/tests/cache_list/frontcontroller22.phpt b/ext/phar/tests/cache_list/frontcontroller22.phpt index 2769b01f2fb..3454e162399 100644 --- a/ext/phar/tests/cache_list/frontcontroller22.phpt +++ b/ext/phar/tests/cache_list/frontcontroller22.phpt @@ -3,6 +3,7 @@ Phar front controller include from cwd test 1 [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller22.phpt +detect_unicode=0 --SKIPIF-- --ENV-- @@ -19,4 +20,4 @@ Content-type: text/html; charset=UTF-8 Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d -Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d \ No newline at end of file +Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d diff --git a/ext/phar/tests/cache_list/frontcontroller23.phpt b/ext/phar/tests/cache_list/frontcontroller23.phpt index 3da9631dfb1..6a053e694cd 100644 --- a/ext/phar/tests/cache_list/frontcontroller23.phpt +++ b/ext/phar/tests/cache_list/frontcontroller23.phpt @@ -3,6 +3,7 @@ Phar front controller with generic action router test [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller23.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -15,4 +16,4 @@ files/frontcontroller14.phar Content-type: text/html; charset=UTF-8 --EXPECTF-- string(9) "/hi/there" -string(%d) "phar://%sfrontcontroller23.php/html/index.php" \ No newline at end of file +string(%d) "phar://%sfrontcontroller23.php/html/index.php" diff --git a/ext/phar/tests/cache_list/frontcontroller24.phpt b/ext/phar/tests/cache_list/frontcontroller24.phpt index 561826bd784..e8892a3dab6 100644 --- a/ext/phar/tests/cache_list/frontcontroller24.phpt +++ b/ext/phar/tests/cache_list/frontcontroller24.phpt @@ -3,6 +3,7 @@ Phar front controller with custom 404 php script [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller24.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -14,4 +15,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/html; charset=UTF-8 --EXPECTF-- -My 404 is rawesome \ No newline at end of file +My 404 is rawesome diff --git a/ext/phar/tests/cache_list/frontcontroller25.phpt b/ext/phar/tests/cache_list/frontcontroller25.phpt index a8779392b6d..2fdc23daade 100644 --- a/ext/phar/tests/cache_list/frontcontroller25.phpt +++ b/ext/phar/tests/cache_list/frontcontroller25.phpt @@ -3,6 +3,7 @@ Phar front controller with extra path_info [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller25.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -15,4 +16,4 @@ files/frontcontroller8.phar Content-type: text/html; charset=UTF-8 --EXPECTF-- string(42) "/frontcontroller25.php/a1.phps/extra/stuff" -string(12) "/extra/stuff" \ No newline at end of file +string(12) "/extra/stuff" diff --git a/ext/phar/tests/cache_list/frontcontroller26.phpt b/ext/phar/tests/cache_list/frontcontroller26.phpt index 86a1c1444c1..dc3bdf8bc30 100644 --- a/ext/phar/tests/cache_list/frontcontroller26.phpt +++ b/ext/phar/tests/cache_list/frontcontroller26.phpt @@ -2,6 +2,7 @@ Phar front controller with unknown extension mime type [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller26.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: application/octet-stream --EXPECTF-- - --ENV-- @@ -14,4 +15,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/plain;charset=UTF-8 --EXPECTF-- -hi \ No newline at end of file +hi diff --git a/ext/phar/tests/cache_list/frontcontroller28.phpt b/ext/phar/tests/cache_list/frontcontroller28.phpt index 80059a9da26..ea76bb21f6c 100644 --- a/ext/phar/tests/cache_list/frontcontroller28.phpt +++ b/ext/phar/tests/cache_list/frontcontroller28.phpt @@ -3,6 +3,7 @@ Phar front controller with huge file [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller28.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller29.phpt b/ext/phar/tests/cache_list/frontcontroller29.phpt index 1cd8f96f2d3..5a5dacff52b 100644 --- a/ext/phar/tests/cache_list/frontcontroller29.phpt +++ b/ext/phar/tests/cache_list/frontcontroller29.phpt @@ -3,6 +3,7 @@ Phar front controller with fatal error in php file [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller29.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -14,4 +15,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/html; charset=UTF-8 --EXPECTF-- -Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1 \ No newline at end of file +Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1 diff --git a/ext/phar/tests/cache_list/frontcontroller3.phpt b/ext/phar/tests/cache_list/frontcontroller3.phpt index 1c1b4798813..f5651e2d783 100644 --- a/ext/phar/tests/cache_list/frontcontroller3.phpt +++ b/ext/phar/tests/cache_list/frontcontroller3.phpt @@ -3,6 +3,7 @@ Phar front controller phps [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller3.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller30.phpt b/ext/phar/tests/cache_list/frontcontroller30.phpt index 5a63da874c2..ca92c728804 100644 --- a/ext/phar/tests/cache_list/frontcontroller30.phpt +++ b/ext/phar/tests/cache_list/frontcontroller30.phpt @@ -2,6 +2,7 @@ Phar front controller with weird SCRIPT_NAME [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller30.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -11,4 +12,4 @@ REQUEST_URI=/huh? files/frontcontroller8.phar --EXPECTF-- oops did not run -%a \ No newline at end of file +%a diff --git a/ext/phar/tests/cache_list/frontcontroller31.phpt b/ext/phar/tests/cache_list/frontcontroller31.phpt index 9ef1221a289..966ca1a40c0 100644 --- a/ext/phar/tests/cache_list/frontcontroller31.phpt +++ b/ext/phar/tests/cache_list/frontcontroller31.phpt @@ -3,6 +3,7 @@ Phar front controller with invalid callback for rewrites [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller31.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller16.phar --EXPECT-- -phar error: invalid rewrite callback \ No newline at end of file +phar error: invalid rewrite callback diff --git a/ext/phar/tests/cache_list/frontcontroller32.phpt b/ext/phar/tests/cache_list/frontcontroller32.phpt index 59116907a59..49cb062e540 100644 --- a/ext/phar/tests/cache_list/frontcontroller32.phpt +++ b/ext/phar/tests/cache_list/frontcontroller32.phpt @@ -3,6 +3,7 @@ Phar front controller with valid callback that is not good [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller32.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller17.phar --EXPECTF-- -%ahar error: failed to call rewrite callback \ No newline at end of file +%ahar error: failed to call rewrite callback diff --git a/ext/phar/tests/cache_list/frontcontroller33.phpt b/ext/phar/tests/cache_list/frontcontroller33.phpt index 95738548231..34244d844e1 100644 --- a/ext/phar/tests/cache_list/frontcontroller33.phpt +++ b/ext/phar/tests/cache_list/frontcontroller33.phpt @@ -3,6 +3,7 @@ Phar front controller with valid callback that does not return any value [cache_ --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller33.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller18.phar --EXPECTF-- -phar error: rewrite callback must return a string or false \ No newline at end of file +phar error: rewrite callback must return a string or false diff --git a/ext/phar/tests/cache_list/frontcontroller34.phpt b/ext/phar/tests/cache_list/frontcontroller34.phpt index 83c22f58f8f..f6677cc04b9 100644 --- a/ext/phar/tests/cache_list/frontcontroller34.phpt +++ b/ext/phar/tests/cache_list/frontcontroller34.phpt @@ -3,6 +3,7 @@ Phar front controller with cwd [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller34.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller4.phpt b/ext/phar/tests/cache_list/frontcontroller4.phpt index 5cf36822770..16961a1e46e 100644 --- a/ext/phar/tests/cache_list/frontcontroller4.phpt +++ b/ext/phar/tests/cache_list/frontcontroller4.phpt @@ -2,6 +2,7 @@ Phar front controller index.php relocate (no /) [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller4.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller5.phpt b/ext/phar/tests/cache_list/frontcontroller5.phpt index 2c738d7bfb3..93ea37a9afa 100644 --- a/ext/phar/tests/cache_list/frontcontroller5.phpt +++ b/ext/phar/tests/cache_list/frontcontroller5.phpt @@ -2,6 +2,7 @@ Phar front controller index.php relocate [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller5.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller6.phpt b/ext/phar/tests/cache_list/frontcontroller6.phpt index 2480be41293..d498072fa29 100644 --- a/ext/phar/tests/cache_list/frontcontroller6.phpt +++ b/ext/phar/tests/cache_list/frontcontroller6.phpt @@ -2,6 +2,7 @@ Phar front controller 404 [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller6.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -20,4 +21,4 @@ Status: 404 Not Found

404 - File /notfound.php Not Found

- \ No newline at end of file + diff --git a/ext/phar/tests/cache_list/frontcontroller7.phpt b/ext/phar/tests/cache_list/frontcontroller7.phpt index a8a88a95fe4..c4d5514ade0 100644 --- a/ext/phar/tests/cache_list/frontcontroller7.phpt +++ b/ext/phar/tests/cache_list/frontcontroller7.phpt @@ -2,6 +2,7 @@ Phar front controller alternate index file [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller7.php +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/cache_list/frontcontroller8.phpt b/ext/phar/tests/cache_list/frontcontroller8.phpt index bf9b390defc..bc6829cba58 100644 --- a/ext/phar/tests/cache_list/frontcontroller8.phpt +++ b/ext/phar/tests/cache_list/frontcontroller8.phpt @@ -2,6 +2,7 @@ Phar front controller no index file 404 [cache_list] --INI-- phar.cache_list={PWD}/frontcontroller8.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -20,4 +21,4 @@ Status: 404 Not Found

404 - File /index.php Not Found

- \ No newline at end of file + diff --git a/ext/phar/tests/cache_list/frontcontroller9.phpt b/ext/phar/tests/cache_list/frontcontroller9.phpt index 1a8b9168ccf..fb6f72ac221 100644 --- a/ext/phar/tests/cache_list/frontcontroller9.phpt +++ b/ext/phar/tests/cache_list/frontcontroller9.phpt @@ -3,6 +3,7 @@ Phar front controller rewrite array [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller9.php +detect_unicode=0 --SKIPIF-- --ENV-- @@ -17,4 +18,4 @@ Content-type: text/html; charset=UTF-8 <?php function hio(){} - \ No newline at end of file + diff --git a/ext/phar/tests/delete.phpt b/ext/phar/tests/delete.phpt index 1d985090645..f91b11b3d5e 100644 --- a/ext/phar/tests/delete.phpt +++ b/ext/phar/tests/delete.phpt @@ -5,6 +5,7 @@ Phar: delete test --INI-- phar.readonly=0 phar.require_hash=0 +detect_unicode=0 --FILE-- --ENV-- @@ -15,4 +16,4 @@ Content-type: text/html; charset=UTF-8 --EXPECTF-- string(9) "\Web\View" -Parse error: syntax error, unexpected T_ECHO, expecting T_FUNCTION in phar://%sfatal_error_webphar.php/Web/View.php on line 380 \ No newline at end of file +Parse error: syntax error, unexpected T_ECHO, expecting T_FUNCTION in phar://%sfatal_error_webphar.php/Web/View.php on line 380 diff --git a/ext/phar/tests/file_get_contents.phpt b/ext/phar/tests/file_get_contents.phpt index fcc9d646559..b931176e500 100644 --- a/ext/phar/tests/file_get_contents.phpt +++ b/ext/phar/tests/file_get_contents.phpt @@ -5,6 +5,7 @@ Phar: test file_get_contents() interception --INI-- phar.require_hash=1 phar.readonly=0 +detect_unicode=0 --FILE-- --EXPECT-- -hihi===DONE=== \ No newline at end of file +hihi===DONE=== diff --git a/ext/phar/tests/fopen.phpt b/ext/phar/tests/fopen.phpt index 5b694d6e2de..b10bcb3a535 100644 --- a/ext/phar/tests/fopen.phpt +++ b/ext/phar/tests/fopen.phpt @@ -6,6 +6,7 @@ Phar: test fopen() interception --INI-- phar.require_hash=1 phar.readonly=0 +detect_unicode=0 --FILE-- --ENV-- diff --git a/ext/phar/tests/frontcontroller1.phpt b/ext/phar/tests/frontcontroller1.phpt index 70933236171..0186b125299 100644 --- a/ext/phar/tests/frontcontroller1.phpt +++ b/ext/phar/tests/frontcontroller1.phpt @@ -2,6 +2,8 @@ Phar front controller other --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller1.php REQUEST_URI=/frontcontroller1.php/a.jpg diff --git a/ext/phar/tests/frontcontroller10.phpt b/ext/phar/tests/frontcontroller10.phpt index 667d5c243cd..b6a0b488f66 100644 --- a/ext/phar/tests/frontcontroller10.phpt +++ b/ext/phar/tests/frontcontroller10.phpt @@ -2,6 +2,7 @@ Phar front controller rewrite access denied --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller12.phpt b/ext/phar/tests/frontcontroller12.phpt index 956ea1c050b..b85b2f716bd 100644 --- a/ext/phar/tests/frontcontroller12.phpt +++ b/ext/phar/tests/frontcontroller12.phpt @@ -2,6 +2,7 @@ Phar front controller mime type unknown int --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -17,4 +18,4 @@ Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type Stack trace: #0 %sfrontcontroller12.php(2): Phar::webPhar('whatever', 'index.php', '', Array) #1 {main} - thrown in %sfrontcontroller12.php on line 2 \ No newline at end of file + thrown in %sfrontcontroller12.php on line 2 diff --git a/ext/phar/tests/frontcontroller13.phpt b/ext/phar/tests/frontcontroller13.phpt index 717e56996fa..cde41f7cddb 100644 --- a/ext/phar/tests/frontcontroller13.phpt +++ b/ext/phar/tests/frontcontroller13.phpt @@ -2,6 +2,7 @@ Phar front controller mime type not string/int --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -17,4 +18,4 @@ Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type Stack trace: #0 %sfrontcontroller13.php(2): Phar::webPhar('whatever', 'index.php', '', Array) #1 {main} - thrown in %sfrontcontroller13.php on line 2 \ No newline at end of file + thrown in %sfrontcontroller13.php on line 2 diff --git a/ext/phar/tests/frontcontroller14.phpt b/ext/phar/tests/frontcontroller14.phpt index 2bdb145c6e3..13de43f426b 100644 --- a/ext/phar/tests/frontcontroller14.phpt +++ b/ext/phar/tests/frontcontroller14.phpt @@ -2,6 +2,8 @@ Phar front controller mime type override, other --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller14.php REQUEST_URI=/frontcontroller14.php/a.jpg diff --git a/ext/phar/tests/frontcontroller15.phpt b/ext/phar/tests/frontcontroller15.phpt index 370098014d1..8dbf144618b 100644 --- a/ext/phar/tests/frontcontroller15.phpt +++ b/ext/phar/tests/frontcontroller15.phpt @@ -2,6 +2,7 @@ Phar front controller mime type override, Phar::PHPS --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller16.phpt b/ext/phar/tests/frontcontroller16.phpt index 712af40bf3e..8b0499b4b4d 100644 --- a/ext/phar/tests/frontcontroller16.phpt +++ b/ext/phar/tests/frontcontroller16.phpt @@ -2,6 +2,7 @@ Phar front controller mime type override, Phar::PHP --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller17.phpt b/ext/phar/tests/frontcontroller17.phpt index 233e2e2a490..ce8cda46423 100644 --- a/ext/phar/tests/frontcontroller17.phpt +++ b/ext/phar/tests/frontcontroller17.phpt @@ -2,6 +2,8 @@ Phar front controller mime type unknown --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller17.php REQUEST_URI=/frontcontroller17.php/fronk.gronk diff --git a/ext/phar/tests/frontcontroller18.phpt b/ext/phar/tests/frontcontroller18.phpt index 19aea455639..3d867070ab5 100644 --- a/ext/phar/tests/frontcontroller18.phpt +++ b/ext/phar/tests/frontcontroller18.phpt @@ -2,6 +2,8 @@ Phar front controller $_SERVER munging failure --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller18.php REQUEST_URI=/frontcontroller18.php/fronk.gronk diff --git a/ext/phar/tests/frontcontroller19.phpt b/ext/phar/tests/frontcontroller19.phpt index 9adafa2b30d..8c72e470564 100644 --- a/ext/phar/tests/frontcontroller19.phpt +++ b/ext/phar/tests/frontcontroller19.phpt @@ -2,6 +2,8 @@ Phar front controller $_SERVER munging failure 2 --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller19.php REQUEST_URI=/frontcontroller19.php/ diff --git a/ext/phar/tests/frontcontroller2.phpt b/ext/phar/tests/frontcontroller2.phpt index d0744dea1dc..987a04ea991 100644 --- a/ext/phar/tests/frontcontroller2.phpt +++ b/ext/phar/tests/frontcontroller2.phpt @@ -2,6 +2,7 @@ Phar front controller PHP test --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller20.phpt b/ext/phar/tests/frontcontroller20.phpt index 45e2bfc25ee..bf87cd96886 100644 --- a/ext/phar/tests/frontcontroller20.phpt +++ b/ext/phar/tests/frontcontroller20.phpt @@ -2,6 +2,8 @@ Phar front controller $_SERVER munging failure 3 --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller20.php REQUEST_URI=/frontcontroller20.php/ diff --git a/ext/phar/tests/frontcontroller21.phpt b/ext/phar/tests/frontcontroller21.phpt index bf50c6e8016..1c61ceb6022 100644 --- a/ext/phar/tests/frontcontroller21.phpt +++ b/ext/phar/tests/frontcontroller21.phpt @@ -2,6 +2,7 @@ Phar front controller $_SERVER munging success --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -21,4 +22,4 @@ string(18) "/index.php?test=hi" string(32) "/frontcontroller21.php/index.php" string(22) "/frontcontroller21.php" string(%d) "%sfrontcontroller21.php" -string(40) "/frontcontroller21.php/index.php?test=hi" \ No newline at end of file +string(40) "/frontcontroller21.php/index.php?test=hi" diff --git a/ext/phar/tests/frontcontroller22.phpt b/ext/phar/tests/frontcontroller22.phpt index b85c1eb497f..f19c88b5950 100644 --- a/ext/phar/tests/frontcontroller22.phpt +++ b/ext/phar/tests/frontcontroller22.phpt @@ -2,6 +2,7 @@ Phar front controller include from cwd test 1 --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -18,4 +19,4 @@ Content-type: text/html; charset=UTF-8 Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d -Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d \ No newline at end of file +Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d diff --git a/ext/phar/tests/frontcontroller23.phpt b/ext/phar/tests/frontcontroller23.phpt index 24464c9beb4..4a676028b24 100644 --- a/ext/phar/tests/frontcontroller23.phpt +++ b/ext/phar/tests/frontcontroller23.phpt @@ -2,6 +2,7 @@ Phar front controller with generic action router test --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -14,4 +15,4 @@ files/frontcontroller14.phar Content-type: text/html; charset=UTF-8 --EXPECTF-- string(9) "/hi/there" -string(%d) "phar://%sfrontcontroller23.php/html/index.php" \ No newline at end of file +string(%d) "phar://%sfrontcontroller23.php/html/index.php" diff --git a/ext/phar/tests/frontcontroller24.phpt b/ext/phar/tests/frontcontroller24.phpt index 767971ee91e..8d60ce2f7c0 100644 --- a/ext/phar/tests/frontcontroller24.phpt +++ b/ext/phar/tests/frontcontroller24.phpt @@ -2,6 +2,7 @@ Phar front controller with custom 404 php script --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/html; charset=UTF-8 --EXPECTF-- -My 404 is rawesome \ No newline at end of file +My 404 is rawesome diff --git a/ext/phar/tests/frontcontroller25.phpt b/ext/phar/tests/frontcontroller25.phpt index 9b383de4131..da4e58b49a4 100644 --- a/ext/phar/tests/frontcontroller25.phpt +++ b/ext/phar/tests/frontcontroller25.phpt @@ -2,6 +2,7 @@ Phar front controller with extra path_info --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -14,4 +15,4 @@ files/frontcontroller8.phar Content-type: text/html; charset=UTF-8 --EXPECTF-- string(42) "/frontcontroller25.php/a1.phps/extra/stuff" -string(12) "/extra/stuff" \ No newline at end of file +string(12) "/extra/stuff" diff --git a/ext/phar/tests/frontcontroller26.phpt b/ext/phar/tests/frontcontroller26.phpt index a8097b0886c..9c5a14d5126 100644 --- a/ext/phar/tests/frontcontroller26.phpt +++ b/ext/phar/tests/frontcontroller26.phpt @@ -2,6 +2,8 @@ Phar front controller with unknown extension mime type --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller26.php REQUEST_URI=/frontcontroller26.php/unknown.ext @@ -11,4 +13,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: application/octet-stream --EXPECTF-- - --ENV-- @@ -13,4 +14,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/plain;charset=UTF-8 --EXPECTF-- -hi \ No newline at end of file +hi diff --git a/ext/phar/tests/frontcontroller28.phpt b/ext/phar/tests/frontcontroller28.phpt index 577800885b1..5871f327a2d 100644 --- a/ext/phar/tests/frontcontroller28.phpt +++ b/ext/phar/tests/frontcontroller28.phpt @@ -2,6 +2,7 @@ Phar front controller with huge file --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller29.phpt b/ext/phar/tests/frontcontroller29.phpt index 0afc17929f3..61f9b1bfc18 100644 --- a/ext/phar/tests/frontcontroller29.phpt +++ b/ext/phar/tests/frontcontroller29.phpt @@ -2,6 +2,7 @@ Phar front controller with fatal error in php file --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -13,4 +14,4 @@ files/frontcontroller8.phar --EXPECTHEADERS-- Content-type: text/html; charset=UTF-8 --EXPECTF-- -Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1 \ No newline at end of file +Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1 diff --git a/ext/phar/tests/frontcontroller3.phpt b/ext/phar/tests/frontcontroller3.phpt index ac36485837b..6d025aec298 100644 --- a/ext/phar/tests/frontcontroller3.phpt +++ b/ext/phar/tests/frontcontroller3.phpt @@ -2,6 +2,7 @@ Phar front controller phps --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller30.phpt b/ext/phar/tests/frontcontroller30.phpt index de6960c2444..9b38bccd4fe 100644 --- a/ext/phar/tests/frontcontroller30.phpt +++ b/ext/phar/tests/frontcontroller30.phpt @@ -2,6 +2,8 @@ Phar front controller with weird SCRIPT_NAME --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/huh? REQUEST_URI=/huh? @@ -9,4 +11,4 @@ REQUEST_URI=/huh? files/frontcontroller8.phar --EXPECTF-- oops did not run -%a \ No newline at end of file +%a diff --git a/ext/phar/tests/frontcontroller31.phpt b/ext/phar/tests/frontcontroller31.phpt index 13c305d2f3e..4995da74ef2 100644 --- a/ext/phar/tests/frontcontroller31.phpt +++ b/ext/phar/tests/frontcontroller31.phpt @@ -2,6 +2,7 @@ Phar front controller with invalid callback for rewrites --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -12,4 +13,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller16.phar --EXPECT-- -phar error: invalid rewrite callback \ No newline at end of file +phar error: invalid rewrite callback diff --git a/ext/phar/tests/frontcontroller32.phpt b/ext/phar/tests/frontcontroller32.phpt index 58f6fffa00a..2459312dc5e 100644 --- a/ext/phar/tests/frontcontroller32.phpt +++ b/ext/phar/tests/frontcontroller32.phpt @@ -2,6 +2,7 @@ Phar front controller with valid callback that is not good --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -12,4 +13,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller17.phar --EXPECTF-- -%ahar error: failed to call rewrite callback \ No newline at end of file +%ahar error: failed to call rewrite callback diff --git a/ext/phar/tests/frontcontroller33.phpt b/ext/phar/tests/frontcontroller33.phpt index 8593e317664..58611080dae 100644 --- a/ext/phar/tests/frontcontroller33.phpt +++ b/ext/phar/tests/frontcontroller33.phpt @@ -2,6 +2,7 @@ Phar front controller with valid callback that does not return any value --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -12,4 +13,4 @@ Content-type: text/html; charset=UTF-8 --FILE_EXTERNAL-- files/frontcontroller18.phar --EXPECTF-- -phar error: rewrite callback must return a string or false \ No newline at end of file +phar error: rewrite callback must return a string or false diff --git a/ext/phar/tests/frontcontroller34.phpt b/ext/phar/tests/frontcontroller34.phpt index 34a49ded4df..bf1cf7f2447 100644 --- a/ext/phar/tests/frontcontroller34.phpt +++ b/ext/phar/tests/frontcontroller34.phpt @@ -2,6 +2,7 @@ Phar front controller with cwd --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- diff --git a/ext/phar/tests/frontcontroller4.phpt b/ext/phar/tests/frontcontroller4.phpt index f2482b92197..d1cb2a4c63e 100644 --- a/ext/phar/tests/frontcontroller4.phpt +++ b/ext/phar/tests/frontcontroller4.phpt @@ -2,6 +2,8 @@ Phar front controller index.php relocate (no /) --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller4.php REQUEST_URI=/frontcontroller4.php diff --git a/ext/phar/tests/frontcontroller5.phpt b/ext/phar/tests/frontcontroller5.phpt index 1990a2b0083..48771efc8f7 100644 --- a/ext/phar/tests/frontcontroller5.phpt +++ b/ext/phar/tests/frontcontroller5.phpt @@ -2,6 +2,8 @@ Phar front controller index.php relocate --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller5.php REQUEST_URI=/frontcontroller5.php/ diff --git a/ext/phar/tests/frontcontroller6.phpt b/ext/phar/tests/frontcontroller6.phpt index 1a2cc2cd23d..1ab4e200326 100644 --- a/ext/phar/tests/frontcontroller6.phpt +++ b/ext/phar/tests/frontcontroller6.phpt @@ -2,6 +2,8 @@ Phar front controller 404 --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller6.php REQUEST_URI=/frontcontroller6.php/notfound.php @@ -18,4 +20,4 @@ Status: 404 Not Found

404 - File /notfound.php Not Found

- \ No newline at end of file + diff --git a/ext/phar/tests/frontcontroller7.phpt b/ext/phar/tests/frontcontroller7.phpt index aff2087522c..c30a366e378 100644 --- a/ext/phar/tests/frontcontroller7.phpt +++ b/ext/phar/tests/frontcontroller7.phpt @@ -2,6 +2,8 @@ Phar front controller alternate index file --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller7.php REQUEST_URI=/frontcontroller7.php/ diff --git a/ext/phar/tests/frontcontroller8.phpt b/ext/phar/tests/frontcontroller8.phpt index 36e3206d668..88312c4061b 100644 --- a/ext/phar/tests/frontcontroller8.phpt +++ b/ext/phar/tests/frontcontroller8.phpt @@ -2,6 +2,8 @@ Phar front controller no index file 404 --SKIPIF-- +--INI-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/frontcontroller8.php REQUEST_URI=/frontcontroller8.php/ @@ -18,4 +20,4 @@ Status: 404 Not Found

404 - File /index.php Not Found

- \ No newline at end of file + diff --git a/ext/phar/tests/frontcontroller9.phpt b/ext/phar/tests/frontcontroller9.phpt index d47a2898e60..36cf2713cb4 100644 --- a/ext/phar/tests/frontcontroller9.phpt +++ b/ext/phar/tests/frontcontroller9.phpt @@ -2,6 +2,7 @@ Phar front controller rewrite array --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --ENV-- @@ -16,4 +17,4 @@ Content-type: text/html; charset=UTF-8 <?php function hio(){} - \ No newline at end of file + diff --git a/ext/phar/tests/include_path_advanced.phpt b/ext/phar/tests/include_path_advanced.phpt index 6feee422b4c..81e528130c1 100644 --- a/ext/phar/tests/include_path_advanced.phpt +++ b/ext/phar/tests/include_path_advanced.phpt @@ -2,6 +2,7 @@ Phar: include_path advanced code coverage test --INI-- default_charset=UTF-8 +detect_unicode=0 --SKIPIF-- --FILE_EXTERNAL-- @@ -9,4 +10,4 @@ files/include_path.phar --EXPECT-- file1.php test/file1.php -ok \ No newline at end of file +ok diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt index e1308956fef..b9bf58922fe 100644 --- a/ext/phar/tests/mounteddir.phpt +++ b/ext/phar/tests/mounteddir.phpt @@ -7,6 +7,7 @@ if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of P ?> --INI-- phar.readonly=0 +detect_unicode=0 --FILE-- --INI-- phar.readonly=0 +detect_unicode=0 --FILE-- --EXPECT-- -hihi===DONE=== \ No newline at end of file +hihi===DONE=== diff --git a/ext/phar/tests/rename.phpt b/ext/phar/tests/rename.phpt index c73c98ec816..2f125405896 100644 --- a/ext/phar/tests/rename.phpt +++ b/ext/phar/tests/rename.phpt @@ -5,6 +5,7 @@ Phar: rename test --INI-- phar.readonly=0 phar.require_hash=0 +detect_unicode=0 --FILE-- --INI-- phar.readonly=0 +detect_unicode=0 --FILE-- +--INI-- +detect_unicode=0 --FILE-- +detect_unicode=0 --ENV-- SCRIPT_NAME=/withphar_web.php REQUEST_URI=/withphar_web.php/web.php diff --git a/ext/phar/tests/zip/notphar.phpt b/ext/phar/tests/zip/notphar.phpt index 3450c84bbd1..c0648c49534 100644 --- a/ext/phar/tests/zip/notphar.phpt +++ b/ext/phar/tests/zip/notphar.phpt @@ -4,6 +4,7 @@ Phar: a non-executable zip with no stub named .phar.zip --INI-- phar.readonly=1 +detect_unicode=0 --FILE-- Date: Sun, 29 Jul 2012 13:41:40 -0400 Subject: [PATCH 371/641] Fix #61642: modify("+5 weekdays") returns Sunday Adding a non-zero multiple of 5 weekdays to any Friday, Saturday, or Sunday would result in a Sunday instead of the correct date. This patch provides an implementation of do_adjust_special_weekday() which does not suffer from this issue. --- ext/date/lib/tm2unixtime.c | 75 +++++++++++++++++------------------- ext/date/tests/bug61642.phpt | 62 +++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 ext/date/tests/bug61642.phpt diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c index c4830bbef0c..9055fee203f 100644 --- a/ext/date/lib/tm2unixtime.c +++ b/ext/date/lib/tm2unixtime.c @@ -220,55 +220,52 @@ static void do_adjust_relative(timelib_time* time) static void do_adjust_special_weekday(timelib_time* time) { - timelib_sll current_dow, count; + timelib_sll count, dow, rem; count = time->relative.special.amount; + dow = timelib_day_of_week(time->y, time->m, time->d); - current_dow = timelib_day_of_week(time->y, time->m, time->d); - if (count == 0) { - /* skip over saturday and sunday */ - if (current_dow == 6) { - time->d += 2; - } - /* skip over sunday */ - if (current_dow == 0) { + /* Add increments of 5 weekdays as a week, leaving the DOW unchanged. */ + time->d += (count / 5) * 7; + + /* Deal with the remainder. */ + rem = (count % 5); + + if (count > 0) { + if (rem == 0) { + /* Head back to Friday if we stop on the weekend. */ + if (dow == 0) { + time->d -= 2; + } else if (dow == 6) { + time->d -= 1; + } + } else if (dow == 6) { + /* We ended up on Saturday, but there's still work to do, so move + * to Sunday and continue from there. */ time->d += 1; - } - } else if (count > 0) { - /* skip over saturday and sunday */ - if (current_dow == 5) { + } else if (dow + rem > 5) { + /* We're on a weekday, but we're going past Friday, so skip right + * over the weekend. */ time->d += 2; } - /* skip over sunday */ - if (current_dow == 6) { - time->d += 1; - } - /* add increments of 5 weekdays as a week */ - time->d += (count / 5) * 7; - /* if current DOW plus the remainder > 5, add two days */ - current_dow = timelib_day_of_week(time->y, time->m, time->d); - time->d += (count % 5); - if ((count % 5) + current_dow > 5) { - time->d += 2; - } - } else if (count < 0) { - /* skip over sunday and saturday */ - if (current_dow == 1) { - time->d -= 2; - } - /* skip over satruday */ - if (current_dow == 0 ) { + } else { + /* Completely mirror the forward direction. This also covers the 0 + * case, since if we start on the weekend, we want to move forward as + * if we stopped there while going backwards. */ + if (rem == 0) { + if (dow == 6) { + time->d += 2; + } else if (dow == 0) { + time->d += 1; + } + } else if (dow == 0) { time->d -= 1; - } - /* subtract increments of 5 weekdays as a week */ - time->d += (count / 5) * 7; - /* if current DOW minus the remainder < 0, subtract two days */ - current_dow = timelib_day_of_week(time->y, time->m, time->d); - time->d += (count % 5); - if ((count % 5) + current_dow < 1) { + } else if (dow + rem < 1) { time->d -= 2; } } + + time->d += rem; } static void do_adjust_special(timelib_time* time) diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt new file mode 100644 index 00000000000..d03a814d882 --- /dev/null +++ b/ext/date/tests/bug61642.phpt @@ -0,0 +1,62 @@ +--TEST-- +Bug #61642 (modify("+5 weekdays") returns Sunday) +--INI-- +date.timezone=UTC +--FILE-- +format('Y-m-d D'); +} + +echo '### ', implode(' ', $header), "\n\n"; + +foreach ($weekdays as $days) { + $line = array(); + + printf('%+3d ', $days); + + foreach ($dates as $startdate) { + $date = new DateTime($startdate); + $date->modify("{$days} weekdays"); + + $line[] = $date->format('Y-m-d D'); + } + + echo implode(' ', $line), "\n"; +} +?> +--EXPECTF-- +### 2012-03-29 Thu 2012-03-30 Fri 2012-03-31 Sat 2012-04-01 Sun 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu + +-11 2012-03-14 Wed 2012-03-15 Thu 2012-03-16 Fri 2012-03-16 Fri 2012-03-16 Fri 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed +-10 2012-03-15 Thu 2012-03-16 Fri 2012-03-19 Mon 2012-03-19 Mon 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu + -9 2012-03-16 Fri 2012-03-19 Mon 2012-03-20 Tue 2012-03-20 Tue 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri + -8 2012-03-19 Mon 2012-03-20 Tue 2012-03-21 Wed 2012-03-21 Wed 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon + -7 2012-03-20 Tue 2012-03-21 Wed 2012-03-22 Thu 2012-03-22 Thu 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue + -6 2012-03-21 Wed 2012-03-22 Thu 2012-03-23 Fri 2012-03-23 Fri 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed + -5 2012-03-22 Thu 2012-03-23 Fri 2012-03-26 Mon 2012-03-26 Mon 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu + -4 2012-03-23 Fri 2012-03-26 Mon 2012-03-27 Tue 2012-03-27 Tue 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri + -3 2012-03-26 Mon 2012-03-27 Tue 2012-03-28 Wed 2012-03-28 Wed 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon + -2 2012-03-27 Tue 2012-03-28 Wed 2012-03-29 Thu 2012-03-29 Thu 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon 2012-04-03 Tue + -1 2012-03-28 Wed 2012-03-29 Thu 2012-03-30 Fri 2012-03-30 Fri 2012-03-30 Fri 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed + +0 2012-03-29 Thu 2012-03-30 Fri 2012-04-02 Mon 2012-04-02 Mon 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu + +1 2012-03-30 Fri 2012-04-02 Mon 2012-04-02 Mon 2012-04-02 Mon 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri + +2 2012-04-02 Mon 2012-04-03 Tue 2012-04-03 Tue 2012-04-03 Tue 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon + +3 2012-04-03 Tue 2012-04-04 Wed 2012-04-04 Wed 2012-04-04 Wed 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue + +4 2012-04-04 Wed 2012-04-05 Thu 2012-04-05 Thu 2012-04-05 Thu 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed + +5 2012-04-05 Thu 2012-04-06 Fri 2012-04-06 Fri 2012-04-06 Fri 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu + +6 2012-04-06 Fri 2012-04-09 Mon 2012-04-09 Mon 2012-04-09 Mon 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri + +7 2012-04-09 Mon 2012-04-10 Tue 2012-04-10 Tue 2012-04-10 Tue 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon + +8 2012-04-10 Tue 2012-04-11 Wed 2012-04-11 Wed 2012-04-11 Wed 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue + +9 2012-04-11 Wed 2012-04-12 Thu 2012-04-12 Thu 2012-04-12 Thu 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed ++10 2012-04-12 Thu 2012-04-13 Fri 2012-04-13 Fri 2012-04-13 Fri 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed 2012-04-19 Thu ++11 2012-04-13 Fri 2012-04-16 Mon 2012-04-16 Mon 2012-04-16 Mon 2012-04-17 Tue 2012-04-18 Wed 2012-04-19 Thu 2012-04-20 Fri From 54b1414be00a7ea8a6ae87c7e45d6a9d405578d2 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 5 Aug 2012 19:25:15 -0700 Subject: [PATCH 372/641] add #61642 --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index eb4b7dfe7bd..56a947764f5 100644 --- a/NEWS +++ b/NEWS @@ -40,9 +40,13 @@ PHP NEWS CURLOPT_TRANSFER_ENCODING, CURLOPT_DNS_SERVERS and CURLOPT_USE_SSL. (Pierrick) . Fixed bug #55635 (CURLOPT_BINARYTRANSFER no longer used. The constant - still exists for backward compatibility but is doing nothing). (Pierrick) + still exists for backward compatibility but is doing nothing). (Pierrick) . Fixed bug #54995 (Missing CURLINFO_RESPONSE_CODE support). (Pierrick) +- Datetime + . Fixed bug #61642 (modify("+5 weekdays") returns Sunday). + (Dmitri Iouchtchenko) + - Hash . Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara) From 07ee764e5709dc8d9f26382d8e7438696f5bb834 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Thu, 19 Jul 2012 00:27:34 +0800 Subject: [PATCH 373/641] Fixed bug #62460 (php binaries installed as binary.dSYM) See http://marc.info/?l=php-cvs&m=125961714419896 Mac OS X 10.7&10.8 affected too. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index fa6c55769e2..d8965833132 100644 --- a/configure.in +++ b/configure.in @@ -1335,10 +1335,10 @@ PHP_CONFIGURE_PART(Configuring libtool) LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS" -dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6. +dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5, 10.6, 10.7 and 10.8. dnl This hack works around it. Ugly. case $host_alias in -*darwin9*|*darwin10*) +*darwin9*|*darwin10*|*darwin11*|*darwin12*) ac_cv_exeext= ;; esac From a239658b9ed06008ca0cbb69c4d85fdfa506c01c Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 5 Aug 2012 20:31:08 -0700 Subject: [PATCH 374/641] fix for #62460 --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index c22d7c2fd42..70cbe8ed833 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ PHP NEWS . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) + . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia) . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php). (Laruence) From 4a2d41a5bbcac465f4f8ec616ce25196326df7b4 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 5 Aug 2012 20:41:14 -0700 Subject: [PATCH 375/641] add note for mcrypt_ecb --- UPGRADING | 1 + 1 file changed, 1 insertion(+) diff --git a/UPGRADING b/UPGRADING index 7d37f760002..7aea61f642f 100755 --- a/UPGRADING +++ b/UPGRADING @@ -93,6 +93,7 @@ PHP X.Y UPGRADE NOTES instead. - IntlDateFormatter::format() and datefmt_format() now also accept an IntlCalendar object for formatting. +- Deprecated mcrypt_ecb() made to produce E_DEPRECATED. ======================================== 5. New Functions From 82bc8821f93064db5a6a42de70af9df2df1519d9 Mon Sep 17 00:00:00 2001 From: Brett Bieber Date: Tue, 24 Jul 2012 16:10:08 -0500 Subject: [PATCH 376/641] Minor spelling corrections --- ext/phar/phar/pharcommand.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 9e968694c3f..cb343675b55 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -91,7 +91,7 @@ class PharCommand extends CLICommand 'h' => array( 'typ' => 'select', 'val' => NULL, - 'inf' => ' Selects the hash algorithmn.', + 'inf' => ' Selects the hash algorithm.', 'select' => array('md5' => 'MD5','sha1' => 'SHA1') ), 'i' => array( @@ -107,7 +107,7 @@ class PharCommand extends CLICommand 'l' => array( 'typ' => 'int', 'val' => 0, - 'inf' => ' Number of preceeding subdirectories to strip from file entries', + 'inf' => ' Number of preceding subdirectories to strip from file entries', ), 'm' => array( 'typ' => 'any', @@ -461,7 +461,7 @@ class PharCommand extends CLICommand 'typ' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; @@ -981,7 +981,7 @@ class PharCommand extends CLICommand 'type' => 'any', 'val' => NULL, 'required' => 1, - 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', + 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.', ); return $args; } From 81c6a060a271c29123c342a282d2c48fda45be03 Mon Sep 17 00:00:00 2001 From: Ryusuke SEKIYAMA Date: Thu, 19 Jul 2012 15:18:31 +0900 Subject: [PATCH 377/641] Added Bison 2.5.1 to bison_version_list --- Zend/acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 97d5d647bb2..a7358fa85df 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -4,7 +4,7 @@ dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ # we only support certain bison versions - bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5" + bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1" # for standalone build of Zend Engine test -z "$SED" && SED=sed From 45f3322905dfa5ae60f7b5a55b8cb29d0ac63e5d Mon Sep 17 00:00:00 2001 From: Lonny Kapelushnik Date: Sun, 5 Aug 2012 15:36:36 +0000 Subject: [PATCH 378/641] var_export outputs an E_WARNING when recursion is detected --- .../tests/general_functions/var_export_error2.phpt | 3 ++- .../tests/general_functions/var_export_error3.phpt | 3 ++- ext/standard/var.c | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt index 2b306696a69..a6403e610de 100644 --- a/ext/standard/tests/general_functions/var_export_error2.phpt +++ b/ext/standard/tests/general_functions/var_export_error2.phpt @@ -15,4 +15,5 @@ var_export($obj, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9 \ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt index 03ed496aca5..c862691e911 100644 --- a/ext/standard/tests/general_functions/var_export_error3.phpt +++ b/ext/standard/tests/general_functions/var_export_error3.phpt @@ -15,4 +15,5 @@ var_export($a, true); ===DONE=== --EXPECTF-- -Fatal error: Nesting level too deep - recursive dependency? in %s on line 9 \ No newline at end of file +Warning: var_export does not handle circular references in %s on line 9 +===DONE=== diff --git a/ext/standard/var.c b/ext/standard/var.c index 735d0a7cbb5..494fb583c75 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -453,6 +453,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); @@ -469,6 +474,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) case IS_OBJECT: myht = Z_OBJPROP_PP(struc); + if(myht && myht->nApplyCount > 0){ + smart_str_appendl(buf, "NULL", 4); + zend_error(E_WARNING, "var_export does not handle circular references"); + return; + } if (level > 1) { smart_str_appendc(buf, '\n'); buffer_append_spaces(buf, level - 1); From 01e414bb6fb1f1939df3b45d3cd64f140f91e440 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 5 Aug 2012 21:00:04 -0700 Subject: [PATCH 379/641] Add #51363 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 623a791b4e7..9aa95dab698 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Core: . Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value). (Laruence) + . Fixed bug #51363 (Fatal error raised by var_export() not caught by error + handler). (Lonny Kapelushnik) - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) From ed793b2a3f857fd49c0c1b036062140da5b3e674 Mon Sep 17 00:00:00 2001 From: Matt Ficken Date: Mon, 6 Aug 2012 14:07:42 +0200 Subject: [PATCH 380/641] Added the intl tests extracted from Symfony. These are making the intl ext crash with ICU at least 4.6, but probably with earlier versions too. --- .../symfony_format_type_int32_intl1.phpt | 49 +++++++++++++++++++ .../symfony_format_type_int32_intl2.phpt | 33 +++++++++++++ .../symfony_format_type_int32_intl3.phpt | 32 ++++++++++++ .../symfony_format_type_int32_intl4.phpt | 30 ++++++++++++ .../symfony_format_type_int32_intl5.phpt | 30 ++++++++++++ .../symfony_format_type_int32_intl6.phpt | 32 ++++++++++++ .../symfony_format_type_int32_intl7.phpt | 32 ++++++++++++ 7 files changed, 238 insertions(+) create mode 100644 ext/intl/tests/symfony_format_type_int32_intl1.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl2.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl3.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl4.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl5.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl6.phpt create mode 100644 ext/intl/tests/symfony_format_type_int32_intl7.phpt diff --git a/ext/intl/tests/symfony_format_type_int32_intl1.phpt b/ext/intl/tests/symfony_format_type_int32_intl1.phpt new file mode 100644 index 00000000000..2867b35690b --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl2.phpt b/ext/intl/tests/symfony_format_type_int32_intl2.phpt new file mode 100644 index 00000000000..6a65a0a8092 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl3.phpt b/ext/intl/tests/symfony_format_type_int32_intl3.phpt new file mode 100644 index 00000000000..5e657db419b --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(14) "-2,147,483,648" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl4.phpt b/ext/intl/tests/symfony_format_type_int32_intl4.phpt new file mode 100644 index 00000000000..54043d92e92 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl5.phpt b/ext/intl/tests/symfony_format_type_int32_intl5.phpt new file mode 100644 index 00000000000..d5f78d7119b --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl6.phpt b/ext/intl/tests/symfony_format_type_int32_intl6.phpt new file mode 100644 index 00000000000..fa708799d13 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(21) "(SFD2,147,483,648.00)" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/tests/symfony_format_type_int32_intl7.phpt b/ext/intl/tests/symfony_format_type_int32_intl7.phpt new file mode 100644 index 00000000000..5bbe4266770 --- /dev/null +++ b/ext/intl/tests/symfony_format_type_int32_intl7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(19) "SFD2,147,483,647.00" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == From ad545949d027f39dad783d9cec1f4e4b58cd3680 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 14 Jul 2012 21:25:55 -0700 Subject: [PATCH 381/641] fix for display of Jewish month names --- ext/calendar/calendar.c | 23 ++++++++++++------ ext/calendar/jewish.c | 52 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 7926fad6714..1ab1f1652eb 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -140,7 +140,7 @@ const zend_function_entry calendar_functions[] = { PHP_FE(frenchtojd, arginfo_frenchtojd) PHP_FE(jddayofweek, arginfo_jddayofweek) PHP_FE(jdmonthname, arginfo_jdmonthname) - PHP_FE(easter_date, arginfo_easter_date) + PHP_FE(easter_date, arginfo_easter_date) PHP_FE(easter_days, arginfo_easter_days) PHP_FE(unixtojd, arginfo_unixtojd) PHP_FE(jdtounix, arginfo_jdtounix) @@ -199,11 +199,14 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = { {"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31, MonthNameShort, MonthNameLong}, {"Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30, - JewishMonthName, JewishMonthName}, + JewishMonthNameLeap, JewishMonthNameLeap}, {"French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30, FrenchMonthName, FrenchMonthName} }; +#define JEWISH_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) +#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) + /* For jddayofweek */ enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG }; @@ -288,7 +291,7 @@ static void _php_cal_info(int cal, zval **ret) PHP_FUNCTION(cal_info) { long cal = -1; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) { RETURN_FALSE; @@ -418,8 +421,14 @@ PHP_FUNCTION(cal_from_jd) add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1); add_assoc_string(return_value, "dayname", DayNameLong[dow], 1); /* month name */ - add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1); - add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1); + if(cal == CAL_JEWISH) { + /* special case for Jewish calendar */ + add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month], 1); + add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month], 1); + } else { + add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1); + add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1); + } } /* }}} */ @@ -608,7 +617,7 @@ PHP_FUNCTION(jdtojewish) RETURN_FALSE; } - snprintf(hebdate, sizeof(hebdate), "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp)); + snprintf(hebdate, sizeof(hebdate), "%s %s %s", heb_number_to_chars(day, fl, &dayp), JEWISH_HEB_MONTH_NAME(year)[month], heb_number_to_chars(year, fl, &yearp)); if (dayp) { efree(dayp); @@ -728,7 +737,7 @@ PHP_FUNCTION(jdmonthname) break; case CAL_MONTH_JEWISH: /* jewish month */ SdnToJewish(julday, &year, &month, &day); - monthname = JewishMonthName[month]; + monthname = JEWISH_MONTH_NAME(year)[month]; break; case CAL_MONTH_FRENCH: /* french month */ SdnToFrench(julday, &year, &month, &day); diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index f4dc7c35ae5..ac256c98606 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -297,9 +297,10 @@ static int yearOffset[19] = 136, 148, 160, 173, 185, 197, 210, 222 }; -char *JewishMonthName[14] = +/* names for leap (13-month) year */ +char *JewishMonthNameLeap[14] = { - "", + "", "Tishri", "Heshvan", "Kislev", @@ -315,15 +316,35 @@ char *JewishMonthName[14] = "Elul" }; -char *JewishMonthHebName[14] = +/* names for regular year */ +char *JewishMonthName[14] = { + "", + "Tishri", + "Heshvan", + "Kislev", + "Tevet", + "Shevat", "", + "Adar", + "Nisan", + "Iyyar", + "Sivan", + "Tammuz", + "Av", + "Elul" +}; + +/* names for leap (13-month) year */ +char *JewishMonthHebNameLeap[14] = +{ + "", "úùøé", "çùåï", "ëñìå", "èáú", "ùáè", - "àãø", + "'àãø ø", "'àãø á", "ðéñï", "àééø", @@ -333,6 +354,25 @@ char *JewishMonthHebName[14] = "àìåì" }; +/* names for regular year */ +char *JewishMonthHebName[14] = +{ + "", + "úùøé", + "çùåï", + "ëñìå", + "èáú", + "ùáè", + "", + "àãø", + "ðéñï", + "àééø", + "ñéåï", + "úîåæ", + "àá", + "àìåì" +}; + /************************************************************************ * Given the year within the 19 year metonic cycle and the time of a molad * (new moon) which starts that year, this routine will calculate what day @@ -587,11 +627,11 @@ void SdnToJewish( (*pMonth)--; (*pDay) += 30; } else { - *pMonth = 6; + *pMonth = 7; *pDay = inputDay - tishri1 + 207; if (*pDay > 0) return; - (*pMonth)--; + (*pMonth) -= 2; (*pDay) += 30; } if (*pDay > 0) From e1489c579389bfa820aa0f4eb20d12ef575c3afc Mon Sep 17 00:00:00 2001 From: Eitan Mosenkis Date: Sun, 15 Jul 2012 20:36:34 -0400 Subject: [PATCH 382/641] Update documentation to reflect fix of 54254 --- ext/calendar/jewish.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index ac256c98606..494d0659623 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -85,8 +85,8 @@ * 3 Kislev 29 30 30 29 30 30 (variable) * 4 Tevet 29 29 29 29 29 29 * 5 Shevat 30 30 30 30 30 30 - * 6 Adar I 29 29 29 30 30 30 (variable) - * 7 Adar II -- -- -- 29 29 29 (optional) + * 6 Adar I -- -- -- 30 30 30 (optional) + * 7 Adar II 29 29 29 29 29 29 * 8 Nisan 30 30 30 30 30 30 * 9 Iyyar 29 29 29 29 29 29 * 10 Sivan 30 30 30 30 30 30 @@ -100,8 +100,8 @@ * have multiple possible spellings in the Roman character set. I have * chosen to use the spellings found in the Encyclopedia Judaica. * - * Adar II, the month added for leap years, is sometimes referred to as - * the 13th month, but I have chosen to assign it the number 7 to keep + * Adar I, the month added for leap years, is sometimes referred to as + * the 13th month, but I have chosen to assign it the number 6 to keep * the months in chronological order. This may not be consistent with * other numbering schemes. * From dedc8f2682b14187782d9ff230529a049ffe8079 Mon Sep 17 00:00:00 2001 From: Eitan Mosenkis Date: Thu, 19 Jul 2012 08:54:30 -0400 Subject: [PATCH 383/641] Add test for interoperability of jdtojewish and cal_days_in_month --- ext/calendar/tests/bug54254.phpt | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ext/calendar/tests/bug54254.phpt diff --git a/ext/calendar/tests/bug54254.phpt b/ext/calendar/tests/bug54254.phpt new file mode 100644 index 00000000000..df9362320c0 --- /dev/null +++ b/ext/calendar/tests/bug54254.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #54254 (cal_days_in_month incompatible with jdtojewish in non-leap-years) +--SKIPIF-- + +--FILE-- + Date: Sun, 5 Aug 2012 20:15:21 -0700 Subject: [PATCH 384/641] some fixes for bug#54254 --- ext/calendar/calendar.c | 4 ++-- ext/calendar/jewish.c | 4 ++-- ext/calendar/sdncal.h | 3 +++ ext/calendar/tests/jdmonthname.phpt | 4 ++-- ext/calendar/tests/jdtojewish.phpt | 8 +++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 1ab1f1652eb..5947aabc986 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -204,8 +204,8 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = { FrenchMonthName, FrenchMonthName} }; -#define JEWISH_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) -#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) +#define JEWISH_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) +#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) /* For jddayofweek */ enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG }; diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index 494d0659623..a5849a7d769 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -86,7 +86,7 @@ * 4 Tevet 29 29 29 29 29 29 * 5 Shevat 30 30 30 30 30 30 * 6 Adar I -- -- -- 30 30 30 (optional) - * 7 Adar II 29 29 29 29 29 29 + * 7 Adar (II) 29 29 29 29 29 29 * 8 Nisan 30 30 30 30 30 30 * 9 Iyyar 29 29 29 29 29 29 * 10 Sivan 30 30 30 30 30 30 @@ -286,7 +286,7 @@ #define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204) #define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589) -static int monthsPerYear[19] = +int monthsPerYear[19] = { 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13 }; diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h index 81328d1369c..c0463c80d45 100644 --- a/ext/calendar/sdncal.h +++ b/ext/calendar/sdncal.h @@ -79,7 +79,10 @@ long int JulianToSdn(int year, int month, int day); void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay); long int JewishToSdn(int year, int month, int day); extern char *JewishMonthName[14]; +extern char *JewishMonthNameLeap[14]; extern char *JewishMonthHebName[14]; +extern char *JewishMonthHebNameLeap[14]; +extern int monthsPerYear[19]; /* French republic calendar conversions. */ void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay); diff --git a/ext/calendar/tests/jdmonthname.phpt b/ext/calendar/tests/jdmonthname.phpt index d05d3c595ef..207d320162b 100644 --- a/ext/calendar/tests/jdmonthname.phpt +++ b/ext/calendar/tests/jdmonthname.phpt @@ -178,7 +178,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan @@ -279,7 +279,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 484b95749cc..bc0ecbdd88e 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -14,10 +14,11 @@ var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n"); + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(3,10,2007))."\r\n"); ?> ---EXPECT-- -string(184) "2/22/5763 +--EXPECTF-- +string(%d) "2/22/5763 ëá çùåï äúùñâ ëá çùåï ä'úùñâ ëá çùåï ä àìôéí úùñâ @@ -27,4 +28,5 @@ string(184) "2/22/5763 á' çùåï ä'úùñ"â á' çùåï ä àìôéí úùñ"â á' çùåï ä' àìôéí úùñ"â +7/20/5767 " From a15459b2916b3ebbbe574f616529b31c2d9fbfe4 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 7 Aug 2012 01:17:17 -0700 Subject: [PATCH 385/641] text fixes from emosenkis --- ext/calendar/jewish.c | 8 ++++---- ext/calendar/tests/cal_info.phpt | 8 ++++---- ext/calendar/tests/jdmonthname.phpt | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index a5849a7d769..9e5b0beced7 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -306,8 +306,8 @@ char *JewishMonthNameLeap[14] = "Kislev", "Tevet", "Shevat", - "AdarI", - "AdarII", + "Adar I", + "Adar II", "Nisan", "Iyyar", "Sivan", @@ -344,8 +344,8 @@ char *JewishMonthHebNameLeap[14] = "ëñìå", "èáú", "ùáè", - "'àãø ø", - "'àãø á", + "àãø à'", + "àãø á'", "ðéñï", "àééø", "ñéåï", diff --git a/ext/calendar/tests/cal_info.phpt b/ext/calendar/tests/cal_info.phpt index 2e3e612925c..7edb4ce67ca 100644 --- a/ext/calendar/tests/cal_info.phpt +++ b/ext/calendar/tests/cal_info.phpt @@ -100,8 +100,8 @@ Array [3] => Kislev [4] => Tevet [5] => Shevat - [6] => AdarI - [7] => AdarII + [6] => Adar I + [7] => Adar II [8] => Nisan [9] => Iyyar [10] => Sivan @@ -117,8 +117,8 @@ Array [3] => Kislev [4] => Tevet [5] => Shevat - [6] => AdarI - [7] => AdarII + [6] => Adar I + [7] => Adar II [8] => Nisan [9] => Iyyar [10] => Sivan diff --git a/ext/calendar/tests/jdmonthname.phpt b/ext/calendar/tests/jdmonthname.phpt index 207d320162b..07ed1161b17 100644 --- a/ext/calendar/tests/jdmonthname.phpt +++ b/ext/calendar/tests/jdmonthname.phpt @@ -75,8 +75,8 @@ December --- mode 4 --- Tevet Shevat -AdarI -AdarII +Adar I +Adar II Nisan Iyyar Sivan From 1190bc440be0ab8ef6703dc9cb1dc4d64bf538f0 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 7 Aug 2012 01:47:50 -0700 Subject: [PATCH 386/641] bug #54254 --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 56a947764f5..0c177ddb267 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,10 @@ PHP NEWS other expressions (https://wiki.php.net/rfc/empty_isset_exprs). (Nikita Popov) +- Calendar: + . Fixed bug #54254 (cal_from_jd returns month = 6 when there is only one Adar) + (Stas, Eitan Mosenkis). + - Core: . Added boolval(). (Jille Timmermans). . Fixed bug #18556 (Engine uses locale rules to handle class names). (Stas) From 4db70fd406c805a296f4531088fe716a1ef67158 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 7 Aug 2012 22:59:12 -0700 Subject: [PATCH 387/641] fix bug #40459 - make all stream funcs that create object call ctor --- ext/standard/tests/streams/bug40459.phpt | 103 ++++++++++++ main/streams/userspace.c | 199 +++++++++-------------- 2 files changed, 184 insertions(+), 118 deletions(-) create mode 100644 ext/standard/tests/streams/bug40459.phpt diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt new file mode 100644 index 00000000000..8ee4363ed93 --- /dev/null +++ b/ext/standard/tests/streams/bug40459.phpt @@ -0,0 +1,103 @@ +--TEST-- +bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called +--FILE-- +constructorCalled = true; + } + + function stream_open($path, $mode, $options, &$opened_path) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return true; + } + + function url_stat($url, $flags) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return array(); + } + + function unlink($url) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rename($from, $to) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function mkdir($dir, $mode, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function rmdir($dir, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + } + + function dir_opendir($url, $options) + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } + function stream_metadata() + { + echo $this->constructorCalled ? 'yes' : 'no'; + return TRUE; + } +} + +stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL); + +echo 'stream_open: '; +fopen('test://test', 'r'); +echo "\n"; + +echo 'url_stat: '; +stat('test://test'); +echo "\n"; + +echo 'dir_opendir: '; +opendir('test://test'); +echo "\n"; + +echo 'rmdir: '; +rmdir('test://test'); +echo "\n"; + +echo 'mkdir: '; +mkdir('test://test'); +echo "\n"; + +echo 'rename: '; +rename('test://test', 'test://test2'); +echo "\n"; + +echo 'unlink: '; +unlink('test://test'); +echo "\n"; + +echo 'touch: '; +touch('test://test', time()); +echo "\n"; + + + +?> +==DONE== +--EXPECT-- +stream_open: yes +url_stat: yes +dir_opendir: yes +rmdir: yes +mkdir: yes +rename: yes +unlink: yes +touch: yes +==DONE== diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 96a5195ed32..3b277160d6a 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -281,6 +281,57 @@ typedef struct _php_userstream_data php_userstream_data_t; }}} **/ +static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context TSRMLS_DC) +{ + zval *object; + /* create an instance of our class */ + ALLOC_ZVAL(object); + object_init_ex(object, uwrap->ce); + Z_SET_REFCOUNT_P(object, 1); + Z_SET_ISREF_P(object); + + if (context) { + add_property_resource(object, "context", context->rsrc_id); + zend_list_addref(context->rsrc_id); + } else { + add_property_null(object, "context"); + } + + if (uwrap->ce->constructor) { + zend_fcall_info fci; + zend_fcall_info_cache fcc; + zval *retval_ptr; + + fci.size = sizeof(fci); + fci.function_table = &uwrap->ce->function_table; + fci.function_name = NULL; + fci.symbol_table = NULL; + fci.object_ptr = object; + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 0; + fci.params = NULL; + fci.no_separation = 1; + + fcc.initialized = 1; + fcc.function_handler = uwrap->ce->constructor; + fcc.calling_scope = EG(scope); + fcc.called_scope = Z_OBJCE_P(object); + fcc.object_ptr = object; + + if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name); + zval_dtor(object); + FREE_ZVAL(object); + return NULL; + } else { + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + } + } + return object; +} + static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; @@ -312,53 +363,12 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena us = emalloc(sizeof(*us)); us->wrapper = uwrap; - /* create an instance of our class */ - ALLOC_ZVAL(us->object); - object_init_ex(us->object, uwrap->ce); - Z_SET_REFCOUNT_P(us->object, 1); - Z_SET_ISREF_P(us->object); - - if (uwrap->ce->constructor) { - zend_fcall_info fci; - zend_fcall_info_cache fcc; - zval *retval_ptr; - - fci.size = sizeof(fci); - fci.function_table = &uwrap->ce->function_table; - fci.function_name = NULL; - fci.symbol_table = NULL; - fci.object_ptr = us->object; - fci.retval_ptr_ptr = &retval_ptr; - fci.param_count = 0; - fci.params = NULL; - fci.no_separation = 1; - - fcc.initialized = 1; - fcc.function_handler = uwrap->ce->constructor; - fcc.calling_scope = EG(scope); - fcc.called_scope = Z_OBJCE_P(us->object); - fcc.object_ptr = us->object; - - if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name); - zval_dtor(us->object); - FREE_ZVAL(us->object); - efree(us); - FG(user_stream_current_filename) = NULL; - PG(in_user_include) = old_in_user_include; - return NULL; - } else { - if (retval_ptr) { - zval_ptr_dtor(&retval_ptr); - } - } - } - - if (context) { - add_property_resource(us->object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(us->object, "context"); + us->object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(us->object == NULL) { + FG(user_stream_current_filename) = NULL; + PG(in_user_include) = old_in_user_include; + efree(us); + return NULL; } /* call it's stream_open method - set up params first */ @@ -447,17 +457,11 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filen us = emalloc(sizeof(*us)); us->wrapper = uwrap; - /* create an instance of our class */ - ALLOC_ZVAL(us->object); - object_init_ex(us->object, uwrap->ce); - Z_SET_REFCOUNT_P(us->object, 1); - Z_SET_ISREF_P(us->object); - - if (context) { - add_property_resource(us->object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(us->object, "context"); + us->object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(us == NULL) { + FG(user_stream_current_filename) = NULL; + efree(us); + return NULL; } /* call it's dir_open method - set up params first */ @@ -1157,16 +1161,9 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the unlink method */ @@ -1211,16 +1208,9 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the rename method */ @@ -1270,16 +1260,9 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the mkdir method */ @@ -1335,16 +1318,9 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int option int ret = 0; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call the rmdir method */ @@ -1420,16 +1396,10 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int opt } /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + zval_ptr_dtor(&zvalue); + return ret; } /* call the mkdir method */ @@ -1484,16 +1454,9 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int fla int ret = -1; /* create an instance of our class */ - ALLOC_ZVAL(object); - object_init_ex(object, uwrap->ce); - Z_SET_REFCOUNT_P(object, 1); - Z_SET_ISREF_P(object); - - if (context) { - add_property_resource(object, "context", context->rsrc_id); - zend_list_addref(context->rsrc_id); - } else { - add_property_null(object, "context"); + object = user_stream_create_object(uwrap, context TSRMLS_CC); + if(object == NULL) { + return ret; } /* call it's stat_url method - set up params first */ From 128a4bbb0d4ff958771401a5c17c2995f03e8414 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 7 Aug 2012 23:03:33 -0700 Subject: [PATCH 388/641] News for bug#40459 --- NEWS | 2 ++ UPGRADING | 3 +++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 9aa95dab698..60fe2b91fe3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ PHP NEWS the exit value). (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error handler). (Lonny Kapelushnik) + . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call + constructor). (Stas) - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) diff --git a/UPGRADING b/UPGRADING index f3a9c3ee8d1..68102b8447e 100755 --- a/UPGRADING +++ b/UPGRADING @@ -347,6 +347,9 @@ PHP 5.4 UPGRADE NOTES allows for toggling if the list of namespaces starts from the document root or from the node you call the method on +- Since 5.4.7, ctor is always called when new user stream wrapper object is created. + Before, it was called only when stream_open was called. + ============================== 5. Changes to existing classes ============================== From 3d4169d751d443313da9f6299d1aff3d9fdc7ed0 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Thu, 9 Aug 2012 21:43:59 +0800 Subject: [PATCH 389/641] Fix phpcredits() BC after remove Logo GUIDs This test was affected: ext/standard/tests/general_functions/phpcredits2.phpt see https://github.com/php/php-src/pull/132/files#diff-3 This makes constant PHP_CREDITS_FULLPAGE didn't functional anymore. --- ext/standard/credits.c | 8 ++++++++ ext/standard/info.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/standard/credits.c b/ext/standard/credits.c index 0f5d6d73511..e87cdcad8be 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -27,6 +27,10 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ { + if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { + php_print_info_htmlhead(TSRMLS_C); + } + if (!sapi_module.phpinfo_as_text) { PUTS("

PHP Credits

\n"); } else { @@ -119,6 +123,10 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ CREDIT_LINE("Windows Infrastructure", "Alex Schoenmaker"); php_info_print_table_end(); } + + if (!sapi_module.phpinfo_as_text && flag & PHP_CREDITS_FULLPAGE) { + PUTS("\n"); + } } /* }}} */ diff --git a/ext/standard/info.c b/ext/standard/info.c index 089f515d95b..beb147797d9 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -881,7 +881,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { php_info_print_hr(); - php_print_credits(PHP_CREDITS_ALL TSRMLS_CC); + php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE TSRMLS_CC); } if (flag & PHP_INFO_LICENSE) { From c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 9 Aug 2012 14:02:33 -0400 Subject: [PATCH 390/641] Update to work with libxml 2.9.0 --- ext/dom/documenttype.c | 4 ++++ ext/dom/node.c | 8 ++++++++ ext/simplexml/simplexml.c | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index d61ba796ab5..eee3b5f887d 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -205,7 +205,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_ if (buff != NULL) { xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL); xmlOutputBufferFlush(buff); +#ifdef LIBXML2_NEW_BUFFER + ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1); +#else ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1); +#endif (void)xmlOutputBufferClose(buff); return SUCCESS; } diff --git a/ext/dom/node.c b/ext/dom/node.c index 5bcb234762e..727d1bcef38 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ RETVAL_FALSE; } else { if (mode == 0) { +#ifdef LIBXML2_NEW_BUFFER + ret = xmlOutputBufferGetSize(buf); +#else ret = buf->buffer->use; +#endif if (ret > 0) { +#ifdef LIBXML2_NEW_BUFFER + RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1); +#else RETVAL_STRINGL((char *) buf->buffer->content, ret, 1); +#endif } else { RETVAL_EMPTY_STRING(); } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index a379111021e..236859686f5 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1387,7 +1387,11 @@ SXE_METHOD(asXML) xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding); xmlOutputBufferFlush(outbuf); +#ifdef LIBXML2_NEW_BUFFER + RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1); +#else RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1); +#endif xmlOutputBufferClose(outbuf); } } else { From a5dfd414941953c282bb68f6b08685252ca93a1a Mon Sep 17 00:00:00 2001 From: Leigh Date: Fri, 10 Aug 2012 11:09:25 +0100 Subject: [PATCH 391/641] zend_make_printable_zval choses cast_object over __toString https://bugs.php.net/bug.php?id=62328 Added a check to see if the object implements a __toString magic method. This should be called instead of the cast_object method of built-in classes when defined. --- Zend/zend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zend/zend.c b/Zend/zend.c index 18c4f11604c..be30e92e7dd 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -258,6 +258,12 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop { TSRMLS_FETCH(); + if (Z_OBJCE_P(expr)->__tostring) { + if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { + break; + } + } + if (Z_OBJ_HANDLER_P(expr, cast_object)) { zval *val; From 222ab9da1aa086a47279d29c16a8ebea514257fe Mon Sep 17 00:00:00 2001 From: Leigh Date: Fri, 10 Aug 2012 11:43:53 +0100 Subject: [PATCH 392/641] Test for bug 62328 --- Zend/tests/bug62328.phpt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Zend/tests/bug62328.phpt diff --git a/Zend/tests/bug62328.phpt b/Zend/tests/bug62328.phpt new file mode 100644 index 00000000000..c56ddc2c69f --- /dev/null +++ b/Zend/tests/bug62328.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #62328 (cast_object takes precedence over __toString) +--FILE-- +__toString() . PHP_EOL; + +?> +--EXPECT-- +__toString +__toString From 7130887719684cff57cb904a6f1b2de5016a00c8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 11 Aug 2012 00:22:52 +0800 Subject: [PATCH 393/641] Fix test, from PR 158 --- ext/xmlrpc/tests/bug61264.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/xmlrpc/tests/bug61264.phpt b/ext/xmlrpc/tests/bug61264.phpt index b1da27f2520..24e4b2749c8 100644 --- a/ext/xmlrpc/tests/bug61264.phpt +++ b/ext/xmlrpc/tests/bug61264.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable +--SKIPIF-- + --FILE-- Date: Sat, 11 Aug 2012 00:34:37 +0800 Subject: [PATCH 394/641] Skip tests reply on Zend MM turned on Those two tests have expect memory exhausted fatal error --- ext/oci8/tests/pecl_bug10194_blob.phpt | 3 +++ ext/standard/tests/strings/str_pad_variation5.phpt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt index faf87ab3c16..96f94bcf4c1 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -6,6 +6,9 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} ?> --INI-- memory_limit=3M diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt index 4b300c4717d..cd979a1c8b1 100644 --- a/ext/standard/tests/strings/str_pad_variation5.phpt +++ b/ext/standard/tests/strings/str_pad_variation5.phpt @@ -5,6 +5,9 @@ memory_limit=128M --SKIPIF-- --FILE-- Date: Sat, 11 Aug 2012 15:59:06 +0800 Subject: [PATCH 395/641] Fixed bug #62795 (Zip extension version not defined) --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index d53e569db14..862575bbb8e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,6 +15,7 @@ ext/dba/libflatfile/flatfile.c ident ext/dba/libcdb/cdb_make.c ident ext/dba/libcdb/cdb.c ident ext/filter/filter.c ident +ext/zip/php_zip.c ident README.input_filter ident run-tests.php ident sapi/nsapi/nsapi.c ident From 7b307fb930e6cf328993dee4b060f6f823c39d24 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 11:50:28 +0800 Subject: [PATCH 396/641] Fixed bug #62328 (implementing __toString and a cast to string fails) __toString should has a high priority --- NEWS | 2 ++ Zend/zend.c | 9 +++------ ext/xml/tests/bug62328.phpt | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 ext/xml/tests/bug62328.phpt diff --git a/NEWS b/NEWS index 60fe2b91fe3..6efc0dfcb2e 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: + . Fixed bug #62328 (implementing __toString and a cast to string fails) + (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value). (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error diff --git a/Zend/zend.c b/Zend/zend.c index 18c4f11604c..09338e7f834 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -258,6 +258,9 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop { TSRMLS_FETCH(); + if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { + break; + } if (Z_OBJ_HANDLER_P(expr, cast_object)) { zval *val; @@ -270,12 +273,6 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } zval_ptr_dtor(&val); } - /* Standard PHP objects */ - if (Z_OBJ_HT_P(expr) == &std_object_handlers || !Z_OBJ_HANDLER_P(expr, cast_object)) { - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { - break; - } - } if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); diff --git a/ext/xml/tests/bug62328.phpt b/ext/xml/tests/bug62328.phpt new file mode 100644 index 00000000000..e4c3c59d37e --- /dev/null +++ b/ext/xml/tests/bug62328.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62328 (implementing __toString and a cast to string fails) +--SKIPIF-- + +--FILE-- +'); + +var_dump((string) $xml); +var_dump($xml->__toString()); +--EXPECT-- +string(15) "stringification" +string(15) "stringification" From 786670f53682c1e43f52c7642e6e47ed25f6708d Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 12:00:16 +0800 Subject: [PATCH 397/641] Update NEWS --- NEWS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6efc0dfcb2e..236f8e56938 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,6 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: - . Fixed bug #62328 (implementing __toString and a cast to string fails) - (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value). (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error @@ -12,6 +10,10 @@ PHP NEWS . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call constructor). (Stas) +- SimpleXML: + . Fixed bug #62328 (implementing __toString and a cast to string fails) + (Laruence) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) From 32c1c5a19fab5c1471a5902a54efcd0875fe7e79 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 12:02:02 +0800 Subject: [PATCH 398/641] Revert "Test for bug 62328" This reverts commit 222ab9da1aa086a47279d29c16a8ebea514257fe. --- Zend/tests/bug62328.phpt | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Zend/tests/bug62328.phpt diff --git a/Zend/tests/bug62328.phpt b/Zend/tests/bug62328.phpt deleted file mode 100644 index c56ddc2c69f..00000000000 --- a/Zend/tests/bug62328.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #62328 (cast_object takes precedence over __toString) ---FILE-- -__toString() . PHP_EOL; - -?> ---EXPECT-- -__toString -__toString From 75f6c8d42cfcf856d7a12f67c3981f3ad62660e9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 12:02:06 +0800 Subject: [PATCH 399/641] Revert "zend_make_printable_zval choses cast_object over __toString" This reverts commit a5dfd414941953c282bb68f6b08685252ca93a1a. --- Zend/zend.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index be30e92e7dd..18c4f11604c 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -258,12 +258,6 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop { TSRMLS_FETCH(); - if (Z_OBJCE_P(expr)->__tostring) { - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { - break; - } - } - if (Z_OBJ_HANDLER_P(expr, cast_object)) { zval *val; From 4970926e4543c15e16b0c047d85dddfb4c09b581 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 20:58:09 +0800 Subject: [PATCH 400/641] Fixed bug #62763 (register_shutdown_function and extending class) --- NEWS | 2 ++ Zend/tests/bug62763.phpt | 23 +++++++++++++++++++++++ ext/standard/basic_functions.c | 7 +++++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug62763.phpt diff --git a/NEWS b/NEWS index 70cbe8ed833..985e27456c5 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.3.16 - Core: + . Fixed bug #62763 (register_shutdown_function and extending class). + (Laruence) . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt new file mode 100644 index 00000000000..50c27bdf35e --- /dev/null +++ b/Zend/tests/bug62763.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #62763 (register_shutdown_function and extending class) +--FILE-- + +--EXPECT-- +test1::shutdowntest2::__destruct diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 99831a1f421..4858b6e375d 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5108,8 +5108,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */ zend_hash_destroy(BG(user_shutdown_function_names)); FREE_HASHTABLE(BG(user_shutdown_function_names)); BG(user_shutdown_function_names) = NULL; - } - zend_end_try(); + } zend_catch { + /* maybe shutdown method call exit, we just ignore it */ + FREE_HASHTABLE(BG(user_shutdown_function_names)); + BG(user_shutdown_function_names) = NULL; + } zend_end_try(); } /* }}} */ From be818e7ea7a7627ab12faa70d9e70a85c823f738 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 12 Aug 2012 20:59:33 +0800 Subject: [PATCH 401/641] Update NEWS --- NEWS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 236f8e56938..da53df00c0a 100644 --- a/NEWS +++ b/NEWS @@ -3,17 +3,17 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: + . Fixed bug #62763 (register_shutdown_function and extending class). + (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value). (Laruence) + . Fixed bug #62328 (implementing __toString and a cast to string fails) + (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error handler). (Lonny Kapelushnik) . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call constructor). (Stas) -- SimpleXML: - . Fixed bug #62328 (implementing __toString and a cast to string fails) - (Laruence) - - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) From 212cfb95d1c7eb7202e1386294808eceef386b78 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 13 Aug 2012 11:03:35 +0800 Subject: [PATCH 402/641] more test script for #62328 --- ext/spl/tests/bug62328.phpt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ext/spl/tests/bug62328.phpt diff --git a/ext/spl/tests/bug62328.phpt b/ext/spl/tests/bug62328.phpt new file mode 100644 index 00000000000..33a8aeee953 --- /dev/null +++ b/ext/spl/tests/bug62328.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62328 (cast_object takes precedence over __toString) +--CREDITS-- +leight at gmail dot com +--FILE-- +__toString() . PHP_EOL; + +?> +--EXPECT-- +__toString +__toString From 80d5ae3cea4c6fdd85789edfde0e2da721a0741b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 13 Aug 2012 21:48:39 +0800 Subject: [PATCH 403/641] Implemented 'finally' keywords for php RFC: https://wiki.php.net/rfc/finally FR: https://bugs.php.net/bug.php?id=32100 and I have got some improvment ideas(performance), will implemented later. thanks --- NEWS | 1 + UPGRADING | 2 + Zend/tests/catch_finally_001.phpt | 32 + Zend/tests/catch_finally_002.phpt | 21 + Zend/tests/catch_finally_003.phpt | 40 + Zend/tests/catch_finally_004.phpt | 41 + Zend/tests/catch_finally_005.phpt | 21 + Zend/tests/catch_finally_006.phpt | 28 + Zend/tests/try_catch_finally_001.phpt | 36 + Zend/tests/try_catch_finally_002.phpt | 42 + Zend/tests/try_catch_finally_003.phpt | 38 + Zend/tests/try_catch_finally_004.phpt | 30 + Zend/tests/try_finally_001.phpt | 23 + Zend/tests/try_finally_002.phpt | 23 + Zend/tests/try_finally_003.phpt | 27 + Zend/zend_compile.c | 49 +- Zend/zend_compile.h | 6 +- Zend/zend_language_parser.y | 22 +- Zend/zend_language_scanner.c | 1427 +++++++++++++------------ Zend/zend_language_scanner.l | 4 + Zend/zend_language_scanner_defs.h | 2 +- Zend/zend_vm_def.h | 195 +++- Zend/zend_vm_execute.h | 534 ++++++++- Zend/zend_vm_execute.skl | 1 + Zend/zend_vm_opcodes.h | 1 + 25 files changed, 1895 insertions(+), 751 deletions(-) create mode 100644 Zend/tests/catch_finally_001.phpt create mode 100644 Zend/tests/catch_finally_002.phpt create mode 100644 Zend/tests/catch_finally_003.phpt create mode 100644 Zend/tests/catch_finally_004.phpt create mode 100644 Zend/tests/catch_finally_005.phpt create mode 100644 Zend/tests/catch_finally_006.phpt create mode 100644 Zend/tests/try_catch_finally_001.phpt create mode 100644 Zend/tests/try_catch_finally_002.phpt create mode 100644 Zend/tests/try_catch_finally_003.phpt create mode 100644 Zend/tests/try_catch_finally_004.phpt create mode 100644 Zend/tests/try_finally_001.phpt create mode 100644 Zend/tests/try_finally_002.phpt create mode 100644 Zend/tests/try_finally_003.phpt diff --git a/NEWS b/NEWS index 0c177ddb267..58eeabd37f2 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 201?, PHP 5.5.0 - General improvements: + . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). (Laruence) . Drop Windows XP and 2003 support. (Pierre) . World domination . Improve set_exception_handler while doing reset.(Laruence) diff --git a/UPGRADING b/UPGRADING index 4fac7a88f57..f95ab4962b1 100755 --- a/UPGRADING +++ b/UPGRADING @@ -31,6 +31,8 @@ PHP X.Y UPGRADE NOTES 2. New Features ======================================== +- Support finally keyword. (Laruence) + (wiki.php.net/rfc/finally) - Support constant array/string dereferencing. (Laruence) (https://wiki.php.net/rfc/constdereference) - Add support for using empty() on the result of function calls and diff --git a/Zend/tests/catch_finally_001.phpt b/Zend/tests/catch_finally_001.phpt new file mode 100644 index 00000000000..2b58fa71326 --- /dev/null +++ b/Zend/tests/catch_finally_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +try +finally +end + +try +catch +finally +end diff --git a/Zend/tests/catch_finally_002.phpt b/Zend/tests/catch_finally_002.phpt new file mode 100644 index 00000000000..5f36ae2aa8b --- /dev/null +++ b/Zend/tests/catch_finally_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +Try catch finally return +--FILE-- + +--EXPECTF-- +try +finally +int(1) diff --git a/Zend/tests/catch_finally_003.phpt b/Zend/tests/catch_finally_003.phpt new file mode 100644 index 00000000000..a47c6f0f2c3 --- /dev/null +++ b/Zend/tests/catch_finally_003.phpt @@ -0,0 +1,40 @@ +--TEST-- +Try catch finally multi-return +--FILE-- + +--EXPECTF-- +string(3) "try" +string(7) "finally" +string(7) "finally" +try +string(4) "para" diff --git a/Zend/tests/catch_finally_004.phpt b/Zend/tests/catch_finally_004.phpt new file mode 100644 index 00000000000..be32a435c3a --- /dev/null +++ b/Zend/tests/catch_finally_004.phpt @@ -0,0 +1,41 @@ +--TEST-- +Nesting try catch finally +--FILE-- +getMessage()); +} while ($ex = $ex->getPrevious()); +?> +--EXPECT-- +123432int(1) +string(7) "finally" +string(5) "catch" diff --git a/Zend/tests/catch_finally_005.phpt b/Zend/tests/catch_finally_005.phpt new file mode 100644 index 00000000000..d8573bd4e28 --- /dev/null +++ b/Zend/tests/catch_finally_005.phpt @@ -0,0 +1,21 @@ +--TEST-- +Try catch finally with return +--FILE-- + +--EXPECTF-- +int(3) diff --git a/Zend/tests/catch_finally_006.phpt b/Zend/tests/catch_finally_006.phpt new file mode 100644 index 00000000000..48937c40d44 --- /dev/null +++ b/Zend/tests/catch_finally_006.phpt @@ -0,0 +1,28 @@ +--TEST-- +Try catch finally: re-throw exception in catch block +--FILE-- +getMessage()); +} +?> +--EXPECT-- +string(4) "para" +string(7) "finally" +string(2) "ex" diff --git a/Zend/tests/try_catch_finally_001.phpt b/Zend/tests/try_catch_finally_001.phpt new file mode 100644 index 00000000000..3d478f461ae --- /dev/null +++ b/Zend/tests/try_catch_finally_001.phpt @@ -0,0 +1,36 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +1234int(1) diff --git a/Zend/tests/try_catch_finally_002.phpt b/Zend/tests/try_catch_finally_002.phpt new file mode 100644 index 00000000000..94143f6fd1e --- /dev/null +++ b/Zend/tests/try_catch_finally_002.phpt @@ -0,0 +1,42 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +123456int(7) diff --git a/Zend/tests/try_catch_finally_003.phpt b/Zend/tests/try_catch_finally_003.phpt new file mode 100644 index 00000000000..78b37be1248 --- /dev/null +++ b/Zend/tests/try_catch_finally_003.phpt @@ -0,0 +1,38 @@ +--TEST-- +Try catch finally +--FILE-- + +--EXPECTF-- +1234int(4) diff --git a/Zend/tests/try_catch_finally_004.phpt b/Zend/tests/try_catch_finally_004.phpt new file mode 100644 index 00000000000..c6946012d9c --- /dev/null +++ b/Zend/tests/try_catch_finally_004.phpt @@ -0,0 +1,30 @@ +--TEST-- +Try catch finally +--CREDITS-- +adoy +--FILE-- + +--EXPECTF-- +string(3) "try" +string(7) "finally" +string(8) "finally2" diff --git a/Zend/tests/try_finally_001.phpt b/Zend/tests/try_finally_001.phpt new file mode 100644 index 00000000000..1c168da275c --- /dev/null +++ b/Zend/tests/try_finally_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +Try finally +--FILE-- + +--EXPECTF-- +string(7) "finally" + +Fatal error: Uncaught exception 'Exception' with message 'ex' %s +Stack trace: +#0 %stry_finally_001.php(%d): foo('finally') +#1 {main} + thrown in %stry_finally_001.php on line %d + diff --git a/Zend/tests/try_finally_002.phpt b/Zend/tests/try_finally_002.phpt new file mode 100644 index 00000000000..44676966fe2 --- /dev/null +++ b/Zend/tests/try_finally_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Try finally +--FILE-- +getMessage()); + } while ($e = $e->getPrevious()); +} +?> +--EXPECT-- +string(7) "finally" +string(3) "try" diff --git a/Zend/tests/try_finally_003.phpt b/Zend/tests/try_finally_003.phpt new file mode 100644 index 00000000000..c5a380995ab --- /dev/null +++ b/Zend/tests/try_finally_003.phpt @@ -0,0 +1,27 @@ +--TEST-- +Try finally +--FILE-- + +--EXPECTF-- +1234 +Fatal error: Uncaught exception 'Exception' with message 'ex' %s +Stack trace: +#0 %stry_finally_003.php(%d): foo() +#1 {main} + thrown in %stry_finally_003.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f8b8941e795..1e995b6738a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2661,6 +2661,7 @@ static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch); CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op; + CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0; return try_catch_offset; } /* }}} */ @@ -2677,7 +2678,7 @@ void zend_do_first_catch(znode *open_parentheses TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{ */ +void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC) /* {{{ */ { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2694,7 +2695,7 @@ void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC) /* {{{ zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); zend_llist_add_element(jmp_list_ptr, &jmp_op_number); - zend_add_catch_element(try_token->u.op.opline_num, get_next_op_number(CG(active_op_array)) TSRMLS_CC); + catch_token->EA = get_next_op_number(CG(active_op_array)); } /* }}} */ @@ -2720,7 +2721,11 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */ } /* }}} */ -void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ +void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ { + finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); +} /* }}} */ + +void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ { long catch_op_number; zend_op *opline; @@ -2748,11 +2753,11 @@ void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var, Z_STRVAL(catch_var->u.constant) = (char*)CG(active_op_array)->vars[opline->op2.var].name; opline->result.num = 0; /* 1 means it's the last catch in the block */ - try_token->u.op.opline_num = catch_op_number; + catch_token->u.op.opline_num = catch_op_number; } /* }}} */ -void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */ +void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */ { int jmp_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2766,7 +2771,39 @@ void zend_do_end_catch(const znode *try_token TSRMLS_DC) /* {{{ */ zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); zend_llist_add_element(jmp_list_ptr, &jmp_op_number); - CG(active_op_array)->opcodes[try_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array)); + CG(active_op_array)->opcodes[catch_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array)); +} +/* }}} */ + +void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ { + if (catch_token->op_type != IS_UNUSED) { + zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC); + } +} +/* }}} */ + + +void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */ +{ + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) { + zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally"); + } + if (finally_token->op_type != IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; + //try_token->u.op.opline_num = catch_token->u.op.opline_num; + + opline->opcode = ZEND_LEAVE; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + } + if (catch_token->op_type == IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0; + } //else { + // try_token->u.op.opline_num = catch_token->u.op.opline_num; + //} + } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index f164122785b..f604de4699c 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -132,6 +132,7 @@ typedef struct _zend_label { typedef struct _zend_try_catch_element { zend_uint try_op; zend_uint catch_op; /* ketchup! */ + zend_uint finally_op; } zend_try_catch_element; #if SIZEOF_LONG == 8 @@ -381,6 +382,7 @@ struct _zend_execute_data { zend_class_entry *current_called_scope; zval *current_this; zval *current_object; + zend_bool leaving; }; #define EX(element) execute_data.element @@ -496,7 +498,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC); -void zend_do_end_catch(const znode *try_token TSRMLS_DC); +void zend_do_end_catch(znode *catch_token TSRMLS_DC); void zend_do_throw(const znode *expr TSRMLS_DC); ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time); @@ -662,7 +664,7 @@ void print_op_array(zend_op_array *op_array, int optimizations); ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC); zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array); void zend_do_first_catch(znode *open_parentheses TSRMLS_DC); -void zend_initialize_try_catch_element(const znode *try_token TSRMLS_DC); +void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC); void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC); ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index c88e9a7c004..80760a5a543 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -160,6 +160,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); %token T_RETURN "return (T_RETURN)" %token T_TRY "try (T_TRY)" %token T_CATCH "catch (T_CATCH)" +%token T_FINALLY "finally (T_FINALLY)" %token T_THROW "throw (T_THROW)" %token T_USE "use (T_USE)" %token T_INSTEADOF "insteadof (T_INSTEADOF)" @@ -314,15 +315,24 @@ unticked_statement: | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}' - T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } - fully_qualified_class_name { zend_do_first_catch(&$7 TSRMLS_CC); } - T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, &$7 TSRMLS_CC); } - '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } - additional_catches { zend_do_mark_last_catch(&$7, &$18 TSRMLS_CC); } + catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); } + finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); } | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); } | T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); } ; +catch_statement: + /* empty */ { $$.op_type = IS_UNUSED; } + | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } + fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); } + T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); } + '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } + additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;} + +finally_statement: + /* empty */ { $$.op_type = IS_UNUSED; } + | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; } +; additional_catches: non_empty_additional_catches { $$ = $1; } @@ -334,12 +344,10 @@ non_empty_additional_catches: | non_empty_additional_catches additional_catch { $$ = $2; } ; - additional_catch: T_CATCH '(' fully_qualified_class_name { $$.u.op.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } ; - unset_variables: unset_variable | unset_variables ',' unset_variable diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 0bfbac99750..f4289c38000 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Apr 30 15:56:25 2012 */ +/* Generated by re2c 0.13.5 on Tue Jul 24 17:16:42 2012 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -1097,7 +1097,7 @@ yyc_INITIAL: yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1791 "Zend/zend_language_scanner.l" +#line 1795 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1175,7 +1175,7 @@ yy5: yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1779 "Zend/zend_language_scanner.l" +#line 1783 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1194,7 +1194,7 @@ yy7: if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1756 "Zend/zend_language_scanner.l" +#line 1760 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1392,7 +1392,7 @@ yy35: ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1716 "Zend/zend_language_scanner.l" +#line 1720 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1436,7 +1436,7 @@ yy43: ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1734 "Zend/zend_language_scanner.l" +#line 1738 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { zendlval->value.str.val = yytext; /* no copying - intentional */ @@ -1454,7 +1454,7 @@ yy45: ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1747 "Zend/zend_language_scanner.l" +#line 1751 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1489,7 +1489,7 @@ yy50: yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1769 "Zend/zend_language_scanner.l" +#line 1773 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -1569,7 +1569,7 @@ yyc_ST_BACKQUOTE: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2242 "Zend/zend_language_scanner.l" +#line 2246 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1621,7 +1621,7 @@ yy58: ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2186 "Zend/zend_language_scanner.l" +#line 2190 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; @@ -1636,7 +1636,7 @@ yy61: ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1659,7 +1659,7 @@ yy63: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1671,7 +1671,7 @@ yy66: ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -1690,7 +1690,7 @@ yy70: ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1716,7 +1716,7 @@ yy73: ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1792,7 +1792,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2192 "Zend/zend_language_scanner.l" +#line 2196 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1852,7 +1852,7 @@ yy80: ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2181 "Zend/zend_language_scanner.l" +#line 2185 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; @@ -1867,7 +1867,7 @@ yy83: ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -1890,7 +1890,7 @@ yy85: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -1902,7 +1902,7 @@ yy88: ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -1921,7 +1921,7 @@ yy92: ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -1947,7 +1947,7 @@ yy95: ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -1966,7 +1966,7 @@ yyc_ST_END_HEREDOC: ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2160 "Zend/zend_language_scanner.l" +#line 2164 "Zend/zend_language_scanner.l" { YYCURSOR += CG(heredoc_len) - 1; yyleng = CG(heredoc_len); @@ -2040,7 +2040,7 @@ yy103: yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2284 "Zend/zend_language_scanner.l" +#line 2288 "Zend/zend_language_scanner.l" { int newline = 0; @@ -2126,7 +2126,7 @@ yy107: ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2173 "Zend/zend_language_scanner.l" +#line 2177 "Zend/zend_language_scanner.l" { zendlval->value.lval = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); @@ -2149,7 +2149,7 @@ yy109: yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -2161,7 +2161,7 @@ yy112: ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1449 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; @@ -2180,7 +2180,7 @@ yy116: ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1865 "Zend/zend_language_scanner.l" +#line 1869 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); @@ -2206,7 +2206,7 @@ yy119: ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1855 "Zend/zend_language_scanner.l" +#line 1859 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); @@ -2379,23 +2379,23 @@ yy123: YYDEBUG(-1, yych); switch ((yych = *YYCURSOR)) { case 'C': - case 'c': goto yy726; + case 'c': goto yy729; case 'L': - case 'l': goto yy727; + case 'l': goto yy730; case 'M': - case 'm': goto yy728; + case 'm': goto yy731; case 'N': - case 'n': goto yy729; + case 'n': goto yy732; case 'V': - case 'v': goto yy730; + case 'v': goto yy733; case 'X': - case 'x': goto yy731; + case 'x': goto yy734; default: goto yy186; } yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1896 "Zend/zend_language_scanner.l" +#line 1900 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; @@ -2407,20 +2407,20 @@ yy125: yych = *++YYCURSOR; if (yych <= 'O') { if (yych <= 'H') { - if (yych == 'E') goto yy708; + if (yych == 'E') goto yy711; goto yy186; } else { - if (yych <= 'I') goto yy709; + if (yych <= 'I') goto yy712; if (yych <= 'N') goto yy186; - goto yy710; + goto yy713; } } else { if (yych <= 'h') { - if (yych == 'e') goto yy708; + if (yych == 'e') goto yy711; goto yy186; } else { - if (yych <= 'i') goto yy709; - if (yych == 'o') goto yy710; + if (yych <= 'i') goto yy712; + if (yych == 'o') goto yy713; goto yy186; } } @@ -2627,7 +2627,7 @@ yy137: yy138: YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1438 "Zend/zend_language_scanner.l" +#line 1442 "Zend/zend_language_scanner.l" { return yytext[0]; } @@ -2640,7 +2640,7 @@ yy139: yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1169 "Zend/zend_language_scanner.l" +#line 1173 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -2659,7 +2659,7 @@ yy142: ++YYCURSOR; YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1198 "Zend/zend_language_scanner.l" +#line 1202 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } @@ -2891,7 +2891,7 @@ yy167: ++YYCURSOR; YYDEBUG(168, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1443 "Zend/zend_language_scanner.l" +#line 1447 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; @@ -2902,7 +2902,7 @@ yy169: ++YYCURSOR; YYDEBUG(170, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1455 "Zend/zend_language_scanner.l" +#line 1459 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2938,7 +2938,7 @@ yy171: yy172: YYDEBUG(172, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1506 "Zend/zend_language_scanner.l" +#line 1510 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ zendlval->value.lval = strtol(yytext, NULL, 0); @@ -2987,7 +2987,7 @@ yy175: yy176: YYDEBUG(176, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1903 "Zend/zend_language_scanner.l" +#line 1907 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3028,7 +3028,7 @@ yy177: yy178: YYDEBUG(178, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1994 "Zend/zend_language_scanner.l" +#line 1998 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3103,7 +3103,7 @@ yy179: yy180: YYDEBUG(180, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2063 "Zend/zend_language_scanner.l" +#line 2067 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3150,7 +3150,7 @@ yy181: ++YYCURSOR; YYDEBUG(182, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2154 "Zend/zend_language_scanner.l" +#line 2158 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; @@ -3161,7 +3161,7 @@ yy183: ++YYCURSOR; YYDEBUG(184, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2412 "Zend/zend_language_scanner.l" +#line 2416 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3197,7 +3197,7 @@ yy187: yy189: YYDEBUG(189, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1571 "Zend/zend_language_scanner.l" +#line 1575 "Zend/zend_language_scanner.l" { zendlval->value.dval = zend_strtod(yytext, NULL); zendlval->type = IS_DOUBLE; @@ -3295,7 +3295,7 @@ yy199: } YYDEBUG(201, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1481 "Zend/zend_language_scanner.l" +#line 1485 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3332,7 +3332,7 @@ yy202: } YYDEBUG(204, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1527 "Zend/zend_language_scanner.l" +#line 1531 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3366,7 +3366,7 @@ yy205: yy206: YYDEBUG(206, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1971 "Zend/zend_language_scanner.l" +#line 1975 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -3408,7 +3408,7 @@ yy209: yy211: YYDEBUG(211, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" +#line 1877 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); zendlval->type = IS_STRING; @@ -3428,7 +3428,7 @@ yy213: } YYDEBUG(214, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1426 "Zend/zend_language_scanner.l" +#line 1430 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } @@ -3441,7 +3441,7 @@ yy215: } YYDEBUG(216, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1418 "Zend/zend_language_scanner.l" +#line 1422 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } @@ -3451,7 +3451,7 @@ yy217: ++YYCURSOR; YYDEBUG(218, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1406 "Zend/zend_language_scanner.l" +#line 1410 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } @@ -3461,7 +3461,7 @@ yy219: ++YYCURSOR; YYDEBUG(220, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1410 "Zend/zend_language_scanner.l" +#line 1414 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } @@ -3471,7 +3471,7 @@ yy221: ++YYCURSOR; YYDEBUG(222, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1402 "Zend/zend_language_scanner.l" +#line 1406 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } @@ -3481,7 +3481,7 @@ yy223: ++YYCURSOR; YYDEBUG(224, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1414 "Zend/zend_language_scanner.l" +#line 1418 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } @@ -3491,7 +3491,7 @@ yy225: ++YYCURSOR; YYDEBUG(226, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1398 "Zend/zend_language_scanner.l" +#line 1402 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } @@ -3504,7 +3504,7 @@ yy227: yy228: YYDEBUG(228, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1980 "Zend/zend_language_scanner.l" +#line 1984 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); @@ -3523,7 +3523,7 @@ yy229: ++YYCURSOR; YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1386 "Zend/zend_language_scanner.l" +#line 1390 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } @@ -3558,7 +3558,7 @@ yy235: ++YYCURSOR; YYDEBUG(236, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1382 "Zend/zend_language_scanner.l" +#line 1386 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } @@ -3571,7 +3571,7 @@ yy237: yy238: YYDEBUG(238, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1937 "Zend/zend_language_scanner.l" +#line 1941 "Zend/zend_language_scanner.l" { int doc_com; @@ -3615,7 +3615,7 @@ yy240: ++YYCURSOR; YYDEBUG(241, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1378 "Zend/zend_language_scanner.l" +#line 1382 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } @@ -3642,7 +3642,7 @@ yy245: ++YYCURSOR; YYDEBUG(246, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1374 "Zend/zend_language_scanner.l" +#line 1378 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } @@ -3653,7 +3653,7 @@ yy247: if ((yych = *YYCURSOR) == '=') goto yy251; YYDEBUG(248, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1434 "Zend/zend_language_scanner.l" +#line 1438 "Zend/zend_language_scanner.l" { return T_SR; } @@ -3663,7 +3663,7 @@ yy249: ++YYCURSOR; YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1362 "Zend/zend_language_scanner.l" +#line 1366 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } @@ -3673,7 +3673,7 @@ yy251: ++YYCURSOR; YYDEBUG(252, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1394 "Zend/zend_language_scanner.l" +#line 1398 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } @@ -3688,7 +3688,7 @@ yy253: yy254: YYDEBUG(254, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1430 "Zend/zend_language_scanner.l" +#line 1434 "Zend/zend_language_scanner.l" { return T_SL; } @@ -3704,7 +3704,7 @@ yy256: ++YYCURSOR; YYDEBUG(257, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1358 "Zend/zend_language_scanner.l" +#line 1362 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } @@ -3715,7 +3715,7 @@ yy258: yy259: YYDEBUG(259, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1354 "Zend/zend_language_scanner.l" +#line 1358 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } @@ -3770,7 +3770,7 @@ yy267: ++YYCURSOR; YYDEBUG(268, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1390 "Zend/zend_language_scanner.l" +#line 1394 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } @@ -3879,7 +3879,7 @@ yy278: yy279: YYDEBUG(279, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2105 "Zend/zend_language_scanner.l" +#line 2109 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -3967,7 +3967,7 @@ yy283: ++YYCURSOR; YYDEBUG(285, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1346 "Zend/zend_language_scanner.l" +#line 1350 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } @@ -3977,7 +3977,7 @@ yy286: ++YYCURSOR; YYDEBUG(287, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1366 "Zend/zend_language_scanner.l" +#line 1370 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } @@ -3987,7 +3987,7 @@ yy288: ++YYCURSOR; YYDEBUG(289, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1334 "Zend/zend_language_scanner.l" +#line 1338 "Zend/zend_language_scanner.l" { return T_INC; } @@ -4010,7 +4010,7 @@ yy292: } YYDEBUG(293, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1322 "Zend/zend_language_scanner.l" +#line 1326 "Zend/zend_language_scanner.l" { return T_LIST; } @@ -4021,7 +4021,7 @@ yy294: if ((yych = *YYCURSOR) == '=') goto yy298; YYDEBUG(295, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1350 "Zend/zend_language_scanner.l" +#line 1354 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } @@ -4031,7 +4031,7 @@ yy296: ++YYCURSOR; YYDEBUG(297, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1318 "Zend/zend_language_scanner.l" +#line 1322 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } @@ -4041,7 +4041,7 @@ yy298: ++YYCURSOR; YYDEBUG(299, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1342 "Zend/zend_language_scanner.l" +#line 1346 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } @@ -4175,7 +4175,7 @@ yy316: } YYDEBUG(319, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1706 "Zend/zend_language_scanner.l" +#line 1710 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -4205,7 +4205,7 @@ yy321: } YYDEBUG(324, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1679 "Zend/zend_language_scanner.l" +#line 1683 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -4257,7 +4257,7 @@ yy327: } YYDEBUG(330, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1661 "Zend/zend_language_scanner.l" +#line 1665 "Zend/zend_language_scanner.l" { zendlval->value.lval = CG(zend_lineno); zendlval->type = IS_LONG; @@ -4298,7 +4298,7 @@ yy335: } YYDEBUG(338, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1640 "Zend/zend_language_scanner.l" +#line 1644 "Zend/zend_language_scanner.l" { const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; @@ -4370,7 +4370,7 @@ yy346: } YYDEBUG(349, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1624 "Zend/zend_language_scanner.l" +#line 1628 "Zend/zend_language_scanner.l" { const char *func_name = NULL; @@ -4406,7 +4406,7 @@ yy351: } YYDEBUG(354, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1667 "Zend/zend_language_scanner.l" +#line 1671 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); @@ -4448,7 +4448,7 @@ yy358: } YYDEBUG(361, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1604 "Zend/zend_language_scanner.l" +#line 1608 "Zend/zend_language_scanner.l" { const char *trait_name = NULL; @@ -4498,7 +4498,7 @@ yy365: } YYDEBUG(368, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1577 "Zend/zend_language_scanner.l" +#line 1581 "Zend/zend_language_scanner.l" { const char *class_name = NULL; @@ -4587,7 +4587,7 @@ yy380: } YYDEBUG(381, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1286 "Zend/zend_language_scanner.l" +#line 1290 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } @@ -4611,7 +4611,7 @@ yy384: } YYDEBUG(385, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1266 "Zend/zend_language_scanner.l" +#line 1270 "Zend/zend_language_scanner.l" { return T_USE; } @@ -4634,7 +4634,7 @@ yy388: } YYDEBUG(389, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1314 "Zend/zend_language_scanner.l" +#line 1318 "Zend/zend_language_scanner.l" { return T_UNSET; } @@ -4810,7 +4810,7 @@ yy405: ++YYCURSOR; YYDEBUG(407, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1214 "Zend/zend_language_scanner.l" +#line 1218 "Zend/zend_language_scanner.l" { return T_INT_CAST; } @@ -4858,7 +4858,7 @@ yy413: ++YYCURSOR; YYDEBUG(416, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1218 "Zend/zend_language_scanner.l" +#line 1222 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } @@ -4932,7 +4932,7 @@ yy427: ++YYCURSOR; YYDEBUG(430, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1222 "Zend/zend_language_scanner.l" +#line 1226 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } @@ -4969,7 +4969,7 @@ yy434: ++YYCURSOR; YYDEBUG(437, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1226 "Zend/zend_language_scanner.l" +#line 1230 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } @@ -5011,7 +5011,7 @@ yy442: ++YYCURSOR; YYDEBUG(445, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1230 "Zend/zend_language_scanner.l" +#line 1234 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } @@ -5056,7 +5056,7 @@ yy451: ++YYCURSOR; YYDEBUG(453, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1234 "Zend/zend_language_scanner.l" +#line 1238 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } @@ -5120,7 +5120,7 @@ yy462: ++YYCURSOR; YYDEBUG(465, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1238 "Zend/zend_language_scanner.l" +#line 1242 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } @@ -5138,7 +5138,7 @@ yy467: } YYDEBUG(468, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1210 "Zend/zend_language_scanner.l" +#line 1214 "Zend/zend_language_scanner.l" { return T_VAR; } @@ -5162,7 +5162,7 @@ yy471: } YYDEBUG(472, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1202 "Zend/zend_language_scanner.l" +#line 1206 "Zend/zend_language_scanner.l" { return T_NEW; } @@ -5205,7 +5205,7 @@ yy479: } YYDEBUG(480, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1262 "Zend/zend_language_scanner.l" +#line 1266 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } @@ -5215,7 +5215,7 @@ yy481: ++YYCURSOR; YYDEBUG(482, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1194 "Zend/zend_language_scanner.l" +#line 1198 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } @@ -5241,7 +5241,7 @@ yy485: ++YYCURSOR; YYDEBUG(486, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1370 "Zend/zend_language_scanner.l" +#line 1374 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } @@ -5251,7 +5251,7 @@ yy487: ++YYCURSOR; YYDEBUG(488, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1338 "Zend/zend_language_scanner.l" +#line 1342 "Zend/zend_language_scanner.l" { return T_DEC; } @@ -5261,7 +5261,7 @@ yy489: ++YYCURSOR; YYDEBUG(490, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1164 "Zend/zend_language_scanner.l" +#line 1168 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; @@ -5311,7 +5311,7 @@ yy496: } YYDEBUG(497, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1310 "Zend/zend_language_scanner.l" +#line 1314 "Zend/zend_language_scanner.l" { return T_PUBLIC; } @@ -5370,7 +5370,7 @@ yy505: } YYDEBUG(506, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1306 "Zend/zend_language_scanner.l" +#line 1310 "Zend/zend_language_scanner.l" { return T_PROTECTED; } @@ -5404,7 +5404,7 @@ yy511: } YYDEBUG(512, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1302 "Zend/zend_language_scanner.l" +#line 1306 "Zend/zend_language_scanner.l" { return T_PRIVATE; } @@ -5417,7 +5417,7 @@ yy513: } YYDEBUG(514, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1140 "Zend/zend_language_scanner.l" +#line 1144 "Zend/zend_language_scanner.l" { return T_PRINT; } @@ -5446,7 +5446,7 @@ yy518: } YYDEBUG(519, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1132 "Zend/zend_language_scanner.l" +#line 1136 "Zend/zend_language_scanner.l" { return T_GOTO; } @@ -5474,7 +5474,7 @@ yy523: } YYDEBUG(524, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1274 "Zend/zend_language_scanner.l" +#line 1278 "Zend/zend_language_scanner.l" { return T_GLOBAL; } @@ -5515,7 +5515,7 @@ yy531: } YYDEBUG(532, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1124 "Zend/zend_language_scanner.l" +#line 1128 "Zend/zend_language_scanner.l" { return T_BREAK; } @@ -5559,7 +5559,7 @@ yy539: } YYDEBUG(540, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1108 "Zend/zend_language_scanner.l" +#line 1112 "Zend/zend_language_scanner.l" { return T_SWITCH; } @@ -5587,7 +5587,7 @@ yy544: } YYDEBUG(545, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1290 "Zend/zend_language_scanner.l" +#line 1294 "Zend/zend_language_scanner.l" { return T_STATIC; } @@ -5618,7 +5618,7 @@ yy549: } YYDEBUG(550, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1104 "Zend/zend_language_scanner.l" +#line 1108 "Zend/zend_language_scanner.l" { return T_AS; } @@ -5641,7 +5641,7 @@ yy553: } YYDEBUG(554, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1326 "Zend/zend_language_scanner.l" +#line 1330 "Zend/zend_language_scanner.l" { return T_ARRAY; } @@ -5654,7 +5654,7 @@ yy555: } YYDEBUG(556, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1422 "Zend/zend_language_scanner.l" +#line 1426 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } @@ -5692,7 +5692,7 @@ yy562: } YYDEBUG(563, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1294 "Zend/zend_language_scanner.l" +#line 1298 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } @@ -5720,7 +5720,7 @@ yy567: } YYDEBUG(568, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1064 "Zend/zend_language_scanner.l" +#line 1068 "Zend/zend_language_scanner.l" { return T_WHILE; } @@ -5733,7 +5733,7 @@ yy569: } YYDEBUG(570, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1048 "Zend/zend_language_scanner.l" +#line 1052 "Zend/zend_language_scanner.l" { return T_IF; } @@ -5789,7 +5789,7 @@ yy576: } YYDEBUG(577, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1278 "Zend/zend_language_scanner.l" +#line 1282 "Zend/zend_language_scanner.l" { return T_ISSET; } @@ -5847,7 +5847,7 @@ yy584: yy585: YYDEBUG(585, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1246 "Zend/zend_language_scanner.l" +#line 1250 "Zend/zend_language_scanner.l" { return T_INCLUDE; } @@ -5880,7 +5880,7 @@ yy590: } YYDEBUG(591, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1250 "Zend/zend_language_scanner.l" +#line 1254 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } @@ -5918,7 +5918,7 @@ yy597: } YYDEBUG(598, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1148 "Zend/zend_language_scanner.l" +#line 1152 "Zend/zend_language_scanner.l" { return T_INTERFACE; } @@ -5972,7 +5972,7 @@ yy605: } YYDEBUG(606, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1270 "Zend/zend_language_scanner.l" +#line 1274 "Zend/zend_language_scanner.l" { return T_INSTEADOF; } @@ -6005,7 +6005,7 @@ yy611: } YYDEBUG(612, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1100 "Zend/zend_language_scanner.l" +#line 1104 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } @@ -6053,7 +6053,7 @@ yy620: } YYDEBUG(621, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1160 "Zend/zend_language_scanner.l" +#line 1164 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } @@ -6108,7 +6108,7 @@ yy628: } YYDEBUG(629, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1152 "Zend/zend_language_scanner.l" +#line 1156 "Zend/zend_language_scanner.l" { return T_TRAIT; } @@ -6131,7 +6131,7 @@ yy632: } YYDEBUG(633, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1044 "Zend/zend_language_scanner.l" +#line 1048 "Zend/zend_language_scanner.l" { return T_THROW; } @@ -6196,7 +6196,7 @@ yy640: yy641: YYDEBUG(641, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1254 "Zend/zend_language_scanner.l" +#line 1258 "Zend/zend_language_scanner.l" { return T_REQUIRE; } @@ -6229,7 +6229,7 @@ yy646: } YYDEBUG(647, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1258 "Zend/zend_language_scanner.l" +#line 1262 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } @@ -6346,7 +6346,7 @@ yy661: } YYDEBUG(662, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1128 "Zend/zend_language_scanner.l" +#line 1132 "Zend/zend_language_scanner.l" { return T_CONTINUE; } @@ -6388,7 +6388,7 @@ yy668: } YYDEBUG(669, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1206 "Zend/zend_language_scanner.l" +#line 1210 "Zend/zend_language_scanner.l" { return T_CLONE; } @@ -6406,7 +6406,7 @@ yy671: } YYDEBUG(672, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1144 "Zend/zend_language_scanner.l" +#line 1148 "Zend/zend_language_scanner.l" { return T_CLASS; } @@ -6456,7 +6456,7 @@ yy680: } YYDEBUG(681, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1330 "Zend/zend_language_scanner.l" +#line 1334 "Zend/zend_language_scanner.l" { return T_CALLABLE; } @@ -6469,7 +6469,7 @@ yy682: } YYDEBUG(683, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1116 "Zend/zend_language_scanner.l" +#line 1120 "Zend/zend_language_scanner.l" { return T_CASE; } @@ -6570,7 +6570,7 @@ yy697: yy698: YYDEBUG(698, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1076 "Zend/zend_language_scanner.l" +#line 1080 "Zend/zend_language_scanner.l" { return T_FOR; } @@ -6598,7 +6598,7 @@ yy702: } YYDEBUG(703, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1084 "Zend/zend_language_scanner.l" +#line 1088 "Zend/zend_language_scanner.l" { return T_FOREACH; } @@ -6616,233 +6616,248 @@ yy705: yy706: YYDEBUG(706, *YYCURSOR); ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; + if ((yych = *YYCURSOR) <= '^') { + if (yych <= '@') { + if (yych <= '/') goto yy707; + if (yych <= '9') goto yy185; + } else { + if (yych == 'L') goto yy708; + if (yych <= 'Z') goto yy185; + } + } else { + if (yych <= 'k') { + if (yych != '`') goto yy185; + } else { + if (yych <= 'l') goto yy708; + if (yych <= 'z') goto yy185; + if (yych >= 0x7F) goto yy185; + } } +yy707: YYDEBUG(707, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1298 "Zend/zend_language_scanner.l" +#line 1302 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 6629 "Zend/zend_language_scanner.c" +#line 6644 "Zend/zend_language_scanner.c" yy708: YYDEBUG(708, *YYCURSOR); yych = *++YYCURSOR; + if (yych == 'Y') goto yy709; + if (yych != 'y') goto yy186; +yy709: + YYDEBUG(709, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } + YYDEBUG(710, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1044 "Zend/zend_language_scanner.l" + { + return T_FINALLY; +} +#line 6662 "Zend/zend_language_scanner.c" +yy711: + YYDEBUG(711, *YYCURSOR); + yych = *++YYCURSOR; if (yych <= 'F') { - if (yych == 'C') goto yy714; + if (yych == 'C') goto yy717; if (yych <= 'E') goto yy186; - goto yy715; + goto yy718; } else { if (yych <= 'c') { if (yych <= 'b') goto yy186; - goto yy714; + goto yy717; } else { - if (yych == 'f') goto yy715; + if (yych == 'f') goto yy718; goto yy186; } } -yy709: - YYDEBUG(709, *YYCURSOR); +yy712: + YYDEBUG(712, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy712; - if (yych == 'e') goto yy712; + if (yych == 'E') goto yy715; + if (yych == 'e') goto yy715; goto yy186; -yy710: - YYDEBUG(710, *YYCURSOR); +yy713: + YYDEBUG(713, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(711, *YYCURSOR); + YYDEBUG(714, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1072 "Zend/zend_language_scanner.l" +#line 1076 "Zend/zend_language_scanner.l" { return T_DO; } -#line 6664 "Zend/zend_language_scanner.c" -yy712: - YYDEBUG(712, *YYCURSOR); +#line 6697 "Zend/zend_language_scanner.c" +yy715: + YYDEBUG(715, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(713, *YYCURSOR); + YYDEBUG(716, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); #line 1020 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6677 "Zend/zend_language_scanner.c" -yy714: - YYDEBUG(714, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy721; - if (yych == 'l') goto yy721; - goto yy186; -yy715: - YYDEBUG(715, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy716; - if (yych != 'a') goto yy186; -yy716: - YYDEBUG(716, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'U') goto yy717; - if (yych != 'u') goto yy186; +#line 6710 "Zend/zend_language_scanner.c" yy717: YYDEBUG(717, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy718; - if (yych != 'l') goto yy186; + if (yych == 'L') goto yy724; + if (yych == 'l') goto yy724; + goto yy186; yy718: YYDEBUG(718, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy719; - if (yych != 't') goto yy186; + if (yych == 'A') goto yy719; + if (yych != 'a') goto yy186; yy719: YYDEBUG(719, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'U') goto yy720; + if (yych != 'u') goto yy186; +yy720: YYDEBUG(720, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1120 "Zend/zend_language_scanner.l" - { - return T_DEFAULT; -} -#line 6716 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'L') goto yy721; + if (yych != 'l') goto yy186; yy721: YYDEBUG(721, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy722; - if (yych != 'a') goto yy186; + if (yych == 'T') goto yy722; + if (yych != 't') goto yy186; yy722: YYDEBUG(722, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'R') goto yy723; - if (yych != 'r') goto yy186; -yy723: - YYDEBUG(723, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy724; - if (yych != 'e') goto yy186; -yy724: - YYDEBUG(724, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(725, *YYCURSOR); + YYDEBUG(723, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1092 "Zend/zend_language_scanner.l" +#line 1124 "Zend/zend_language_scanner.l" { - return T_DECLARE; + return T_DEFAULT; } -#line 6744 "Zend/zend_language_scanner.c" +#line 6749 "Zend/zend_language_scanner.c" +yy724: + YYDEBUG(724, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'A') goto yy725; + if (yych != 'a') goto yy186; +yy725: + YYDEBUG(725, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'R') goto yy726; + if (yych != 'r') goto yy186; yy726: YYDEBUG(726, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy788; - if (yych == 'h') goto yy788; - goto yy186; + if (yych == 'E') goto yy727; + if (yych != 'e') goto yy186; yy727: YYDEBUG(727, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'S') goto yy782; - if (yych == 's') goto yy782; - goto yy186; -yy728: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } YYDEBUG(728, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'P') goto yy778; - if (yych == 'p') goto yy778; - goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1096 "Zend/zend_language_scanner.l" + { + return T_DECLARE; +} +#line 6777 "Zend/zend_language_scanner.c" yy729: YYDEBUG(729, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy744; - if (yych == 'd') goto yy744; + if (yych == 'H') goto yy791; + if (yych == 'h') goto yy791; goto yy186; yy730: YYDEBUG(730, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'A') goto yy741; - if (yych == 'a') goto yy741; + if (yych == 'S') goto yy785; + if (yych == 's') goto yy785; goto yy186; yy731: YYDEBUG(731, *YYCURSOR); yych = *++YYCURSOR; - if (yych <= 'T') { - if (yych == 'I') goto yy732; - if (yych <= 'S') goto yy186; - goto yy733; - } else { - if (yych <= 'i') { - if (yych <= 'h') goto yy186; - } else { - if (yych == 't') goto yy733; - goto yy186; - } - } + if (yych == 'P') goto yy781; + if (yych == 'p') goto yy781; + goto yy186; yy732: YYDEBUG(732, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy739; - if (yych == 't') goto yy739; + if (yych == 'D') goto yy747; + if (yych == 'd') goto yy747; goto yy186; yy733: YYDEBUG(733, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy734; - if (yych != 'e') goto yy186; + if (yych == 'A') goto yy744; + if (yych == 'a') goto yy744; + goto yy186; yy734: YYDEBUG(734, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'N') goto yy735; - if (yych != 'n') goto yy186; + if (yych <= 'T') { + if (yych == 'I') goto yy735; + if (yych <= 'S') goto yy186; + goto yy736; + } else { + if (yych <= 'i') { + if (yych <= 'h') goto yy186; + } else { + if (yych == 't') goto yy736; + goto yy186; + } + } yy735: YYDEBUG(735, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'D') goto yy736; - if (yych != 'd') goto yy186; + if (yych == 'T') goto yy742; + if (yych == 't') goto yy742; + goto yy186; yy736: YYDEBUG(736, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'S') goto yy737; - if (yych != 's') goto yy186; + if (yych == 'E') goto yy737; + if (yych != 'e') goto yy186; yy737: YYDEBUG(737, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'N') goto yy738; + if (yych != 'n') goto yy186; +yy738: + YYDEBUG(738, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'D') goto yy739; + if (yych != 'd') goto yy186; +yy739: + YYDEBUG(739, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'S') goto yy740; + if (yych != 's') goto yy186; +yy740: + YYDEBUG(740, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(738, *YYCURSOR); + YYDEBUG(741, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1156 "Zend/zend_language_scanner.l" +#line 1160 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6828 "Zend/zend_language_scanner.c" -yy739: - YYDEBUG(739, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(740, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1016 "Zend/zend_language_scanner.l" - { - return T_EXIT; -} -#line 6841 "Zend/zend_language_scanner.c" -yy741: - YYDEBUG(741, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy742; - if (yych != 'l') goto yy186; +#line 6861 "Zend/zend_language_scanner.c" yy742: YYDEBUG(742, *YYCURSOR); ++YYCURSOR; @@ -6851,309 +6866,309 @@ yy742: } YYDEBUG(743, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1242 "Zend/zend_language_scanner.l" +#line 1016 "Zend/zend_language_scanner.l" + { + return T_EXIT; +} +#line 6874 "Zend/zend_language_scanner.c" +yy744: + YYDEBUG(744, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'L') goto yy745; + if (yych != 'l') goto yy186; +yy745: + YYDEBUG(745, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } + YYDEBUG(746, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1246 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6859 "Zend/zend_language_scanner.c" -yy744: - YYDEBUG(744, *YYCURSOR); +#line 6892 "Zend/zend_language_scanner.c" +yy747: + YYDEBUG(747, *YYCURSOR); yych = *++YYCURSOR; YYDEBUG(-1, yych); switch (yych) { case 'D': - case 'd': goto yy745; + case 'd': goto yy748; case 'F': - case 'f': goto yy746; + case 'f': goto yy749; case 'I': - case 'i': goto yy747; + case 'i': goto yy750; case 'S': - case 's': goto yy748; + case 's': goto yy751; case 'W': - case 'w': goto yy749; + case 'w': goto yy752; default: goto yy186; } -yy745: - YYDEBUG(745, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'E') goto yy771; - if (yych == 'e') goto yy771; - goto yy186; -yy746: - YYDEBUG(746, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'O') goto yy763; - if (yych == 'o') goto yy763; - goto yy186; -yy747: - YYDEBUG(747, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy761; - if (yych == 'f') goto yy761; - goto yy186; yy748: YYDEBUG(748, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'W') goto yy755; - if (yych == 'w') goto yy755; + if (yych == 'E') goto yy774; + if (yych == 'e') goto yy774; goto yy186; yy749: YYDEBUG(749, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy750; - if (yych != 'h') goto yy186; + if (yych == 'O') goto yy766; + if (yych == 'o') goto yy766; + goto yy186; yy750: YYDEBUG(750, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy751; - if (yych != 'i') goto yy186; + if (yych == 'F') goto yy764; + if (yych == 'f') goto yy764; + goto yy186; yy751: YYDEBUG(751, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'L') goto yy752; - if (yych != 'l') goto yy186; + if (yych == 'W') goto yy758; + if (yych == 'w') goto yy758; + goto yy186; yy752: YYDEBUG(752, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy753; - if (yych != 'e') goto yy186; + if (yych == 'H') goto yy753; + if (yych != 'h') goto yy186; yy753: YYDEBUG(753, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'I') goto yy754; + if (yych != 'i') goto yy186; +yy754: YYDEBUG(754, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1068 "Zend/zend_language_scanner.l" - { - return T_ENDWHILE; -} -#line 6933 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'L') goto yy755; + if (yych != 'l') goto yy186; yy755: YYDEBUG(755, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'I') goto yy756; - if (yych != 'i') goto yy186; + if (yych == 'E') goto yy756; + if (yych != 'e') goto yy186; yy756: YYDEBUG(756, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'T') goto yy757; - if (yych != 't') goto yy186; -yy757: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } YYDEBUG(757, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy758; - if (yych != 'c') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1072 "Zend/zend_language_scanner.l" + { + return T_ENDWHILE; +} +#line 6966 "Zend/zend_language_scanner.c" yy758: YYDEBUG(758, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'H') goto yy759; - if (yych != 'h') goto yy186; + if (yych == 'I') goto yy759; + if (yych != 'i') goto yy186; yy759: YYDEBUG(759, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy760; + if (yych != 't') goto yy186; +yy760: + YYDEBUG(760, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'C') goto yy761; + if (yych != 'c') goto yy186; +yy761: + YYDEBUG(761, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'H') goto yy762; + if (yych != 'h') goto yy186; +yy762: + YYDEBUG(762, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(760, *YYCURSOR); + YYDEBUG(763, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1112 "Zend/zend_language_scanner.l" +#line 1116 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 6966 "Zend/zend_language_scanner.c" -yy761: - YYDEBUG(761, *YYCURSOR); +#line 6999 "Zend/zend_language_scanner.c" +yy764: + YYDEBUG(764, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(762, *YYCURSOR); + YYDEBUG(765, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1056 "Zend/zend_language_scanner.l" +#line 1060 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 6979 "Zend/zend_language_scanner.c" -yy763: - YYDEBUG(763, *YYCURSOR); +#line 7012 "Zend/zend_language_scanner.c" +yy766: + YYDEBUG(766, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy764; + if (yych == 'R') goto yy767; if (yych != 'r') goto yy186; -yy764: - YYDEBUG(764, *YYCURSOR); +yy767: + YYDEBUG(767, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy765; + if (yych <= '/') goto yy768; if (yych <= '9') goto yy185; } else { - if (yych == 'E') goto yy766; + if (yych == 'E') goto yy769; if (yych <= 'Z') goto yy185; } } else { if (yych <= 'd') { if (yych != '`') goto yy185; } else { - if (yych <= 'e') goto yy766; + if (yych <= 'e') goto yy769; if (yych <= 'z') goto yy185; if (yych >= 0x7F) goto yy185; } } -yy765: - YYDEBUG(765, *YYCURSOR); +yy768: + YYDEBUG(768, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1080 "Zend/zend_language_scanner.l" +#line 1084 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 7012 "Zend/zend_language_scanner.c" -yy766: - YYDEBUG(766, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy767; - if (yych != 'a') goto yy186; -yy767: - YYDEBUG(767, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'C') goto yy768; - if (yych != 'c') goto yy186; -yy768: - YYDEBUG(768, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'H') goto yy769; - if (yych != 'h') goto yy186; +#line 7045 "Zend/zend_language_scanner.c" yy769: YYDEBUG(769, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'A') goto yy770; + if (yych != 'a') goto yy186; +yy770: YYDEBUG(770, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1088 "Zend/zend_language_scanner.l" - { - return T_ENDFOREACH; -} -#line 7040 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'C') goto yy771; + if (yych != 'c') goto yy186; yy771: YYDEBUG(771, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'C') goto yy772; - if (yych != 'c') goto yy186; + if (yych == 'H') goto yy772; + if (yych != 'h') goto yy186; yy772: YYDEBUG(772, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'L') goto yy773; - if (yych != 'l') goto yy186; -yy773: + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } YYDEBUG(773, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'A') goto yy774; - if (yych != 'a') goto yy186; + yyleng = YYCURSOR - SCNG(yy_text); +#line 1092 "Zend/zend_language_scanner.l" + { + return T_ENDFOREACH; +} +#line 7073 "Zend/zend_language_scanner.c" yy774: YYDEBUG(774, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'R') goto yy775; - if (yych != 'r') goto yy186; + if (yych == 'C') goto yy775; + if (yych != 'c') goto yy186; yy775: YYDEBUG(775, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy776; - if (yych != 'e') goto yy186; + if (yych == 'L') goto yy776; + if (yych != 'l') goto yy186; yy776: YYDEBUG(776, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } + yych = *++YYCURSOR; + if (yych == 'A') goto yy777; + if (yych != 'a') goto yy186; +yy777: YYDEBUG(777, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1096 "Zend/zend_language_scanner.l" - { - return T_ENDDECLARE; -} -#line 7078 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yych == 'R') goto yy778; + if (yych != 'r') goto yy186; yy778: YYDEBUG(778, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'T') goto yy779; - if (yych != 't') goto yy186; + if (yych == 'E') goto yy779; + if (yych != 'e') goto yy186; yy779: YYDEBUG(779, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'Y') goto yy780; - if (yych != 'y') goto yy186; -yy780: - YYDEBUG(780, *YYCURSOR); ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 4) { goto yy185; } - YYDEBUG(781, *YYCURSOR); + YYDEBUG(780, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1282 "Zend/zend_language_scanner.l" +#line 1100 "Zend/zend_language_scanner.l" { - return T_EMPTY; + return T_ENDDECLARE; } -#line 7101 "Zend/zend_language_scanner.c" +#line 7111 "Zend/zend_language_scanner.c" +yy781: + YYDEBUG(781, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'T') goto yy782; + if (yych != 't') goto yy186; yy782: YYDEBUG(782, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'E') goto yy783; - if (yych != 'e') goto yy186; + if (yych == 'Y') goto yy783; + if (yych != 'y') goto yy186; yy783: YYDEBUG(783, *YYCURSOR); ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } + YYDEBUG(784, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1286 "Zend/zend_language_scanner.l" + { + return T_EMPTY; +} +#line 7134 "Zend/zend_language_scanner.c" +yy785: + YYDEBUG(785, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'E') goto yy786; + if (yych != 'e') goto yy186; +yy786: + YYDEBUG(786, *YYCURSOR); + ++YYCURSOR; if ((yych = *YYCURSOR) <= '^') { if (yych <= '@') { - if (yych <= '/') goto yy784; + if (yych <= '/') goto yy787; if (yych <= '9') goto yy185; } else { - if (yych == 'I') goto yy785; + if (yych == 'I') goto yy788; if (yych <= 'Z') goto yy185; } } else { if (yych <= 'h') { if (yych != '`') goto yy185; } else { - if (yych <= 'i') goto yy785; + if (yych <= 'i') goto yy788; if (yych <= 'z') goto yy185; if (yych >= 0x7F) goto yy185; } } -yy784: - YYDEBUG(784, *YYCURSOR); +yy787: + YYDEBUG(787, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1060 "Zend/zend_language_scanner.l" +#line 1064 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 7134 "Zend/zend_language_scanner.c" -yy785: - YYDEBUG(785, *YYCURSOR); - yych = *++YYCURSOR; - if (yych == 'F') goto yy786; - if (yych != 'f') goto yy186; -yy786: - YYDEBUG(786, *YYCURSOR); - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 4) { - goto yy185; - } - YYDEBUG(787, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1052 "Zend/zend_language_scanner.l" - { - return T_ELSEIF; -} -#line 7152 "Zend/zend_language_scanner.c" +#line 7167 "Zend/zend_language_scanner.c" yy788: YYDEBUG(788, *YYCURSOR); yych = *++YYCURSOR; - if (yych == 'O') goto yy789; - if (yych != 'o') goto yy186; + if (yych == 'F') goto yy789; + if (yych != 'f') goto yy186; yy789: YYDEBUG(789, *YYCURSOR); ++YYCURSOR; @@ -7162,11 +7177,29 @@ yy789: } YYDEBUG(790, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1136 "Zend/zend_language_scanner.l" +#line 1056 "Zend/zend_language_scanner.l" + { + return T_ELSEIF; +} +#line 7185 "Zend/zend_language_scanner.c" +yy791: + YYDEBUG(791, *YYCURSOR); + yych = *++YYCURSOR; + if (yych == 'O') goto yy792; + if (yych != 'o') goto yy186; +yy792: + YYDEBUG(792, *YYCURSOR); + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy185; + } + YYDEBUG(793, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1140 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7170 "Zend/zend_language_scanner.c" +#line 7203 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7205,41 +7238,41 @@ yyc_ST_LOOKING_FOR_PROPERTY: 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; - YYDEBUG(791, *YYCURSOR); + YYDEBUG(794, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '-') { if (yych <= '\r') { - if (yych <= 0x08) goto yy799; - if (yych <= '\n') goto yy793; - if (yych <= '\f') goto yy799; + if (yych <= 0x08) goto yy802; + if (yych <= '\n') goto yy796; + if (yych <= '\f') goto yy802; } else { - if (yych == ' ') goto yy793; - if (yych <= ',') goto yy799; - goto yy795; + if (yych == ' ') goto yy796; + if (yych <= ',') goto yy802; + goto yy798; } } else { if (yych <= '_') { - if (yych <= '@') goto yy799; - if (yych <= 'Z') goto yy797; - if (yych <= '^') goto yy799; - goto yy797; + if (yych <= '@') goto yy802; + if (yych <= 'Z') goto yy800; + if (yych <= '^') goto yy802; + goto yy800; } else { - if (yych <= '`') goto yy799; - if (yych <= 'z') goto yy797; - if (yych <= '~') goto yy799; - goto yy797; + if (yych <= '`') goto yy802; + if (yych <= 'z') goto yy800; + if (yych <= '~') goto yy802; + goto yy800; } } -yy793: - YYDEBUG(793, *YYCURSOR); +yy796: + YYDEBUG(796, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy805; -yy794: - YYDEBUG(794, *YYCURSOR); + goto yy808; +yy797: + YYDEBUG(797, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1169 "Zend/zend_language_scanner.l" +#line 1173 "Zend/zend_language_scanner.l" { zendlval->value.str.val = yytext; /* no copying - intentional */ zendlval->value.str.len = yyleng; @@ -7247,73 +7280,73 @@ yy794: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7251 "Zend/zend_language_scanner.c" -yy795: - YYDEBUG(795, *YYCURSOR); +#line 7284 "Zend/zend_language_scanner.c" +yy798: + YYDEBUG(798, *YYCURSOR); ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy802; -yy796: - YYDEBUG(796, *YYCURSOR); + if ((yych = *YYCURSOR) == '>') goto yy805; +yy799: + YYDEBUG(799, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1188 "Zend/zend_language_scanner.l" +#line 1192 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7265 "Zend/zend_language_scanner.c" -yy797: - YYDEBUG(797, *YYCURSOR); +#line 7298 "Zend/zend_language_scanner.c" +yy800: + YYDEBUG(800, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy801; -yy798: - YYDEBUG(798, *YYCURSOR); + goto yy804; +yy801: + YYDEBUG(801, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1181 "Zend/zend_language_scanner.l" +#line 1185 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7281 "Zend/zend_language_scanner.c" -yy799: - YYDEBUG(799, *YYCURSOR); +#line 7314 "Zend/zend_language_scanner.c" +yy802: + YYDEBUG(802, *YYCURSOR); yych = *++YYCURSOR; - goto yy796; -yy800: - YYDEBUG(800, *YYCURSOR); + goto yy799; +yy803: + YYDEBUG(803, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy801: - YYDEBUG(801, *YYCURSOR); +yy804: + YYDEBUG(804, *YYCURSOR); if (yybm[0+yych] & 64) { - goto yy800; + goto yy803; } - goto yy798; -yy802: - YYDEBUG(802, *YYCURSOR); + goto yy801; +yy805: + YYDEBUG(805, *YYCURSOR); ++YYCURSOR; - YYDEBUG(803, *YYCURSOR); + YYDEBUG(806, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1177 "Zend/zend_language_scanner.l" +#line 1181 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7306 "Zend/zend_language_scanner.c" -yy804: - YYDEBUG(804, *YYCURSOR); +#line 7339 "Zend/zend_language_scanner.c" +yy807: + YYDEBUG(807, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy805: - YYDEBUG(805, *YYCURSOR); +yy808: + YYDEBUG(808, *YYCURSOR); if (yybm[0+yych] & 128) { - goto yy804; + goto yy807; } - goto yy794; + goto yy797; } /* *********************************** */ yyc_ST_LOOKING_FOR_VARNAME: @@ -7352,74 +7385,74 @@ yyc_ST_LOOKING_FOR_VARNAME: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - YYDEBUG(806, *YYCURSOR); + YYDEBUG(809, *YYCURSOR); YYFILL(2); yych = *YYCURSOR; if (yych <= '_') { - if (yych <= '@') goto yy810; - if (yych <= 'Z') goto yy808; - if (yych <= '^') goto yy810; + if (yych <= '@') goto yy813; + if (yych <= 'Z') goto yy811; + if (yych <= '^') goto yy813; } else { - if (yych <= '`') goto yy810; - if (yych <= 'z') goto yy808; - if (yych <= '~') goto yy810; + if (yych <= '`') goto yy813; + if (yych <= 'z') goto yy811; + if (yych <= '~') goto yy813; } -yy808: - YYDEBUG(808, *YYCURSOR); +yy811: + YYDEBUG(811, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '_') { if (yych <= '@') { - if (yych <= '/') goto yy809; - if (yych <= '9') goto yy812; + if (yych <= '/') goto yy812; + if (yych <= '9') goto yy815; } else { - if (yych <= '[') goto yy812; - if (yych >= '_') goto yy812; + if (yych <= '[') goto yy815; + if (yych >= '_') goto yy815; } } else { if (yych <= '|') { - if (yych <= '`') goto yy809; - if (yych <= 'z') goto yy812; + if (yych <= '`') goto yy812; + if (yych <= 'z') goto yy815; } else { - if (yych != '~') goto yy812; + if (yych != '~') goto yy815; } } -yy809: - YYDEBUG(809, *YYCURSOR); +yy812: + YYDEBUG(812, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1474 "Zend/zend_language_scanner.l" +#line 1478 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 7398 "Zend/zend_language_scanner.c" -yy810: - YYDEBUG(810, *YYCURSOR); - yych = *++YYCURSOR; - goto yy809; -yy811: - YYDEBUG(811, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy812: - YYDEBUG(812, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy811; - } - if (yych == '[') goto yy814; - if (yych == '}') goto yy814; +#line 7431 "Zend/zend_language_scanner.c" +yy813: YYDEBUG(813, *YYCURSOR); - YYCURSOR = YYMARKER; - goto yy809; + yych = *++YYCURSOR; + goto yy812; yy814: YYDEBUG(814, *YYCURSOR); ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; +yy815: YYDEBUG(815, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy814; + } + if (yych == '[') goto yy817; + if (yych == '}') goto yy817; + YYDEBUG(816, *YYCURSOR); + YYCURSOR = YYMARKER; + goto yy812; +yy817: + YYDEBUG(817, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(818, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1464 "Zend/zend_language_scanner.l" +#line 1468 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); zend_copy_value(zendlval, yytext, yyleng); @@ -7428,18 +7461,18 @@ yy814: yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7432 "Zend/zend_language_scanner.c" +#line 7465 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_NOWDOC: - YYDEBUG(816, *YYCURSOR); + YYDEBUG(819, *YYCURSOR); YYFILL(1); yych = *YYCURSOR; - YYDEBUG(818, *YYCURSOR); + YYDEBUG(821, *YYCURSOR); ++YYCURSOR; - YYDEBUG(819, *YYCURSOR); + YYDEBUG(822, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2356 "Zend/zend_language_scanner.l" +#line 2360 "Zend/zend_language_scanner.l" { int newline = 0; @@ -7494,7 +7527,7 @@ nowdoc_scan_done: HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7498 "Zend/zend_language_scanner.c" +#line 7531 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7532,76 +7565,76 @@ yyc_ST_VAR_OFFSET: 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, }; - YYDEBUG(820, *YYCURSOR); + YYDEBUG(823, *YYCURSOR); YYFILL(3); yych = *YYCURSOR; if (yych <= '/') { if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy834; - if (yych <= '\n') goto yy830; - goto yy834; + if (yych <= 0x08) goto yy837; + if (yych <= '\n') goto yy833; + goto yy837; } else { - if (yych <= '\r') goto yy830; - if (yych <= 0x1F) goto yy834; - goto yy830; + if (yych <= '\r') goto yy833; + if (yych <= 0x1F) goto yy837; + goto yy833; } } else { if (yych <= '$') { - if (yych <= '"') goto yy829; - if (yych <= '#') goto yy830; - goto yy825; + if (yych <= '"') goto yy832; + if (yych <= '#') goto yy833; + goto yy828; } else { - if (yych == '\'') goto yy830; - goto yy829; + if (yych == '\'') goto yy833; + goto yy832; } } } else { if (yych <= '\\') { if (yych <= '@') { - if (yych <= '0') goto yy822; - if (yych <= '9') goto yy824; - goto yy829; + if (yych <= '0') goto yy825; + if (yych <= '9') goto yy827; + goto yy832; } else { - if (yych <= 'Z') goto yy832; - if (yych <= '[') goto yy829; - goto yy830; + if (yych <= 'Z') goto yy835; + if (yych <= '[') goto yy832; + goto yy833; } } else { if (yych <= '_') { - if (yych <= ']') goto yy827; - if (yych <= '^') goto yy829; - goto yy832; + if (yych <= ']') goto yy830; + if (yych <= '^') goto yy832; + goto yy835; } else { - if (yych <= '`') goto yy829; - if (yych <= 'z') goto yy832; - if (yych <= '~') goto yy829; - goto yy832; + if (yych <= '`') goto yy832; + if (yych <= 'z') goto yy835; + if (yych <= '~') goto yy832; + goto yy835; } } } -yy822: - YYDEBUG(822, *YYCURSOR); +yy825: + YYDEBUG(825, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= 'W') { if (yych <= '9') { - if (yych >= '0') goto yy846; + if (yych >= '0') goto yy849; } else { - if (yych == 'B') goto yy843; + if (yych == 'B') goto yy846; } } else { if (yych <= 'b') { - if (yych <= 'X') goto yy845; - if (yych >= 'b') goto yy843; + if (yych <= 'X') goto yy848; + if (yych >= 'b') goto yy846; } else { - if (yych == 'x') goto yy845; + if (yych == 'x') goto yy848; } } -yy823: - YYDEBUG(823, *YYCURSOR); +yy826: + YYDEBUG(826, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1552 "Zend/zend_language_scanner.l" +#line 1556 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { zendlval->value.lval = strtol(yytext, NULL, 10); @@ -7613,81 +7646,81 @@ yy823: } return T_NUM_STRING; } -#line 7617 "Zend/zend_language_scanner.c" -yy824: - YYDEBUG(824, *YYCURSOR); +#line 7650 "Zend/zend_language_scanner.c" +yy827: + YYDEBUG(827, *YYCURSOR); yych = *++YYCURSOR; - goto yy842; -yy825: - YYDEBUG(825, *YYCURSOR); + goto yy845; +yy828: + YYDEBUG(828, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '_') { - if (yych <= '@') goto yy826; - if (yych <= 'Z') goto yy838; - if (yych >= '_') goto yy838; + if (yych <= '@') goto yy829; + if (yych <= 'Z') goto yy841; + if (yych >= '_') goto yy841; } else { - if (yych <= '`') goto yy826; - if (yych <= 'z') goto yy838; - if (yych >= 0x7F) goto yy838; + if (yych <= '`') goto yy829; + if (yych <= 'z') goto yy841; + if (yych >= 0x7F) goto yy841; } -yy826: - YYDEBUG(826, *YYCURSOR); +yy829: + YYDEBUG(829, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1884 "Zend/zend_language_scanner.l" +#line 1888 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7642 "Zend/zend_language_scanner.c" -yy827: - YYDEBUG(827, *YYCURSOR); - ++YYCURSOR; - YYDEBUG(828, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1879 "Zend/zend_language_scanner.l" - { - yy_pop_state(TSRMLS_C); - return ']'; -} -#line 7653 "Zend/zend_language_scanner.c" -yy829: - YYDEBUG(829, *YYCURSOR); - yych = *++YYCURSOR; - goto yy826; +#line 7675 "Zend/zend_language_scanner.c" yy830: YYDEBUG(830, *YYCURSOR); ++YYCURSOR; YYDEBUG(831, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1889 "Zend/zend_language_scanner.l" +#line 1883 "Zend/zend_language_scanner.l" + { + yy_pop_state(TSRMLS_C); + return ']'; +} +#line 7686 "Zend/zend_language_scanner.c" +yy832: + YYDEBUG(832, *YYCURSOR); + yych = *++YYCURSOR; + goto yy829; +yy833: + YYDEBUG(833, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(834, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1893 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); return T_ENCAPSED_AND_WHITESPACE; } -#line 7670 "Zend/zend_language_scanner.c" -yy832: - YYDEBUG(832, *YYCURSOR); +#line 7703 "Zend/zend_language_scanner.c" +yy835: + YYDEBUG(835, *YYCURSOR); ++YYCURSOR; yych = *YYCURSOR; - goto yy837; -yy833: - YYDEBUG(833, *YYCURSOR); + goto yy840; +yy836: + YYDEBUG(836, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1896 "Zend/zend_language_scanner.l" +#line 1900 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); zendlval->type = IS_STRING; return T_STRING; } -#line 7685 "Zend/zend_language_scanner.c" -yy834: - YYDEBUG(834, *YYCURSOR); +#line 7718 "Zend/zend_language_scanner.c" +yy837: + YYDEBUG(837, *YYCURSOR); ++YYCURSOR; - YYDEBUG(835, *YYCURSOR); + YYDEBUG(838, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2412 "Zend/zend_language_scanner.l" +#line 2416 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7696,118 +7729,118 @@ yy834: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 7700 "Zend/zend_language_scanner.c" -yy836: - YYDEBUG(836, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; -yy837: - YYDEBUG(837, *YYCURSOR); - if (yybm[0+yych] & 16) { - goto yy836; - } - goto yy833; -yy838: - YYDEBUG(838, *YYCURSOR); - ++YYCURSOR; - YYFILL(1); - yych = *YYCURSOR; +#line 7733 "Zend/zend_language_scanner.c" +yy839: YYDEBUG(839, *YYCURSOR); - if (yych <= '^') { - if (yych <= '9') { - if (yych >= '0') goto yy838; - } else { - if (yych <= '@') goto yy840; - if (yych <= 'Z') goto yy838; - } - } else { - if (yych <= '`') { - if (yych <= '_') goto yy838; - } else { - if (yych <= 'z') goto yy838; - if (yych >= 0x7F) goto yy838; - } - } + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; yy840: YYDEBUG(840, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1873 "Zend/zend_language_scanner.l" - { - zend_copy_value(zendlval, (yytext+1), (yyleng-1)); - zendlval->type = IS_STRING; - return T_VARIABLE; -} -#line 7742 "Zend/zend_language_scanner.c" + if (yybm[0+yych] & 16) { + goto yy839; + } + goto yy836; yy841: YYDEBUG(841, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; -yy842: YYDEBUG(842, *YYCURSOR); - if (yybm[0+yych] & 32) { - goto yy841; + if (yych <= '^') { + if (yych <= '9') { + if (yych >= '0') goto yy841; + } else { + if (yych <= '@') goto yy843; + if (yych <= 'Z') goto yy841; + } + } else { + if (yych <= '`') { + if (yych <= '_') goto yy841; + } else { + if (yych <= 'z') goto yy841; + if (yych >= 0x7F) goto yy841; + } } - goto yy823; yy843: YYDEBUG(843, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 128) { - goto yy851; - } + yyleng = YYCURSOR - SCNG(yy_text); +#line 1877 "Zend/zend_language_scanner.l" + { + zend_copy_value(zendlval, (yytext+1), (yyleng-1)); + zendlval->type = IS_STRING; + return T_VARIABLE; +} +#line 7775 "Zend/zend_language_scanner.c" yy844: YYDEBUG(844, *YYCURSOR); - YYCURSOR = YYMARKER; - goto yy823; -yy845: - YYDEBUG(845, *YYCURSOR); - yych = *++YYCURSOR; - if (yybm[0+yych] & 64) { - goto yy849; - } - goto yy844; -yy846: - YYDEBUG(846, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; +yy845: + YYDEBUG(845, *YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy844; + } + goto yy826; +yy846: + YYDEBUG(846, *YYCURSOR); + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy854; + } +yy847: YYDEBUG(847, *YYCURSOR); - if (yych <= '/') goto yy848; - if (yych <= '9') goto yy846; + YYCURSOR = YYMARKER; + goto yy826; yy848: YYDEBUG(848, *YYCURSOR); - yyleng = YYCURSOR - SCNG(yy_text); -#line 1564 "Zend/zend_language_scanner.l" - { /* Offset must be treated as a string */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_NUM_STRING; -} -#line 7789 "Zend/zend_language_scanner.c" + yych = *++YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy852; + } + goto yy847; yy849: YYDEBUG(849, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; YYDEBUG(850, *YYCURSOR); - if (yybm[0+yych] & 64) { - goto yy849; - } - goto yy848; + if (yych <= '/') goto yy851; + if (yych <= '9') goto yy849; yy851: YYDEBUG(851, *YYCURSOR); + yyleng = YYCURSOR - SCNG(yy_text); +#line 1568 "Zend/zend_language_scanner.l" + { /* Offset must be treated as a string */ + zendlval->value.str.val = (char *)estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + return T_NUM_STRING; +} +#line 7822 "Zend/zend_language_scanner.c" +yy852: + YYDEBUG(852, *YYCURSOR); ++YYCURSOR; YYFILL(1); yych = *YYCURSOR; - YYDEBUG(852, *YYCURSOR); - if (yybm[0+yych] & 128) { - goto yy851; + YYDEBUG(853, *YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy852; } - goto yy848; + goto yy851; +yy854: + YYDEBUG(854, *YYCURSOR); + ++YYCURSOR; + YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(855, *YYCURSOR); + if (yybm[0+yych] & 128) { + goto yy854; + } + goto yy851; } } -#line 2421 "Zend/zend_language_scanner.l" +#line 2425 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index c73f39aedb9..1104c6ac27e 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1041,6 +1041,10 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_CATCH; } +"finally" { + return T_FINALLY; +} + "throw" { return T_THROW; } diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 5ef78a9faf3..519d415e74a 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Apr 30 15:56:25 2012 */ +/* Generated by re2c 0.13.5 on Tue Jul 24 17:16:42 2012 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 5480698d9f5..ad9301d975b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2133,7 +2133,9 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (OP2_TYPE == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2833,7 +2835,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) USE_OPLINE zval *retval_ptr; zend_free_op free_op1; - + SAVE_OPLINE(); retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -2842,6 +2844,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) FREE_OP1(); } } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (OP1_TYPE == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2863,12 +2868,59 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } FREE_OP1_IF_VAR(); - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -2881,6 +2933,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -2936,7 +2992,50 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) } while (0); FREE_OP1_IF_VAR(); - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -4997,8 +5096,8 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) { zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; int i; - zend_uint catch_op_num = 0; - int catched = 0; + zend_uint catch_op_num = 0, finally_op_num = 0; + int catched = 0, finally = 0; zval restored_error_reporting; void **stack_frame = (void**)(((char*)EX_Ts()) + @@ -5013,10 +5112,15 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { /* further blocks will not be relevant... */ break; - } else if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { catch_op_num = EX(op_array)->try_catch_array[i].catch_op; - catched = 1; + catched = i + 1; } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -5073,12 +5177,29 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } EX(old_error_reporting) = NULL; - if (!catched) { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } + if (catched && finally) { + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } } ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY) @@ -5196,4 +5317,50 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { +{ + USE_OPLINE; + SAVE_OPLINE(); + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } +} + ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5cedfbe3438..df7c94f5ed4 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -372,6 +372,7 @@ zend_vm_enter: EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; + EX(leaving) = 0; nested = 1; LOAD_REGS(); @@ -1033,8 +1034,8 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER { zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; int i; - zend_uint catch_op_num = 0; - int catched = 0; + zend_uint catch_op_num = 0, finally_op_num = 0; + int catched = 0, finally = 0; zval restored_error_reporting; void **stack_frame = (void**)(((char*)EX_Ts()) + @@ -1049,10 +1050,15 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { /* further blocks will not be relevant... */ break; - } else if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EX(op_array)->try_catch_array[i].catch_op; - catched = 1; } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EX(op_array)->try_catch_array[i].catch_op; + catched = i + 1; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -1109,12 +1115,29 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } EX(old_error_reporting) = NULL; - if (!catched) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } + if (catched && finally) { + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } } static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1152,12 +1175,60 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } +static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE; + SAVE_OPLINE(); + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } +} + static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CONST == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1458,7 +1529,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_TMP_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1622,7 +1695,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1786,7 +1861,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_UNUSED == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1820,7 +1897,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A USE_OPLINE SAVE_OPLINE(); - EG(exception) = NULL; + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CV == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2233,6 +2312,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CONST == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2254,12 +2336,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2272,6 +2400,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -2326,7 +2458,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -6766,6 +6940,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(free_op1.var); } } else if (!1) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_TMP_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -6787,12 +6964,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -6805,6 +7028,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -6859,7 +7086,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11204,6 +11473,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -11225,12 +11497,59 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11243,6 +11562,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -11298,7 +11621,50 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE } while (0); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27205,6 +27571,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else if (!0) { /* Not a temp var */ + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CV == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -27226,12 +27595,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27244,6 +27659,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER SAVE_OPLINE(); do { + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } + if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -27298,7 +27717,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -40794,6 +41255,31 @@ void zend_init_opcodes_handlers(void) ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, ZEND_JMP_SET_VAR_SPEC_CV_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, + ZEND_LEAVE_SPEC_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 426f689795f..f5d0b7879a9 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -35,6 +35,7 @@ zend_vm_enter: EX(prev_execute_data) = EG(current_execute_data); EG(current_execute_data) = execute_data; EX(nested) = nested; + EX(leaving) = 0; nested = 1; LOAD_REGS(); diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 680778c2a28..69603d1d138 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -159,3 +159,4 @@ #define ZEND_SEPARATE 156 #define ZEND_QM_ASSIGN_VAR 157 #define ZEND_JMP_SET_VAR 158 +#define ZEND_LEAVE 159 From ae716939eb500f962336d37b96069cb7452c25df Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Aug 2012 17:17:18 +0200 Subject: [PATCH 404/641] Support trivial finally in generators (no yield, no return) The finally clause is now properly run when an exception is thrown in the try-block. It is not yet run on `return` and also not run when the generator is claused within a try block. I'll add those two things as soon as laruence refactored the finally code. --- Zend/zend_vm_def.h | 24 ++++++++++++------------ Zend/zend_vm_execute.h | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 83ae5c5ba43..49ee3148e3d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2513,6 +2513,18 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) zend_bool nested; zend_op_array *op_array = EX(op_array); + /* Generators go throw a different cleanup process */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + + /* Close the generator to free up resources */ + zend_generator_close(generator, 1 TSRMLS_CC); + + /* Pass execution back to handling code */ + ZEND_VM_RETURN(); + } + EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { @@ -5213,18 +5225,6 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } else { - /* For generators skip the leave handler and return directly */ - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 495b520ecb2..94c2a7cf166 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -496,6 +496,18 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) zend_bool nested; zend_op_array *op_array = EX(op_array); + /* Generators go throw a different cleanup process */ + if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { + /* The generator object is stored in return_value_ptr_ptr */ + zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + + /* Close the generator to free up resources */ + zend_generator_close(generator, 1 TSRMLS_CC); + + /* Pass execution back to handling code */ + ZEND_VM_RETURN(); + } + EG(current_execute_data) = EX(prev_execute_data); EG(opline_ptr) = NULL; if (!EG(active_symbol_table)) { @@ -1177,18 +1189,6 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } else { - /* For generators skip the leave handler and return directly */ - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } } From f3192ea6e4405dded21cc81a6587374b019a6173 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Aug 2012 18:42:16 +0200 Subject: [PATCH 405/641] Fix 64bit JSON test --- ext/json/tests/pass001.1_64bit.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/json/tests/pass001.1_64bit.phpt b/ext/json/tests/pass001.1_64bit.phpt index 9c3e6699528..ff2714436d0 100644 --- a/ext/json/tests/pass001.1_64bit.phpt +++ b/ext/json/tests/pass001.1_64bit.phpt @@ -90,10 +90,10 @@ $arr = json_decode($test, true); var_dump($arr); echo "ENCODE: FROM OBJECT\n"; -$obj_enc = json_encode($obj); +$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $obj_enc . "\n"; echo "ENCODE: FROM ARRAY\n"; -$arr_enc = json_encode($arr); +$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR); echo $arr_enc . "\n"; echo "DECODE AGAIN: AS OBJECT\n"; From 7195a5b3768e519b8f50d131a8c7041a0b57959e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Aug 2012 19:24:44 +0200 Subject: [PATCH 406/641] Forgot to add test --- .../generators/finally_uninterrupted.phpt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Zend/tests/generators/finally_uninterrupted.phpt diff --git a/Zend/tests/generators/finally_uninterrupted.phpt b/Zend/tests/generators/finally_uninterrupted.phpt new file mode 100644 index 00000000000..64c94382aa0 --- /dev/null +++ b/Zend/tests/generators/finally_uninterrupted.phpt @@ -0,0 +1,28 @@ +--TEST-- +Use of finally in generator without interrupt +--FILE-- +rewind(); // force run + +?> +--EXPECTF-- +finally run + +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 [internal function]: gen() +#1 %s(%d): Generator->rewind() +#2 {main} + thrown in %s on line %d From baea290b6c0843afb23bf9ea2979a8de15a406ce Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 13 Aug 2012 19:44:45 +0200 Subject: [PATCH 407/641] fix windows build --- Zend/zend_vm_def.h | 4 ++-- Zend/zend_vm_execute.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ad9301d975b..1aded4e4a2c 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5319,10 +5319,10 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { { - USE_OPLINE; - SAVE_OPLINE(); + USE_OPLINE zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); if (EX(leaving)) { zend_uint catch_op_num = 0, finally_op_num = 0; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index df7c94f5ed4..c4fe9a92d8c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1177,10 +1177,10 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - USE_OPLINE; - SAVE_OPLINE(); + USE_OPLINE zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); if (EX(leaving)) { zend_uint catch_op_num = 0, finally_op_num = 0; From 544f5ad35bfe8351ea3f0821a61d83ce9300457d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Aug 2012 20:29:55 +0200 Subject: [PATCH 408/641] Fix mcrypt_ecb tests after deprecation --- ext/mcrypt/tests/mcrypt_ecb.phpt | 6 ++++++ ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt | 4 +++- ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt | 2 ++ ext/mcrypt/tests/mcrypt_ecb_error.phpt | 2 ++ ext/mcrypt/tests/mcrypt_ecb_variation1.phpt | 4 +++- ext/mcrypt/tests/mcrypt_ecb_variation2.phpt | 4 +++- ext/mcrypt/tests/mcrypt_ecb_variation3.phpt | 4 +++- ext/mcrypt/tests/mcrypt_ecb_variation4.phpt | 4 +++- ext/mcrypt/tests/mcrypt_ecb_variation5.phpt | 4 +++- 9 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ext/mcrypt/tests/mcrypt_ecb.phpt b/ext/mcrypt/tests/mcrypt_ecb.phpt index e75d9fa6cde..b6d0a227865 100644 --- a/ext/mcrypt/tests/mcrypt_ecb.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb.phpt @@ -18,4 +18,10 @@ echo trim(mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n"; mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT); --EXPECTF-- + +Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d + +Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d PHP Testfest 2008 + +Deprecated: Function mcrypt_ecb() is deprecated in %s on line %d diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt index 7a5cc27f443..82f9608da8d 100644 --- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt @@ -8,6 +8,8 @@ if (!extension_loaded("mcrypt")) { ?> --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- Date: Mon, 13 Aug 2012 21:44:50 +0200 Subject: [PATCH 409/641] Rename mcrypt_cbf -> mcrypt_cfb Also fix ECB -> CFB in the initialization vector size call (not that it makes a difference, they have the same size). --- ext/mcrypt/tests/{mcrypt_cbf.phpt => mcrypt_cfb.phpt} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename ext/mcrypt/tests/{mcrypt_cbf.phpt => mcrypt_cfb.phpt} (91%) diff --git a/ext/mcrypt/tests/mcrypt_cbf.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt similarity index 91% rename from ext/mcrypt/tests/mcrypt_cbf.phpt rename to ext/mcrypt/tests/mcrypt_cfb.phpt index 8ec3cd7d3e0..54919c85897 100644 --- a/ext/mcrypt/tests/mcrypt_cbf.phpt +++ b/ext/mcrypt/tests/mcrypt_cfb.phpt @@ -1,5 +1,5 @@ --TEST-- -mcrypt_cbf +mcrypt_cfb --SKIPIF-- --FILE-- @@ -8,7 +8,7 @@ $key = "FooBar"; $secret = "PHP Testfest 2008"; $cipher = MCRYPT_RIJNDAEL_128; -$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND); +$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND); $enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv); // we have to trim as AES rounds the blocks and decrypt doesnt detect that @@ -20,4 +20,4 @@ mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT); --EXPECTF-- PHP Testfest 2008 -Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d \ No newline at end of file +Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d From 7aed2390503bfe91c91eec67ed0c88b12ff3612c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Aug 2012 21:46:15 +0200 Subject: [PATCH 410/641] Ask for less random data in mcrypt_create_iv Otherwise the RNG blocks and the test takes a lot of time to run (and occasionally fails). --- ext/mcrypt/tests/mcrypt_create_iv.phpt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/mcrypt/tests/mcrypt_create_iv.phpt b/ext/mcrypt/tests/mcrypt_create_iv.phpt index cf6456fef71..1aa48868b04 100644 --- a/ext/mcrypt/tests/mcrypt_create_iv.phpt +++ b/ext/mcrypt/tests/mcrypt_create_iv.phpt @@ -5,13 +5,13 @@ mcrypt_create_iv --FILE-- Date: Tue, 14 Aug 2012 08:59:40 +0800 Subject: [PATCH 411/641] Add functions declarations, use tabs --- Zend/zend_compile.c | 38 +- Zend/zend_compile.h | 2 + Zend/zend_language_parser.y | 16 +- Zend/zend_vm_def.h | 360 +++++------ Zend/zend_vm_execute.h | 1202 +++++++++++++++++------------------ 5 files changed, 808 insertions(+), 810 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1e995b6738a..48b85f0b709 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2722,7 +2722,7 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */ /* }}} */ void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ { - finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); + finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array)); } /* }}} */ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ @@ -2776,34 +2776,30 @@ void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */ /* }}} */ void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ { - if (catch_token->op_type != IS_UNUSED) { - zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC); - } + if (catch_token->op_type != IS_UNUSED) { + zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC); + } } /* }}} */ - void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */ { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally"); - } - if (finally_token->op_type != IS_UNUSED) { - CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; - //try_token->u.op.opline_num = catch_token->u.op.opline_num; - - opline->opcode = ZEND_LEAVE; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } - if (catch_token->op_type == IS_UNUSED) { - CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0; - } //else { - // try_token->u.op.opline_num = catch_token->u.op.opline_num; - //} + if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) { + zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally"); + } + if (finally_token->op_type != IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; + //try_token->u.op.opline_num = catch_token->u.op.opline_num; + opline->opcode = ZEND_LEAVE; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + } + if (catch_token->op_type == IS_UNUSED) { + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0; + } } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index f604de4699c..550fb0e9318 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -499,6 +499,8 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC); void zend_do_end_catch(znode *catch_token TSRMLS_DC); +void zend_do_finally(znode *finally_token TSRMLS_DC); +void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC); void zend_do_throw(const znode *expr TSRMLS_DC); ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 80760a5a543..a508fc73629 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -315,23 +315,23 @@ unticked_statement: | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}' - catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); } - finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); } + catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); } + finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); } | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); } | T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); } ; catch_statement: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } - fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); } - T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); } + /* empty */ { $$.op_type = IS_UNUSED; } + | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); } + fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); } + T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;} finally_statement: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; } + /* empty */ { $$.op_type = IS_UNUSED; } + | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; } ; additional_catches: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 1aded4e4a2c..17dfb5fd81b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1187,18 +1187,18 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) EX_T(opline->op1.var).var.ptr_ptr) { PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - - if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) { - zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); - FREE_OP2(); - FREE_OP1(); - } else { - container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); - FREE_OP2(); - FREE_OP1_VAR_PTR(); - } + + if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) { + zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); + FREE_OP2(); + FREE_OP1(); + } else { + container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); + FREE_OP2(); + FREE_OP1_VAR_PTR(); + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2133,9 +2133,9 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (OP2_TYPE == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2835,7 +2835,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) USE_OPLINE zval *retval_ptr; zend_free_op free_op1; - + SAVE_OPLINE(); retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -2844,9 +2844,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) FREE_OP1(); } } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (OP1_TYPE == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2868,9 +2868,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } else { zval *ret; - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); @@ -2878,49 +2878,49 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } FREE_OP1_IF_VAR(); - if (!(EG(active_op_array)->last_try_catch)) { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -2933,9 +2933,9 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) SAVE_OPLINE(); do { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ @@ -2993,49 +2993,49 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); - if (!(EG(active_op_array)->last_try_catch)) { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -3816,7 +3816,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zend_op_array *new_op_array=NULL; zend_free_op free_op1; zval *inc_filename; - zval *tmp_inc_filename = NULL; + zval *tmp_inc_filename = NULL; zend_bool failure_retval=0; SAVE_OPLINE(); @@ -5113,14 +5113,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) /* further blocks will not be relevant... */ break; } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { catch_op_num = EX(op_array)->try_catch_array[i].catch_op; catched = i + 1; } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EX(op_array)->try_catch_array[i].finally_op; - finally = i + 1; - } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -5178,28 +5178,28 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) EX(old_error_reporting) = NULL; if (catched && finally) { - if (finally_op_num > catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else { - zend_exception_save(TSRMLS_C); - EX(leaving) = finally; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catched) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally) { - zend_exception_save(TSRMLS_C); - EX(leaving) = finally; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } } ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY) @@ -5304,8 +5304,8 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) SAVE_OPLINE(); var_ptr = EX_T(opline->op1.var).var.ptr; if (Z_TYPE_P(var_ptr) != IS_OBJECT && - !PZVAL_IS_REF(var_ptr) && - Z_REFCOUNT_P(var_ptr) > 1) { + !PZVAL_IS_REF(var_ptr) && + Z_REFCOUNT_P(var_ptr) > 1) { Z_DELREF_P(var_ptr); ALLOC_ZVAL(new_zv); @@ -5318,49 +5318,49 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) } ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { -{ - USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + { + USE_OPLINE + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; - SAVE_OPLINE(); - zend_exception_restore(TSRMLS_C); - if (EX(leaving)) { - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(exception)) { - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + SAVE_OPLINE(); + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } else { - ZEND_VM_NEXT_OPCODE(); - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } } ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c4fe9a92d8c..6fd7f0790dc 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1051,14 +1051,14 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER /* further blocks will not be relevant... */ break; } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { catch_op_num = EX(op_array)->try_catch_array[i].catch_op; catched = i + 1; } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EX(op_array)->try_catch_array[i].finally_op; - finally = i + 1; - } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + finally = i + 1; + } } while (EX(fbc)) { @@ -1116,28 +1116,28 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER EX(old_error_reporting) = NULL; if (catched && finally) { - if (finally_op_num > catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else { - zend_exception_save(TSRMLS_C); - EX(leaving) = finally; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catched) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally) { - zend_exception_save(TSRMLS_C); - EX(leaving) = finally; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } + if (finally_op_num > catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catched) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally) { + zend_exception_save(TSRMLS_C); + EX(leaving) = finally; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } } static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1176,49 +1176,49 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + { + USE_OPLINE + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; - SAVE_OPLINE(); - zend_exception_restore(TSRMLS_C); - if (EX(leaving)) { - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(exception)) { - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + SAVE_OPLINE(); + zend_exception_restore(TSRMLS_C); + if (EX(leaving)) { + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(exception)) { + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } else { - ZEND_VM_NEXT_OPCODE(); - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } else { + ZEND_VM_NEXT_OPCODE(); + } } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1226,9 +1226,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CONST == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1529,9 +1529,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_TMP_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1695,9 +1695,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_VAR == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1861,9 +1861,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_UNUSED == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -1897,9 +1897,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A USE_OPLINE SAVE_OPLINE(); - if (EG(exception)) { - zend_exception_save(TSRMLS_C); - } + if (EG(exception)) { + zend_exception_save(TSRMLS_C); + } if (IS_CV == IS_UNUSED) { EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); CHECK_EXCEPTION(); @@ -2312,9 +2312,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else if (!0) { /* Not a temp var */ - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CONST == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -2336,58 +2336,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } else { zval *ret; - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2400,9 +2400,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); do { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ @@ -2458,49 +2458,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2700,7 +2700,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zend_op_array *new_op_array=NULL; zval *inc_filename; - zval *tmp_inc_filename = NULL; + zval *tmp_inc_filename = NULL; zend_bool failure_retval=0; SAVE_OPLINE(); @@ -3562,17 +3562,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_ PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { - zval *container = opline->op1.zv; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { + zval *container = opline->op1.zv; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4418,17 +4418,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HA PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { - zval *container = opline->op1.zv; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); + if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { + zval *container = opline->op1.zv; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5122,17 +5122,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { - zval *container = opline->op1.zv; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { + zval *container = opline->op1.zv; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6382,17 +6382,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAN PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { - zval *container = opline->op1.zv; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + if (IS_CONST == IS_TMP_VAR || IS_CONST == IS_CONST) { + zval *container = opline->op1.zv; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6940,9 +6940,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(free_op1.var); } } else if (!1) { /* Not a temp var */ - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_TMP_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -6964,58 +6964,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7028,9 +7028,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ @@ -7086,49 +7086,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7329,7 +7329,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zend_op_array *new_op_array=NULL; zend_free_op free_op1; zval *inc_filename; - zval *tmp_inc_filename = NULL; + zval *tmp_inc_filename = NULL; zend_bool failure_retval=0; SAVE_OPLINE(); @@ -8243,17 +8243,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HA PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { - zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { + zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op1.var); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op1.var); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -8967,17 +8967,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAND PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { - zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); - zval_dtor(free_op1.var); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); + if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { + zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); + zval_dtor(free_op1.var); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -9671,17 +9671,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { - zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - zval_dtor(free_op1.var); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { + zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + zval_dtor(free_op1.var); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -10797,17 +10797,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDL PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { - zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + if (IS_TMP_VAR == IS_TMP_VAR || IS_TMP_VAR == IS_CONST) { + zval *container = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op1.var); - } else { - container = NULL; - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op1.var); + } else { + container = NULL; + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11473,9 +11473,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; } } else if (!0) { /* Not a temp var */ - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_VAR == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -11497,9 +11497,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); @@ -11507,49 +11507,49 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11562,9 +11562,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE SAVE_OPLINE(); do { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ @@ -11622,49 +11622,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11974,7 +11974,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zend_op_array *new_op_array=NULL; zend_free_op free_op1; zval *inc_filename; - zval *tmp_inc_filename = NULL; + zval *tmp_inc_filename = NULL; zend_bool failure_retval=0; SAVE_OPLINE(); @@ -13465,17 +13465,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { - zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { + zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } else { - container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15642,17 +15642,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { - zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } else { - container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } + if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { + zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -17733,17 +17733,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { - zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } else { - container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } + if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { + zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20094,8 +20094,8 @@ static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND SAVE_OPLINE(); var_ptr = EX_T(opline->op1.var).var.ptr; if (Z_TYPE_P(var_ptr) != IS_OBJECT && - !PZVAL_IS_REF(var_ptr) && - Z_REFCOUNT_P(var_ptr) > 1) { + !PZVAL_IS_REF(var_ptr) && + Z_REFCOUNT_P(var_ptr) > 1) { Z_DELREF_P(var_ptr); ALLOC_ZVAL(new_zv); @@ -20859,17 +20859,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { - zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + if (IS_VAR == IS_TMP_VAR || IS_VAR == IS_CONST) { + zval *container = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } else { - container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } else { + container = _get_zval_ptr_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -27571,9 +27571,9 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else if (!0) { /* Not a temp var */ - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CV == IS_CONST || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -27595,58 +27595,58 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval *ret; - if (*EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (*EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } ALLOC_ZVAL(ret); INIT_PZVAL_COPY(ret, retval_ptr); *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27659,9 +27659,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER SAVE_OPLINE(); do { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - zval_ptr_dtor(EG(return_value_ptr_ptr)); - } + if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { + zval_ptr_dtor(EG(return_value_ptr_ptr)); + } if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) { /* Not supposed to happen, but we'll allow it */ @@ -27717,49 +27717,49 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } + if (!(EG(active_op_array)->last_try_catch)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (EG(prev_exception)) { + /* leaving */ + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } + } else if (catch_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + ZEND_VM_CONTINUE(); + } else if (finally_op_num) { + EX(leaving) = 1; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + ZEND_VM_CONTINUE(); + } else if (EX(leaving)) { + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -28057,7 +28057,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zend_op_array *new_op_array=NULL; zval *inc_filename; - zval *tmp_inc_filename = NULL; + zval *tmp_inc_filename = NULL; zend_bool failure_retval=0; SAVE_OPLINE(); @@ -29401,17 +29401,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { - zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { + zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - } else { - container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + } else { + container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -31357,17 +31357,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { - zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); + if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { + zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); - } else { - container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); - zval_dtor(free_op2.var); + } else { + container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC); + zval_dtor(free_op2.var); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -33319,17 +33319,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { - zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { + zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else { - container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } else { + container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, EX_Ts(), &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC); + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -36176,17 +36176,17 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); } - if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { - zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + if (IS_CV == IS_TMP_VAR || IS_CV == IS_CONST) { + zval *container = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - } else { - container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); - zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); + } else { + container = _get_zval_ptr_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); + zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC); - } + } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); From f82be0550b573027b1fb8ef106e7c8efc78878e1 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 14 Aug 2012 14:08:38 +0800 Subject: [PATCH 412/641] add test for alone try block, and update test scripts summary --- Zend/tests/try_catch_finally_002.phpt | 2 +- Zend/tests/try_catch_finally_003.phpt | 2 +- Zend/tests/try_catch_finally_004.phpt | 2 +- Zend/tests/try_finally_004.phpt | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 Zend/tests/try_finally_004.phpt diff --git a/Zend/tests/try_catch_finally_002.phpt b/Zend/tests/try_catch_finally_002.phpt index 94143f6fd1e..79efcb3de8c 100644 --- a/Zend/tests/try_catch_finally_002.phpt +++ b/Zend/tests/try_catch_finally_002.phpt @@ -1,5 +1,5 @@ --TEST-- -Try catch finally +Try catch finally catch(multi catch blocks) --FILE-- +--EXPECTF-- +Fatal error: Cannot use try without catch or finally in %stry_finally_004.php on line %d From 154fe7486d55b5bd71dc9ecbac369a48596a3325 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 14 Aug 2012 14:17:27 +0800 Subject: [PATCH 413/641] typo --- Zend/tests/try_catch_finally_003.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/try_catch_finally_003.phpt b/Zend/tests/try_catch_finally_003.phpt index e605538c869..784063b7490 100644 --- a/Zend/tests/try_catch_finally_003.phpt +++ b/Zend/tests/try_catch_finally_003.phpt @@ -1,5 +1,5 @@ --TEST-- -Try catch finally (multi catch blcoks with return) +Try catch finally (multi catch blocks with return) --FILE-- Date: Tue, 14 Aug 2012 17:33:38 +0200 Subject: [PATCH 414/641] Fix exif test failure There are two slightly different error messages for invalid pointers, so make the pattern slightly less strict to account for both. --- ext/exif/tests/bug60150.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/exif/tests/bug60150.phpt b/ext/exif/tests/bug60150.phpt index 63cf0a9daf5..be01998fd8e 100755 --- a/ext/exif/tests/bug60150.phpt +++ b/ext/exif/tests/bug60150.phpt @@ -12,7 +12,7 @@ var_dump(exif_read_data($infile)); ?> ===DONE=== --EXPECTF-- -Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(x%x + x%x = x%x > x%x) in %s on line %d +Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(%s) in %s on line %d Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d From da3660a4c42cb90c8d5626ac1da71c1201f98d4b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 00:15:34 +0800 Subject: [PATCH 415/641] Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when closing handler call exit) --- NEWS | 5 +++++ ext/session/mod_user.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index da53df00c0a..78b865212d5 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,11 @@ PHP NEWS . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result). (Laruence) +- Session: + . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted + when close handler call exit). (Laruence) + + ?? ??? 2012, PHP 5.4.6 - CLI Server: diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 2ff5302f782..41a63fc4b2b 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -99,6 +99,7 @@ PS_OPEN_FUNC(user) PS_CLOSE_FUNC(user) { + zend_bool bailout = 0; STDVARS; if (!PS(mod_user_implemented)) { @@ -106,9 +107,22 @@ PS_CLOSE_FUNC(user) return SUCCESS; } - retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); + zend_try { + retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); + } zend_catch { + bailout = 1; + PS(mod_user_implemented) = 0; + } zend_end_try(); + PS(mod_user_implemented) = 0; + if (bailout) { + if (retval) { + zval_ptr_dtor(&retval); + } + zend_bailout(); + } + FINISH; } From b2fe342d04d6a7ef5b56a55723e2d2b975a8622e Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 00:25:06 +0800 Subject: [PATCH 416/641] improve the fix --- ext/session/mod_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 41a63fc4b2b..7fe147b0a6b 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -114,8 +114,6 @@ PS_CLOSE_FUNC(user) PS(mod_user_implemented) = 0; } zend_end_try(); - PS(mod_user_implemented) = 0; - if (bailout) { if (retval) { zval_ptr_dtor(&retval); @@ -123,6 +121,8 @@ PS_CLOSE_FUNC(user) zend_bailout(); } + PS(mod_user_implemented) = 0; + FINISH; } From 9be55beb91378562e6e02ef4f1d010c4b1acbff9 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 00:31:57 +0800 Subject: [PATCH 417/641] Attempt to fix segfault due to retval is not initialized --- ext/session/mod_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 7fe147b0a6b..e18e826cebb 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC) } #define STDVARS \ - zval *retval; \ + zval *retval = NULL; \ int ret = FAILURE #define PSF(a) PS(mod_user_names).name.ps_##a From a5a409ebff1037f4b00fdf6d46dd61c72cb6d315 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 00:44:47 +0800 Subject: [PATCH 418/641] Fixed bug (segfault due to retval is not initialized) --- NEWS | 3 +++ ext/session/mod_user.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 985e27456c5..c7afe53d94e 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,9 @@ PHP NEWS . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result). (Laruence) +- Session: + . Fixed bug (segfault due to retval is not initialized). (Laruence) + - SPL: . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault). (Laruence, Gustavo) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 17af624998b..c187e26818b 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -63,7 +63,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC) } #define STDVARS1 \ - zval *retval; \ + zval *retval = NULL; \ int ret = FAILURE #define STDVARS \ From bec5e1015556df91b18b3fbfb6e611c3a9273d02 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 00:46:56 +0800 Subject: [PATCH 419/641] update NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 78b865212d5..c7fb47feaed 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ PHP NEWS result). (Laruence) - Session: + . Fixed bug (segfault due to retval is not initialized). (Laruence) . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when close handler call exit). (Laruence) From 80044a0879d65f524f40d0dc01121a4446e16856 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Wed, 15 Aug 2012 01:03:56 +0800 Subject: [PATCH 420/641] Fix intl tests failed because of missing skipif section --- ext/intl/tests/breakiter___construct.phpt | 1 + ext/intl/tests/breakiter_clone_basic.phpt | 4 ++++ ext/intl/tests/breakiter_current_basic.phpt | 4 ++++ ext/intl/tests/breakiter_factories_basic.phpt | 1 + ext/intl/tests/breakiter_factories_error.phpt | 4 ++++ ext/intl/tests/breakiter_first_basic.phpt | 1 + .../tests/breakiter_first_last_previous_current_error.phpt | 4 ++++ ext/intl/tests/breakiter_following_basic.phpt | 4 ++++ .../tests/breakiter_following_preceding_isBoundary_error.phpt | 4 ++++ ext/intl/tests/breakiter_getLocale_basic.phpt | 4 ++++ ext/intl/tests/breakiter_getLocale_error.phpt | 4 ++++ ext/intl/tests/breakiter_getPartsIterator_basic.phpt | 4 ++++ ext/intl/tests/breakiter_getText_basic.phpt | 1 + ext/intl/tests/breakiter_getText_error.phpt | 4 ++++ ext/intl/tests/breakiter_isBoundary_basic.phpt | 4 ++++ ext/intl/tests/breakiter_last_basic.phpt | 1 + ext/intl/tests/breakiter_next_basic.phpt | 4 ++++ ext/intl/tests/breakiter_next_error.phpt | 4 ++++ ext/intl/tests/breakiter_preceding_basic.phpt | 4 ++++ ext/intl/tests/breakiter_previous_basic.phpt | 4 ++++ ext/intl/tests/breakiter_setText_basic.phpt | 1 + ext/intl/tests/breakiter_setText_error.phpt | 4 ++++ ext/intl/tests/dateformat___construct_bad_tz_cal.phpt | 4 ++++ ext/intl/tests/dateformat_create_cal_arg.phpt | 4 ++++ ext/intl/tests/dateformat_getCalendarObject_error.phpt | 4 ++++ ext/intl/tests/dateformat_getTimeZone_error.phpt | 4 ++++ ext/intl/tests/dateformat_get_set_calendar.phpt | 4 ++++ ext/intl/tests/dateformat_get_set_timezone.phpt | 4 ++++ ext/intl/tests/dateformat_setTimeZoneID_deprecation.phpt | 4 ++++ ext/intl/tests/dateformat_setTimeZone_error.phpt | 4 ++++ ext/intl/tests/dateformat_timezone_arg_variations.phpt | 4 ++++ ext/intl/tests/rbbiter___construct_basic.phpt | 4 ++++ ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt | 4 ++++ ext/intl/tests/rbbiter_getRuleStatus_basic.phpt | 4 ++++ ext/intl/tests/rbbiter_getRules_basic.phpt | 4 ++++ 35 files changed, 122 insertions(+) diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt index 9ea6a9cf118..a818075a30c 100644 --- a/ext/intl/tests/breakiter___construct.phpt +++ b/ext/intl/tests/breakiter___construct.phpt @@ -1,6 +1,7 @@ --TEST-- IntlBreakIterator::__construct() should not be callable --SKIPIF-- + Date: Wed, 15 Aug 2012 01:06:10 +0800 Subject: [PATCH 421/641] Merge fix e7535e06e63104ccc0c90c4425b6c2541aa3c939 to 5.3 thanks for reeze.xia@gmail.com notice this --- ext/standard/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/standard/file.c b/ext/standard/file.c index 44d3a4e6a96..7147e982581 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -162,6 +162,7 @@ static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) FG(pclose_ret) = 0; FG(user_stream_current_filename) = NULL; FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE; + FG(wrapper_errors) = NULL; } static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) From 1a527397cc5cf6d745205c21d7e34a9e789189f1 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 15 Aug 2012 01:25:31 +0800 Subject: [PATCH 422/641] better fix & this test pass now --- ext/session/mod_user.c | 5 ++--- ext/session/tests/bug60634_error_5.phpt | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index e18e826cebb..84a28d34275 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -111,9 +111,10 @@ PS_CLOSE_FUNC(user) retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC); } zend_catch { bailout = 1; - PS(mod_user_implemented) = 0; } zend_end_try(); + PS(mod_user_implemented) = 0; + if (bailout) { if (retval) { zval_ptr_dtor(&retval); @@ -121,8 +122,6 @@ PS_CLOSE_FUNC(user) zend_bailout(); } - PS(mod_user_implemented) = 0; - FINISH; } diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt index 376b65f20b6..8081ab988a3 100644 --- a/ext/session/tests/bug60634_error_5.phpt +++ b/ext/session/tests/bug60634_error_5.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in close during exec ---XFAIL-- -Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID From 8c3bf96022ff6fb6be1e7bc87b794cab9e9bf90c Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 14 Aug 2012 11:41:36 -0700 Subject: [PATCH 423/641] Small test tidy up Make some test changes so the tests can be run with the CLI webserver --- ext/oci8/tests/details.inc | 53 ++++++++++++++++++---------------- ext/oci8/tests/xmltype_01.phpt | 1 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 0f03c3a65fa..9a86c468684 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -45,31 +45,34 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) { * Used for creating/dropping schema objects used by a test */ -function oci8_test_sql_execute($c, $stmtarray) -{ - foreach ($stmtarray as $stmt) { - $s = oci_parse($c, $stmt); - if (!$s) { - $m = oci_error($c); - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; - } - else { - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - if (!in_array($m['code'], array( // ignore expected errors - 942 // table or view does not exist - , 1918 // user does not exist - , 2024 // database link not found - , 2289 // sequence does not exist - , 4080 // trigger does not exist - , 38802 // edition does not exist - ))) { - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; - } - } - } - } +if (!function_exists('oci8_test_sql_execute')) { + function oci8_test_sql_execute($c, $stmtarray) + { + foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + if (!$s) { + $m = oci_error($c); + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + } + else { + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + if (!in_array($m['code'], array( // ignore expected errors + 942 // table or view does not exist + , 1918 // user does not exist + , 2024 // database link not found + , 2289 // sequence does not exist + , 4080 // trigger does not exist + , 38802 // edition does not exist + ))) { + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + } + } + } + } + } + } ?> diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt index 21aca6cc126..ebbbb31facc 100644 --- a/ext/oci8/tests/xmltype_01.phpt +++ b/ext/oci8/tests/xmltype_01.phpt @@ -5,6 +5,7 @@ Basic XMLType test if (!extension_loaded("simplexml")) die("skip no simplexml extension"); $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- Date: Tue, 14 Aug 2012 14:10:20 -0700 Subject: [PATCH 424/641] Fix skipifs Skipifs were referencing an unset variable --- ext/oci8/tests/bind_char_2_11gR1.phpt | 2 +- ext/oci8/tests/bind_char_3_11gR1.phpt | 2 +- ext/oci8/tests/bind_char_4_11gR1.phpt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index 8bb28733fee..edb2a12ff0a 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -5,7 +5,7 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index 4c6241ccfd2..fea77754d17 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index 14d58788560..2bc2f142463 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -5,7 +5,7 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', $sv, $matches) !== 1) { +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); } From 018395efafeb8cbce0b8864ca4a1eac232db1cbb Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 15 Aug 2012 14:47:00 +0200 Subject: [PATCH 425/641] Try to fix mysqli_field tests Those tests seem to fail when people have a different default collation, so try to fix by specifying utf8_general_ci explicitely. --- ext/mysqli/tests/table.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc index aa1207af444..2700c5a5e24 100644 --- a/ext/mysqli/tests/table.inc +++ b/ext/mysqli/tests/table.inc @@ -12,7 +12,7 @@ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { exit(1); } -if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { +if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1) COLLATE utf8_general_ci, PRIMARY KEY(id)) ENGINE=' . $engine)) { printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); exit(1); } @@ -20,4 +20,4 @@ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(i if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); } -?> \ No newline at end of file +?> From 0312d0a262e4e15ce49dddaa1b10492aba08ec38 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 16 Aug 2012 18:17:26 +0800 Subject: [PATCH 426/641] Prevents `goto` out of a finally block --- Zend/tests/try_finally_005.phpt | 17 +++++++++++++++++ Zend/tests/try_finally_006.phpt | 18 ++++++++++++++++++ Zend/zend_compile.c | 19 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 Zend/tests/try_finally_005.phpt create mode 100644 Zend/tests/try_finally_006.phpt diff --git a/Zend/tests/try_finally_005.phpt b/Zend/tests/try_finally_005.phpt new file mode 100644 index 00000000000..e0937f1b16b --- /dev/null +++ b/Zend/tests/try_finally_005.phpt @@ -0,0 +1,17 @@ +--TEST-- +Finally with long goto +--FILE-- + +--EXPECTF-- +Fatal error: 'goto' out of a finally block is disallowed in %stry_finally_005.php on line %d diff --git a/Zend/tests/try_finally_006.phpt b/Zend/tests/try_finally_006.phpt new file mode 100644 index 00000000000..ba1c183eb4b --- /dev/null +++ b/Zend/tests/try_finally_006.phpt @@ -0,0 +1,18 @@ +--TEST-- +Finally with near goto +--FILE-- + +--EXPECTF-- +label diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 48b85f0b709..378cf17bffa 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2277,6 +2277,25 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 zval_dtor(label); Z_TYPE_P(label) = IS_NULL; + if (op_array->last_try_catch) { + zend_uint i, op_num = opline - CG(active_op_array)->opcodes; + for (i=0; ilast_try_catch; i++) { + if (op_array->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num >= op_array->try_catch_array[i].finally_op) { + zend_op *p, *end; + p = opline; + end = op_array->opcodes + opline->op1.opline_num; + while (++p < end) { + if (p->opcode == ZEND_LEAVE) { + zend_error(E_COMPILE_ERROR, "'goto' out of a finally block is disallowed"); + } + } + } + } + } + /* Check that we are not moving into loop or switch */ current = opline->extended_value; for (distance = 0; current != dest->brk_cont; distance++) { From 8649e4236b12ce9b90356a5804be96bd1f67bcd6 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 16 Aug 2012 14:32:55 +0400 Subject: [PATCH 427/641] Fixed bug #62838 enchant_dict_quick_check() destroys zval, but fails to initialize it --- NEWS | 4 ++++ ext/enchant/enchant.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c7afe53d94e..8da72560173 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,10 @@ PHP NEWS . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault). (Laruence, Gustavo) +- Enchant: + . Fixed bug #62838 (enchant_dict_quick_check() destroys zval, but fails to + initialize it). (Tony, Mateusz Goik). + 19 Jul 2012, PHP 5.3.15 - Zend Engine: diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 0126d9ef4ed..dcc39e267b2 100755 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -729,6 +729,7 @@ PHP_FUNCTION(enchant_dict_quick_check) if (sugg) { zval_dtor(sugg); + array_init(sugg); } PHP_ENCHANT_GET_DICT; @@ -742,8 +743,6 @@ PHP_FUNCTION(enchant_dict_quick_check) RETURN_FALSE; } - array_init(sugg); - suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st); memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg)); if (suggs && n_sugg) { From 7014a0eb6d1611151a286c0ff4f2238f92c120d6 Mon Sep 17 00:00:00 2001 From: Sherif Ramadan Date: Thu, 16 Aug 2012 10:21:22 -0400 Subject: [PATCH 428/641] Fixed Mcrypt deprecated functions and related tests --- ext/mcrypt/mcrypt.c | 6 ++-- ext/mcrypt/tests/mcrypt_cbc.phpt | 6 ++++ ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt | 14 ++++++++++ ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt | 14 ++++++++++ ext/mcrypt/tests/mcrypt_cbc_error.phpt | 4 +++ ext/mcrypt/tests/mcrypt_cbc_variation1.phpt | 26 +++++++++++++++++ ext/mcrypt/tests/mcrypt_cbc_variation2.phpt | 27 +++++++++++++++++- ext/mcrypt/tests/mcrypt_cbc_variation3.phpt | 27 +++++++++++++++++- ext/mcrypt/tests/mcrypt_cbc_variation4.phpt | 28 ++++++++++++++++++- ext/mcrypt/tests/mcrypt_cbc_variation5.phpt | 26 +++++++++++++++++ ext/mcrypt/tests/mcrypt_cfb.phpt | 6 ++++ ext/mcrypt/tests/mcrypt_ofb.phpt | 10 +++++-- .../tests/mcrypt_rijndael128_128BitKey.phpt | 20 ++++++++++++- 13 files changed, 205 insertions(+), 9 deletions(-) diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 20a0f73b187..dcac776d024 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -239,9 +239,9 @@ ZEND_END_ARG_INFO() const zend_function_entry mcrypt_functions[] = { /* {{{ */ PHP_DEP_FE(mcrypt_ecb, arginfo_mcrypt_ecb) - PHP_FE(mcrypt_cbc, arginfo_mcrypt_cbc) - PHP_FE(mcrypt_cfb, arginfo_mcrypt_cfb) - PHP_FE(mcrypt_ofb, arginfo_mcrypt_ofb) + PHP_DEP_FE(mcrypt_cbc, arginfo_mcrypt_cbc) + PHP_DEP_FE(mcrypt_cfb, arginfo_mcrypt_cfb) + PHP_DEP_FE(mcrypt_ofb, arginfo_mcrypt_ofb) PHP_FE(mcrypt_get_key_size, arginfo_mcrypt_get_key_size) PHP_FE(mcrypt_get_block_size, arginfo_mcrypt_get_block_size) PHP_FE(mcrypt_get_cipher_name, arginfo_mcrypt_get_cipher_name) diff --git a/ext/mcrypt/tests/mcrypt_cbc.phpt b/ext/mcrypt/tests/mcrypt_cbc.phpt index f9160db011b..27cc5b22244 100644 --- a/ext/mcrypt/tests/mcrypt_cbc.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc.phpt @@ -18,6 +18,12 @@ echo trim(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n"; mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT); --EXPECTF-- + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d PHP Testfest 2008 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommend in %s on line %d diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt index 6df30799353..67799a3fdd9 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt @@ -72,16 +72,24 @@ function special_var_dump($str) { --- testing different key lengths key length=8 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(32) "736563726574206d6573736167650000" key length=20 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(32) "736563726574206d6573736167650000" key length=24 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(32) "736563726574206d6573736167650000" key length=26 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d string(32) "736563726574206d6573736167650000" @@ -89,14 +97,20 @@ string(32) "736563726574206d6573736167650000" iv length=4 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(32) "736563726574206d6573736167650000" iv length=8 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(32) "736563726574206d6573736167650000" iv length=9 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(32) "736563726574206d6573736167650000" ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt index 35fabd9aca7..1af094c27b0 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt @@ -55,16 +55,24 @@ foreach ($ivs as $iv) { --- testing different key lengths key length=8 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(112) "082b437d039d09418e20dc9de1dafa7ed6da5c6335b78950968441da1faf40c1f886e04da8ca177b80b376811e138c1bf51cb48dae2e7939" key length=20 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(112) "0627351e0f8a082bf7981ae2c700a43fd3d44b270ac67b00fded1c5796eea935be0fef2a23da0b3f5e243929e62ac957bf0bf463aa90fc4f" key length=24 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac" key length=26 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac" @@ -72,14 +80,20 @@ string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b6 iv length=4 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1" iv length=8 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(112) "bac347506bf092c5557c4363c301745d78f047028e2953e84fd66b30aeb6005812dadbe8baa871b83278341599b0c448ddaaa52b5a378ce5" iv length=9 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1" ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cbc_error.phpt b/ext/mcrypt/tests/mcrypt_cbc_error.phpt index ec3912b03fc..3c221802147 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_error.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_error.phpt @@ -41,11 +41,15 @@ var_dump( mcrypt_cbc($cipher, $key, $data) ); -- Testing mcrypt_cbc() function with more than expected no. of arguments -- +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc() expects at most 5 parameters, 6 given in %s on line %d NULL -- Testing mcrypt_cbc() function with less than expected no. of arguments -- +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc() expects at least 4 parameters, 3 given in %s on line %d NULL ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt index 5482de3e20a..eb233e3f92e 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_variation1.phpt @@ -124,106 +124,132 @@ fclose($fp); *** Testing mcrypt_cbc() : usage variation *** --int 0-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --int 1-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --int 12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --int -12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --float 10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --float -10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --float 12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --float -12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --float .5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --empty array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d) NULL --int indexed array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d) NULL --associative array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d) NULL --nested arrays-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d) NULL --uppercase NULL-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --lowercase null-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --lowercase true-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --lowercase false-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --uppercase TRUE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --uppercase FALSE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --empty string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --empty string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --instance of classWithToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --instance of classWithoutToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, object given, %s(%d) NULL --undefined var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --unset var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d) bool(false) --resource-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 1 to be string, resource given, %s(%d) NULL ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt index f49e80ee937..3d2a0614722 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt @@ -124,87 +124,112 @@ fclose($fp); *** Testing mcrypt_cbc() : usage variation *** --int 0-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "bc27b3a4e33b531d5983fc7df693cd09" --int 1-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "bc27b3a4e33b531d5983fc7df693cd09" --int 12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "d109b7973383127002474ae731c4b3a8" --int -12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "3e82a931cedb03a38b91a637ff8c9f9e" --float 10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "de71833586c1d7132a289960ebeeca7a" --float -10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "7d0489dd2e99ae910ecc015573f3dd16" --float 12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "978055b42c0506a8947e3c3c8d994baf" --float -12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "4aa84ba400c2b8ef467d4d98372b4f4e" --float .5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "e731dc5059b84e0c8774ac490f77d6e6" --empty array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d) string(0) "" --int indexed array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d) string(0) "" --associative array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d) string(0) "" --nested arrays-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d) string(0) "" --uppercase NULL-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --lowercase null-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --lowercase true-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "bc27b3a4e33b531d5983fc7df693cd09" --lowercase false-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --uppercase TRUE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "bc27b3a4e33b531d5983fc7df693cd09" --uppercase FALSE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --empty string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --empty string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --instance of classWithToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "19420fa26f561ee82ed84abbcd2d284b" --instance of classWithoutToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, object given, %s(%d) string(0) "" --undefined var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --unset var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "be722a5ffc361d721fbcab1eacc6acf5" --resource-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 2 to be string, resource given, %s(%d) string(0) "" ===DONE=== - diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt index 5b2398ddbda..9a1464b1122 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt @@ -124,87 +124,112 @@ fclose($fp); *** Testing mcrypt_cbc() : usage variation *** --int 0-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "ce5fcfe737859795" --int 1-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "84df495f6cd82dd9" --int 12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "905ab1ae27ee9991" --int -12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "5835174e9c67c3e7" --float 10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "28ff0601ad9e47fa" --float -10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "ce9f2b6e2fc3d9f7" --float 12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "24eb882ce9763e4018fba9b7f01b0c3e" --float -12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5eed30e428f32de1d7a7064d0ed4d3eb" --float .5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "bebf2a13676e1e30" --empty array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d) string(0) "" --int indexed array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d) string(0) "" --associative array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d) string(0) "" --nested arrays-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d) string(0) "" --uppercase NULL-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --lowercase null-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --lowercase true-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "84df495f6cd82dd9" --lowercase false-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --uppercase TRUE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "84df495f6cd82dd9" --uppercase FALSE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --empty string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --empty string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --instance of classWithToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "7c91cdf8f8c51485034a9ee528eb016b" --instance of classWithoutToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, object given, %s(%d) string(0) "" --undefined var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --unset var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(16) "206f6d3617a5ab32" --resource-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 3 to be string, resource given, %s(%d) string(0) "" ===DONE=== - diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt index f9a511f3900..a3dd29ba41b 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt @@ -124,82 +124,108 @@ fclose($fp); *** Testing mcrypt_cbc() : usage variation *** --float 10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --float -10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --float 12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --float -12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --float .5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --empty array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --int indexed array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --associative array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --nested arrays-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --uppercase NULL-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --lowercase null-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --lowercase true-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --lowercase false-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --uppercase TRUE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --uppercase FALSE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --empty string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --empty string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --mixed case string-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --heredoc-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --instance of classWithToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8 - Object of class classWithToString could not be converted to int, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --instance of classWithoutToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d) string(32) "983d5edc5f77fe42e2372a0339dc22b0" --undefined var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --unset var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) string(32) "5f781523f696d596e4b809d72197a0cc" --resource-- -string(%d) %s +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) +string(32) "983d5edc5f77fe42e2372a0339dc22b0" ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt index 7d49db853d3..0c75c979341 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt @@ -124,106 +124,132 @@ fclose($fp); *** Testing mcrypt_cbc() : usage variation *** --int 0-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --int 1-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --int 12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --int -12345-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --float 10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --float -10.5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --float 12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --float -12.3456789000e10-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --float .5-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --empty array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d) string(0) "" --int indexed array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d) string(0) "" --associative array-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d) string(0) "" --nested arrays-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d) string(0) "" --uppercase NULL-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --lowercase null-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --lowercase true-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --lowercase false-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --uppercase TRUE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --uppercase FALSE-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --empty string DQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --empty string SQ-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --instance of classWithToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --instance of classWithoutToString-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, object given, %s(%d) string(0) "" --undefined var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --unset var-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d) string(32) "6438db90653c4d3080c3ceab43618c05" --resource-- +Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 2 - mcrypt_cbc() expects parameter 5 to be string, resource given, %s(%d) string(0) "" ===DONE=== diff --git a/ext/mcrypt/tests/mcrypt_cfb.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt index 54919c85897..11120633a5e 100644 --- a/ext/mcrypt/tests/mcrypt_cfb.phpt +++ b/ext/mcrypt/tests/mcrypt_cfb.phpt @@ -18,6 +18,12 @@ echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n"; mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT); --EXPECTF-- + +Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d + +Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d PHP Testfest 2008 +Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d + Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d diff --git a/ext/mcrypt/tests/mcrypt_ofb.phpt b/ext/mcrypt/tests/mcrypt_ofb.phpt index 1532c4cf29f..94203530603 100644 --- a/ext/mcrypt/tests/mcrypt_ofb.phpt +++ b/ext/mcrypt/tests/mcrypt_ofb.phpt @@ -17,5 +17,11 @@ echo trim(mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n"; // a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv); ---EXPECT-- -PHP Testfest 2008 \ No newline at end of file +--EXPECTF-- + +Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d + +Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d +PHP Testfest 2008 + +Deprecated: Function mcrypt_ofb() is deprecated in %s on line %d diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt index 100352a1c7e..e450a69047e 100644 --- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt +++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt @@ -76,24 +76,34 @@ foreach ($ivs as $iv) { key length=0 string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397" + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" key length=0 string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397" + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" key length=8 string(128) "d6a3042b278fa5816dc6f46152acbe5fd7d1813c3808c27cd969d8e10a64d0238724edfda0322f4512308f22d142df0e92bed861c2b732f7650e234df59183dc" + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" key length=16 string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101" + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" --- testing different iv lengths iv length=0 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4" @@ -102,6 +112,8 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206 iv length=0 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4" @@ -110,6 +122,8 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206 iv length=8 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4" @@ -117,14 +131,18 @@ Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" iv length=16 + +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101" string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" iv length=17 +Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d + Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4" Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000" -===DONE=== \ No newline at end of file +===DONE=== From acd402d4e78ce25e80d19aa564bed1329dcc4ddc Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 16 Aug 2012 23:01:58 +0800 Subject: [PATCH 429/641] typo --- Zend/zend_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 378cf17bffa..d7ca6eab33f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2278,7 +2278,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 Z_TYPE_P(label) = IS_NULL; if (op_array->last_try_catch) { - zend_uint i, op_num = opline - CG(active_op_array)->opcodes; + zend_uint i, op_num = opline - op_array->opcodes; for (i=0; ilast_try_catch; i++) { if (op_array->try_catch_array[i].try_op > op_num) { break; From fc26aa7f3e223ab8e3d5c07b4b0c6dd3cf09cb83 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Aug 2012 17:10:05 +0200 Subject: [PATCH 430/641] Adjust UPGRADING/NEWS for additional mcrypt deprecations --- NEWS | 4 ++++ UPGRADING | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 58eeabd37f2..b71945087ff 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,10 @@ PHP NEWS - Hash . Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara) +- MCrypt + . mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw + E_DEPRECATED. (GoogleGuy) + - MySQLi . Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql. Known for stability problems. (Andrey) diff --git a/UPGRADING b/UPGRADING index f95ab4962b1..aeab14b48fc 100755 --- a/UPGRADING +++ b/UPGRADING @@ -98,7 +98,9 @@ PHP X.Y UPGRADE NOTES instead. - IntlDateFormatter::format() and datefmt_format() now also accept an IntlCalendar object for formatting. -- Deprecated mcrypt_ecb() made to produce E_DEPRECATED. +- mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw + E_DEPRECATED. Their use was already previously discouraged in the docs, + but that predated the existence of E_DEPRECATED. - php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and zend_logo_guid() have been removed From 9a38bd66c87e8f6e1ac8e28014bb42686d5742d3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Aug 2012 17:46:34 +0200 Subject: [PATCH 431/641] Fix php_ini_loaded_file() test If running ./run-tests.php directly there isn't necessarily an ini file, so the function can also return false. --- ext/standard/tests/php_ini_loaded_file.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/tests/php_ini_loaded_file.phpt b/ext/standard/tests/php_ini_loaded_file.phpt index 747e0196f19..7d441582eeb 100644 --- a/ext/standard/tests/php_ini_loaded_file.phpt +++ b/ext/standard/tests/php_ini_loaded_file.phpt @@ -10,5 +10,5 @@ precision=12 ---EXPECTF-- -string(%d) "%sphp.ini" +--EXPECTREGEX-- +string\(\d+\) ".*php\.ini"|bool\(false\) From b5305d267b6c3b1b09ab0ba4ecf4f66edc5d4077 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Aug 2012 19:02:39 +0200 Subject: [PATCH 432/641] Fix curl_basic_022.phpt Some curl versions seem to have issues handling dates beyond Thu, 31-Dec-2037 23:59:59 GMT (dates after this are just clamped to MAX_INT). --- ext/curl/tests/curl_basic_022.phpt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/curl/tests/curl_basic_022.phpt b/ext/curl/tests/curl_basic_022.phpt index 6a611af590c..d4277a3f899 100644 --- a/ext/curl/tests/curl_basic_022.phpt +++ b/ext/curl/tests/curl_basic_022.phpt @@ -11,15 +11,15 @@ if ($curl_version['version_number'] < 0x070e01) { --EXPECT-- array(2) { [0]=> - string(38) ".php.net TRUE / FALSE 2147368447 C1 v1" + string(38) ".php.net TRUE / FALSE 2145916799 C1 v1" [1]=> - string(38) ".php.net TRUE / FALSE 2147368447 C2 v2" + string(38) ".php.net TRUE / FALSE 2145916799 C2 v2" } From 2e1d31d123ea5f310719c6c3c51587834907b7bf Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 16 Aug 2012 15:45:21 -0300 Subject: [PATCH 433/641] - Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is not set) --- sapi/cli/php_http_parser.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h index b740a0995ef..7e72b78d7db 100644 --- a/sapi/cli/php_http_parser.h +++ b/sapi/cli/php_http_parser.h @@ -32,7 +32,10 @@ extern "C" { # include "win32/php_stdint.h" # include "config.w32.h" #else -# include +# include "php_config.h" +# ifdef HAVE_STDINT_H +# include +# endif #endif /* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run From 9cf0139460c7531ebe8fdd523ba6cf7067a7f282 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Thu, 16 Aug 2012 14:48:44 -0400 Subject: [PATCH 434/641] Fixed bug #62839 curl_copy_handle segfault with CURLOPT_FILE. The refcount was incremented before the assignement. --- NEWS | 1 + ext/curl/interface.c | 4 ++-- ext/curl/tests/bug62839.phpt | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 ext/curl/tests/bug62839.phpt diff --git a/NEWS b/NEWS index 8da72560173..7f5c48b2aae 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ PHP NEWS with run-test.php). (Laruence) - CURL: + . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). (r.hampartsumyan@gmail.com, Laruence) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 94be60fd5d5..7b728730382 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1610,9 +1610,9 @@ PHP_FUNCTION(curl_copy_handle) dupch->uses = 0; ch->uses++; if (ch->handlers->write->stream) { - Z_ADDREF_P(dupch->handlers->write->stream); - dupch->handlers->write->stream = ch->handlers->write->stream; + Z_ADDREF_P(ch->handlers->write->stream); } + dupch->handlers->write->stream = ch->handlers->write->stream; dupch->handlers->write->method = ch->handlers->write->method; dupch->handlers->write->type = ch->handlers->write->type; if (ch->handlers->read->stream) { diff --git a/ext/curl/tests/bug62839.phpt b/ext/curl/tests/bug62839.phpt new file mode 100644 index 00000000000..39e6fc9cbe9 --- /dev/null +++ b/ext/curl/tests/bug62839.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +DONE! From 8cccc5c37d0113a0560410435126cb3032dd22a7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Aug 2012 21:30:58 +0200 Subject: [PATCH 435/641] Revert "Try to fix mysqli_field tests" This reverts commit 018395efafeb8cbce0b8864ca4a1eac232db1cbb. This change didn't really make sense in hindsight. Looking for some other fix. --- ext/mysqli/tests/table.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc index 2700c5a5e24..aa1207af444 100644 --- a/ext/mysqli/tests/table.inc +++ b/ext/mysqli/tests/table.inc @@ -12,7 +12,7 @@ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { exit(1); } -if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1) COLLATE utf8_general_ci, PRIMARY KEY(id)) ENGINE=' . $engine)) { +if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); exit(1); } @@ -20,4 +20,4 @@ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1) COLLATE utf8_g if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); } -?> +?> \ No newline at end of file From 0b23da1c74c52a819b728c78c66c182511223355 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 17 Aug 2012 18:28:32 +0800 Subject: [PATCH 436/641] Fixed bug #62836 (Seg fault or broken object references on unserialize()) --- NEWS | 4 +++ ext/standard/tests/serialize/bug62836_1.phpt | 34 ++++++++++++++++++ ext/standard/tests/serialize/bug62836_2.phpt | 37 ++++++++++++++++++++ ext/standard/var_unserializer.c | 6 ++++ 4 files changed, 81 insertions(+) create mode 100644 ext/standard/tests/serialize/bug62836_1.phpt create mode 100644 ext/standard/tests/serialize/bug62836_2.phpt diff --git a/NEWS b/NEWS index c7fb47feaed..1142a428828 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,10 @@ PHP NEWS . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when close handler call exit). (Laruence) +- Standard: + . Fixed bug #62836 (Seg fault or broken object references on unserialize()). + (Laruence) + ?? ??? 2012, PHP 5.4.6 diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt new file mode 100644 index 00000000000..72910464101 --- /dev/null +++ b/ext/standard/tests/serialize/bug62836_1.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #62836 (Seg fault or broken object references on unserialize()) +--FILE-- + +--EXPECT-- +A Object +( + [b] => B Object + ( + ) + + [b1] => B Object + ( + ) + + [c] => B Object + ( + ) + + [c1] => B Object + ( + ) + +) +okey diff --git a/ext/standard/tests/serialize/bug62836_2.phpt b/ext/standard/tests/serialize/bug62836_2.phpt new file mode 100644 index 00000000000..0634b1dac13 --- /dev/null +++ b/ext/standard/tests/serialize/bug62836_2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #62836 (Seg fault or broken object references on unserialize()) +--FILE-- + +--EXPECT-- +A Object +( + [b] => B Object + ( + ) + + [b1] => B Object + ( + ) + + [c] => B Object + ( + ) + + [c1] => B Object + ( + ) + +) +okey diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index e1ac636d04c..2537c5213b6 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -620,10 +620,13 @@ yy20: do { /* Try to find class directly */ + BG(serialize_lock) = 1; if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + BG(serialize_lock) = 0; ce = *pce; break; } + BG(serialize_lock) = 0; /* Check for unserialize callback */ if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) { @@ -638,7 +641,9 @@ yy20: args[0] = &arg_func_name; MAKE_STD_ZVAL(arg_func_name); ZVAL_STRING(arg_func_name, class_name, 1); + BG(serialize_lock) = 1; if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { + BG(serialize_lock) = 0; php_error_docref(NULL TSRMLS_CC, E_WARNING, "defined (%s) but not found", user_func->value.str.val); incomplete_class = 1; ce = PHP_IC_ENTRY; @@ -646,6 +651,7 @@ yy20: zval_ptr_dtor(&arg_func_name); break; } + BG(serialize_lock) = 0; if (retval_ptr) { zval_ptr_dtor(&retval_ptr); } From 24493652382c985b13a9ed94aae5fffae16a6895 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 17 Aug 2012 21:18:20 +0800 Subject: [PATCH 437/641] Fixed context info in error message --- Zend/zend_compile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d7ca6eab33f..bad9411a2f4 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2289,6 +2289,11 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 end = op_array->opcodes + opline->op1.opline_num; while (++p < end) { if (p->opcode == ZEND_LEAVE) { + if (pass2) { + CG(in_compilation) = 1; + CG(active_op_array) = op_array; + CG(zend_lineno) = opline->lineno; + } zend_error(E_COMPILE_ERROR, "'goto' out of a finally block is disallowed"); } } From 14847af41d153e3abe4986afa49526d93810098a Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Fri, 17 Aug 2012 23:07:54 +0800 Subject: [PATCH 438/641] Update version numbers to 5.4.7-dev. --- configure.in | 2 +- main/php_version.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index 1e806899225..e5e1cd63752 100644 --- a/configure.in +++ b/configure.in @@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...); PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=4 -PHP_RELEASE_VERSION=5 +PHP_RELEASE_VERSION=7 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/main/php_version.h b/main/php_version.h index 4b7709c552b..3315661b7a9 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 5 +#define PHP_RELEASE_VERSION 7 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.5-dev" -#define PHP_VERSION_ID 50405 +#define PHP_VERSION "5.4.7-dev" +#define PHP_VERSION_ID 50407 From f2a8912e618d4bd8ff5be266e37f2b6e2280e994 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 18 Aug 2012 00:16:34 +0800 Subject: [PATCH 439/641] Refactor examing of jumping out of finally block --- Zend/tests/try_finally_005.phpt | 2 +- Zend/tests/try_finally_006.phpt | 14 +++++++++++--- Zend/tests/try_finally_007.phpt | 22 ++++++++++++++++++++++ Zend/tests/try_finally_008.phpt | 24 ++++++++++++++++++++++++ Zend/zend_compile.c | 30 +++--------------------------- Zend/zend_compile.h | 3 ++- Zend/zend_opcode.c | 17 +++++++++++++++++ 7 files changed, 80 insertions(+), 32 deletions(-) create mode 100644 Zend/tests/try_finally_007.phpt create mode 100644 Zend/tests/try_finally_008.phpt diff --git a/Zend/tests/try_finally_005.phpt b/Zend/tests/try_finally_005.phpt index e0937f1b16b..2c6c2c9e6ce 100644 --- a/Zend/tests/try_finally_005.phpt +++ b/Zend/tests/try_finally_005.phpt @@ -14,4 +14,4 @@ label: foo(); ?> --EXPECTF-- -Fatal error: 'goto' out of a finally block is disallowed in %stry_finally_005.php on line %d +Fatal error: jump out of a finally block is disallowed in %stry_finally_005.php on line %d diff --git a/Zend/tests/try_finally_006.phpt b/Zend/tests/try_finally_006.phpt index ba1c183eb4b..2bfa4caea9c 100644 --- a/Zend/tests/try_finally_006.phpt +++ b/Zend/tests/try_finally_006.phpt @@ -3,12 +3,19 @@ Finally with near goto --FILE-- --EXPECTF-- label +okey diff --git a/Zend/tests/try_finally_007.phpt b/Zend/tests/try_finally_007.phpt new file mode 100644 index 00000000000..b13bd59e508 --- /dev/null +++ b/Zend/tests/try_finally_007.phpt @@ -0,0 +1,22 @@ +--TEST-- +Finally with goto previous label +--FILE-- + +--EXPECTF-- +Fatal error: jump out of a finally block is disallowed in %stry_finally_007.php on line %d diff --git a/Zend/tests/try_finally_008.phpt b/Zend/tests/try_finally_008.phpt new file mode 100644 index 00000000000..77ecf4fdeee --- /dev/null +++ b/Zend/tests/try_finally_008.phpt @@ -0,0 +1,24 @@ +--TEST-- +Finally with jmp (do while) +--FILE-- + +--EXPECTF-- +Fatal error: jump out of a finally block is disallowed in %stry_finally_008.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index bad9411a2f4..6a501f78a5d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2277,30 +2277,6 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 zval_dtor(label); Z_TYPE_P(label) = IS_NULL; - if (op_array->last_try_catch) { - zend_uint i, op_num = opline - op_array->opcodes; - for (i=0; ilast_try_catch; i++) { - if (op_array->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num >= op_array->try_catch_array[i].finally_op) { - zend_op *p, *end; - p = opline; - end = op_array->opcodes + opline->op1.opline_num; - while (++p < end) { - if (p->opcode == ZEND_LEAVE) { - if (pass2) { - CG(in_compilation) = 1; - CG(active_op_array) = op_array; - CG(zend_lineno) = opline->lineno; - } - zend_error(E_COMPILE_ERROR, "'goto' out of a finally block is disallowed"); - } - } - } - } - } - /* Check that we are not moving into loop or switch */ current = opline->extended_value; for (distance = 0; current != dest->brk_cont; distance++) { @@ -2686,6 +2662,7 @@ static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch); CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op; CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0; + CG(active_op_array)->try_catch_array[try_catch_offset].finally_end = 0; return try_catch_offset; } /* }}} */ @@ -2808,14 +2785,13 @@ void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ * void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */ { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) { zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally"); } if (finally_token->op_type != IS_UNUSED) { + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; - //try_token->u.op.opline_num = catch_token->u.op.opline_num; + CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array)); opline->opcode = ZEND_LEAVE; SET_UNUSED(opline->op1); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 550fb0e9318..a06c985a979 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -132,7 +132,8 @@ typedef struct _zend_label { typedef struct _zend_try_catch_element { zend_uint try_op; zend_uint catch_op; /* ketchup! */ - zend_uint finally_op; + zend_uint finally_op; + zend_uint finally_end; } zend_try_catch_element; #if SIZEOF_LONG == 8 diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 19fd71e763d..8cccfe63768 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -528,6 +528,23 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) } /* break omitted intentionally */ case ZEND_JMP: + if (op_array->last_try_catch) { + zend_uint i, op_num = opline - op_array->opcodes; + for (i=0; i < op_array->last_try_catch; i++) { + if (op_array->try_catch_array[i].try_op > op_num) { + break; + } + if ((op_num >= op_array->try_catch_array[i].finally_op + && op_num < op_array->try_catch_array[i].finally_end) + && (opline->op1.opline_num >= op_array->try_catch_array[i].finally_end + || opline->op1.opline_num < op_array->try_catch_array[i].finally_op)) { + CG(in_compilation) = 1; + CG(active_op_array) = op_array; + CG(zend_lineno) = opline->lineno; + zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed"); + } + } + } opline->op1.jmp_addr = &op_array->opcodes[opline->op1.opline_num]; break; case ZEND_JMPZ: From 294e7c295fe55372fb93d4dbbf3ccb7ac785cb4a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 17 Aug 2012 15:17:29 +0200 Subject: [PATCH 440/641] Annother attempt at fixing the mysqli_fetch_field tests Instead of character set detection (which doesn't always work correctly) fetch the character set info using mysqli_get_charset(). To make sure that the returned info applies to all of client, connection and result explicitely set utf8 as charset using mysqli_set_charset() before. I'm not sure whether that last part is really necessary, but included it to be safe. --- ext/mysqli/tests/connect.inc | 93 ------------------- ext/mysqli/tests/mysqli_fetch_field.phpt | 22 +++-- ext/mysqli/tests/mysqli_fetch_field_oo.phpt | 21 +++-- ext/mysqli/tests/mysqli_fetch_fields.phpt | 20 ++-- ext/mysqli/tests/mysqli_field_seek.phpt | 22 +++-- ..._stmt_get_result_metadata_fetch_field.phpt | 21 +++-- 6 files changed, 64 insertions(+), 135 deletions(-) diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc index 3a9d8ec258c..4acc20cb919 100644 --- a/ext/mysqli/tests/connect.inc +++ b/ext/mysqli/tests/connect.inc @@ -129,99 +129,6 @@ } } - function my_get_charsets($link) { - - /* Those tree are set by SET NAMES */ - $charsets = array( - 'client' => NULL, - 'results' => NULL, - 'connection' => NULL, - ); - - if (!($res = mysqli_query($link, "SHOW VARIABLES LIKE '%character%'"))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - - $names = array(); - while ($row = mysqli_fetch_assoc($res)) { - $names[$row['Variable_name']] = $row['Value']; - } - mysqli_free_result($res); - - if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_client']))) || - !($details = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - - $charsets['client'] = array( - 'charset' => $details['Charset'], - 'desc' => $details['Description'], - 'collation' => $details['Default collation'], - 'maxlen' => $details['Maxlen'], - 'nr' => NULL, - ); - - if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || - !($collation = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - $charsets['client']['nr'] = $collation['Id']; - - if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_results']))) || - !($details = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - - $charsets['results'] = array( - 'charset' => $details['Charset'], - 'desc' => $details['Description'], - 'collation' => $details['Default collation'], - 'maxlen' => $details['Maxlen'], - 'nr' => NULL, - ); - - if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || - !($collation = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - $charsets['results']['nr'] = $collation['Id']; - - - if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_connection']))) || - !($details = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - - $charsets['connection'] = array( - 'charset' => $details['Charset'], - 'desc' => $details['Description'], - 'collation' => $details['Default collation'], - 'maxlen' => $details['Maxlen'], - 'nr' => NULL, - ); - - if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || - !($collation = mysqli_fetch_assoc($res))) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); - return $charsets; - } - mysqli_free_result($res); - $charsets['connection']['nr'] = $collation['Id']; - - return $charsets; - } - function have_innodb($link) { if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) && ($row = $res->fetch_row()) && diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt index d1d358b3421..2b9108072b4 100644 --- a/ext/mysqli/tests/mysqli_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field.phpt @@ -22,7 +22,13 @@ require_once('skipifconnectfailure.inc'); require('table.inc'); - $charsets = my_get_charsets($link); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + + $charsetInfo = mysqli_get_charset($link); + if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } @@ -34,19 +40,17 @@ require_once('skipifconnectfailure.inc'); /* label column, result set charset */ $tmp = mysqli_fetch_field($res); var_dump($tmp); - if ($tmp->charsetnr != $charsets['results']['nr']) { + if ($tmp->charsetnr != $charsetInfo->number) { printf("[004] Expecting charset %s/%d got %d\n", - $charsets['results']['charset'], - $charsets['results']['nr'], $tmp->charsetnr); + $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); } - if ($tmp->length != (1 * $charsets['results']['maxlen'])) { + if ($tmp->length != $charsetInfo->max_length) { printf("[005] Expecting length %d got %d\n", - $charsets['results']['maxlen'], - $tmp->max_length); + $charsetInfo->max_length, $tmp->max_length); } if ($tmp->db != $db) { printf("011] Expecting database '%s' got '%s'\n", - $db, $tmp->db); + $db, $tmp->db); } var_dump(mysqli_fetch_field($res)); @@ -174,4 +178,4 @@ object(stdClass)#%d (13) { [%u|b%"decimals"]=> int(0) } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt index 2d5ad261b13..8c5609b163d 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt @@ -27,7 +27,12 @@ require_once('skipifconnectfailure.inc'); if (!is_null($tmp = @$res->fetch_field($link))) printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $charsets = my_get_charsets($link); + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!$mysqli->set_charset('utf8')) + printf("[%d] %s\n", $mysqli->errno, $mysqli->errno); + + $charsetInfo = $mysqli->get_charset(); if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); @@ -37,18 +42,16 @@ require_once('skipifconnectfailure.inc'); $tmp = $res->fetch_field(); var_dump($tmp); - if ($tmp->charsetnr != $charsets['results']['nr']) { + if ($tmp->charsetnr != $charsetInfo->number) { printf("[005] Expecting charset %s/%d got %d\n", - $charsets['results']['charset'], - $charsets['results']['nr'], $tmp->charsetnr); + $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr); } - if ($tmp->length != (1 * $charsets['results']['maxlen'])) { + if ($tmp->length != $charsetInfo->max_length) { printf("[006] Expecting length %d got %d\n", - $charsets['results']['maxlen'], - $tmp->max_length); + $charsetInfo->max_length, $tmp->max_length); } if ($tmp->db != $db) { - printf("008] Expecting database '%s' got '%s'\n", + printf("[007] Expecting database '%s' got '%s'\n", $db, $tmp->db); } @@ -126,4 +129,4 @@ object(stdClass)#%d (13) { bool(false) Warning: mysqli_result::fetch_field(): Couldn't fetch mysqli_result in %s on line %d -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt index 479c71cbbc5..6b66d6f231f 100644 --- a/ext/mysqli/tests/mysqli_fetch_fields.phpt +++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt @@ -21,7 +21,13 @@ require_once('skipifconnectfailure.inc'); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); - $charsets = my_get_charsets($link); + + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + + $charsetInfo = mysqli_get_charset($link); if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -33,14 +39,14 @@ require_once('skipifconnectfailure.inc'); switch ($k) { case 1: /* label column, result set charset */ - if ($field->charsetnr != $charsets['results']['nr']) { + if ($field->charsetnr != $charsetInfo->number) { printf("[004] Expecting charset %s/%d got %d\n", - $charsets['results']['charset'], - $charsets['results']['nr'], $field->charsetnr); + $charsetInfo->charset, + $charsetInfo->number, $field->charsetnr); } - if ($field->length != (1 * $charsets['results']['maxlen'])) { + if ($field->length != $charsetInfo->max_length) { printf("[005] Expecting length %d got %d\n", - $charsets['results']['maxlen'], + $charsetInfo->max_length, $field->max_length); } break; @@ -118,4 +124,4 @@ object(stdClass)#%d (13) { } Warning: mysqli_fetch_fields(): Couldn't fetch mysqli_result in %s on line %d -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt index a747bdfa019..449d2f90d41 100644 --- a/ext/mysqli/tests/mysqli_field_seek.phpt +++ b/ext/mysqli/tests/mysqli_field_seek.phpt @@ -66,7 +66,13 @@ require_once('skipifconnectfailure.inc'); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); - $charsets = my_get_charsets($link); + + // Make sure that client, connection and result charsets are all the + // same. Not sure whether this is strictly necessary. + if (!mysqli_set_charset($link, 'utf8')) + printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link)); + + $charsetInfo = mysqli_get_charset($link); if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -81,15 +87,13 @@ require_once('skipifconnectfailure.inc'); $field = mysqli_fetch_field($res); var_dump($field); /* label column, result set charset */ - if ($field->charsetnr != $charsets['results']['nr']) { + if ($field->charsetnr != $charsetInfo->number) { printf("[004] Expecting charset %s/%d got %d\n", - $charsets['results']['charset'], - $charsets['results']['nr'], $field->charsetnr); + $charsetInfo->charset, $charsetInfo->number, $field->charsetnr); } - if ($field->length != (1 * $charsets['results']['maxlen'])) { + if ($field->length != $charsetInfo->max_length) { printf("[005] Expecting length %d got %d\n", - $charsets['results']['maxlen'], - $field->max_length); + $charsetInfo->max_length, $field->max_length); } var_dump(mysqli_field_tell($res)); @@ -217,7 +221,7 @@ bool(false) Warning: mysqli_field_seek(): Invalid field offset in %s on line %d bool(false) bool(true) -object(stdClass)#3 (13) { +object(stdClass)#%d (13) { [%u|b%"name"]=> %unicode|string%(5) "_null" [%u|b%"orgname"]=> @@ -248,4 +252,4 @@ object(stdClass)#3 (13) { Warning: mysqli_field_seek(): Couldn't fetch mysqli_result in %s on line %d NULL -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt index afaccaf3c7a..739bf56ea15 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt @@ -12,7 +12,13 @@ if (!function_exists('mysqli_stmt_get_result')) --FILE-- charsetnr != $charsets['results']['nr']) { + if ($field->charsetnr != $charsetInfo->number) { printf("[004] Expecting charset %s/%d got %d\n", - $charsets['results']['charset'], - $charsets['results']['nr'], $field->charsetnr); + $charsetInfo->charset, + $charsetInfo->number, $field->charsetnr); } - if ($field->length != (1 * $charsets['results']['maxlen'])) { + if ($field->length != $charsetInfo->max_length) { printf("[005] Expecting length %d got %d\n", - $charsets['results']['maxlen'], - $field->max_length); + $charsetInfo->max_length, $field->max_length); } } } @@ -173,4 +178,4 @@ object(stdClass)#%d (13) { [%u|b%"decimals"]=> int(31) } -done! \ No newline at end of file +done! From 1a23d42909070269d53fc7500d683e88ba219cb3 Mon Sep 17 00:00:00 2001 From: Matt Ficken Date: Fri, 17 Aug 2012 20:29:08 +0200 Subject: [PATCH 441/641] More intl tests extracted from symfony --- .../symfony_format_type_double_intl1.phpt | 30 ++++++++++++ .../symfony_format_type_double_intl2.phpt | 30 ++++++++++++ .../symfony_format_type_double_intl3.phpt | 30 ++++++++++++ .../symfony_format_type_double_intl4.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int32_intl1.phpt | 49 +++++++++++++++++++ ext/intl/symfony_format_type_int32_intl2.phpt | 33 +++++++++++++ ext/intl/symfony_format_type_int32_intl3.phpt | 32 ++++++++++++ ext/intl/symfony_format_type_int32_intl4.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int32_intl5.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int32_intl6.phpt | 32 ++++++++++++ ext/intl/symfony_format_type_int32_intl7.phpt | 32 ++++++++++++ ext/intl/symfony_format_type_int64_intl1.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl2.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl3.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl4.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl5.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl6.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl7.phpt | 30 ++++++++++++ ext/intl/symfony_format_type_int64_intl8.phpt | 30 ++++++++++++ 19 files changed, 598 insertions(+) create mode 100644 ext/intl/symfony_format_type_double_intl1.phpt create mode 100644 ext/intl/symfony_format_type_double_intl2.phpt create mode 100644 ext/intl/symfony_format_type_double_intl3.phpt create mode 100644 ext/intl/symfony_format_type_double_intl4.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl1.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl2.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl3.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl4.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl5.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl6.phpt create mode 100644 ext/intl/symfony_format_type_int32_intl7.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl1.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl2.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl3.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl4.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl5.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl6.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl7.phpt create mode 100644 ext/intl/symfony_format_type_int64_intl8.phpt diff --git a/ext/intl/symfony_format_type_double_intl1.phpt b/ext/intl/symfony_format_type_double_intl1.phpt new file mode 100644 index 00000000000..13a7ad761fa --- /dev/null +++ b/ext/intl/symfony_format_type_double_intl1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_double_intl2.phpt b/ext/intl/symfony_format_type_double_intl2.phpt new file mode 100644 index 00000000000..6bff7cc3557 --- /dev/null +++ b/ext/intl/symfony_format_type_double_intl2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(3) "1.1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_double_intl3.phpt b/ext/intl/symfony_format_type_double_intl3.phpt new file mode 100644 index 00000000000..3b0d576df7d --- /dev/null +++ b/ext/intl/symfony_format_type_double_intl3.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_double_intl4.phpt b/ext/intl/symfony_format_type_double_intl4.phpt new file mode 100644 index 00000000000..3476e108923 --- /dev/null +++ b/ext/intl/symfony_format_type_double_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #4 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.10" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl1.phpt b/ext/intl/symfony_format_type_int32_intl1.phpt new file mode 100644 index 00000000000..2867b35690b --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl2.phpt b/ext/intl/symfony_format_type_int32_intl2.phpt new file mode 100644 index 00000000000..6a65a0a8092 --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl3.phpt b/ext/intl/symfony_format_type_int32_intl3.phpt new file mode 100644 index 00000000000..5e657db419b --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl3.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(14) "-2,147,483,648" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl4.phpt b/ext/intl/symfony_format_type_int32_intl4.phpt new file mode 100644 index 00000000000..54043d92e92 --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl5.phpt b/ext/intl/symfony_format_type_int32_intl5.phpt new file mode 100644 index 00000000000..d5f78d7119b --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl6.phpt b/ext/intl/symfony_format_type_int32_intl6.phpt new file mode 100644 index 00000000000..fa708799d13 --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(21) "(SFD2,147,483,648.00)" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl7.phpt b/ext/intl/symfony_format_type_int32_intl7.phpt new file mode 100644 index 00000000000..5bbe4266770 --- /dev/null +++ b/ext/intl/symfony_format_type_int32_intl7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7 +--SKIPIF-- + +--FILE-- +format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); + +var_dump($unit_test_args); + +// execute the code from #testFormatTypeInt32Intl +$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(4) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(19) "SFD2,147,483,647.00" + [3]=> + string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl1.phpt b/ext/intl/symfony_format_type_int64_intl1.phpt new file mode 100644 index 00000000000..01f58209117 --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #1 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl2.phpt b/ext/intl/symfony_format_type_int64_intl2.phpt new file mode 100644 index 00000000000..13d1cdaee7f --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl2.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #2 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(1) "1" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl3.phpt b/ext/intl/symfony_format_type_int64_intl3.phpt new file mode 100644 index 00000000000..a7c80b34c3c --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl3.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #3 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(13) "2,147,483,648" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl4.phpt b/ext/intl/symfony_format_type_int64_intl4.phpt new file mode 100644 index 00000000000..f1a0801edfe --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl4.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #4 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(14) "-2,147,483,649" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl5.phpt b/ext/intl/symfony_format_type_int64_intl5.phpt new file mode 100644 index 00000000000..dad8735b89a --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl5.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #5 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + int(1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl6.phpt b/ext/intl/symfony_format_type_int64_intl6.phpt new file mode 100644 index 00000000000..f038cbd0c3c --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl6.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #6 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(1.1) + [2]=> + string(7) "SFD1.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl7.phpt b/ext/intl/symfony_format_type_int64_intl7.phpt new file mode 100644 index 00000000000..9c8853cafc8 --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl7.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #7 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(2147483648) + [2]=> + string(19) "SFD2,147,483,648.00" +} +== didn't crash == diff --git a/ext/intl/symfony_format_type_int64_intl8.phpt b/ext/intl/symfony_format_type_int64_intl8.phpt new file mode 100644 index 00000000000..50524976abf --- /dev/null +++ b/ext/intl/symfony_format_type_int64_intl8.phpt @@ -0,0 +1,30 @@ +--TEST-- +Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #8 +--SKIPIF-- + +--FILE-- +format($unit_test_args[1], \NumberFormatter::TYPE_INT64); + +echo "== didn't crash ==".PHP_EOL; + +?> +--EXPECT-- +array(3) { + [0]=> + object(NumberFormatter)#1 (0) { + } + [1]=> + float(-2147483649) + [2]=> + string(21) "(SFD2,147,483,649.00)" +} +== didn't crash == From 72b9b8f380690357fc29efdfcba183b8a8a81268 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 18 Aug 2012 11:44:09 +0800 Subject: [PATCH 442/641] Make the codes clearer, and also check continue statement --- Zend/tests/try_finally_008.phpt | 5 +-- Zend/tests/try_finally_009.phpt | 23 ++++++++++++++ Zend/zend_opcode.c | 54 ++++++++++++++++++++++++--------- Zend/zend_vm_def.h | 6 ++-- Zend/zend_vm_execute.h | 4 +-- 5 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 Zend/tests/try_finally_009.phpt diff --git a/Zend/tests/try_finally_008.phpt b/Zend/tests/try_finally_008.phpt index 77ecf4fdeee..9025d8824da 100644 --- a/Zend/tests/try_finally_008.phpt +++ b/Zend/tests/try_finally_008.phpt @@ -7,15 +7,12 @@ function foo () { try { try { } finally { - goto label; - echo "dummy"; + break; } } catch (Exception $e) { } finally { } } while (0); -label: - echo "label"; } foo(); diff --git a/Zend/tests/try_finally_009.phpt b/Zend/tests/try_finally_009.phpt new file mode 100644 index 00000000000..7c3da6760b6 --- /dev/null +++ b/Zend/tests/try_finally_009.phpt @@ -0,0 +1,23 @@ +--TEST-- +Finally with jmp (for continue) +--FILE-- + +--EXPECTF-- +Fatal error: jump out of a finally block is disallowed in %stry_finally_009.php on line %d diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 8cccfe63768..86144d60e18 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -485,6 +485,24 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a } } +static void zend_check_finally_breakout(zend_op_array *op_array, zend_op *opline, zend_uint dst_num TSRMLS_DC) { + zend_uint i, op_num = opline - op_array->opcodes; + for (i=0; i < op_array->last_try_catch; i++) { + if (op_array->try_catch_array[i].try_op > op_num) { + break; + } + if ((op_num >= op_array->try_catch_array[i].finally_op + && op_num < op_array->try_catch_array[i].finally_end) + && (dst_num >= op_array->try_catch_array[i].finally_end + || dst_num < op_array->try_catch_array[i].finally_op)) { + CG(in_compilation) = 1; + CG(active_op_array) = op_array; + CG(zend_lineno) = opline->lineno; + zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed"); + } + } +} + ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) { zend_op *opline, *end; @@ -529,24 +547,30 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) /* break omitted intentionally */ case ZEND_JMP: if (op_array->last_try_catch) { - zend_uint i, op_num = opline - op_array->opcodes; - for (i=0; i < op_array->last_try_catch; i++) { - if (op_array->try_catch_array[i].try_op > op_num) { - break; - } - if ((op_num >= op_array->try_catch_array[i].finally_op - && op_num < op_array->try_catch_array[i].finally_end) - && (opline->op1.opline_num >= op_array->try_catch_array[i].finally_end - || opline->op1.opline_num < op_array->try_catch_array[i].finally_op)) { - CG(in_compilation) = 1; - CG(active_op_array) = op_array; - CG(zend_lineno) = opline->lineno; - zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed"); - } - } + zend_check_finally_breakout(op_array, opline, opline->op1.opline_num TSRMLS_CC); } opline->op1.jmp_addr = &op_array->opcodes[opline->op1.opline_num]; break; + case ZEND_BRK: + case ZEND_CONT: + if (op_array->last_try_catch) { + zend_uint i, op_num = opline - op_array->opcodes; + int nest_levels, array_offset; + zend_brk_cont_element *jmp_to; + + nest_levels = Z_LVAL_P(opline->op2.zv); + array_offset = opline->op1.opline_num; + do { + jmp_to = &op_array->brk_cont_array[array_offset]; + if (nest_levels > 1) { + array_offset = jmp_to->parent; + } + } while (--nest_levels > 0); + if (op_array->last_try_catch) { + zend_check_finally_breakout(op_array, opline, jmp_to->brk TSRMLS_CC); + } + } + break; case ZEND_JMPZ: case ZEND_JMPNZ: case ZEND_JMPZ_EX: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 17dfb5fd81b..1da4c12440a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5317,10 +5317,10 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { - { +ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) +{ USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6fd7f0790dc..b5a649d0a27 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1176,9 +1176,9 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS } static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) - { +{ USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; + zend_uint i, op_num = opline - EG(active_op_array)->opcodes; SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); From 57e7c7bd49dae25f2d3ec935b5e264d0fb62b6b3 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 18 Aug 2012 11:57:53 +0800 Subject: [PATCH 443/641] tab --- Zend/zend_compile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index a06c985a979..8919fdc6b80 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -80,7 +80,7 @@ typedef union _znode_op { zend_op *jmp_addr; zval *zv; zend_literal *literal; - void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */ + void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */ } znode_op; typedef struct _znode { /* used only during compilation */ From ebefbdb76d7e16c03dc9f3cf761bff6656af42c0 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 18 Aug 2012 12:21:48 +0800 Subject: [PATCH 444/641] Fix test failed --- sapi/cgi/tests/apache_request_headers.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt index 881b6bb171c..fd36e3024f8 100644 --- a/sapi/cgi/tests/apache_request_headers.phpt +++ b/sapi/cgi/tests/apache_request_headers.phpt @@ -17,12 +17,12 @@ $file = dirname(__FILE__)."/012.test.php"; file_put_contents($file, ''); -passthru("$php $file"); +passthru("$php -n $file"); $names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_'); foreach ($names as $name) { putenv($name."=".str_repeat("A", 256)); - passthru("$php -q $file"); + passthru("$php -n -q $file"); putenv($name); } unlink($file); From b2a74b5bdb5fe66a59969cb2aa87931958ca56d3 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 18 Aug 2012 11:28:00 -0300 Subject: [PATCH 445/641] - Remove unused vars --- Zend/zend_opcode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 86144d60e18..7cbc15b0b08 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -554,7 +554,6 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) case ZEND_BRK: case ZEND_CONT: if (op_array->last_try_catch) { - zend_uint i, op_num = opline - op_array->opcodes; int nest_levels, array_offset; zend_brk_cont_element *jmp_to; From 46a3f257724df7b85cc8c3e6374c36ed9ee783b4 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Sun, 19 Aug 2012 17:57:45 +0800 Subject: [PATCH 446/641] Fixed bug #62852 (Unserialize invalid DateTime causes crash) --- ext/date/php_date.c | 16 ++++++++++++---- ext/date/tests/bug62852.phpt | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 ext/date/tests/bug62852.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e8a457052ec..d9e6a289b45 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2544,6 +2544,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) { convert_to_long(*z_timezone_type); if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) { + zend_error_handling error_handling; + + zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); convert_to_string(*z_timezone); switch (Z_LVAL_PP(z_timezone_type)) { @@ -2551,9 +2554,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat case TIMELIB_ZONETYPE_ABBR: { char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2); snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); - php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC); efree(tmp); - return 1; + break; } case TIMELIB_ZONETYPE_ID: @@ -2567,10 +2570,15 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat tzobj->tzi.tz = tzi; tzobj->initialized = 1; - php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); + php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); - return 1; + break; + default: + zend_restore_error_handling(&error_handling TSRMLS_CC); + return 0; } + zend_restore_error_handling(&error_handling TSRMLS_CC); + return 1; } } } diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt new file mode 100644 index 00000000000..6426a80fb86 --- /dev/null +++ b/ext/date/tests/bug62852.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #62852 (Unserialize invalid DateTime causes crash) +--INI-- +date.timezone=GMT +--FILE-- +getMessage()); +} +?> +--EXPECTF-- +string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): Double time specification" From 8b87c6df8408b95a1bfae4a82958a48e3a220b5a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 19 Aug 2012 18:33:06 +0800 Subject: [PATCH 447/641] Update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 7f5c48b2aae..b796117fddc 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ PHP NEWS (r.hampartsumyan@gmail.com, Laruence) - DateTime: + . Fixed bug #62852 (Unserialize invalid DateTime causes crash). + (reeze.xia@gmail.com) . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) - PDO: From 2b685075b57cd0d0ed83d0566a97c81824f95063 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 11:35:18 -0300 Subject: [PATCH 448/641] - Remove unused variable --- ext/standard/pack.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 61228a63df7..9894746f776 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -676,7 +676,6 @@ PHP_FUNCTION(unpack) switch ((int) type) { case 'a': { /* a will not strip any trailing whitespace or null padding */ - char pad = ' '; int len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ From dc1138b102b8fde7a119cb8f7ceb30b26dfdf6b3 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 12:13:48 -0300 Subject: [PATCH 449/641] - Value stored to var is never read --- ext/dom/element.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/dom/element.c b/ext/dom/element.c index 979274176b4..33002fa1eea 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -832,7 +832,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns) } if (errorcode == 0 && is_xmlns == 0) { - attr = xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value); + xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value); } } else { name_valid = xmlValidateName((xmlChar *) localname, 0); @@ -844,7 +844,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns) if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) { node_list_unlink(attr->children TSRMLS_CC); } - attr = xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value); + xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value); } } } From 001966c754f67f36871507e70e2ec1af5a9816bd Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 12:44:44 -0300 Subject: [PATCH 450/641] - Value stored to var is never used --- Zend/zend_API.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 56182138a89..70cf0c7af87 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2445,11 +2445,9 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca /* Skip leading \ */ if (Z_STRVAL_P(callable)[0] == '\\') { mlen = Z_STRLEN_P(callable) - 1; - mname = Z_STRVAL_P(callable) + 1; lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); } else { mlen = Z_STRLEN_P(callable); - mname = Z_STRVAL_P(callable); lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); } /* Check if function with given name exists. From 6cd0e446dd93b5232b49c6248102b77b17865904 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 12:55:38 -0300 Subject: [PATCH 451/641] - Value stored to var is never used --- ext/spl/spl_directory.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 4f8edb5211a..8c1810ef71d 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -434,7 +434,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ if (file_path && !use_copy) { efree(file_path); } - use_copy = 1; file_path_len = 1; file_path = "/"; #endif From 50ab6c63a700155b8d6be361eac29eae2bc6d869 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 14:34:38 -0300 Subject: [PATCH 452/641] - Value stored to var is never used --- ext/standard/string.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 1a7bd1e0b47..68bf3fecfca 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3902,7 +3902,6 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) new_char_count--; } if (new_char_count > 0) { - char_count=new_char_count; begin=new_begin; } } From 3dd256a67b61a995b580cce762a46be689ea34b1 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 14:50:49 -0300 Subject: [PATCH 453/641] - Value stored to var is never used --- ext/standard/url.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/standard/url.c b/ext/standard/url.c index 18c300c51cf..2525afb905d 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -220,14 +220,14 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) if (query && fragment) { if (query > fragment) { - p = e = fragment; + e = fragment; } else { - p = e = query; + e = query; } } else if (query) { - p = e = query; + e = query; } else if (fragment) { - p = e = fragment; + e = fragment; } } else { e = p; From f4054afe40bd2b1876832b01f6cbae8f8236d2aa Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Aug 2012 15:09:14 -0300 Subject: [PATCH 454/641] - Value stored to var is never used --- ext/phar/util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/phar/util.c b/ext/phar/util.c index 9797ec8250a..cc4457493b0 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -211,8 +211,6 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, return FAILURE; } #endif - - filename_len = strlen(entry.tmp); filename = entry.tmp; /* only check openbasedir for files, not for phar streams */ From 675545f042fc08d015a27ee2c88d16d4d2e4ce04 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 19 Aug 2012 20:37:44 -0700 Subject: [PATCH 455/641] update NEWS --- NEWS | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1142a428828..c9d6305d4cd 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ PHP NEWS (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return the exit value). (Laruence) + . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) + . Fixed bug #62716 (munmap() is called with the incorrect length). + (slangley@google.com) + . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) . Fixed bug #62328 (implementing __toString and a cast to string fails) (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error @@ -14,6 +18,13 @@ PHP NEWS . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call constructor). (Stas) +- CURL: + . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) + +- DateTime: + . Fixed bug #62852 (Unserialize invalid DateTime causes crash). + (reeze.xia@gmail.com) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) @@ -31,7 +42,7 @@ PHP NEWS (Laruence) -?? ??? 2012, PHP 5.4.6 +16 Aug 2012, PHP 5.4.6 - CLI Server: . Implemented FR #62700 (have the console output 'Listening on From 5ee3bf16474bd94f4813714491742fb17e258d18 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 19 Aug 2012 21:43:16 -0700 Subject: [PATCH 456/641] add finally --- ext/tokenizer/tokenizer_data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index 85822f19940..a915bb8eacc 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -21,7 +21,7 @@ /* DO NOT EDIT THIS FILE! This file is generated using tokenizer_data_gen.sh -*/ +*/ #include "php.h" #include "zend.h" @@ -110,6 +110,7 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); @@ -244,6 +245,7 @@ char *get_token_type_name(int token_type) case T_RETURN: return "T_RETURN"; case T_TRY: return "T_TRY"; case T_CATCH: return "T_CATCH"; + case T_FINALLY: return "T_FINALLY"; case T_THROW: return "T_THROW"; case T_USE: return "T_USE"; case T_INSTEADOF: return "T_INSTEADOF"; From 591c59d9bf09ead5605e30d71db6ff1351fa0d50 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 19 Aug 2012 21:46:29 -0700 Subject: [PATCH 457/641] add heredoc parsing fix --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index b71945087ff..f4df4463fa7 100644 --- a/NEWS +++ b/NEWS @@ -70,6 +70,9 @@ PHP NEWS - pgsql . Added pg_escape_literal() and pg_escape_identifier() (Yasuo) +- Tokenizer: + . Fixed bug #60097 (token_get_all fails to lex nested heredoc). (Nikita Popov) + - Zip: . Upgraded libzip to 0.10.1 (Anatoliy) From 36b88d77f2a9d0ac74692a679f636ccb5d11589f Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Mon, 20 Aug 2012 00:03:55 +0100 Subject: [PATCH 458/641] bug #62844; relative URL schemes in parse_url() --- ext/standard/tests/url/parse_url_relative_scheme.phpt | 11 +++++++++++ ext/standard/url.c | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 ext/standard/tests/url/parse_url_relative_scheme.phpt diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt new file mode 100644 index 00000000000..7c8952db71e --- /dev/null +++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test parse_url() function: Checks relative URL schemes (e.g. "//example.com") +--FILE-- + + string(11) "example.org" +} + diff --git a/ext/standard/url.c b/ext/standard/url.c index 0555c7b65aa..f1e48a1a5f7 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } else { goto just_path; } + } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */ + s += 2; } else { just_path: ue = s + length; From 4ec29b945c9b1811c89e46c16215a7563a9f0430 Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Mon, 20 Aug 2012 00:29:18 +0100 Subject: [PATCH 459/641] relative-scheme --- ext/standard/url.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/url.c b/ext/standard/url.c index f1e48a1a5f7..44a568032b6 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -204,7 +204,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } else { goto just_path; } - } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */ + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ s += 2; } else { just_path: From 12ea5c54e521d189c97b8f5c4f9bf65f137f3c80 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 19 Aug 2012 22:19:57 -0700 Subject: [PATCH 460/641] Fix for #62844 --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index c9d6305d4cd..27a34c3c689 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: + . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds). . Fixed bug #62763 (register_shutdown_function and extending class). (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return From 05f10480c556ebe52bbef52cb2da5a0aca8ee070 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 20 Aug 2012 12:53:18 +0200 Subject: [PATCH 461/641] Drop Generator::close() method --- Zend/tests/generators/clone_with_foreach.phpt | 2 +- Zend/tests/generators/clone_with_stack.phpt | 2 +- .../generators/clone_with_symbol_table.phpt | 2 +- Zend/tests/generators/clone_with_this.phpt | 2 +- .../generators/close_inside_generator.phpt | 22 ------------- Zend/tests/generators/generator_close.phpt | 32 ------------------- .../generators/yield_during_method_call.phpt | 4 +-- Zend/zend_generators.c | 30 ----------------- Zend/zend_generators.h | 4 --- 9 files changed, 6 insertions(+), 94 deletions(-) delete mode 100644 Zend/tests/generators/close_inside_generator.phpt delete mode 100644 Zend/tests/generators/generator_close.phpt diff --git a/Zend/tests/generators/clone_with_foreach.phpt b/Zend/tests/generators/clone_with_foreach.phpt index b8873380365..b05ed073120 100644 --- a/Zend/tests/generators/clone_with_foreach.phpt +++ b/Zend/tests/generators/clone_with_foreach.phpt @@ -20,7 +20,7 @@ $g2->next(); var_dump($g1->current()); var_dump($g2->current()); -$g1->close(); +unset($g1); $g2->next(); var_dump($g2->current()); diff --git a/Zend/tests/generators/clone_with_stack.phpt b/Zend/tests/generators/clone_with_stack.phpt index 673c0e5d1e7..5a8e6d842ca 100644 --- a/Zend/tests/generators/clone_with_stack.phpt +++ b/Zend/tests/generators/clone_with_stack.phpt @@ -10,7 +10,7 @@ function gen() { $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->send(10); ?> diff --git a/Zend/tests/generators/clone_with_symbol_table.phpt b/Zend/tests/generators/clone_with_symbol_table.phpt index 0d1bd4ec3c4..e1fefebd8fa 100644 --- a/Zend/tests/generators/clone_with_symbol_table.phpt +++ b/Zend/tests/generators/clone_with_symbol_table.phpt @@ -19,7 +19,7 @@ function gen() { $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->next(); ?> diff --git a/Zend/tests/generators/clone_with_this.phpt b/Zend/tests/generators/clone_with_this.phpt index 66efd02987d..b242d851ebe 100644 --- a/Zend/tests/generators/clone_with_this.phpt +++ b/Zend/tests/generators/clone_with_this.phpt @@ -16,7 +16,7 @@ class Test { $g1 = (new Test)->gen(); $g1->rewind(); // goto yield $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->next(); ?> diff --git a/Zend/tests/generators/close_inside_generator.phpt b/Zend/tests/generators/close_inside_generator.phpt deleted file mode 100644 index 1df64bf6b1a..00000000000 --- a/Zend/tests/generators/close_inside_generator.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Calling close() during the exectution of the generator ---FILE-- -close(); - - echo "Still running"; -} - -$gen = gen(); -$gen->send($gen); - -?> ---EXPECTF-- -Warning: A generator cannot be closed while it is running in %s on line %d -Still running diff --git a/Zend/tests/generators/generator_close.phpt b/Zend/tests/generators/generator_close.phpt deleted file mode 100644 index 3dec285409f..00000000000 --- a/Zend/tests/generators/generator_close.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Generator can be closed by calling ->close() ---FILE-- -close(); - } -} - -?> ---EXPECT-- -int(0) -int(1) -int(2) -int(3) -int(4) -int(5) -int(6) -int(7) -int(8) -int(9) diff --git a/Zend/tests/generators/yield_during_method_call.phpt b/Zend/tests/generators/yield_during_method_call.phpt index e8859ac0c27..5fbe84fff55 100644 --- a/Zend/tests/generators/yield_during_method_call.phpt +++ b/Zend/tests/generators/yield_during_method_call.phpt @@ -20,13 +20,13 @@ $gen->send('foo'); // test resource cleanup $gen = gen(); $gen->rewind(); -$gen->close(); +unset($gen); // test cloning $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->send('bar'); ?> diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 716b0a782ed..41c6dfcd946 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -301,8 +301,6 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM /* The key will be incremented on first use, so it'll start at 0 */ generator->largest_used_integer_key = -1; - generator->is_currently_running = 0; - zend_object_std_init(&generator->std, class_type TSRMLS_CC); object.handle = zend_objects_store_put(generator, NULL, @@ -391,8 +389,6 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ zend_class_entry *original_scope = EG(scope); zend_class_entry *original_called_scope = EG(called_scope); - zend_bool original_is_currently_running = generator->is_currently_running; - /* Remember the current stack position so we can back up pushed args */ generator->original_stack_top = zend_vm_stack_top(TSRMLS_C); @@ -417,8 +413,6 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ EG(scope) = generator->execute_data->current_scope; EG(called_scope) = generator->execute_data->current_called_scope; - generator->is_currently_running = 1; - /* We want the backtrace to look as if the generator function was * called from whatever method we are current running (e.g. next()). * The first prev_execute_data contains an additional stack frame, @@ -440,8 +434,6 @@ static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ EG(scope) = original_scope; EG(called_scope) = original_called_scope; - generator->is_currently_running = original_is_currently_running; - /* The stack top before and after the execution differ, i.e. there are * arguments pushed to the stack. */ if (generator->original_stack_top != zend_vm_stack_top(TSRMLS_C)) { @@ -598,27 +590,6 @@ ZEND_METHOD(Generator, send) } } -/* {{{ proto void Generator::close() - * Closes the generator */ -ZEND_METHOD(Generator, close) -{ - zend_generator *generator; - - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - - if (generator->is_currently_running) { - zend_error(E_WARNING, "A generator cannot be closed while it is running"); - return; - } - - zend_generator_close(generator, 0 TSRMLS_CC); -} -/* }}} */ - /* get_iterator implementation */ typedef struct _zend_generator_iterator { @@ -747,7 +718,6 @@ static const zend_function_entry generator_functions[] = { ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, close, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_FE_END }; diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index d67ea4137bf..f58dafdb1f0 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -46,10 +46,6 @@ typedef struct _zend_generator { temp_variable *send_target; /* Largest used integer key for auto-incrementing keys */ long largest_used_integer_key; - - /* We need to know whether the generator is currently executed to avoid it - * being closed while still running */ - zend_bool is_currently_running; } zend_generator; extern ZEND_API zend_class_entry *zend_ce_generator; From 9003cd142553384c3d271b12407186d5352868ad Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 20 Aug 2012 13:28:36 +0200 Subject: [PATCH 462/641] Fix zts build (typo) --- Zend/zend_generators.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index f58dafdb1f0..f5f4926e353 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -51,7 +51,7 @@ typedef struct _zend_generator { extern ZEND_API zend_class_entry *zend_ce_generator; void zend_register_generator_ce(TSRMLS_D); -zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_CC); +zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC); void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC); END_EXTERN_C() From b9a050100ce430db758ff791914e88478b2814b8 Mon Sep 17 00:00:00 2001 From: Popa Adrian Marius Date: Mon, 20 Aug 2012 16:56:37 +0300 Subject: [PATCH 463/641] skip test for bug 43130 on firebird , not relevant --- ext/pdo/tests/bug_43130.phpt | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index a35138a07ff..70f8887111c 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip not relevant for sqlite driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not relevant for oci driver - Hyphen is not legal for bind names in Oracle DB'); +if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) die('skip not relevant for firebird driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); ?> From f45a0f31c8354947c0e2b9ea44a63fc0a2c23a01 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 20 Aug 2012 16:01:16 +0200 Subject: [PATCH 464/641] Disallow serialization and unserialization --- .../errors/serialize_unserialize_error.phpt | 46 +++++++++++++++++++ Zend/zend_generators.c | 32 ++++++++++--- 2 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 Zend/tests/generators/errors/serialize_unserialize_error.phpt diff --git a/Zend/tests/generators/errors/serialize_unserialize_error.phpt b/Zend/tests/generators/errors/serialize_unserialize_error.phpt new file mode 100644 index 00000000000..a8470b0a63a --- /dev/null +++ b/Zend/tests/generators/errors/serialize_unserialize_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Generators can't be serialized or unserialized +--FILE-- + +--EXPECTF-- +exception 'Exception' with message 'Serialization of 'Generator' is not allowed' in %s:%d +Stack trace: +#0 %s(%d): serialize(Object(Generator)) +#1 {main} + +exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d +Stack trace: +#0 [internal function]: Generator->__wakeup() +#1 %s(%d): unserialize('O:9:"Generator"...') +#2 {main} + + +Notice: unserialize(): Error at offset 19 of 20 bytes in %s on line %d +exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d +Stack trace: +#0 %s(%d): unserialize('C:9:"Generator"...') +#1 {main} diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 41c6dfcd946..b4d8932b6bb 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -590,6 +590,23 @@ ZEND_METHOD(Generator, send) } } + +/* {{{ proto void Generator::__wakeup + * Throws an Exception as generators can't be serialized */ +ZEND_METHOD(Generator, __wakeup) +{ + /* Just specifying the zend_class_unserialize_deny handler is not enough, + * because it is only invoked for C unserialization. For O the error has + * to be thrown in __wakeup. */ + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + zend_throw_exception(NULL, "Unserialization of 'Generator' is not allowed", 0 TSRMLS_CC); +} +/* }}} */ + /* get_iterator implementation */ typedef struct _zend_generator_iterator { @@ -712,12 +729,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1) ZEND_END_ARG_INFO() static const zend_function_entry generator_functions[] = { - ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, __wakeup, arginfo_generator_void, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -729,6 +747,8 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_generator->create_object = zend_generator_create; + zend_ce_generator->serialize = zend_class_serialize_deny; + zend_ce_generator->unserialize = zend_class_unserialize_deny; /* get_iterator has to be assigned *after* implementing the inferface */ zend_class_implements(zend_ce_generator TSRMLS_CC, 1, zend_ce_iterator); From 33d872d9f3fff72f496a018a19e02ab632ccadbb Mon Sep 17 00:00:00 2001 From: Popa Marius Adrian Date: Mon, 20 Aug 2012 17:25:56 +0300 Subject: [PATCH 465/641] skip test for bug 43130 on firebird , not relevant --- ext/pdo/tests/bug_43130.phpt | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt index a35138a07ff..70f8887111c 100644 --- a/ext/pdo/tests/bug_43130.phpt +++ b/ext/pdo/tests/bug_43130.phpt @@ -8,6 +8,7 @@ if (false == $dir) die('skip no driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip not relevant for sqlite driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver'); if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip not relevant for oci driver - Hyphen is not legal for bind names in Oracle DB'); +if (!strncasecmp(getenv('PDOTEST_DSN'), 'firebird', strlen('firebird'))) die('skip not relevant for firebird driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); ?> From c54d73d54c8e2166f680b3db03238d5263a451c1 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Mon, 20 Aug 2012 23:42:31 +0200 Subject: [PATCH 466/641] Bug 62462: Prevent multibyte characters from being split between the lines Merged from https://github.com/php/php-src/pull/120 --- ext/standard/quot_print.c | 7 +++++-- ext/standard/tests/strings/bug62462.phpt | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/strings/bug62462.phpt diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 1ce7eff0528..4eb69d7ef21 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t len lp = 0; } else { if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) { - if ((lp += 3) > PHP_QPRINT_MAXL) { + if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) + || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) + || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) + || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) { *d++ = '='; *d++ = '\015'; *d++ = '\012'; @@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode) * End: * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 - */ + */ \ No newline at end of file diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt new file mode 100644 index 00000000000..c6eb41a543e --- /dev/null +++ b/ext/standard/tests/strings/bug62462.phpt @@ -0,0 +1,17 @@ +--TEST-- +Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test +--FILE-- + + +==DONE== +--EXPECT-- +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85 +==DONE== From 18bb426587d62f93c54c40bf8535eb8416603629 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Mon, 20 Aug 2012 23:42:31 +0200 Subject: [PATCH 467/641] Bug 62462: Prevent multibyte characters from being split between the lines Merged from https://github.com/php/php-src/pull/120 --- ext/standard/quot_print.c | 7 +++++-- ext/standard/tests/strings/bug62462.phpt | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/strings/bug62462.phpt diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 1ce7eff0528..4eb69d7ef21 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned char *str, size_t len lp = 0; } else { if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) { - if ((lp += 3) > PHP_QPRINT_MAXL) { + if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) + || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) + || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) + || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) { *d++ = '='; *d++ = '\015'; *d++ = '\012'; @@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode) * End: * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 - */ + */ \ No newline at end of file diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt new file mode 100644 index 00000000000..c6eb41a543e --- /dev/null +++ b/ext/standard/tests/strings/bug62462.phpt @@ -0,0 +1,17 @@ +--TEST-- +Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test +--FILE-- + + +==DONE== +--EXPECT-- +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85 +==DONE== From 8722173ad5d3132bfefbeb753c29e246876b0492 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 21 Aug 2012 13:32:15 +0800 Subject: [PATCH 468/641] Implemented FR #62840 (Add sort flag to ArrayObject::ksort) --- NEWS | 3 ++ ext/spl/spl_array.c | 46 ++++++++++++++------- ext/spl/tests/arrayObject_asort_basic1.phpt | 20 ++++++++- ext/spl/tests/arrayObject_ksort_basic1.phpt | 26 ++++++++++-- 4 files changed, 73 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 27a34c3c689..d60f51b5305 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,9 @@ PHP NEWS . Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when close handler call exit). (Laruence) +- SPL: + . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence) + - Standard: . Fixed bug #62836 (Seg fault or broken object references on unserialize()). (Laruence) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index e2ea17a3fe3..1e4577a3f96 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -58,6 +58,10 @@ PHPAPI zend_class_entry *spl_ce_RecursiveArrayIterator; #define SPL_ARRAY_INT_MASK 0xFFFF0000 #define SPL_ARRAY_CLONE_MASK 0x0300FFFF +#define SPL_ARRAY_METHOD_NO_ARG 0 +#define SPL_ARRAY_METHOD_USE_ARG 1 +#define SPL_ARRAY_METHOD_MAY_USER_ARG 2 + typedef struct _spl_array_object { zend_object std; zval *array; @@ -1426,14 +1430,28 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - zval *tmp, *arg; + zval *tmp, *arg = NULL; zval *retval_ptr = NULL; MAKE_STD_ZVAL(tmp); Z_TYPE_P(tmp) = IS_ARRAY; Z_ARRVAL_P(tmp) = aht; - if (use_arg) { + if (!use_arg) { + aht->nApplyCount++; + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC); + aht->nApplyCount--; + } else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) { + Z_TYPE_P(tmp) = IS_NULL; + zval_ptr_dtor(&tmp); + zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0 TSRMLS_CC); + return; + } + aht->nApplyCount++; + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, arg? 2 : 1, tmp, arg TSRMLS_CC); + aht->nApplyCount--; + } else { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { Z_TYPE_P(tmp) = IS_NULL; zval_ptr_dtor(&tmp); @@ -1443,10 +1461,6 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam aht->nApplyCount++; zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, tmp, arg TSRMLS_CC); aht->nApplyCount--; - } else { - aht->nApplyCount++; - zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, tmp, NULL TSRMLS_CC); - aht->nApplyCount--; } Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the hashtable */ zval_ptr_dtor(&tmp); @@ -1461,35 +1475,35 @@ SPL_METHOD(cname, fname) \ spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, sizeof(#fname)-1, use_arg); \ } -/* {{{ proto int ArrayObject::asort() - proto int ArrayIterator::asort() +/* {{{ proto int ArrayObject::asort([int $sort_flags = SORT_REGULAR ]) + proto int ArrayIterator::asort([int $sort_flags = SORT_REGULAR ]) Sort the entries by values. */ -SPL_ARRAY_METHOD(Array, asort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, asort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */ -/* {{{ proto int ArrayObject::ksort() - proto int ArrayIterator::ksort() +/* {{{ proto int ArrayObject::ksort([int $sort_flags = SORT_REGULAR ]) + proto int ArrayIterator::ksort([int $sort_flags = SORT_REGULAR ]) Sort the entries by key. */ -SPL_ARRAY_METHOD(Array, ksort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, ksort, SPL_ARRAY_METHOD_MAY_USER_ARG) /* }}} */ /* {{{ proto int ArrayObject::uasort(callback cmp_function) proto int ArrayIterator::uasort(callback cmp_function) Sort the entries by values user defined function. */ -SPL_ARRAY_METHOD(Array, uasort, 1) /* }}} */ +SPL_ARRAY_METHOD(Array, uasort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */ /* {{{ proto int ArrayObject::uksort(callback cmp_function) proto int ArrayIterator::uksort(callback cmp_function) Sort the entries by key using user defined function. */ -SPL_ARRAY_METHOD(Array, uksort, 1) /* }}} */ +SPL_ARRAY_METHOD(Array, uksort, SPL_ARRAY_METHOD_USE_ARG) /* }}} */ /* {{{ proto int ArrayObject::natsort() proto int ArrayIterator::natsort() Sort the entries by values using "natural order" algorithm. */ -SPL_ARRAY_METHOD(Array, natsort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, natsort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */ /* {{{ proto int ArrayObject::natcasesort() proto int ArrayIterator::natcasesort() Sort the entries by key using case insensitive "natural order" algorithm. */ -SPL_ARRAY_METHOD(Array, natcasesort, 0) /* }}} */ +SPL_ARRAY_METHOD(Array, natcasesort, SPL_ARRAY_METHOD_NO_ARG) /* }}} */ /* {{{ proto mixed|NULL ArrayIterator::current() Return current array entry */ diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt index ec69049a328..53df1d502b9 100644 --- a/ext/spl/tests/arrayObject_asort_basic1.phpt +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -17,12 +17,14 @@ var_dump($ao1->asort()); var_dump($ao1); var_dump($ao2->asort('blah')); var_dump($ao2); +var_dump($ao2->asort(SORT_NUMERIC)); +var_dump($ao2); ?> ===DONE=== --EXPECTF-- *** Testing ArrayObject::asort() : basic functionality *** bool(true) -object(ArrayObject)#1 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { [1]=> @@ -33,8 +35,22 @@ object(ArrayObject)#1 (1) { int(4) } } + +Warning: asort() expects parameter 2 to be long, string given in %sarrayObject_asort_basic1.php on line %d +bool(false) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(3) { + ["a"]=> + int(4) + ["b"]=> + int(2) + ["c"]=> + int(3) + } +} bool(true) -object(ArrayObject)#2 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt index 9c8d1e73451..8f379381269 100644 --- a/ext/spl/tests/arrayObject_ksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt @@ -16,12 +16,14 @@ var_dump($ao1->ksort()); var_dump($ao1); var_dump($ao2->ksort('blah')); var_dump($ao2); +var_dump($ao2->ksort(SORT_STRING)); +var_dump($ao2); ?> ===DONE=== --EXPECTF-- *** Testing ArrayObject::ksort() : basic functionality *** bool(true) -object(ArrayObject)#1 (1) { +object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { [0]=> @@ -32,18 +34,34 @@ object(ArrayObject)#1 (1) { int(3) } } -bool(true) + +Warning: ksort() expects parameter 2 to be long, string given in %sarrayObject_ksort_basic1.php on line %d +bool(false) object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(4) { - ["a"]=> - int(2) ["b"]=> int(4) + ["a"]=> + int(2) ["q"]=> int(3) [99]=> string(1) "x" } } +bool(true) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(4) { + [99]=> + string(1) "x" + ["a"]=> + int(2) + ["b"]=> + int(4) + ["q"]=> + int(3) + } +} ===DONE=== From 0cdc1f5626bd400278aa193867e1fd4fe3f771d4 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Tue, 21 Aug 2012 14:32:39 +0800 Subject: [PATCH 469/641] Move test files to tests dir There are 7 files duplicated, so those files was deleted --- ext/intl/symfony_format_type_int32_intl1.phpt | 49 ------------------- ext/intl/symfony_format_type_int32_intl2.phpt | 33 ------------- ext/intl/symfony_format_type_int32_intl3.phpt | 32 ------------ ext/intl/symfony_format_type_int32_intl4.phpt | 30 ------------ ext/intl/symfony_format_type_int32_intl5.phpt | 30 ------------ ext/intl/symfony_format_type_int32_intl6.phpt | 32 ------------ ext/intl/symfony_format_type_int32_intl7.phpt | 32 ------------ .../symfony_format_type_double_intl1.phpt | 0 .../symfony_format_type_double_intl2.phpt | 0 .../symfony_format_type_double_intl3.phpt | 0 .../symfony_format_type_double_intl4.phpt | 0 .../symfony_format_type_int64_intl1.phpt | 0 .../symfony_format_type_int64_intl2.phpt | 0 .../symfony_format_type_int64_intl3.phpt | 0 .../symfony_format_type_int64_intl4.phpt | 0 .../symfony_format_type_int64_intl5.phpt | 0 .../symfony_format_type_int64_intl6.phpt | 0 .../symfony_format_type_int64_intl7.phpt | 0 .../symfony_format_type_int64_intl8.phpt | 0 19 files changed, 238 deletions(-) delete mode 100644 ext/intl/symfony_format_type_int32_intl1.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl2.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl3.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl4.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl5.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl6.phpt delete mode 100644 ext/intl/symfony_format_type_int32_intl7.phpt rename ext/intl/{ => tests}/symfony_format_type_double_intl1.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_double_intl2.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_double_intl3.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_double_intl4.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl1.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl2.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl3.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl4.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl5.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl6.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl7.phpt (100%) rename ext/intl/{ => tests}/symfony_format_type_int64_intl8.phpt (100%) diff --git a/ext/intl/symfony_format_type_int32_intl1.phpt b/ext/intl/symfony_format_type_int32_intl1.phpt deleted file mode 100644 index 2867b35690b..00000000000 --- a/ext/intl/symfony_format_type_int32_intl1.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1 ---SKIPIF-- - ---FILE-- -format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(3) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - int(1) - [2]=> - string(1) "1" -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl2.phpt b/ext/intl/symfony_format_type_int32_intl2.phpt deleted file mode 100644 index 6a65a0a8092..00000000000 --- a/ext/intl/symfony_format_type_int32_intl2.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2 ---SKIPIF-- - ---FILE-- -format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(3) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - float(1.1) - [2]=> - string(1) "1" -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl3.phpt b/ext/intl/symfony_format_type_int32_intl3.phpt deleted file mode 100644 index 5e657db419b..00000000000 --- a/ext/intl/symfony_format_type_int32_intl3.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3 ---SKIPIF-- - ---FILE-- -format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); - -var_dump($unit_test_args); - -// execute the code from #testFormatTypeInt32Intl -$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(4) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - float(2147483648) - [2]=> - string(14) "-2,147,483,648" - [3]=> - string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl4.phpt b/ext/intl/symfony_format_type_int32_intl4.phpt deleted file mode 100644 index 54043d92e92..00000000000 --- a/ext/intl/symfony_format_type_int32_intl4.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4 ---SKIPIF-- - ---FILE-- -format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(3) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - int(1) - [2]=> - string(7) "SFD1.00" -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl5.phpt b/ext/intl/symfony_format_type_int32_intl5.phpt deleted file mode 100644 index d5f78d7119b..00000000000 --- a/ext/intl/symfony_format_type_int32_intl5.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5 ---SKIPIF-- - ---FILE-- -format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(3) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - float(1.1) - [2]=> - string(7) "SFD1.00" -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl6.phpt b/ext/intl/symfony_format_type_int32_intl6.phpt deleted file mode 100644 index fa708799d13..00000000000 --- a/ext/intl/symfony_format_type_int32_intl6.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6 ---SKIPIF-- - ---FILE-- -format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); - -var_dump($unit_test_args); - -// execute the code from #testFormatTypeInt32Intl -$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(4) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - float(2147483648) - [2]=> - string(21) "(SFD2,147,483,648.00)" - [3]=> - string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_int32_intl7.phpt b/ext/intl/symfony_format_type_int32_intl7.phpt deleted file mode 100644 index 5bbe4266770..00000000000 --- a/ext/intl/symfony_format_type_int32_intl7.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7 ---SKIPIF-- - ---FILE-- -format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}'); - -var_dump($unit_test_args); - -// execute the code from #testFormatTypeInt32Intl -$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32); - -echo "== didn't crash ==".PHP_EOL; - -?> ---EXPECT-- -array(4) { - [0]=> - object(NumberFormatter)#1 (0) { - } - [1]=> - float(-2147483649) - [2]=> - string(19) "SFD2,147,483,647.00" - [3]=> - string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range." -} -== didn't crash == diff --git a/ext/intl/symfony_format_type_double_intl1.phpt b/ext/intl/tests/symfony_format_type_double_intl1.phpt similarity index 100% rename from ext/intl/symfony_format_type_double_intl1.phpt rename to ext/intl/tests/symfony_format_type_double_intl1.phpt diff --git a/ext/intl/symfony_format_type_double_intl2.phpt b/ext/intl/tests/symfony_format_type_double_intl2.phpt similarity index 100% rename from ext/intl/symfony_format_type_double_intl2.phpt rename to ext/intl/tests/symfony_format_type_double_intl2.phpt diff --git a/ext/intl/symfony_format_type_double_intl3.phpt b/ext/intl/tests/symfony_format_type_double_intl3.phpt similarity index 100% rename from ext/intl/symfony_format_type_double_intl3.phpt rename to ext/intl/tests/symfony_format_type_double_intl3.phpt diff --git a/ext/intl/symfony_format_type_double_intl4.phpt b/ext/intl/tests/symfony_format_type_double_intl4.phpt similarity index 100% rename from ext/intl/symfony_format_type_double_intl4.phpt rename to ext/intl/tests/symfony_format_type_double_intl4.phpt diff --git a/ext/intl/symfony_format_type_int64_intl1.phpt b/ext/intl/tests/symfony_format_type_int64_intl1.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl1.phpt rename to ext/intl/tests/symfony_format_type_int64_intl1.phpt diff --git a/ext/intl/symfony_format_type_int64_intl2.phpt b/ext/intl/tests/symfony_format_type_int64_intl2.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl2.phpt rename to ext/intl/tests/symfony_format_type_int64_intl2.phpt diff --git a/ext/intl/symfony_format_type_int64_intl3.phpt b/ext/intl/tests/symfony_format_type_int64_intl3.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl3.phpt rename to ext/intl/tests/symfony_format_type_int64_intl3.phpt diff --git a/ext/intl/symfony_format_type_int64_intl4.phpt b/ext/intl/tests/symfony_format_type_int64_intl4.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl4.phpt rename to ext/intl/tests/symfony_format_type_int64_intl4.phpt diff --git a/ext/intl/symfony_format_type_int64_intl5.phpt b/ext/intl/tests/symfony_format_type_int64_intl5.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl5.phpt rename to ext/intl/tests/symfony_format_type_int64_intl5.phpt diff --git a/ext/intl/symfony_format_type_int64_intl6.phpt b/ext/intl/tests/symfony_format_type_int64_intl6.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl6.phpt rename to ext/intl/tests/symfony_format_type_int64_intl6.phpt diff --git a/ext/intl/symfony_format_type_int64_intl7.phpt b/ext/intl/tests/symfony_format_type_int64_intl7.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl7.phpt rename to ext/intl/tests/symfony_format_type_int64_intl7.phpt diff --git a/ext/intl/symfony_format_type_int64_intl8.phpt b/ext/intl/tests/symfony_format_type_int64_intl8.phpt similarity index 100% rename from ext/intl/symfony_format_type_int64_intl8.phpt rename to ext/intl/tests/symfony_format_type_int64_intl8.phpt From a45e81d093e830c25aed13480091049c901c38ec Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Tue, 21 Aug 2012 10:08:46 +0200 Subject: [PATCH 470/641] Bug 62462: adjusting test --- .../strings/quoted_printable_encode_002.phpt | Bin 7290 -> 7292 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt index 5380eb0bffe85046be0654f80a2cdd91897cb739..aaf5608f333402cf06b3657cd8fedd4d941e1877 100644 GIT binary patch delta 401 zcmexm@yBArSw<#Z-OU#n!5GG)6M@`|LJpJHvvUGj2RWQ3%Y*eg y@B@_?0u6O!2PsM9bDV6z%?@Ne5OD@72AOh!3#ueh7^Gx4JLn;o`sN%lJ~jYGmuqnV delta 308 zcmexk@ylYvSw Date: Tue, 21 Aug 2012 10:08:46 +0200 Subject: [PATCH 471/641] Bug 62462: adjusting test --- .../strings/quoted_printable_encode_002.phpt | Bin 7290 -> 7292 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt index 5380eb0bffe85046be0654f80a2cdd91897cb739..aaf5608f333402cf06b3657cd8fedd4d941e1877 100644 GIT binary patch delta 401 zcmexm@yBArSw<#Z-OU#n!5GG)6M@`|LJpJHvvUGj2RWQ3%Y*eg y@B@_?0u6O!2PsM9bDV6z%?@Ne5OD@72AOh!3#ueh7^Gx4JLn;o`sN%lJ~jYGmuqnV delta 308 zcmexk@ylYvSw Date: Tue, 21 Aug 2012 13:22:00 +0200 Subject: [PATCH 472/641] Added test for bug #51353. It'll be skipped by default and must be activated manually. --- ext/zip/tests/bug51353.phpt | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 ext/zip/tests/bug51353.phpt diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt new file mode 100644 index 00000000000..560945f9dd8 --- /dev/null +++ b/ext/zip/tests/bug51353.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #51353 ZIP64 problem, archive with 100000 items +--SKIPIF-- +12M big, + or create it dynamically. */ +$zip = new ZipArchive; +$r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); +if ($r) { + for ($i = 0; $i < 100000; $i++) { + $zip->addFromString("$i.txt", '1'); + } + $zip->close(); +} else { + die("failed"); +} + +$zip = new ZipArchive; +$r = $zip->open("$base_path/51353.zip"); +if ($r) { + $zip->extractTo("$base_path/51353_unpack"); + $zip->close(); + + $a = glob("$base_path/51353_unpack/*.txt"); + echo count($a) . "\n"; +} else { + die("failed"); +} + +echo "OK"; +--CLEAN-- + Date: Tue, 21 Aug 2012 13:36:58 +0200 Subject: [PATCH 473/641] Bump version. --- Zend/zend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend.h b/Zend/zend.h index 39bf5be512f..de2a2e595e8 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -22,7 +22,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "2.4.0" +#define ZEND_VERSION "2.5.0-dev" #define ZEND_ENGINE_2 From 60ad16e11f97fb58f736577c2cf9fef9f109b97a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 21 Aug 2012 22:11:11 +0800 Subject: [PATCH 474/641] skip test properly --- ext/mysql/tests/mysql_query_load_data_openbasedir.phpt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt index c2685a572e9..474065faf14 100644 --- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt @@ -2,13 +2,12 @@ LOAD DATA INFILE - open_basedir --SKIPIF-- Date: Tue, 21 Aug 2012 22:15:54 +0800 Subject: [PATCH 475/641] skip test properly --- ext/mysql/tests/mysql_query_load_data_openbasedir.phpt | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt index 339d36c9349..aa15f5ca126 100644 --- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt @@ -2,7 +2,6 @@ LOAD DATA INFILE - open_basedir --SKIPIF-- Date: Tue, 21 Aug 2012 20:15:34 -0300 Subject: [PATCH 476/641] - Removed PHP 6 checks --- ext/phar/phar.c | 5 +- ext/phar/phar_object.c | 137 ++--------------------------------------- ext/phar/stream.c | 13 +--- ext/phar/tar.c | 5 +- ext/phar/zip.c | 16 ----- 5 files changed, 9 insertions(+), 167 deletions(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index f7d08da4ab9..7b7d559811a 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2653,11 +2653,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, len = -len; } user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else + if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (closeoldfile) { php_stream_close(oldfile); } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 0335615ea47..d19f30c612e 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -58,9 +58,6 @@ static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { -#if PHP_MAJOR_VERSION >= 6 - int is_unicode = 0; -#endif HashTable *_SERVER; zval **stuff; char *path_info; @@ -76,18 +73,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char _SERVER = Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]); /* PATH_INFO and PATH_TRANSLATED should always be munged */ -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -96,38 +82,19 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PATH_INFO", sizeof("PHAR_PATH_INFO"), &temp, sizeof(zval **), NULL); } } -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED"), (void *) &temp, sizeof(zval **), NULL); } @@ -136,18 +103,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -156,29 +112,14 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_REQUEST_URI", sizeof("PHAR_REQUEST_URI"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); @@ -187,68 +128,34 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_PHP_SELF", sizeof("PHAR_PHP_SELF"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_NAME) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); ZVAL_STRINGL(*stuff, entry, entry_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_SCRIPT_NAME", sizeof("PHAR_SCRIPT_NAME"), (void *) &temp, sizeof(zval **), NULL); } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_FILENAME) { -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff TSRMLS_CC)) { - if (Z_TYPE_PP(stuff) == IS_UNICODE) { - is_unicode = 1; - zval_unicode_to_string(*stuff TSRMLS_CC); - } else { - is_unicode = 0; - } -#else if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff)) { -#endif - path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); -#if PHP_MAJOR_VERSION >= 6 - if (is_unicode) { - zval_string_to_unicode(*stuff TSRMLS_CC); - } -#endif + zend_hash_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME"), (void *) &temp, sizeof(zval **), NULL); } } @@ -940,11 +847,7 @@ PHP_METHOD(Phar, webPhar) if (ext) { ++ext; -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val TSRMLS_CC)) { -#else if (SUCCESS == zend_hash_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)+1, (void **) &val)) { -#endif switch (Z_TYPE_PP(val)) { case IS_LONG: if (Z_LVAL_PP(val) == PHAR_MIME_PHP || Z_LVAL_PP(val) == PHAR_MIME_PHPS) { @@ -958,11 +861,6 @@ PHP_METHOD(Phar, webPhar) RETURN_FALSE; } break; -#if PHP_MAJOR_VERSION >= 6 - case IS_UNICODE: - zval_unicode_to_string(*(val) TSRMLS_CC); - /* break intentionally omitted */ -#endif case IS_STRING: mime_type = Z_STRVAL_PP(val); code = PHAR_MIME_OTHER; @@ -1013,26 +911,12 @@ PHP_METHOD(Phar, mungServer) for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(mungvalues)); SUCCESS == zend_hash_has_more_elements(Z_ARRVAL_P(mungvalues)); zend_hash_move_forward(Z_ARRVAL_P(mungvalues))) { zval **data = NULL; -#if PHP_MAJOR_VERSION >= 6 - zval *unicopy = NULL; -#endif if (SUCCESS != zend_hash_get_current_data(Z_ARRVAL_P(mungvalues), (void **) &data)) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to retrieve array value in Phar::mungServer()"); return; } -#if PHP_MAJOR_VERSION >= 6 - if (Z_TYPE_PP(data) == IS_UNICODE) { - MAKE_STD_ZVAL(unicopy); - *unicopy = **data; - zval_copy_ctor(unicopy); - INIT_PZVAL(unicopy); - zval_unicode_to_string(unicopy TSRMLS_CC); - data = &unicopy; - } -#endif - if (Z_TYPE_PP(data) != IS_STRING) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME"); return; @@ -1054,11 +938,6 @@ PHP_METHOD(Phar, mungServer) if (Z_STRLEN_PP(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_PP(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME; } -#if PHP_MAJOR_VERSION >= 6 - if (unicopy) { - zval_ptr_dtor(&unicopy); - } -#endif } } /* }}} */ @@ -5033,11 +4912,7 @@ PHP_METHOD(PharFileInfo, getContent) phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC); Z_TYPE_P(return_value) = IS_STRING; -#if PHP_MAJOR_VERSION >= 6 - Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, (void **) &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0); -#else Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0); -#endif if (!Z_STRVAL_P(return_value)) { Z_STRVAL_P(return_value) = estrndup("", 0); diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 7e74ed60f3f..ccfe2a5886d 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -207,30 +207,19 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *pat fpf = php_stream_alloc(&phar_ops, idata, NULL, mode); php_url_free(resource); efree(internal_file); -#if PHP_MAJOR_VERSION >= 6 - if (context && context->options && phar_find_key(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption TSRMLS_CC)) { -#else + if (context && context->options && zend_hash_find(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption) == SUCCESS) { -#endif pharcontext = HASH_OF(*pzoption); if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 -#if PHP_MAJOR_VERSION >= 6 - && phar_find_key(pharcontext, "compress", sizeof("compress"), (void**)&pzoption TSRMLS_CC) -#else && zend_hash_find(pharcontext, "compress", sizeof("compress"), (void**)&pzoption) == SUCCESS -#endif && Z_TYPE_PP(pzoption) == IS_LONG && (Z_LVAL_PP(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 ) { idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; idata->internal_file->flags |= Z_LVAL_PP(pzoption); } -#if PHP_MAJOR_VERSION >= 6 - if (phar_find_key(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption TSRMLS_CC)) { -#else if (zend_hash_find(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption) == SUCCESS) { -#endif if (idata->internal_file->metadata) { zval_ptr_dtor(&idata->internal_file->metadata); idata->internal_file->metadata = NULL; diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 917734c992a..43d1ede2384 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -986,11 +986,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau len = -len; } user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else + if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } diff --git a/ext/phar/zip.c b/ext/phar/zip.c index ced975cb384..3372622552d 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -603,11 +603,7 @@ foundit: php_stream_filter_append(&fp->readfilters, filter); -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -628,11 +624,7 @@ foundit: php_stream_filter_append(&fp->readfilters, filter); -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -643,11 +635,7 @@ foundit: php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); } else { -#if PHP_MAJOR_VERSION >= 6 - if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { -#endif pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -1252,11 +1240,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau user_stub = 0; -#if PHP_MAJOR_VERSION >= 6 - if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { -#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { -#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname); } From e5bdd2c0eeab50dc1f863dae9a32d3857ece6a79 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 22 Aug 2012 13:41:47 +0800 Subject: [PATCH 477/641] Fixed bug #62885 (mysqli_poll - Segmentation fault) --- NEWS | 3 +++ ext/mysqli/mysqli_nonapi.c | 5 +++++ ext/mysqli/tests/bug62885.phpt | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 ext/mysqli/tests/bug62885.phpt diff --git a/NEWS b/NEWS index b796117fddc..3d156c17885 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,9 @@ PHP NEWS (reeze.xia@gmail.com) . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) +- MySQLnd: + . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index fbfc02e2fc7..0ef67a2c44a 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -705,6 +705,11 @@ PHP_FUNCTION(mysqli_poll) RETURN_FALSE; } + if (!r_array && !e_array) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed"); + RETURN_FALSE; + } + if (r_array != NULL) { mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array TSRMLS_CC); } diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt new file mode 100644 index 00000000000..9fb0aa0f030 --- /dev/null +++ b/ext/mysqli/tests/bug62885.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #62885 (mysqli_poll - Segmentation fault) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d + +Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d +okey From 703a4e390de277afb85d722a0792912d0b2d2d46 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 22 Aug 2012 13:51:44 +0800 Subject: [PATCH 478/641] stash --- Zend/zend_compile.c | 1 + Zend/zend_compile.h | 4 +- Zend/zend_opcode.c | 1 + Zend/zend_vm_def.h | 294 ++++++++++++--------- Zend/zend_vm_execute.h | 574 ++++++++++++++--------------------------- 5 files changed, 364 insertions(+), 510 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 33d1d377ca6..2ae8cc510f3 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2792,6 +2792,7 @@ void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_to zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array)); + CG(active_op_array)->has_finally_block = 1; opline->opcode = ZEND_LEAVE; SET_UNUSED(opline->op1); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 8919fdc6b80..80e02ab3098 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -281,6 +281,7 @@ struct _zend_op_array { zend_try_catch_element *try_catch_array; int last_try_catch; + zend_bool has_finally_block; /* static variables support */ HashTable *static_variables; @@ -383,7 +384,8 @@ struct _zend_execute_data { zend_class_entry *current_called_scope; zval *current_this; zval *current_object; - zend_bool leaving; + zend_uint leaving; + zend_uint leaving_dest; }; #define EX(element) execute_data.element diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 7cbc15b0b08..2552d2ebd64 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -87,6 +87,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz op_array->static_variables = NULL; op_array->last_try_catch = 0; + op_array->has_finally_block = 0; op_array->this_var = -1; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 1da4c12440a..d921f81efc6 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2878,49 +2878,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } FREE_OP1_IF_VAR(); - if (!(EG(active_op_array)->last_try_catch)) { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } + if (EG(active_op_array)->has_finally_block) { + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -2993,49 +2954,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); - if (!(EG(active_op_array)->last_try_catch)) { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } + if (EG(active_op_array)->has_finally_block) { + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -3370,6 +3292,93 @@ ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type) +{ + USE_OPLINE + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + + SAVE_OPLINE(); + + switch (type) { + case ZEND_THROW: + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + { + if (EG(prev_exception)) { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + /* EG(exception) || EG(prev_exception) */ + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else if (EX(leaving)) { + /* leave it to ZEND_LEAVE */ + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } + break; + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op + && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op + || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); + } + } + break; + } + ZEND_VM_CONTINUE(); +} + ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) { USE_OPLINE @@ -3379,6 +3388,10 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->brk; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -3391,6 +3404,10 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->cont; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -3418,6 +3435,10 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) } break; } + if ((EG(active_op_array)->has_finally_block)) { + EX(leaving_dest) = opline->op1.jmp_addr - EG(active_op_array)->opcodes; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO); + } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -5184,7 +5205,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) ZEND_VM_CONTINUE(); } else { zend_exception_save(TSRMLS_C); - EX(leaving) = finally; + EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } @@ -5194,7 +5215,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) ZEND_VM_CONTINUE(); } else if (finally) { zend_exception_save(TSRMLS_C); - EX(leaving) = finally; + EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } else { @@ -5284,7 +5305,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) zend_function *op_array; SAVE_OPLINE(); - + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); @@ -5320,47 +5341,68 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; - - SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); - if (EX(leaving)) { - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(exception)) { - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } else { + if (!EX(leaving)) { ZEND_VM_NEXT_OPCODE(); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + switch (EX(leaving)) { + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + case ZEND_THROW: + { + if (EG(exception)) { + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } + break; + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, EX(leaving)); + break; + } } + + ZEND_VM_CONTINUE(); } ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index b5a649d0a27..9818583334c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -794,6 +794,93 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + + SAVE_OPLINE(); + + switch (type) { + case ZEND_THROW: + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + { + if (EG(prev_exception)) { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + /* EG(exception) || EG(prev_exception) */ + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else if (EX(leaving)) { + /* leave it to ZEND_LEAVE */ + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } + break; + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + { + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op + && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op + || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); + } + } + break; + } + ZEND_VM_CONTINUE(); +} + static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -1122,7 +1209,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER ZEND_VM_CONTINUE(); } else { zend_exception_save(TSRMLS_C); - EX(leaving) = finally; + EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } @@ -1132,7 +1219,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER ZEND_VM_CONTINUE(); } else if (finally) { zend_exception_save(TSRMLS_C); - EX(leaving) = finally; + EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); ZEND_VM_CONTINUE(); } else { @@ -1178,47 +1265,68 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zend_uint i, op_num = opline - EG(active_op_array)->opcodes; - - SAVE_OPLINE(); zend_exception_restore(TSRMLS_C); - if (EX(leaving)) { - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(exception)) { - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } else { + if (!EX(leaving)) { ZEND_VM_NEXT_OPCODE(); + } else { + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + switch (EX(leaving)) { + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + case ZEND_THROW: + { + if (EG(exception)) { + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { + catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i = 0; i < EX(leaving); i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } + break; + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + return zend_finally_handler_leaving_SPEC(EX(leaving), ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + break; + } } + + ZEND_VM_CONTINUE(); } static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1455,6 +1563,10 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->brk; + return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -1467,6 +1579,10 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->cont; + return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -1494,6 +1610,10 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } + if ((EG(active_op_array)->has_finally_block)) { + EX(leaving_dest) = opline->op1.jmp_addr - EG(active_op_array)->opcodes; + return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -2345,49 +2465,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2458,49 +2539,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -6973,49 +7015,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7086,49 +7089,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11507,49 +11471,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11622,49 +11547,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27604,49 +27490,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27717,49 +27564,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - if (!(EG(active_op_array)->last_try_catch)) { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (EG(prev_exception)) { - /* leaving */ - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } - } else if (catch_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - ZEND_VM_CONTINUE(); - } else if (finally_op_num) { - EX(leaving) = 1; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - ZEND_VM_CONTINUE(); - } else if (EX(leaving)) { - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } + if (EG(active_op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From 22f55d56659d31a3546556dd39f3833af6d1fa3d Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 22 Aug 2012 11:43:12 +0200 Subject: [PATCH 479/641] Fixed bug #62313 Zend\tests\errmsg_021.phpt fails --- Zend/zend_API.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 65d97795345..a231415547c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2531,6 +2531,9 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt } /* }}} */ +#ifdef ZEND_WIN32 +#pragma optimize("", off) +#endif static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { zend_object_value retval; @@ -2539,6 +2542,9 @@ static zend_object_value display_disabled_class(zend_class_entry *class_type TSR zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name); return retval; } +#ifdef ZEND_WIN32 +#pragma optimize("", on) +#endif /* }}} */ static const zend_function_entry disabled_class_new[] = { From 60a29791e4b66844e5dfff698141074d48fc3da8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 22 Aug 2012 18:32:03 +0800 Subject: [PATCH 480/641] Fixed bug that jmp in try block jmp over finally block Refactor the implemention, make codes clear --- Zend/tests/catch_finally_001.phpt | 2 +- Zend/tests/catch_finally_002.phpt | 2 +- Zend/tests/catch_finally_003.phpt | 2 +- Zend/tests/catch_finally_004.phpt | 2 +- Zend/tests/catch_finally_005.phpt | 2 +- Zend/tests/catch_finally_006.phpt | 2 +- Zend/tests/try_catch_finally_005.phpt | 52 ++ Zend/tests/try_catch_finally_006.phpt | 39 ++ Zend/tests/try_catch_finally_007.phpt | 46 ++ Zend/tests/try_finally_001.phpt | 3 +- Zend/tests/try_finally_002.phpt | 2 +- Zend/tests/try_finally_003.phpt | 2 +- Zend/tests/try_finally_004.phpt | 2 +- Zend/tests/try_finally_005.phpt | 2 +- Zend/tests/try_finally_006.phpt | 2 +- Zend/tests/try_finally_007.phpt | 2 +- Zend/tests/try_finally_008.phpt | 2 +- Zend/tests/try_finally_009.phpt | 2 +- Zend/zend_compile.c | 24 +- Zend/zend_compile.h | 6 +- Zend/zend_opcode.c | 6 +- Zend/zend_vm_def.h | 865 +++++++++++++------------- Zend/zend_vm_execute.h | 379 ++++++----- 23 files changed, 759 insertions(+), 689 deletions(-) create mode 100644 Zend/tests/try_catch_finally_005.phpt create mode 100644 Zend/tests/try_catch_finally_006.phpt create mode 100644 Zend/tests/try_catch_finally_007.phpt diff --git a/Zend/tests/catch_finally_001.phpt b/Zend/tests/catch_finally_001.phpt index 2b58fa71326..0c3f597a0a5 100644 --- a/Zend/tests/catch_finally_001.phpt +++ b/Zend/tests/catch_finally_001.phpt @@ -1,5 +1,5 @@ --TEST-- -Try catch finally +Try catch finally (basic test) --FILE-- +--EXPECTF-- +string(5) "break" +string(9) "continue1" +string(9) "continue1" +string(9) "continue2" +string(7) "finally" +string(9) "continue2" +string(8) "cactched" +string(7) "finally" +string(9) "continue2" +string(7) "finally" diff --git a/Zend/tests/try_catch_finally_006.phpt b/Zend/tests/try_catch_finally_006.phpt new file mode 100644 index 00000000000..dab6af6a581 --- /dev/null +++ b/Zend/tests/try_catch_finally_006.phpt @@ -0,0 +1,39 @@ +--TEST-- +Try catch finally (goto in try/catch block) +--CREDITS-- +adoy +--FILE-- + +--EXPECTF-- +string(8) "finally1" +string(8) "finally2" +string(5) "label" +string(7) "return2" +string(8) "finally1" +string(7) "catched" +string(8) "finally2" +string(7) "return1" diff --git a/Zend/tests/try_catch_finally_007.phpt b/Zend/tests/try_catch_finally_007.phpt new file mode 100644 index 00000000000..ad33c681317 --- /dev/null +++ b/Zend/tests/try_catch_finally_007.phpt @@ -0,0 +1,46 @@ +--TEST-- +Try catch finally (goto in try/catch block) +--CREDITS-- +adoy +--FILE-- + +--EXPECTF-- +string(8) "finally1" +string(7) "catched" +string(8) "finally2" +string(5) "label" +NULL +string(8) "finally1" +string(7) "catched" +string(8) "finally2" +string(6) "return" diff --git a/Zend/tests/try_finally_001.phpt b/Zend/tests/try_finally_001.phpt index 1c168da275c..0f740872c2a 100644 --- a/Zend/tests/try_finally_001.phpt +++ b/Zend/tests/try_finally_001.phpt @@ -1,5 +1,5 @@ --TEST-- -Try finally +Try finally (basic test) --FILE-- EA = get_next_op_number(CG(active_op_array)); + catch_token->EA = get_next_op_number(CG(active_op_array)); } /* }}} */ @@ -2792,7 +2792,7 @@ void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_to zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num; CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->has_finally_block = 1; + CG(active_op_array)->has_finally_block = 1; opline->opcode = ZEND_LEAVE; SET_UNUSED(opline->op1); @@ -4059,9 +4059,9 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* /** And, ensure that the referenced method is resolvable, too. */ lcname = zend_str_tolower_dup(cur_method_ref->method_name, - cur_method_ref->mname_len); + cur_method_ref->mname_len); method_exists = zend_hash_exists(&cur_method_ref->ce->function_table, - lcname, cur_method_ref->mname_len + 1); + lcname, cur_method_ref->mname_len + 1); efree(lcname); if (!method_exists) { @@ -5043,11 +5043,11 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name opline->op2_type = IS_CONST; if (doing_inheritance) { - /* Make sure a trait does not try to extend a class */ - if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); - } - + /* Make sure a trait does not try to extend a class */ + if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { + zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); + } + opline->extended_value = parent_class_name->u.op.var; opline->opcode = ZEND_DECLARE_INHERITED_CLASS; } else { @@ -6998,9 +6998,9 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); if (((Z_STRLEN_P(name) == sizeof("self")-1) && - !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRLEN_P(name) == sizeof("parent")-1) && - !memcmp(lcname, "parent", sizeof("parent")-1))) { + !memcmp(lcname, "self", sizeof("self")-1)) || + ((Z_STRLEN_P(name) == sizeof("parent")-1) && + !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 80e02ab3098..971860602ee 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -281,7 +281,7 @@ struct _zend_op_array { zend_try_catch_element *try_catch_array; int last_try_catch; - zend_bool has_finally_block; + zend_bool has_finally_block; /* static variables support */ HashTable *static_variables; @@ -384,8 +384,8 @@ struct _zend_execute_data { zend_class_entry *current_called_scope; zval *current_this; zval *current_object; - zend_uint leaving; - zend_uint leaving_dest; + zend_uint leaving; + zend_uint leaving_dest; }; #define EX(element) execute_data.element diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 2552d2ebd64..6c158291004 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -87,7 +87,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz op_array->static_variables = NULL; op_array->last_try_catch = 0; - op_array->has_finally_block = 0; + op_array->has_finally_block = 0; op_array->this_var = -1; @@ -552,8 +552,8 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) } opline->op1.jmp_addr = &op_array->opcodes[opline->op1.opline_num]; break; - case ZEND_BRK: - case ZEND_CONT: + case ZEND_BRK: + case ZEND_CONT: if (op_array->last_try_catch) { int nest_levels, array_offset; zend_brk_cont_element *jmp_to; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index d921f81efc6..ce1674e4f38 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1840,6 +1840,392 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) +{ + zend_bool nested; + zend_op_array *op_array = EX(op_array); + + EG(current_execute_data) = EX(prev_execute_data); + EG(opline_ptr) = NULL; + if (!EG(active_symbol_table)) { + zval ***cv = EX_CVs(); + zval ***end = cv + op_array->last_var; + while (cv != end) { + if (*cv) { + zval_ptr_dtor(*cv); + } + cv++; + } + } + + if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { + zval_ptr_dtor((zval**)&op_array->prototype); + } + + nested = EX(nested); + + zend_vm_stack_free(execute_data TSRMLS_CC); + + if (nested) { + execute_data = EG(current_execute_data); + } + if (nested) { + USE_OPLINE + + LOAD_REGS(); + LOAD_OPLINE(); + if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) { + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + EX(object) = EX(current_object); + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + destroy_op_array(op_array TSRMLS_CC); + efree(op_array); + if (UNEXPECTED(EG(exception) != NULL)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + HANDLE_EXCEPTION_LEAVE(); + } else if (RETURN_VALUE_USED(opline)) { + if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */ + zval *retval; + + ALLOC_ZVAL(retval); + ZVAL_BOOL(retval, 1); + INIT_PZVAL(retval); + EX_T(opline->result.var).var.ptr = retval; + } + } + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); + } else { + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } + } + EG(active_symbol_table) = EX(symbol_table); + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + if (EG(This)) { + if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } + } + zval_ptr_dtor(&EG(This)); + } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + if (UNEXPECTED(EG(exception) != NULL)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { + zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); + } + HANDLE_EXCEPTION_LEAVE(); + } + + ZEND_VM_INC_OPCODE(); + ZEND_VM_LEAVE(); + } + } + ZEND_VM_RETURN(); +} + +ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) +{ + USE_OPLINE + zend_bool should_change_scope = 0; + zend_function *fbc = EX(function_state).function; + + SAVE_OPLINE(); + if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) { + if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) { + zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); /* Never reached */ + } + if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { + zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", + fbc->common.scope ? fbc->common.scope->name : "", + fbc->common.scope ? "::" : "", + fbc->common.function_name); + } + } + if (fbc->common.scope && + !(fbc->common.fn_flags & ZEND_ACC_STATIC) && + !EX(object)) { + + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + /* FIXME: output identifiers properly */ + zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name); + } else { + /* FIXME: output identifiers properly */ + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name, fbc->common.function_name); + } + } + + if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) { + should_change_scope = 1; + EX(current_this) = EG(This); + EX(current_scope) = EG(scope); + EX(current_called_scope) = EG(called_scope); + EG(This) = EX(object); + EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL; + EG(called_scope) = EX(called_scope); + } + + zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); + EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); + LOAD_OPLINE(); + + if (fbc->type == ZEND_INTERNAL_FUNCTION) { + temp_variable *ret = &EX_T(opline->result.var); + + MAKE_STD_ZVAL(ret->var.ptr); + ZVAL_NULL(ret->var.ptr); + ret->var.ptr_ptr = &ret->var.ptr; + ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; + + if (fbc->common.arg_info) { + zend_uint i=0; + zval **p = (zval**)EX(function_state).arguments; + ulong arg_count = opline->extended_value; + + while (arg_count>0) { + zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC); + arg_count--; + } + } + + if (!zend_execute_internal) { + /* saves one function call if zend_execute_internal is not used */ + fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + } else { + zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC); + } + + if (!RETURN_VALUE_USED(opline)) { + zval_ptr_dtor(&ret->var.ptr); + } + } else if (fbc->type == ZEND_USER_FUNCTION) { + EX(original_return_value) = EG(return_value_ptr_ptr); + EG(active_symbol_table) = NULL; + EG(active_op_array) = &fbc->op_array; + EG(return_value_ptr_ptr) = NULL; + if (RETURN_VALUE_USED(opline)) { + temp_variable *ret = &EX_T(opline->result.var); + + ret->var.ptr = NULL; + EG(return_value_ptr_ptr) = &ret->var.ptr; + ret->var.ptr_ptr = &ret->var.ptr; + ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; + } + + if (EXPECTED(zend_execute == execute)) { + if (EXPECTED(EG(exception) == NULL)) { + ZEND_VM_ENTER(); + } + } else { + zend_execute(EG(active_op_array) TSRMLS_CC); + } + + EG(opline_ptr) = &EX(opline); + EG(active_op_array) = EX(op_array); + EG(return_value_ptr_ptr) = EX(original_return_value); + if (EG(active_symbol_table)) { + if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { + zend_hash_destroy(EG(active_symbol_table)); + FREE_HASHTABLE(EG(active_symbol_table)); + } else { + /* clean before putting into the cache, since clean + could call dtors, which could use cached hash */ + zend_hash_clean(EG(active_symbol_table)); + *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); + } + } + EG(active_symbol_table) = EX(symbol_table); + } else { /* ZEND_OVERLOADED_FUNCTION */ + MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr); + ZVAL_NULL(EX_T(opline->result.var).var.ptr); + + /* Not sure what should be done here if it's a static method */ + if (EXPECTED(EX(object) != NULL)) { + Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + } else { + zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); + } + + if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { + efree((char*)fbc->common.function_name); + } + efree(fbc); + + if (!RETURN_VALUE_USED(opline)) { + zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); + } else { + Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); + Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); + EX_T(opline->result.var).var.fcall_returned_reference = 0; + EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; + } + } + + EX(function_state).function = (zend_function *) EX(op_array); + EX(function_state).arguments = NULL; + + if (should_change_scope) { + if (EG(This)) { + if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { + if (IS_CTOR_USED(EX(called_scope))) { + Z_DELREF_P(EG(This)); + } + if (Z_REFCOUNT_P(EG(This)) == 1) { + zend_object_store_ctor_failed(EG(This) TSRMLS_CC); + } + } + zval_ptr_dtor(&EG(This)); + } + EG(This) = EX(current_this); + EG(scope) = EX(current_scope); + EG(called_scope) = EX(current_called_scope); + } + + EX(object) = EX(current_object); + EX(called_scope) = DECODE_CTOR(EX(called_scope)); + + zend_vm_stack_clear_multiple(TSRMLS_C); + + if (UNEXPECTED(EG(exception) != NULL)) { + zend_throw_exception_internal(NULL TSRMLS_CC); + if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { + zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); + } + HANDLE_EXCEPTION(); + } + + ZEND_VM_NEXT_OPCODE(); +} + +ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type) +{ + USE_OPLINE + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + + SAVE_OPLINE(); + + switch (type) { + case ZEND_THROW: + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + case ZEND_LEAVE: + { + if (EG(prev_exception) || (type == ZEND_LEAVE && EG(exception))) { + for (i=0; ilast_try_catch; i++) { + if (EX(op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EX(op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + } + if (op_num < EX(op_array)->try_catch_array[i].catch_op) { + catch_op_num = EX(op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i=0; ilast_try_catch; i++) { + if (EX(op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EX(op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + /* EG(exception) || EG(prev_exception) */ + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + if (type != ZEND_LEAVE) { + EX(leaving) = type; + } + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else if (EX(leaving) && type != ZEND_LEAVE) { + /* leave it to ZEND_LEAVE */ + EX(leaving) = type; + ZEND_VM_NEXT_OPCODE(); + } else { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + } + } + break; + case ZEND_JMP: + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + { + /* these can not occurred in exception context */ + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op + && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op + || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); + } + } + break; + } + ZEND_VM_CONTINUE(); +} + ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY) { USE_OPLINE @@ -1847,6 +2233,10 @@ ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY) #if DEBUG_ZEND>=2 printf("Jumping to %d\n", opline->op1.opline_num); #endif + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_JMP); + } ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); ZEND_VM_CONTINUE(); /* CHECK_ME */ } @@ -2508,299 +2898,6 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HELPER(zend_leave_helper, ANY, ANY) -{ - zend_bool nested; - zend_op_array *op_array = EX(op_array); - - EG(current_execute_data) = EX(prev_execute_data); - EG(opline_ptr) = NULL; - if (!EG(active_symbol_table)) { - zval ***cv = EX_CVs(); - zval ***end = cv + op_array->last_var; - while (cv != end) { - if (*cv) { - zval_ptr_dtor(*cv); - } - cv++; - } - } - - if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { - zval_ptr_dtor((zval**)&op_array->prototype); - } - - nested = EX(nested); - - zend_vm_stack_free(execute_data TSRMLS_CC); - - if (nested) { - execute_data = EG(current_execute_data); - } - if (nested) { - USE_OPLINE - - LOAD_REGS(); - LOAD_OPLINE(); - if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) { - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - EX(object) = EX(current_object); - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - destroy_op_array(op_array TSRMLS_CC); - efree(op_array); - if (UNEXPECTED(EG(exception) != NULL)) { - zend_throw_exception_internal(NULL TSRMLS_CC); - HANDLE_EXCEPTION_LEAVE(); - } else if (RETURN_VALUE_USED(opline)) { - if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */ - zval *retval; - - ALLOC_ZVAL(retval); - ZVAL_BOOL(retval, 1); - INIT_PZVAL(retval); - EX_T(opline->result.var).var.ptr = retval; - } - } - - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); - } else { - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } - } - EG(active_symbol_table) = EX(symbol_table); - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - if (EG(This)) { - if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { - if (IS_CTOR_USED(EX(called_scope))) { - Z_DELREF_P(EG(This)); - } - if (Z_REFCOUNT_P(EG(This)) == 1) { - zend_object_store_ctor_failed(EG(This) TSRMLS_CC); - } - } - zval_ptr_dtor(&EG(This)); - } - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - zend_vm_stack_clear_multiple(TSRMLS_C); - - if (UNEXPECTED(EG(exception) != NULL)) { - zend_throw_exception_internal(NULL TSRMLS_CC); - if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); - } - HANDLE_EXCEPTION_LEAVE(); - } - - ZEND_VM_INC_OPCODE(); - ZEND_VM_LEAVE(); - } - } - ZEND_VM_RETURN(); -} - -ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) -{ - USE_OPLINE - zend_bool should_change_scope = 0; - zend_function *fbc = EX(function_state).function; - - SAVE_OPLINE(); - if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) { - if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) { - zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name); - CHECK_EXCEPTION(); - ZEND_VM_NEXT_OPCODE(); /* Never reached */ - } - if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { - zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - fbc->common.scope ? fbc->common.scope->name : "", - fbc->common.scope ? "::" : "", - fbc->common.function_name); - } - } - if (fbc->common.scope && - !(fbc->common.fn_flags & ZEND_ACC_STATIC) && - !EX(object)) { - - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - /* FIXME: output identifiers properly */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name); - } else { - /* FIXME: output identifiers properly */ - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name, fbc->common.function_name); - } - } - - if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) { - should_change_scope = 1; - EX(current_this) = EG(This); - EX(current_scope) = EG(scope); - EX(current_called_scope) = EG(called_scope); - EG(This) = EX(object); - EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL; - EG(called_scope) = EX(called_scope); - } - - zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); - EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); - LOAD_OPLINE(); - - if (fbc->type == ZEND_INTERNAL_FUNCTION) { - temp_variable *ret = &EX_T(opline->result.var); - - MAKE_STD_ZVAL(ret->var.ptr); - ZVAL_NULL(ret->var.ptr); - ret->var.ptr_ptr = &ret->var.ptr; - ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; - - if (fbc->common.arg_info) { - zend_uint i=0; - zval **p = (zval**)EX(function_state).arguments; - ulong arg_count = opline->extended_value; - - while (arg_count>0) { - zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC); - arg_count--; - } - } - - if (!zend_execute_internal) { - /* saves one function call if zend_execute_internal is not used */ - fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); - } else { - zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC); - } - - if (!RETURN_VALUE_USED(opline)) { - zval_ptr_dtor(&ret->var.ptr); - } - } else if (fbc->type == ZEND_USER_FUNCTION) { - EX(original_return_value) = EG(return_value_ptr_ptr); - EG(active_symbol_table) = NULL; - EG(active_op_array) = &fbc->op_array; - EG(return_value_ptr_ptr) = NULL; - if (RETURN_VALUE_USED(opline)) { - temp_variable *ret = &EX_T(opline->result.var); - - ret->var.ptr = NULL; - EG(return_value_ptr_ptr) = &ret->var.ptr; - ret->var.ptr_ptr = &ret->var.ptr; - ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; - } - - if (EXPECTED(zend_execute == execute)) { - if (EXPECTED(EG(exception) == NULL)) { - ZEND_VM_ENTER(); - } - } else { - zend_execute(EG(active_op_array) TSRMLS_CC); - } - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = EX(op_array); - EG(return_value_ptr_ptr) = EX(original_return_value); - if (EG(active_symbol_table)) { - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } else { - /* clean before putting into the cache, since clean - could call dtors, which could use cached hash */ - zend_hash_clean(EG(active_symbol_table)); - *(++EG(symtable_cache_ptr)) = EG(active_symbol_table); - } - } - EG(active_symbol_table) = EX(symbol_table); - } else { /* ZEND_OVERLOADED_FUNCTION */ - MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr); - ZVAL_NULL(EX_T(opline->result.var).var.ptr); - - /* Not sure what should be done here if it's a static method */ - if (EXPECTED(EX(object) != NULL)) { - Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); - } else { - zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); - } - - if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - efree((char*)fbc->common.function_name); - } - efree(fbc); - - if (!RETURN_VALUE_USED(opline)) { - zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); - } else { - Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); - Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); - EX_T(opline->result.var).var.fcall_returned_reference = 0; - EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; - } - } - - EX(function_state).function = (zend_function *) EX(op_array); - EX(function_state).arguments = NULL; - - if (should_change_scope) { - if (EG(This)) { - if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { - if (IS_CTOR_USED(EX(called_scope))) { - Z_DELREF_P(EG(This)); - } - if (Z_REFCOUNT_P(EG(This)) == 1) { - zend_object_store_ctor_failed(EG(This) TSRMLS_CC); - } - } - zval_ptr_dtor(&EG(This)); - } - EG(This) = EX(current_this); - EG(scope) = EX(current_scope); - EG(called_scope) = EX(current_called_scope); - } - - EX(object) = EX(current_object); - EX(called_scope) = DECODE_CTOR(EX(called_scope)); - - zend_vm_stack_clear_multiple(TSRMLS_C); - - if (UNEXPECTED(EG(exception) != NULL)) { - zend_throw_exception_internal(NULL TSRMLS_CC); - if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { - zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); - } - HANDLE_EXCEPTION(); - } - - ZEND_VM_NEXT_OPCODE(); -} - ZEND_VM_HANDLER(61, ZEND_DO_FCALL_BY_NAME, ANY, ANY) { EX(function_state).function = EX(fbc); @@ -2878,10 +2975,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } FREE_OP1_IF_VAR(); - if (EG(active_op_array)->has_finally_block) { - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); - } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + if (EX(op_array)->has_finally_block) { + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -2954,10 +3051,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); - if (EG(active_op_array)->has_finally_block) { - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF); - } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + if (EX(op_array)->has_finally_block) { + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -3292,93 +3389,6 @@ ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type) -{ - USE_OPLINE - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - - SAVE_OPLINE(); - - switch (type) { - case ZEND_THROW: - case ZEND_RETURN: - case ZEND_RETURN_BY_REF: - { - if (EG(prev_exception)) { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } else { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - } - - if (catch_op_num && finally_op_num) { - /* EG(exception) || EG(prev_exception) */ - if (catch_op_num > finally_op_num) { - EX(leaving) = ZEND_THROW; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } - } else if (catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } else if (finally_op_num) { - EX(leaving) = type; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else if (EX(leaving)) { - /* leave it to ZEND_LEAVE */ - ZEND_VM_NEXT_OPCODE(); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } - break; - case ZEND_BRK: - case ZEND_CONT: - case ZEND_GOTO: - { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op - && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op - || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - - if (finally_op_num) { - EX(leaving) = type; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); - } - } - break; - } - ZEND_VM_CONTINUE(); -} - ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) { USE_OPLINE @@ -3388,10 +3398,10 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->brk; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK); - } + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = el->brk; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -3404,10 +3414,10 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->cont; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT); - } + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->cont; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -3435,10 +3445,10 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) } break; } - if ((EG(active_op_array)->has_finally_block)) { - EX(leaving_dest) = opline->op1.jmp_addr - EG(active_op_array)->opcodes; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO); - } + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO); + } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -5305,7 +5315,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) zend_function *op_array; SAVE_OPLINE(); - + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); @@ -5340,64 +5350,21 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) { - USE_OPLINE zend_exception_restore(TSRMLS_C); - if (!EX(leaving)) { ZEND_VM_NEXT_OPCODE(); } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - switch (EX(leaving)) { + zend_uint leaving = EX(leaving); + switch (leaving) { case ZEND_RETURN: case ZEND_RETURN_BY_REF: case ZEND_THROW: - { - if (EG(exception)) { - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } else { - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = ZEND_THROW; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } - } else if (catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); - } - } - break; + leaving = ZEND_LEAVE; + case ZEND_JMP: case ZEND_BRK: case ZEND_CONT: case ZEND_GOTO: - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, EX(leaving)); + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, leaving); break; } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 9818583334c..bd191245741 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -427,33 +427,6 @@ zend_vm_enter: zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen"); } -static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - -#if DEBUG_ZEND>=2 - printf("Jumping to %d\n", opline->op1.opline_num); -#endif - ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); - ZEND_VM_CONTINUE(); /* CHECK_ME */ -} - -static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - zval *tmp = &EX_T(opline->result.var).tmp_var; - - SAVE_OPLINE(); - tmp->value.str.val = emalloc(1); - tmp->value.str.val[0] = 0; - tmp->value.str.len = 0; - Z_SET_REFCOUNT_P(tmp, 1); - tmp->type = IS_STRING; - Z_UNSET_ISREF_P(tmp); - /*CHECK_EXCEPTION();*/ - ZEND_VM_NEXT_OPCODE(); -} - static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) { zend_bool nested; @@ -747,6 +720,130 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zend_uint i, op_num = opline - EX(op_array)->opcodes; + zend_uint catch_op_num = 0, finally_op_num = 0; + + SAVE_OPLINE(); + + switch (type) { + case ZEND_THROW: + case ZEND_RETURN: + case ZEND_RETURN_BY_REF: + case ZEND_LEAVE: + { + if (EG(prev_exception) || (type == ZEND_LEAVE && EG(exception))) { + for (i=0; ilast_try_catch; i++) { + if (EX(op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EX(op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + } + if (op_num < EX(op_array)->try_catch_array[i].catch_op) { + catch_op_num = EX(op_array)->try_catch_array[i].catch_op; + } + } + } else { + for (i=0; ilast_try_catch; i++) { + if (EX(op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EX(op_array)->try_catch_array[i].finally_op) { + finally_op_num = EX(op_array)->try_catch_array[i].finally_op; + } + } + } + + if (catch_op_num && finally_op_num) { + /* EG(exception) || EG(prev_exception) */ + if (catch_op_num > finally_op_num) { + EX(leaving) = ZEND_THROW; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } + } else if (catch_op_num) { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); + } else if (finally_op_num) { + if (type != ZEND_LEAVE) { + EX(leaving) = type; + } + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else if (EX(leaving) && type != ZEND_LEAVE) { + /* leave it to ZEND_LEAVE */ + EX(leaving) = type; + ZEND_VM_NEXT_OPCODE(); + } else { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + } + break; + case ZEND_JMP: + case ZEND_BRK: + case ZEND_CONT: + case ZEND_GOTO: + { + /* these can not occurred in exception context */ + for (i=0; ilast_try_catch; i++) { + if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { + break; + } + if (op_num < EG(active_op_array)->try_catch_array[i].finally_op + && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op + || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { + finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; + } + } + + if (finally_op_num) { + EX(leaving) = type; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); + } else { + EX(leaving) = 0; + ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); + } + } + break; + } + ZEND_VM_CONTINUE(); +} + +static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + +#if DEBUG_ZEND>=2 + printf("Jumping to %d\n", opline->op1.opline_num); +#endif + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + return zend_finally_handler_leaving_SPEC(ZEND_JMP, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); + ZEND_VM_CONTINUE(); /* CHECK_ME */ +} + +static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zval *tmp = &EX_T(opline->result.var).tmp_var; + + SAVE_OPLINE(); + tmp->value.str.val = emalloc(1); + tmp->value.str.val[0] = 0; + tmp->value.str.len = 0; + Z_SET_REFCOUNT_P(tmp, 1); + tmp->type = IS_STRING; + Z_UNSET_ISREF_P(tmp); + /*CHECK_EXCEPTION();*/ + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { EX(function_state).function = EX(fbc); @@ -794,93 +891,6 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE_HANDLER_ARGS) -{ - USE_OPLINE - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - - SAVE_OPLINE(); - - switch (type) { - case ZEND_THROW: - case ZEND_RETURN: - case ZEND_RETURN_BY_REF: - { - if (EG(prev_exception)) { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } else { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - } - - if (catch_op_num && finally_op_num) { - /* EG(exception) || EG(prev_exception) */ - if (catch_op_num > finally_op_num) { - EX(leaving) = ZEND_THROW; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } - } else if (catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } else if (finally_op_num) { - EX(leaving) = type; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else if (EX(leaving)) { - /* leave it to ZEND_LEAVE */ - ZEND_VM_NEXT_OPCODE(); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } - break; - case ZEND_BRK: - case ZEND_CONT: - case ZEND_GOTO: - { - for (i=0; ilast_try_catch; i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op - && (EX(leaving_dest) < EG(active_op_array)->try_catch_array[i].try_op - || EX(leaving_dest) >= EG(active_op_array)->try_catch_array[i].finally_end)) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - - if (finally_op_num) { - EX(leaving) = type; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[EX(leaving_dest)]); - } - } - break; - } - ZEND_VM_CONTINUE(); -} - static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -1264,64 +1274,21 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_LEAVE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - USE_OPLINE zend_exception_restore(TSRMLS_C); - if (!EX(leaving)) { ZEND_VM_NEXT_OPCODE(); } else { - zend_uint i, op_num = opline - EX(op_array)->opcodes; - zend_uint catch_op_num = 0, finally_op_num = 0; - switch (EX(leaving)) { + zend_uint leaving = EX(leaving); + switch (leaving) { case ZEND_RETURN: case ZEND_RETURN_BY_REF: case ZEND_THROW: - { - if (EG(exception)) { - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { - catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op; - } - } - } else { - for (i = 0; i < EX(leaving); i++) { - if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { - break; - } - if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) { - finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op; - } - } - } - - if (catch_op_num && finally_op_num) { - if (catch_op_num > finally_op_num) { - EX(leaving) = ZEND_THROW; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } - } else if (catch_op_num) { - EX(leaving) = 0; - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); - } else if (finally_op_num) { - ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); - } else { - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } - break; + leaving = ZEND_LEAVE; + case ZEND_JMP: case ZEND_BRK: case ZEND_CONT: case ZEND_GOTO: - return zend_finally_handler_leaving_SPEC(EX(leaving), ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(leaving, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); break; } } @@ -1563,10 +1530,10 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->brk; - return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = el->brk; + return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -1579,10 +1546,10 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->cont; - return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } + if (EG(active_op_array)->has_finally_block) { + EX(leaving_dest) = el->cont; + return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -1610,10 +1577,10 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - if ((EG(active_op_array)->has_finally_block)) { - EX(leaving_dest) = opline->op1.jmp_addr - EG(active_op_array)->opcodes; - return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } + if (EX(op_array)->has_finally_block) { + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + return zend_finally_handler_leaving_SPEC(ZEND_GOTO, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -2465,10 +2432,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG *EG(return_value_ptr_ptr) = ret; } - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2539,10 +2506,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7015,10 +6982,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7089,10 +7056,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11471,10 +11438,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11547,10 +11514,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27490,10 +27457,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27564,10 +27531,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - if (EG(active_op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From 7a56ac00a04d4fc72052bb679626e723da3eef44 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 22 Aug 2012 10:50:50 -0300 Subject: [PATCH 481/641] - Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private) --- Zend/tests/bug62892.phpt | 21 +++++++++++++++++++++ ext/reflection/php_reflection.c | 6 ++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug62892.phpt diff --git a/Zend/tests/bug62892.phpt b/Zend/tests/bug62892.phpt new file mode 100644 index 00000000000..e6b0e60ff3c --- /dev/null +++ b/Zend/tests/bug62892.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private) +--FILE-- +getTraitAliases()); + +?> +--EXPECTF-- +array(0) { +} diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6656f58c65e..7c9981924de 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4464,8 +4464,10 @@ ZEND_METHOD(reflection_class, getTraitAliases) int method_name_len; zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method; - method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); - add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + if (ce->trait_aliases[i]->alias) { + method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); + add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + } i++; } } From b721ed57eb767dd14630aef375cec5a729245d62 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 22 Aug 2012 10:54:14 -0300 Subject: [PATCH 482/641] - BFN --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index d60f51b5305..ad50c26cabb 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,11 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: + . Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing + trait methods as private). (Felipe) . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds). + . Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is not + set). (Felipe) . Fixed bug #62763 (register_shutdown_function and extending class). (Laruence) . Fixed bug #62725 (Calling exit() in a shutdown function does not return From a90170e6f803f283d6c8e4e8d6b7bd8b7bd011a4 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 22 Aug 2012 11:19:29 +0200 Subject: [PATCH 483/641] WTF? --- NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS b/NEWS index f4df4463fa7..00f8ec6be9e 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,6 @@ PHP NEWS - General improvements: . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). (Laruence) . Drop Windows XP and 2003 support. (Pierre) - . World domination . Improve set_exception_handler while doing reset.(Laruence) . Support constant array/string dereferencing. (Laruence) . Add support for using empty() on the result of function calls and From fbacf9c237f4fb60af453ff77c08e7513ec93024 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 22 Aug 2012 11:19:42 -0300 Subject: [PATCH 484/641] - Fix NEWS --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ad50c26cabb..de19a206374 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,6 @@ PHP NEWS ?? ??? 2012, PHP 5.4.7 - Core: - . Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing - trait methods as private). (Felipe) . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds). . Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is not set). (Felipe) @@ -34,6 +32,8 @@ PHP NEWS . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) - Reflection: + . Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing + trait methods as private). (Felipe) . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result). (Laruence) From 815874c646468f73d4bba3619543ab047873b5e7 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 22 Aug 2012 20:04:42 +0200 Subject: [PATCH 485/641] plug a leak when the server ask the client for a auth protocol, that the client doesn't understand. This is 5.5 specific bug, as a result of a refactoring in 5.5 --- ext/mysqlnd/mysqlnd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 9a907a5644d..d7462f77a54 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -622,19 +622,19 @@ mysqlnd_run_authentication( } DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no); } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL); - if (plugin_data) { - mnd_efree(plugin_data); - } if (ret == PASS) { DBG_INF_FMT("saving requested_protocol=%s", requested_protocol); conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol TSRMLS_CC); } - +end: + if (plugin_data) { + mnd_efree(plugin_data); + } if (requested_protocol) { mnd_efree(requested_protocol); } -end: + DBG_RETURN(ret); } /* }}} */ @@ -838,6 +838,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn, MYSQLND_NET * net = conn->net; DBG_ENTER("mysqlnd_conn_data::connect"); + DBG_INF_FMT("conn=%p", conn); if (PASS != conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { goto err; @@ -1149,7 +1150,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char * size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, query); enum_func_status ret = FAIL; DBG_ENTER("mysqlnd_conn_data::query"); - DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query); + DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query); if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { if (PASS == conn->m->send_query(conn, query, query_len TSRMLS_CC) && @@ -1883,10 +1884,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn TSR Fall-through */ CONN_SET_STATE(conn, CONN_QUIT_SENT); - net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); /* Fall-through */ case CONN_QUIT_SENT: /* The user has killed its own connection */ + net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC); break; } @@ -2446,7 +2447,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn T MYSQLND_RES * result = NULL; DBG_ENTER("mysqlnd_conn_data::store_result"); - DBG_INF_FMT("conn=%llu", conn->thread_id); + DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn); if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { do { From a5d0c1e21b9fa166d8fe5ec7d52a24a5f7adc107 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 21 Aug 2012 23:21:59 +0200 Subject: [PATCH 486/641] Fix handling of several uinitialized intl objects --- ext/intl/collator/collator_class.h | 9 ++++---- ext/intl/collator/collator_create.c | 2 +- ext/intl/dateformat/dateformat.c | 2 +- ext/intl/dateformat/dateformat_attr.c | 5 ++-- ext/intl/dateformat/dateformat_class.c | 21 +++++++++++------ ext/intl/dateformat/dateformat_class.h | 10 +++++++- ext/intl/formatter/formatter_class.c | 23 ++++++++++++------- ext/intl/formatter/formatter_class.h | 15 +++++++++--- ext/intl/formatter/formatter_main.c | 2 +- ext/intl/msgformat/msgformat.c | 2 +- ext/intl/msgformat/msgformat_class.c | 22 ++++++++++++------ ext/intl/msgformat/msgformat_class.h | 10 +++++++- .../resourcebundle/resourcebundle_class.c | 9 +++++++- .../resourcebundle/resourcebundle_class.h | 11 ++++++++- ext/intl/tests/dateformat_clone_bad_obj.phpt | 20 ++++++++++++++++ ext/intl/tests/formatter_clone_bad_obj.phpt | 20 ++++++++++++++++ ext/intl/tests/msgfmt_clone_bad_obj.phpt | 20 ++++++++++++++++ 17 files changed, 163 insertions(+), 40 deletions(-) create mode 100644 ext/intl/tests/dateformat_clone_bad_obj.phpt create mode 100644 ext/intl/tests/formatter_clone_bad_obj.phpt create mode 100644 ext/intl/tests/msgfmt_clone_bad_obj.phpt diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h index 835abd66c8a..7a56dfce508 100644 --- a/ext/intl/collator/collator_class.h +++ b/ext/intl/collator/collator_class.h @@ -20,8 +20,9 @@ #include -#include "intl_common.h" -#include "intl_error.h" +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include @@ -54,9 +55,7 @@ extern zend_class_entry *Collator_ce_ptr; Collator_object* co = NULL; \ intl_error_reset( NULL TSRMLS_CC ); \ -#define COLLATOR_METHOD_FETCH_OBJECT \ - co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); \ - intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC ); \ +#define COLLATOR_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(Collator, co) // Macro to check return value of a ucol_* function call. #define COLLATOR_CHECK_STATUS( co, msg ) \ diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 0f0cc193e4c..b2a9968af49 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -45,7 +45,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC ); + COLLATOR_METHOD_FETCH_OBJECT; if(locale_len == 0) { locale = INTL_G(default_locale); diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index b399a39fcb5..8aded18bd64 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -108,7 +108,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) goto error; } - DATE_FORMAT_METHOD_FETCH_OBJECT; + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; if (DATE_FORMAT_OBJECT(dfo) != NULL) { intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 6131cedc956..b8c5f25e3aa 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -17,8 +17,9 @@ #include "config.h" #endif -#include "php_intl.h" -#include "intl_convert.h" +#include "../php_intl.h" +#include "dateformat_class.h" +#include "../intl_convert.h" #include "dateformat_class.h" #include "dateformat_attr.h" diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index eb3f5f4e770..85a67f7f9fc 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -23,6 +23,8 @@ #include "dateformat.h" #include "dateformat_attr.h" +#include + zend_class_entry *IntlDateFormatter_ce_ptr = NULL; static zend_object_handlers IntlDateFormatter_handlers; @@ -87,18 +89,23 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); IntlDateFormatter_object *dfo, *new_dfo; - DATE_FORMAT_METHOD_FETCH_OBJECT; + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; + new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC); new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC); /* clone formatter object */ - DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(new_dfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_dfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_dfo), "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC ); - IntlDateFormatter_object_dtor(new_dfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone IntlDateFormatter object"); + if (dfo->datef_data.udatf != NULL) { + DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(dfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) { + /* set up error in case error handler is interested */ + intl_errors_set(INTL_DATA_ERROR_P(dfo), INTL_DATA_ERROR_CODE(dfo), + "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC ); + zend_throw_exception(NULL, "Failed to clone IntlDateFormatter object", 0 TSRMLS_CC); + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed IntlDateFormatter", 0 TSRMLS_CC); } return new_obj_val; } diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h index 9ad83ee3d63..d58abe42f58 100644 --- a/ext/intl/dateformat/dateformat_class.h +++ b/ext/intl/dateformat/dateformat_class.h @@ -38,7 +38,15 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr; /* Auxiliary macros */ #define DATE_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(IntlDateFormatter, dfo) -#define DATE_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo) +#define DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo) +#define DATE_FORMAT_METHOD_FETCH_OBJECT \ + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (dfo->datef_data.udatf == NULL) \ + { \ + intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf #endif // #ifndef DATE_FORMAT_CLASS_H diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 0bb5894f096..5790f0c2e19 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -24,6 +24,8 @@ #include "formatter_main.h" #include "formatter_attr.h" +#include + zend_class_entry *NumberFormatter_ce_ptr = NULL; static zend_object_handlers NumberFormatter_handlers; @@ -82,18 +84,23 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); NumberFormatter_object *nfo, *new_nfo; - FORMATTER_METHOD_FETCH_OBJECT; + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC); new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC); - /* clone formatter object */ - FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), &INTL_DATA_ERROR_CODE(new_nfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_nfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_nfo), "Failed to clone NumberFormatter object", 0 TSRMLS_CC ); - NumberFormatter_object_dtor(new_nfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone NumberFormatter object"); + /* clone formatter object. It may fail, the destruction code must handle this case */ + if (FORMATTER_OBJECT(nfo) != NULL) { + FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), + &INTL_DATA_ERROR_CODE(nfo)); + if (U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) { + /* set up error in case error handler is interested */ + intl_errors_set(INTL_DATA_ERROR_P(nfo), INTL_DATA_ERROR_CODE(nfo), + "Failed to clone NumberFormatter object", 0 TSRMLS_CC); + zend_throw_exception(NULL, "Failed to clone NumberFormatter object", 0 TSRMLS_CC); + } + } else { + zend_throw_exception(NULL, "Cannot clone unconstructed NumberFormatter", 0 TSRMLS_CC); } return new_obj_val; } diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h index cf1cb060c6d..95828666643 100644 --- a/ext/intl/formatter/formatter_class.h +++ b/ext/intl/formatter/formatter_class.h @@ -34,8 +34,17 @@ extern zend_class_entry *NumberFormatter_ce_ptr; /* Auxiliary macros */ -#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo) -#define FORMATTER_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo) -#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum +#define FORMATTER_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(NumberFormatter, nfo) +#define FORMATTER_OBJECT(nfo) (nfo)->nf_data.unum +#define FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(NumberFormatter, nfo) +#define FORMATTER_METHOD_FETCH_OBJECT \ + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (FORMATTER_OBJECT(nfo) == NULL) \ + { \ + intl_errors_set(&nfo->nf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed NumberFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #endif // #ifndef FORMATTER_CLASS_H diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 8fa17560b89..5cb64833260 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -47,7 +47,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); object = return_value; - FORMATTER_METHOD_FETCH_OBJECT; + FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; /* Convert pattern (if specified) to UTF-16. */ if(pattern && pattern_len) { diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 0a01204fae9..e3fb9425a9c 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -49,7 +49,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - MSG_FORMAT_METHOD_FETCH_OBJECT; + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; /* Convert pattern (if specified) to UTF-16. */ if(pattern && pattern_len) { diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 7ed28df3dc5..9cccef27093 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -24,6 +24,8 @@ #include "msgformat.h" #include "msgformat_attr.h" +#include + zend_class_entry *MessageFormatter_ce_ptr = NULL; static zend_object_handlers MessageFormatter_handlers; @@ -80,18 +82,24 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) zend_object_handle handle = Z_OBJ_HANDLE_P(object); MessageFormatter_object *mfo, *new_mfo; - MSG_FORMAT_METHOD_FETCH_OBJECT; + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC); new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC); + /* clone formatter object */ - MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), &INTL_DATA_ERROR_CODE(new_mfo)); - if(U_FAILURE(INTL_DATA_ERROR_CODE(new_mfo))) { - /* set up error in case error handler is interested */ - intl_error_set( NULL, INTL_DATA_ERROR_CODE(new_mfo), "Failed to clone MessageFormatter object", 0 TSRMLS_CC ); - MessageFormatter_object_dtor(new_mfo, new_obj_val.handle TSRMLS_CC); /* free new object */ - zend_error(E_ERROR, "Failed to clone MessageFormatter object"); + if (MSG_FORMAT_OBJECT(mfo) != NULL) { + MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), + &INTL_DATA_ERROR_CODE(mfo)); + + if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) { + intl_errors_set(INTL_DATA_ERROR_P(mfo), INTL_DATA_ERROR_CODE(mfo), + "Failed to clone MessageFormatter object", 0 TSRMLS_CC); + zend_throw_exception_ex(NULL, 0, "Failed to clone MessageFormatter object"); + } + } else { + zend_throw_exception_ex(NULL, 0, "Cannot clone unconstructed MessageFormatter"); } return new_obj_val; } diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h index b6b8e33226e..337e04e647d 100644 --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -37,7 +37,15 @@ extern zend_class_entry *MessageFormatter_ce_ptr; /* Auxiliary macros */ #define MSG_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(MessageFormatter, mfo) -#define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) +#define MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) +#define MSG_FORMAT_METHOD_FETCH_OBJECT \ + MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ + if (MSG_FORMAT_OBJECT(mfo) == NULL) { \ + intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed MessageFormatter", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index d2a29d9b25c..9c0459e1a3e 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -252,7 +252,14 @@ PHP_FUNCTION( resourcebundle_get ) /* {{{ resourcebundle_array_count */ int resourcebundle_array_count(zval *object, long *count TSRMLS_DC) { - ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); + ResourceBundle_object *rb; + RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; + + if (rb->me == NULL) { + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); + return 0; + } *count = ures_getSize( rb->me ); diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h index 4755d723b8a..8da3ed9d474 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.h +++ b/ext/intl/resourcebundle/resourcebundle_class.h @@ -33,7 +33,16 @@ typedef struct { } ResourceBundle_object; #define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb) -#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \ + INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb); \ + if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \ + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + + #define RESOURCEBUNDLE_OBJECT(rb) (rb)->me void resourcebundle_register_class( TSRMLS_D ); diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt new file mode 100644 index 00000000000..5e12b96ae81 --- /dev/null +++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed IntlDateFormatter +--SKIPIF-- + +--FILE-- +getMessage()); +} + +--EXPECTF-- +string(%s) "Cannot clone unconstructed IntlDateFormatter" diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt new file mode 100644 index 00000000000..ef7b28a5465 --- /dev/null +++ b/ext/intl/tests/formatter_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed numfmt +--SKIPIF-- + +--FILE-- +getMessage()); +} + +--EXPECTF-- +string(42) "Cannot clone unconstructed NumberFormatter" diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt new file mode 100644 index 00000000000..48321094d1d --- /dev/null +++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt @@ -0,0 +1,20 @@ +--TEST-- +Cloning unconstructed MessageFormatter +--SKIPIF-- + +--FILE-- +getMessage()); +} + +--EXPECTF-- +string(%d) "Cannot clone unconstructed MessageFormatter" From cd1f45b3be2e630aab32f58770124d38661b518e Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Wed, 22 Aug 2012 22:38:31 +0200 Subject: [PATCH 487/641] Fix handling of several uinitialized intl objects PHP 5.4 specific changes. Not having this in the merge commit helps porting to pecl/intl --- ext/intl/spoofchecker/spoofchecker_class.h | 9 +++++++++ ext/intl/spoofchecker/spoofchecker_create.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h index 8db64680ef6..b9e334fadba 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.h +++ b/ext/intl/spoofchecker/spoofchecker_class.h @@ -55,6 +55,15 @@ extern zend_class_entry *Spoofchecker_ce_ptr; Spoofchecker_object* co = NULL; \ intl_error_reset(NULL TSRMLS_CC); \ +#define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(Spoofchecker, co) +#define SPOOFCHECKER_METHOD_FETCH_OBJECT \ + SPOOFCHECKERMETHOD_FETCH_OBJECT_NO_CHECK; \ + if (co->uspoof == NULL) { \ + intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed Spoofchecker", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + #define SPOOFCHECKER_METHOD_FETCH_OBJECT \ co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \ intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \ diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c index 3659551ede6..cf0173f9974 100644 --- a/ext/intl/spoofchecker/spoofchecker_create.c +++ b/ext/intl/spoofchecker/spoofchecker_create.c @@ -35,7 +35,7 @@ PHP_METHOD(Spoofchecker, __construct) return; } - SPOOFCHECKER_METHOD_FETCH_OBJECT; + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co)); INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker"); From b9eae3d67c10ccaf83e85e36777704f276f0ffae Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 21 Aug 2012 23:21:59 +0200 Subject: [PATCH 488/641] Fix handling of several uinitialized intl objects Master specific changes. Not having this in the merge commit helps porting to pecl/intl --- ext/intl/dateformat/dateformat_create.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 7fefbe7449c..a2899f79746 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -76,7 +76,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) } locale = Locale::createFromName(locale_str); - DATE_FORMAT_METHOD_FETCH_OBJECT; + DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; if (DATE_FORMAT_OBJECT(dfo) != NULL) { intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR, From ca4dd76160568ea30227469535431df12f4f5c27 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Wed, 22 Aug 2012 23:04:46 +0200 Subject: [PATCH 489/641] Update NEWS given a5d0c1e2 --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 3d156c17885..8492aa6c6b0 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,9 @@ PHP NEWS (reeze.xia@gmail.com) . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) +- Intl: + . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) + - MySQLnd: . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence) From b98fc4379f1279a06fa01a90e79f2145d9498be0 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 22 Aug 2012 19:39:57 -0300 Subject: [PATCH 490/641] - Fixed ZTS build --- ext/intl/msgformat/msgformat_class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index ead0e5f143d..da1e1e595a7 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -97,10 +97,10 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) { intl_errors_set(INTL_DATA_ERROR_P(mfo), INTL_DATA_ERROR_CODE(mfo), "Failed to clone MessageFormatter object", 0 TSRMLS_CC); - zend_throw_exception_ex(NULL, 0, "Failed to clone MessageFormatter object"); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to clone MessageFormatter object"); } } else { - zend_throw_exception_ex(NULL, 0, "Cannot clone unconstructed MessageFormatter"); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Cannot clone unconstructed MessageFormatter"); } return new_obj_val; } From 6a8db0c0815b0458a8db3b213487198cc5288875 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Wed, 22 Aug 2012 23:33:29 -0700 Subject: [PATCH 491/641] Updated INSTALL. Generated from the XML Docs. --- INSTALL | 202 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 128 insertions(+), 74 deletions(-) diff --git a/INSTALL b/INSTALL index b493f3c29be..c0cbe5f2c15 100644 --- a/INSTALL +++ b/INSTALL @@ -24,6 +24,7 @@ Installing PHP + Installing a PHP extension on Windows + Compiling shared PECL extensions with the pecl command + Compiling shared PECL extensions with phpize + + php-config + Compiling PECL extensions statically into PHP * Problems? + Read the FAQ @@ -83,7 +84,7 @@ General Installation Considerations With PHP you can also write desktop GUI applications using the PHP-GTK extension. This is a completely different approach than writing web pages, as you do not output any HTML, but manage windows and objects - within them. For more information about PHP-GTK, please » visit the + within them. For more information about PHP-GTK, please » visit the site dedicated to this extension. PHP-GTK is not included in the official PHP distribution. @@ -92,9 +93,9 @@ General Installation Considerations will also find information on the command line executable in the following sections. - PHP source code and binary distributions for Windows can be found at » - http://www.php.net/downloads.php. We recommend you to choose a » mirror - nearest to you for downloading the distributions. + PHP source code and binary distributions for Windows can be found at + » http://www.php.net/downloads.php. We recommend you to choose a + » mirror nearest to you for downloading the distributions. __________________________________________________________________ __________________________________________________________________ @@ -140,9 +141,9 @@ Table of Contents * A web server * Any module specific components (such as GD, PDF libs, etc.) - When building directly from SVN sources or after custom modifications + When building directly from Git sources or after custom modifications you might also need: - * autoconf: 2.13 + * autoconf: 2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0) * automake: 1.4+ * libtool: 1.4.x+ (except 1.4.2) * re2c: Version 0.13.4 or newer @@ -375,12 +376,12 @@ Apache 2.x on Unix systems For information on why, read the related FAQ entry on using Apache2 with a threaded MPM - The » Apache Documentation is the most authoritative source of + The » Apache Documentation is the most authoritative source of information on the Apache 2.x server. More information about installation options for Apache may be found there. - The most recent version of Apache HTTP Server may be obtained from » - Apache download site, and a fitting PHP version from the above + The most recent version of Apache HTTP Server may be obtained from + » Apache download site, and a fitting PHP version from the above mentioned places. This quick guide covers only the basics to get started with Apache 2.x and PHP. For more information read the » Apache Documentation. The version numbers have been omitted here, to ensure @@ -498,7 +499,7 @@ service httpd restart This should not be undertaken without being aware of the consequences of this decision, and having at least a fair understanding of the - implications. The Apache documentation regarding » MPM-Modules + implications. The Apache documentation regarding » MPM-Modules discusses MPMs in a great deal more detail. Note: @@ -520,7 +521,7 @@ Lighttpd 1.4 on Unix systems This section contains notes and hints specific to Lighttpd 1.4 installs of PHP on Unix systems. - Please use the » Lighttpd trac to learn how to install Lighttpd + Please use the » Lighttpd trac to learn how to install Lighttpd properly before continuing. Fastcgi is the preferred SAPI to connect PHP and Lighttpd. Fastcgi is @@ -627,15 +628,15 @@ Sun, iPlanet and Netscape servers on Sun Solaris current web servers read the note about subrequests. You can find more information about setting up PHP for the Netscape - Enterprise Server (NES) here: » - http://benoit.noss.free.fr/php/install-php4.html + Enterprise Server (NES) here: + » http://benoit.noss.free.fr/php/install-php4.html To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape web servers, enter the proper install directory for the --with-nsapi=[DIR] option. The default directory is usually /opt/netscape/suitespot/. Please also read /php-xxx-version/sapi/nsapi/nsapi-readme.txt. - 1. Install the following packages from » http://www.sunfreeware.com/ + 1. Install the following packages from » http://www.sunfreeware.com/ or another download site: + autoconf-2.13 + automake-1.4 @@ -837,7 +838,7 @@ Testing Using Variables Some server supplied environment variables are not defined in the - current » CGI/1.1 specification. Only the following variables are + current » CGI/1.1 specification. Only the following variables are defined there: AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, @@ -855,20 +856,20 @@ HP-UX specific installation notes There are two main options for installing PHP on HP-UX systems. Either compile it, or install a pre-compiled binary. - Official pre-compiled packages are located here: » - http://software.hp.com/ + Official pre-compiled packages are located here: + » http://software.hp.com/ Until this manual section is rewritten, the documentation about compiling PHP (and related extensions) on HP-UX systems has been - removed. For now, consider reading the following external resource: » - Building Apache and PHP on HP-UX 11.11 + removed. For now, consider reading the following external resource: + » Building Apache and PHP on HP-UX 11.11 __________________________________________________________________ __________________________________________________________________ OpenBSD installation notes - This section contains notes and hints specific to installing PHP on » - OpenBSD 3.6. + This section contains notes and hints specific to installing PHP on + » OpenBSD 3.6. Using Binary Packages @@ -900,12 +901,12 @@ Using Binary Packages (install the PEAR libraries) # pkg_add php4-pear-4.3.8.tgz - Read the » packages(7) manual page for more information about binary + Read the » packages(7) manual page for more information about binary packages on OpenBSD. Using Ports - You can also compile up PHP from source using the » ports tree. + You can also compile up PHP from source using the » ports tree. However, this is only recommended for users familiar with OpenBSD. The PHP 4 port is split into two sub-directories: core and extensions. The extensions directory generates sub-packages for all of the supported @@ -926,7 +927,7 @@ Common Problems automatically installs into the correct chroot directories, so no special modification is needed there. More information on the OpenBSD Apache is available in the » OpenBSD FAQ. - * The OpenBSD 3.6 package for the » gd extension requires XFree86 to + * The OpenBSD 3.6 package for the » gd extension requires XFree86 to be installed. If you do not wish to use some of the font features that require X11, install the php4-gd-4.3.8-no_x11.tgz package instead. @@ -951,18 +952,26 @@ Required software Solaris installs often lack C compilers and their related tools. Read this FAQ for information on why using GNU versions for some of these - tools is necessary. The required software is as follows: + tools is necessary. + + For unpacking the PHP distribution you need + * tar + * gzip or + * bzip2 + + For compiling PHP you need * gcc (recommended, other C compilers may work) * make - * flex + * GNU sed + + For building extra extensions or hacking the code of PHP you might also + need + * flex (up to PHP 5.2) + * re2c * bison * m4 * autoconf * automake - * perl - * gzip - * tar - * GNU sed In addition, you will need to install (and possibly compile) any additional software specific to your configuration, such as Oracle or @@ -971,14 +980,16 @@ Required software Using Packages You can simplify the Solaris install process by using pkgadd to install - most of your needed components. + most of your needed components. The Image Packaging System (IPS) for + Solaris 11 Express also contains most of the required components for + installation using the pkg command. __________________________________________________________________ __________________________________________________________________ Debian GNU/Linux installation notes - This section contains notes and hints specific to installing PHP on » - Debian GNU/Linux. + This section contains notes and hints specific to installing PHP on + » Debian GNU/Linux. Warning Unofficial builds from third-parties are not supported here. Any bugs @@ -1205,6 +1216,7 @@ Table of Contents * Installing a PHP extension on Windows * Compiling shared PECL extensions with the pecl command * Compiling shared PECL extensions with phpize + * php-config * Compiling PECL extensions statically into PHP __________________________________________________________________ @@ -1227,8 +1239,8 @@ Introduction to PECL Installations To this php.ini file, or through the use of the dl() function. When building PHP modules, it's important to have known-good versions - of the required tools (autoconf, automake, libtool, etc.) See the » - Anonymous SVN Instructions for details on the required tools, and + of the required tools (autoconf, automake, libtool, etc.) See the + » Anonymous Git Instructions for details on the required tools, and required versions. __________________________________________________________________ __________________________________________________________________ @@ -1247,7 +1259,7 @@ Downloading PECL extensions the PECL web site are available for download and installation using the » pecl command. Specific revisions may also be specified. * SVN Most PECL extensions also reside in SVN. A web-based view may - be seen at » http://svn.php.net/viewvc/pecl/. To download straight + be seen at » http://svn.php.net/viewvc/pecl/. To download straight from SVN, the following sequence of commands may be used: $ svn checkout http://svn.php.net/repository/pecl/extname/trunk extname @@ -1279,7 +1291,7 @@ Where to find an extension? PHP extensions are usually called "php_*.dll" (where the star represents the name of the extension) and they are located under the - "PHP\ext" ("PHP\extensions" in PHP4) folder. + "PHP\ext" ("PHP\extensions" in PHP 4) folder. PHP ships with the extensions most useful to the majority of developers. They are called "core" extensions. @@ -1365,7 +1377,7 @@ Resolving problems Compiling shared PECL extensions with the pecl command - PECL makes it easy to create shared PHP extensions. Using the » pecl + PECL makes it easy to create shared PHP extensions. Using the » pecl command, do the following: $ pecl install extname @@ -1424,6 +1436,51 @@ $ make __________________________________________________________________ __________________________________________________________________ +php-config + + php-config is a simple shell script for obtaining information about the + installed PHP configuration. + + When compiling extensions, if you have multiple PHP versions installed, + you may specify for which installation you'd like to build by using the + --with-php-config option during configuration, specifying the path of + the respective php-config script. + + The list of command line options provided by the php-config script can + be queried anytime by running php-config with the -h switch: +Usage: /usr/local/bin/php-config [OPTION] +Options: + --prefix [...] + --includes [...] + --ldflags [...] + --libs [...] + --extension-dir [...] + --include-dir [...] + --php-binary [...] + --php-sapis [...] + --configure-options [...] + --version [...] + --vernum [...] + + CAPTION: Command line options + + Option Description + --prefix Directory prefix where PHP is installed, e.g. /usr/local + --includes List of -I options with all include files + --ldflags LD Flags which PHP was compiled with + --libs Extra libraries which PHP was compiled with + --extension-dir Directory where extensions are searched by default + --include-dir Directory prefix where header files are installed by + default + --php-binary Full path to php CLI or CGI binary + --php-sapis Show all SAPI modules available + --configure-options Configure options to recreate configuration of + current PHP installation + --version PHP version + --vernum PHP version as integer + __________________________________________________________________ + __________________________________________________________________ + Compiling PECL extensions statically into PHP You might find that you need to build a PECL extension statically into @@ -1485,11 +1542,11 @@ Other problems If you are still stuck, someone on the PHP installation mailing list may be able to help you. You should check out the archive first, in case someone already answered someone else who had the same problem as - you. The archives are available from the support page on » - http://www.php.net/support.php. To subscribe to the PHP installation - mailing list, send an empty mail to » - php-install-subscribe@lists.php.net. The mailing list address is » - php-install@lists.php.net. + you. The archives are available from the support page on + » http://www.php.net/support.php. To subscribe to the PHP installation + mailing list, send an empty mail to + » php-install-subscribe@lists.php.net. The mailing list address is + » php-install@lists.php.net. If you want to get help on the mailing list, please try to be precise and give the necessary details about your environment (which operating @@ -1504,11 +1561,11 @@ Bug reports If you think you have found a bug in PHP, please report it. The PHP developers probably don't know about it, and unless you report it, chances are it won't be fixed. You can report bugs using the - bug-tracking system at » http://bugs.php.net/. Please do not send bug + bug-tracking system at » http://bugs.php.net/. Please do not send bug reports in mailing list or personal letters. The bug system is also suitable to submit feature requests. - Read the » How to report a bug document before submitting any bug + Read the » How to report a bug document before submitting any bug reports! __________________________________________________________________ __________________________________________________________________ @@ -1528,14 +1585,14 @@ The configuration file The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web - server is started. For the CGI and CLI version, it happens on every + server is started. For the CGI and CLI versions, it happens on every invocation. - php.ini is searched in these locations (in order): + php.ini is searched for in these locations (in order): * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD) - * The PHPRC environment variable. Before PHP 5.2.0 this was checked + * The PHPRC environment variable. Before PHP 5.2.0, this was checked after the registry key mentioned below. * As of PHP 5.2.0, the location of the php.ini file can be set for different versions of PHP. The following registry keys are examined @@ -1543,33 +1600,33 @@ The configuration file [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP major, minor and release versions. If there is a value for - IniFilePath in these keys, then the first one found will be used as - the location of the php.ini (Windows only). + IniFilePath in any of these keys, the first one found will be used + as the location of the php.ini (Windows only). * [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only). - * Current working directory (except CLI) + * Current working directory (except CLI). * The web server's directory (for SAPI modules), or directory of PHP - (otherwise in Windows) + (otherwise in Windows). * Windows directory (C:\windows or C:\winnt) (for Windows), or - --with-config-file-path compile time option + --with-config-file-path compile time option. - If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is - e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI - name can be determined by php_sapi_name(). + If php-SAPI.ini exists (where SAPI is the SAPI in use, so, for example, + php-cli.ini or php-apache.ini), it is used instead of php.ini. The SAPI + name can be determined with php_sapi_name(). Note: - The Apache web server changes the directory to root at startup + The Apache web server changes the directory to root at startup, causing PHP to attempt to read php.ini from the root filesystem if it exists. - The php.ini directives handled by extensions are documented - respectively on the pages of the extensions themselves. The list of the - core directives is available in the appendix. Probably not all PHP - directives are documented in the manual though. For a complete list of + The php.ini directives handled by extensions are documented on the + respective pages of the extensions themselves. A list of the core + directives is available in the appendix. Not all PHP directives are + necessarily documented in this manual: for a complete list of directives available in your PHP version, please read your well - commented php.ini file. Alternatively, you may find the » the latest - php.ini from SVN helpful too. + commented php.ini file. Alternatively, you may find » the latest + php.ini from Git helpful too. Example #1 php.ini example ; any text on a line after an unquoted semicolon (;) is ignored @@ -1635,12 +1692,13 @@ Where a configuration setting may be set CAPTION: Definition of PHP_INI_* modes - Mode Value Meaning - PHP_INI_USER 1 Entry can be set in user scripts (like with ini_set()) - or in the Windows registry - PHP_INI_PERDIR 6 Entry can be set in php.ini, .htaccess or httpd.conf - PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf - PHP_INI_ALL 7 Entry can be set anywhere + Mode Meaning + PHP_INI_USER Entry can be set in user scripts (like with ini_set()) or + in the Windows registry. Since PHP 5.3, entry can be set in .user.ini + PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or + .user.ini (since PHP 5.3) + PHP_INI_SYSTEM Entry can be set in php.ini or httpd.conf + PHP_INI_ALL Entry can be set anywhere __________________________________________________________________ __________________________________________________________________ @@ -1788,13 +1846,9 @@ Installation each request to play in, further weaknesses are introduced into PHP's system. - If you feel you have to use a threaded MPM, look at a FastCGI + If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space. - And finally, this warning against using a threaded MPM is not as - strong for Windows systems because most libraries on that - platform tend to be threadsafe. - Unix/Windows: Where should my php.ini file be located? By default on Unix it should be in /usr/local/lib which is /lib. Most people will want to change this at From 64bd4551b4cf7820c2327312d3b335f9a89e8764 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Wed, 22 Aug 2012 23:40:48 -0700 Subject: [PATCH 492/641] Updated INSTALL. Generated from the XML Docs. --- INSTALL | 202 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 128 insertions(+), 74 deletions(-) diff --git a/INSTALL b/INSTALL index b493f3c29be..c0cbe5f2c15 100644 --- a/INSTALL +++ b/INSTALL @@ -24,6 +24,7 @@ Installing PHP + Installing a PHP extension on Windows + Compiling shared PECL extensions with the pecl command + Compiling shared PECL extensions with phpize + + php-config + Compiling PECL extensions statically into PHP * Problems? + Read the FAQ @@ -83,7 +84,7 @@ General Installation Considerations With PHP you can also write desktop GUI applications using the PHP-GTK extension. This is a completely different approach than writing web pages, as you do not output any HTML, but manage windows and objects - within them. For more information about PHP-GTK, please » visit the + within them. For more information about PHP-GTK, please » visit the site dedicated to this extension. PHP-GTK is not included in the official PHP distribution. @@ -92,9 +93,9 @@ General Installation Considerations will also find information on the command line executable in the following sections. - PHP source code and binary distributions for Windows can be found at » - http://www.php.net/downloads.php. We recommend you to choose a » mirror - nearest to you for downloading the distributions. + PHP source code and binary distributions for Windows can be found at + » http://www.php.net/downloads.php. We recommend you to choose a + » mirror nearest to you for downloading the distributions. __________________________________________________________________ __________________________________________________________________ @@ -140,9 +141,9 @@ Table of Contents * A web server * Any module specific components (such as GD, PDF libs, etc.) - When building directly from SVN sources or after custom modifications + When building directly from Git sources or after custom modifications you might also need: - * autoconf: 2.13 + * autoconf: 2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0) * automake: 1.4+ * libtool: 1.4.x+ (except 1.4.2) * re2c: Version 0.13.4 or newer @@ -375,12 +376,12 @@ Apache 2.x on Unix systems For information on why, read the related FAQ entry on using Apache2 with a threaded MPM - The » Apache Documentation is the most authoritative source of + The » Apache Documentation is the most authoritative source of information on the Apache 2.x server. More information about installation options for Apache may be found there. - The most recent version of Apache HTTP Server may be obtained from » - Apache download site, and a fitting PHP version from the above + The most recent version of Apache HTTP Server may be obtained from + » Apache download site, and a fitting PHP version from the above mentioned places. This quick guide covers only the basics to get started with Apache 2.x and PHP. For more information read the » Apache Documentation. The version numbers have been omitted here, to ensure @@ -498,7 +499,7 @@ service httpd restart This should not be undertaken without being aware of the consequences of this decision, and having at least a fair understanding of the - implications. The Apache documentation regarding » MPM-Modules + implications. The Apache documentation regarding » MPM-Modules discusses MPMs in a great deal more detail. Note: @@ -520,7 +521,7 @@ Lighttpd 1.4 on Unix systems This section contains notes and hints specific to Lighttpd 1.4 installs of PHP on Unix systems. - Please use the » Lighttpd trac to learn how to install Lighttpd + Please use the » Lighttpd trac to learn how to install Lighttpd properly before continuing. Fastcgi is the preferred SAPI to connect PHP and Lighttpd. Fastcgi is @@ -627,15 +628,15 @@ Sun, iPlanet and Netscape servers on Sun Solaris current web servers read the note about subrequests. You can find more information about setting up PHP for the Netscape - Enterprise Server (NES) here: » - http://benoit.noss.free.fr/php/install-php4.html + Enterprise Server (NES) here: + » http://benoit.noss.free.fr/php/install-php4.html To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape web servers, enter the proper install directory for the --with-nsapi=[DIR] option. The default directory is usually /opt/netscape/suitespot/. Please also read /php-xxx-version/sapi/nsapi/nsapi-readme.txt. - 1. Install the following packages from » http://www.sunfreeware.com/ + 1. Install the following packages from » http://www.sunfreeware.com/ or another download site: + autoconf-2.13 + automake-1.4 @@ -837,7 +838,7 @@ Testing Using Variables Some server supplied environment variables are not defined in the - current » CGI/1.1 specification. Only the following variables are + current » CGI/1.1 specification. Only the following variables are defined there: AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, @@ -855,20 +856,20 @@ HP-UX specific installation notes There are two main options for installing PHP on HP-UX systems. Either compile it, or install a pre-compiled binary. - Official pre-compiled packages are located here: » - http://software.hp.com/ + Official pre-compiled packages are located here: + » http://software.hp.com/ Until this manual section is rewritten, the documentation about compiling PHP (and related extensions) on HP-UX systems has been - removed. For now, consider reading the following external resource: » - Building Apache and PHP on HP-UX 11.11 + removed. For now, consider reading the following external resource: + » Building Apache and PHP on HP-UX 11.11 __________________________________________________________________ __________________________________________________________________ OpenBSD installation notes - This section contains notes and hints specific to installing PHP on » - OpenBSD 3.6. + This section contains notes and hints specific to installing PHP on + » OpenBSD 3.6. Using Binary Packages @@ -900,12 +901,12 @@ Using Binary Packages (install the PEAR libraries) # pkg_add php4-pear-4.3.8.tgz - Read the » packages(7) manual page for more information about binary + Read the » packages(7) manual page for more information about binary packages on OpenBSD. Using Ports - You can also compile up PHP from source using the » ports tree. + You can also compile up PHP from source using the » ports tree. However, this is only recommended for users familiar with OpenBSD. The PHP 4 port is split into two sub-directories: core and extensions. The extensions directory generates sub-packages for all of the supported @@ -926,7 +927,7 @@ Common Problems automatically installs into the correct chroot directories, so no special modification is needed there. More information on the OpenBSD Apache is available in the » OpenBSD FAQ. - * The OpenBSD 3.6 package for the » gd extension requires XFree86 to + * The OpenBSD 3.6 package for the » gd extension requires XFree86 to be installed. If you do not wish to use some of the font features that require X11, install the php4-gd-4.3.8-no_x11.tgz package instead. @@ -951,18 +952,26 @@ Required software Solaris installs often lack C compilers and their related tools. Read this FAQ for information on why using GNU versions for some of these - tools is necessary. The required software is as follows: + tools is necessary. + + For unpacking the PHP distribution you need + * tar + * gzip or + * bzip2 + + For compiling PHP you need * gcc (recommended, other C compilers may work) * make - * flex + * GNU sed + + For building extra extensions or hacking the code of PHP you might also + need + * flex (up to PHP 5.2) + * re2c * bison * m4 * autoconf * automake - * perl - * gzip - * tar - * GNU sed In addition, you will need to install (and possibly compile) any additional software specific to your configuration, such as Oracle or @@ -971,14 +980,16 @@ Required software Using Packages You can simplify the Solaris install process by using pkgadd to install - most of your needed components. + most of your needed components. The Image Packaging System (IPS) for + Solaris 11 Express also contains most of the required components for + installation using the pkg command. __________________________________________________________________ __________________________________________________________________ Debian GNU/Linux installation notes - This section contains notes and hints specific to installing PHP on » - Debian GNU/Linux. + This section contains notes and hints specific to installing PHP on + » Debian GNU/Linux. Warning Unofficial builds from third-parties are not supported here. Any bugs @@ -1205,6 +1216,7 @@ Table of Contents * Installing a PHP extension on Windows * Compiling shared PECL extensions with the pecl command * Compiling shared PECL extensions with phpize + * php-config * Compiling PECL extensions statically into PHP __________________________________________________________________ @@ -1227,8 +1239,8 @@ Introduction to PECL Installations To this php.ini file, or through the use of the dl() function. When building PHP modules, it's important to have known-good versions - of the required tools (autoconf, automake, libtool, etc.) See the » - Anonymous SVN Instructions for details on the required tools, and + of the required tools (autoconf, automake, libtool, etc.) See the + » Anonymous Git Instructions for details on the required tools, and required versions. __________________________________________________________________ __________________________________________________________________ @@ -1247,7 +1259,7 @@ Downloading PECL extensions the PECL web site are available for download and installation using the » pecl command. Specific revisions may also be specified. * SVN Most PECL extensions also reside in SVN. A web-based view may - be seen at » http://svn.php.net/viewvc/pecl/. To download straight + be seen at » http://svn.php.net/viewvc/pecl/. To download straight from SVN, the following sequence of commands may be used: $ svn checkout http://svn.php.net/repository/pecl/extname/trunk extname @@ -1279,7 +1291,7 @@ Where to find an extension? PHP extensions are usually called "php_*.dll" (where the star represents the name of the extension) and they are located under the - "PHP\ext" ("PHP\extensions" in PHP4) folder. + "PHP\ext" ("PHP\extensions" in PHP 4) folder. PHP ships with the extensions most useful to the majority of developers. They are called "core" extensions. @@ -1365,7 +1377,7 @@ Resolving problems Compiling shared PECL extensions with the pecl command - PECL makes it easy to create shared PHP extensions. Using the » pecl + PECL makes it easy to create shared PHP extensions. Using the » pecl command, do the following: $ pecl install extname @@ -1424,6 +1436,51 @@ $ make __________________________________________________________________ __________________________________________________________________ +php-config + + php-config is a simple shell script for obtaining information about the + installed PHP configuration. + + When compiling extensions, if you have multiple PHP versions installed, + you may specify for which installation you'd like to build by using the + --with-php-config option during configuration, specifying the path of + the respective php-config script. + + The list of command line options provided by the php-config script can + be queried anytime by running php-config with the -h switch: +Usage: /usr/local/bin/php-config [OPTION] +Options: + --prefix [...] + --includes [...] + --ldflags [...] + --libs [...] + --extension-dir [...] + --include-dir [...] + --php-binary [...] + --php-sapis [...] + --configure-options [...] + --version [...] + --vernum [...] + + CAPTION: Command line options + + Option Description + --prefix Directory prefix where PHP is installed, e.g. /usr/local + --includes List of -I options with all include files + --ldflags LD Flags which PHP was compiled with + --libs Extra libraries which PHP was compiled with + --extension-dir Directory where extensions are searched by default + --include-dir Directory prefix where header files are installed by + default + --php-binary Full path to php CLI or CGI binary + --php-sapis Show all SAPI modules available + --configure-options Configure options to recreate configuration of + current PHP installation + --version PHP version + --vernum PHP version as integer + __________________________________________________________________ + __________________________________________________________________ + Compiling PECL extensions statically into PHP You might find that you need to build a PECL extension statically into @@ -1485,11 +1542,11 @@ Other problems If you are still stuck, someone on the PHP installation mailing list may be able to help you. You should check out the archive first, in case someone already answered someone else who had the same problem as - you. The archives are available from the support page on » - http://www.php.net/support.php. To subscribe to the PHP installation - mailing list, send an empty mail to » - php-install-subscribe@lists.php.net. The mailing list address is » - php-install@lists.php.net. + you. The archives are available from the support page on + » http://www.php.net/support.php. To subscribe to the PHP installation + mailing list, send an empty mail to + » php-install-subscribe@lists.php.net. The mailing list address is + » php-install@lists.php.net. If you want to get help on the mailing list, please try to be precise and give the necessary details about your environment (which operating @@ -1504,11 +1561,11 @@ Bug reports If you think you have found a bug in PHP, please report it. The PHP developers probably don't know about it, and unless you report it, chances are it won't be fixed. You can report bugs using the - bug-tracking system at » http://bugs.php.net/. Please do not send bug + bug-tracking system at » http://bugs.php.net/. Please do not send bug reports in mailing list or personal letters. The bug system is also suitable to submit feature requests. - Read the » How to report a bug document before submitting any bug + Read the » How to report a bug document before submitting any bug reports! __________________________________________________________________ __________________________________________________________________ @@ -1528,14 +1585,14 @@ The configuration file The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web - server is started. For the CGI and CLI version, it happens on every + server is started. For the CGI and CLI versions, it happens on every invocation. - php.ini is searched in these locations (in order): + php.ini is searched for in these locations (in order): * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD) - * The PHPRC environment variable. Before PHP 5.2.0 this was checked + * The PHPRC environment variable. Before PHP 5.2.0, this was checked after the registry key mentioned below. * As of PHP 5.2.0, the location of the php.ini file can be set for different versions of PHP. The following registry keys are examined @@ -1543,33 +1600,33 @@ The configuration file [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP major, minor and release versions. If there is a value for - IniFilePath in these keys, then the first one found will be used as - the location of the php.ini (Windows only). + IniFilePath in any of these keys, the first one found will be used + as the location of the php.ini (Windows only). * [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only). - * Current working directory (except CLI) + * Current working directory (except CLI). * The web server's directory (for SAPI modules), or directory of PHP - (otherwise in Windows) + (otherwise in Windows). * Windows directory (C:\windows or C:\winnt) (for Windows), or - --with-config-file-path compile time option + --with-config-file-path compile time option. - If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is - e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI - name can be determined by php_sapi_name(). + If php-SAPI.ini exists (where SAPI is the SAPI in use, so, for example, + php-cli.ini or php-apache.ini), it is used instead of php.ini. The SAPI + name can be determined with php_sapi_name(). Note: - The Apache web server changes the directory to root at startup + The Apache web server changes the directory to root at startup, causing PHP to attempt to read php.ini from the root filesystem if it exists. - The php.ini directives handled by extensions are documented - respectively on the pages of the extensions themselves. The list of the - core directives is available in the appendix. Probably not all PHP - directives are documented in the manual though. For a complete list of + The php.ini directives handled by extensions are documented on the + respective pages of the extensions themselves. A list of the core + directives is available in the appendix. Not all PHP directives are + necessarily documented in this manual: for a complete list of directives available in your PHP version, please read your well - commented php.ini file. Alternatively, you may find the » the latest - php.ini from SVN helpful too. + commented php.ini file. Alternatively, you may find » the latest + php.ini from Git helpful too. Example #1 php.ini example ; any text on a line after an unquoted semicolon (;) is ignored @@ -1635,12 +1692,13 @@ Where a configuration setting may be set CAPTION: Definition of PHP_INI_* modes - Mode Value Meaning - PHP_INI_USER 1 Entry can be set in user scripts (like with ini_set()) - or in the Windows registry - PHP_INI_PERDIR 6 Entry can be set in php.ini, .htaccess or httpd.conf - PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf - PHP_INI_ALL 7 Entry can be set anywhere + Mode Meaning + PHP_INI_USER Entry can be set in user scripts (like with ini_set()) or + in the Windows registry. Since PHP 5.3, entry can be set in .user.ini + PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or + .user.ini (since PHP 5.3) + PHP_INI_SYSTEM Entry can be set in php.ini or httpd.conf + PHP_INI_ALL Entry can be set anywhere __________________________________________________________________ __________________________________________________________________ @@ -1788,13 +1846,9 @@ Installation each request to play in, further weaknesses are introduced into PHP's system. - If you feel you have to use a threaded MPM, look at a FastCGI + If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space. - And finally, this warning against using a threaded MPM is not as - strong for Windows systems because most libraries on that - platform tend to be threadsafe. - Unix/Windows: Where should my php.ini file be located? By default on Unix it should be in /usr/local/lib which is /lib. Most people will want to change this at From 6d1bebfcb0ad746cd0410d403a3812853a2cd457 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 23 Aug 2012 15:41:49 +0800 Subject: [PATCH 493/641] Fixed bug #62358 (Segfault when using traits a lot) --- NEWS | 5 ++++- Zend/tests/bug62358.phpt | 32 ++++++++++++++++++++++++++++++++ Zend/zend_compile.c | 4 +++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug62358.phpt diff --git a/NEWS b/NEWS index de19a206374..44209888394 100644 --- a/NEWS +++ b/NEWS @@ -13,7 +13,7 @@ PHP NEWS . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) - . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) + . Fixed bug #62358 (Segfault when using traits a lot). (Laruence) . Fixed bug #62328 (implementing __toString and a cast to string fails) (Laruence) . Fixed bug #51363 (Fatal error raised by var_export() not caught by error @@ -28,6 +28,9 @@ PHP NEWS . Fixed bug #62852 (Unserialize invalid DateTime causes crash). (reeze.xia@gmail.com) +- Installation: + . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt new file mode 100644 index 00000000000..35d8b483d97 --- /dev/null +++ b/Zend/tests/bug62358.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #62358 (Segfault when using traits a lot) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of B::foo() should be compatible with A::foo() in %sbug62358.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 841e1b93165..21e5ca2f6be 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3786,7 +3786,6 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int } fn->common.scope = ce; - fn->common.prototype = prototype; if (prototype && (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT @@ -3801,11 +3800,14 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int if (prototype) { do_inheritance_check_on_method(fn, prototype TSRMLS_CC); } + /* one more thing: make sure we properly implement an abstract method */ if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) { do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC); } + fn->common.prototype = prototype; + /* delete inherited fn if the function to be added is not abstract */ if (existing_fn && existing_fn->common.scope != ce From d39aa984ad3ef79a8fc3db0cf8dc525a0738a7bc Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 23 Aug 2012 16:06:17 +0800 Subject: [PATCH 494/641] Refix #62358, previous has side-affect --- Zend/zend_compile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 21e5ca2f6be..4ef4b97d6d4 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3786,6 +3786,7 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int } fn->common.scope = ce; + fn->common.prototype = prototype; if (prototype && (prototype->common.fn_flags & ZEND_ACC_IMPLEMENTED_ABSTRACT @@ -3803,11 +3804,11 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int /* one more thing: make sure we properly implement an abstract method */ if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) { + prototype = fn->common.prototype; do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC); + fn->common.prototype = prototype; } - fn->common.prototype = prototype; - /* delete inherited fn if the function to be added is not abstract */ if (existing_fn && existing_fn->common.scope != ce From 87785c7d5aa197011f3aa747caa122a9190333c4 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 23 Aug 2012 16:13:34 +0800 Subject: [PATCH 495/641] tabs --- Zend/zend_compile.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 4ef4b97d6d4..09383c12d09 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3804,9 +3804,9 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int /* one more thing: make sure we properly implement an abstract method */ if (existing_fn && existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) { - prototype = fn->common.prototype; + prototype = fn->common.prototype; do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC); - fn->common.prototype = prototype; + fn->common.prototype = prototype; } /* delete inherited fn if the function to be added is not abstract */ @@ -3834,9 +3834,9 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int if (zend_hash_quick_update(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &fn_copy, sizeof(zend_function), (void**)&fn_copy_p)==FAILURE) { zend_error(E_COMPILE_ERROR, "Trait method %s has not been applied, because failure occurred during updating class method table", hash_key->arKey); } - + zend_add_magic_methods(ce, hash_key->arKey, hash_key->nKeyLength, fn_copy_p TSRMLS_CC); - + zend_function_dtor(fn); } else { zend_function_dtor(fn); @@ -4028,9 +4028,9 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* /** And, ensure that the referenced method is resolvable, too. */ lcname = zend_str_tolower_dup(cur_method_ref->method_name, - cur_method_ref->mname_len); + cur_method_ref->mname_len); method_exists = zend_hash_exists(&cur_method_ref->ce->function_table, - lcname, cur_method_ref->mname_len + 1); + lcname, cur_method_ref->mname_len + 1); efree(lcname); if (!method_exists) { @@ -5012,11 +5012,11 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name opline->op2_type = IS_CONST; if (doing_inheritance) { - /* Make sure a trait does not try to extend a class */ - if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { - zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); - } - + /* Make sure a trait does not try to extend a class */ + if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { + zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name); + } + opline->extended_value = parent_class_name->u.op.var; opline->opcode = ZEND_DECLARE_INHERITED_CLASS; } else { @@ -6961,9 +6961,9 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); if (((Z_STRLEN_P(name) == sizeof("self")-1) && - !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRLEN_P(name) == sizeof("parent")-1) && - !memcmp(lcname, "parent", sizeof("parent")-1))) { + !memcmp(lcname, "self", sizeof("self")-1)) || + ((Z_STRLEN_P(name) == sizeof("parent")-1) && + !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } From d212a5d391a8d4c0de32001175314dbf78b957d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 23 Aug 2012 10:32:05 +0100 Subject: [PATCH 496/641] Fix SPOOFCHECKER_METHOD_FETCH_OBJECT definition --- ext/intl/spoofchecker/spoofchecker_class.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h index b9e334fadba..ec043d9dc87 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.h +++ b/ext/intl/spoofchecker/spoofchecker_class.h @@ -22,6 +22,7 @@ #include "intl_common.h" #include "spoofchecker_create.h" #include "intl_error.h" +#include "intl_data.h" #include @@ -57,17 +58,13 @@ extern zend_class_entry *Spoofchecker_ce_ptr; #define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(Spoofchecker, co) #define SPOOFCHECKER_METHOD_FETCH_OBJECT \ - SPOOFCHECKERMETHOD_FETCH_OBJECT_NO_CHECK; \ + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; \ if (co->uspoof == NULL) { \ intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \ "Found unconstructed Spoofchecker", 0 TSRMLS_CC); \ RETURN_FALSE; \ } -#define SPOOFCHECKER_METHOD_FETCH_OBJECT \ - co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \ - intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \ - // Macro to check return value of a ucol_* function call. #define SPOOFCHECKER_CHECK_STATUS(co, msg) \ intl_error_set_code(NULL, SPOOFCHECKER_ERROR_CODE(co) TSRMLS_CC); \ From eca4fc69918c856966298435bd1133e55a3c8e58 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 23 Aug 2012 13:32:06 +0200 Subject: [PATCH 497/641] ZTS fix introduced by Felipe must also go into 5.3 --- ext/intl/msgformat/msgformat_class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 9cccef27093..36d06d2d365 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -96,10 +96,10 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) { intl_errors_set(INTL_DATA_ERROR_P(mfo), INTL_DATA_ERROR_CODE(mfo), "Failed to clone MessageFormatter object", 0 TSRMLS_CC); - zend_throw_exception_ex(NULL, 0, "Failed to clone MessageFormatter object"); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to clone MessageFormatter object"); } } else { - zend_throw_exception_ex(NULL, 0, "Cannot clone unconstructed MessageFormatter"); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Cannot clone unconstructed MessageFormatter"); } return new_obj_val; } From 9a72b52a1f36d8eacf122d2bc52be6b792fbb18a Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Thu, 23 Aug 2012 17:09:45 +0200 Subject: [PATCH 498/641] fixing test for upcoming mpir upgrade - mpir is going to be upgraded up to 2.5.1 on windows --- ext/gmp/tests/022-win32.phpt | 90 -------------------------- ext/gmp/tests/022.phpt | 3 - ext/gmp/tests/gmp_nextprime-win32.phpt | 45 ------------- ext/gmp/tests/gmp_nextprime.phpt | 3 - 4 files changed, 141 deletions(-) delete mode 100644 ext/gmp/tests/022-win32.phpt delete mode 100644 ext/gmp/tests/gmp_nextprime-win32.phpt diff --git a/ext/gmp/tests/022-win32.phpt b/ext/gmp/tests/022-win32.phpt deleted file mode 100644 index 7abb0e82bd3..00000000000 --- a/ext/gmp/tests/022-win32.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -gmp_gcdext() basic tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -string(1) "3" -string(2) "41" -string(4) "-112" -string(1) "1" -string(4) "-805" -string(3) "359" -string(1) "3" -string(2) "32" -string(5) "-2257" -string(4) "3003" -string(3) "-10" -string(2) "19" -string(1) "2" -string(2) "67" -string(2) "-3" -string(2) "15" -string(7) "-601519" -string(1) "6" -string(3) "345" -string(1) "1" -string(1) "0" -string(1) "1" -string(5) "84319" -string(9) "-84241831" -string(1) "1" -string(12) "167180205823" -string(15) "-17856272782919" -string(3) "195" -string(15) "-23387298979862" -string(11) "34225091793" - -Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) - -Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) - -Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d -NULL -Done - diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/022.phpt index f699e8283d9..469aa3013d5 100644 --- a/ext/gmp/tests/022.phpt +++ b/ext/gmp/tests/022.phpt @@ -2,9 +2,6 @@ gmp_gcdext() basic tests --SKIPIF-- --FILE-- ---FILE-- - ---EXPECTF-- -string(1) "2" -string(1) "2" -string(4) "-997" -string(4) "1009" -string(6) "100003" - -Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d -string(1) "0" -string(1) "0" - -Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d -string(1) "0" -Done - diff --git a/ext/gmp/tests/gmp_nextprime.phpt b/ext/gmp/tests/gmp_nextprime.phpt index 623ccbed070..5683c8c31fd 100644 --- a/ext/gmp/tests/gmp_nextprime.phpt +++ b/ext/gmp/tests/gmp_nextprime.phpt @@ -2,9 +2,6 @@ gmp_nextprime() --SKIPIF-- --FILE-- Date: Thu, 23 Aug 2012 23:21:25 +0800 Subject: [PATCH 499/641] Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) --- NEWS | 2 ++ ext/spl/spl_fixedarray.c | 12 ++++++++---- ext/spl/tests/bug62904.phpt | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 ext/spl/tests/bug62904.phpt diff --git a/NEWS b/NEWS index 44209888394..b51f28e821c 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,8 @@ PHP NEWS when close handler call exit). (Laruence) - SPL: + . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) + (Laruence) . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence) - Standard: diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 11242855451..244bd3e0df2 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -223,10 +223,14 @@ static zend_object_value spl_fixedarray_object_new_ex(zend_class_entry *class_ty if (orig && clone_orig) { spl_fixedarray_object *other = (spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC); intern->ce_get_iterator = other->ce_get_iterator; - - intern->array = emalloc(sizeof(spl_fixedarray)); - spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); - spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + if (!other->array) { + /* leave a empty object, will be dtor later by CLONE handler */ + zend_throw_exception(spl_ce_RuntimeException, "The instance wasn't initialized properly", 0 TSRMLS_CC); + } else { + intern->array = emalloc(sizeof(spl_fixedarray)); + spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); + spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + } } while (parent) { diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt new file mode 100644 index 00000000000..7e392da9abb --- /dev/null +++ b/ext/spl/tests/bug62904.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #62904 (Crash when cloning an object which inherits SplFixedArray) +--FILE-- +getMessage()); +} +--EXPECTF-- +string(40) "The instance wasn't initialized properly" From 13bcf685cb0a92e502ebe39f4b22c64304a9f333 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 23 Aug 2012 23:27:16 +0800 Subject: [PATCH 500/641] Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) --- NEWS | 2 ++ ext/spl/spl_fixedarray.c | 12 ++++++++---- ext/spl/tests/bug62904.phpt | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 ext/spl/tests/bug62904.phpt diff --git a/NEWS b/NEWS index 8492aa6c6b0..9af7977feed 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,8 @@ PHP NEWS . Fixed bug (segfault due to retval is not initialized). (Laruence) - SPL: + . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) + (Laruence) . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance gives Segmentation fault). (Laruence, Gustavo) diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index ee8f51eb33f..0aac6d3f30e 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -223,10 +223,14 @@ static zend_object_value spl_fixedarray_object_new_ex(zend_class_entry *class_ty if (orig && clone_orig) { spl_fixedarray_object *other = (spl_fixedarray_object*)zend_object_store_get_object(orig TSRMLS_CC); intern->ce_get_iterator = other->ce_get_iterator; - - intern->array = emalloc(sizeof(spl_fixedarray)); - spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); - spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + if (!other->array) { + /* leave a empty object, will be dtor later by CLONE handler */ + zend_throw_exception(spl_ce_RuntimeException, "The instance wasn't initialized properly", 0 TSRMLS_CC); + } else { + intern->array = emalloc(sizeof(spl_fixedarray)); + spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC); + spl_fixedarray_copy(intern->array, other->array TSRMLS_CC); + } } while (parent) { diff --git a/ext/spl/tests/bug62904.phpt b/ext/spl/tests/bug62904.phpt new file mode 100644 index 00000000000..7e392da9abb --- /dev/null +++ b/ext/spl/tests/bug62904.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #62904 (Crash when cloning an object which inherits SplFixedArray) +--FILE-- +getMessage()); +} +--EXPECTF-- +string(40) "The instance wasn't initialized properly" From 7bedd275ebc2c1982dae8abe52cf58d7f7bb9d17 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 24 Aug 2012 18:18:38 +0800 Subject: [PATCH 501/641] Fix test --- ext/phar/tests/phpinfo_003.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt index 031d3cf4970..04452b082e3 100644 --- a/ext/phar/tests/phpinfo_003.phpt +++ b/ext/phar/tests/phpinfo_003.phpt @@ -24,7 +24,7 @@ Phar Phar: PHP Archive support => enabled Phar EXT version => %s Phar API version => 1.1.1 -SVN revision => %cRevision: %s $ +SVN revision => %s Phar-based phar archives => enabled Tar-based phar archives => enabled ZIP-based phar archives => enabled From 55d680e9682e3218b333d929bf3b24ddfe83c436 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 24 Aug 2012 18:21:49 +0800 Subject: [PATCH 502/641] better fix --- ext/phar/tests/phpinfo_003.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt index 04452b082e3..045f1a090d3 100644 --- a/ext/phar/tests/phpinfo_003.phpt +++ b/ext/phar/tests/phpinfo_003.phpt @@ -24,7 +24,7 @@ Phar Phar: PHP Archive support => enabled Phar EXT version => %s Phar API version => 1.1.1 -SVN revision => %s +SVN revision => %cId: %s $ Phar-based phar archives => enabled Tar-based phar archives => enabled ZIP-based phar archives => enabled From 68c1e1cfe95b026086cacf40a005ea8f399e9595 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Aug 2012 13:51:39 +0200 Subject: [PATCH 503/641] Add dedicated opcode for returns from a generator Generators don't have a return value, so it doesn't make sense to have a shared implementation here. --- Zend/zend_opcode.c | 5 ++- Zend/zend_vm_def.h | 19 +++++------ Zend/zend_vm_execute.h | 77 ++++++++++++++++++------------------------ Zend/zend_vm_opcodes.h | 1 + 4 files changed, 44 insertions(+), 58 deletions(-) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 0f39b8a41d8..5c4b20fd348 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -586,9 +586,8 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) CG(zend_lineno) = opline->lineno; zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\""); } - if (opline->opcode == ZEND_RETURN_BY_REF) { - opline->opcode = ZEND_RETURN; - } + + opline->opcode = ZEND_GENERATOR_RETURN; } break; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 975a2a70717..216cd59bdbc 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2931,17 +2931,6 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) zval *retval_ptr; zend_free_op free_op1; - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - SAVE_OPLINE(); retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -3066,6 +3055,14 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } +ZEND_VM_HANDLER(162, ZEND_GENERATOR_RETURN, ANY, ANY) +{ + if (EX(op_array)->has_finally_block) { + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); + } + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); +} + ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) { USE_OPLINE diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 402442f23a6..ebc0fb9c49c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -885,6 +885,14 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } +static int ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + if (EX(op_array)->has_finally_block) { + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + } + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); +} + static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -2443,17 +2451,6 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zval *retval_ptr; - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - SAVE_OPLINE(); retval_ptr = opline->op1.zv; @@ -7760,17 +7757,6 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - SAVE_OPLINE(); retval_ptr = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -12982,17 +12968,6 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; zend_free_op free_op1; - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - SAVE_OPLINE(); retval_ptr = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC); @@ -30530,17 +30505,6 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *retval_ptr; - if (EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) { - /* The generator object is stored in return_value_ptr_ptr */ - zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); - - /* Close the generator to free up resources */ - zend_generator_close(generator, 1 TSRMLS_CC); - - /* Pass execution back to handling code */ - ZEND_VM_RETURN(); - } - SAVE_OPLINE(); retval_ptr = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC); @@ -44986,6 +44950,31 @@ void zend_init_opcodes_handlers(void) ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, + ZEND_GENERATOR_RETURN_SPEC_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 0a9cf008e3e..0b4903ac365 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -162,3 +162,4 @@ #define ZEND_LEAVE 159 #define ZEND_YIELD 160 #define ZEND_DELEGATE_YIELD 161 +#define ZEND_GENERATOR_RETURN 162 From 7cdf6367a51a54fce8676aeb6fd32bf91b00f84b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Aug 2012 13:52:16 +0200 Subject: [PATCH 504/641] Finally with return now works in generators too --- .../tests/generators/finally_with_return.phpt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Zend/tests/generators/finally_with_return.phpt diff --git a/Zend/tests/generators/finally_with_return.phpt b/Zend/tests/generators/finally_with_return.phpt new file mode 100644 index 00000000000..b26a49f32fa --- /dev/null +++ b/Zend/tests/generators/finally_with_return.phpt @@ -0,0 +1,33 @@ +--TEST-- +Use of finally in generator with return +--FILE-- +rewind(); // force run + +?> +--EXPECTF-- +before return +before return in inner finally +outer finally run From 4c83ecc75452a23799c39f9bbb95b617fa46bf84 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Fri, 24 Aug 2012 10:16:40 -0400 Subject: [PATCH 505/641] Fixed bug #62912 (CURLINFO_PRIMARY_IP is not exposed) CURLINFO_PRIMARY_* and CURLINFO_LOCAL_* where available in curl_getinfo but the constant itself was not exposed to php userland --- NEWS | 2 ++ ext/curl/interface.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b51f28e821c..5e482d2b2b9 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ PHP NEWS constructor). (Stas) - CURL: + . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed). + (Pierrick) . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) - DateTime: diff --git a/ext/curl/interface.c b/ext/curl/interface.c index b57ce1bd079..d75e5c058b1 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -713,6 +713,14 @@ PHP_MINIT_FUNCTION(curl) #if LIBCURL_VERSION_NUM >= 0x071202 REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL); #endif +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP); +#endif +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ + REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT); + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP); + REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT); +#endif /* cURL protocol constants (curl_version) */ @@ -2447,6 +2455,8 @@ PHP_FUNCTION(curl_getinfo) create_certinfo(ci, listcode TSRMLS_CC); CAAZ("certinfo", listcode); } +#endif +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_IP, &s_code) == CURLE_OK) { CAAS("primary_ip", s_code); } @@ -2473,10 +2483,10 @@ PHP_FUNCTION(curl_getinfo) } else { switch (option) { /* string variable types */ -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */ case CURLINFO_PRIMARY_IP: #endif -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ case CURLINFO_LOCAL_IP: #endif case CURLINFO_PRIVATE: @@ -2496,7 +2506,7 @@ PHP_FUNCTION(curl_getinfo) break; } /* Long variable types */ -#if LIBCURL_VERSION_NUM >= 0x071500 +#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */ case CURLINFO_PRIMARY_PORT: case CURLINFO_LOCAL_PORT: #endif From 4d8edda341efef1901365f10213c027e745ac7ab Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Aug 2012 15:50:53 +0200 Subject: [PATCH 506/641] Run finally if generator is closed before finishing --- .../generators/finally_ran_on_close.phpt | 25 +++++++++++++ Zend/zend_generators.c | 35 ++++++++++++++++++- Zend/zend_generators.h | 1 + 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/generators/finally_ran_on_close.phpt diff --git a/Zend/tests/generators/finally_ran_on_close.phpt b/Zend/tests/generators/finally_ran_on_close.phpt new file mode 100644 index 00000000000..44a84fae5c7 --- /dev/null +++ b/Zend/tests/generators/finally_ran_on_close.phpt @@ -0,0 +1,25 @@ +--TEST-- +finally is run even if a generator is closed mid-execution +--FILE-- +rewind(); +unset($gen); + +?> +--EXPECT-- +before yield +finally run diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index b4d8932b6bb..3170ec9c33d 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -32,6 +32,39 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio if (generator->execute_data) { zend_execute_data *execute_data = generator->execute_data; + if (!finished_execution) { + zend_op_array *op_array = execute_data->op_array; + if (op_array->has_finally_block) { + zend_uint op_num = execute_data->opline - op_array->opcodes; + zend_uint finally_op_num = 0; + + /* Find next finally block */ + int i; + for (i = 0; i < op_array->last_try_catch; i++) { + zend_try_catch_element *try_catch = &op_array->try_catch_array[i]; + + if (op_num < try_catch->try_op) { + break; + } + + if (op_num < try_catch->finally_op) { + finally_op_num = try_catch->finally_op; + } + } + + /* If a finally block was found we jump directly to it and + * resume the generator. Furthermore we abort this close call + * because the generator will already be closed somewhere in + * the resume. */ + if (finally_op_num) { + execute_data->opline = &op_array->opcodes[finally_op_num]; + execute_data->leaving = ZEND_RETURN; + zend_generator_resume(generator TSRMLS_CC); + return; + } + } + } + if (!execute_data->symbol_table) { zend_free_compiled_variables(execute_data->CVs, execute_data->op_array->last_var); } else { @@ -371,7 +404,7 @@ static zend_function *zend_generator_get_constructor(zval *object TSRMLS_DC) /* } /* }}} */ -static void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ +void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ { /* The generator is already closed, thus can't resume */ if (!generator->execute_data) { diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index f5f4926e353..37ffbbd6ccb 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -53,6 +53,7 @@ extern ZEND_API zend_class_entry *zend_ce_generator; void zend_register_generator_ce(TSRMLS_D); zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC); void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC); +void zend_generator_resume(zend_generator *generator TSRMLS_DC); END_EXTERN_C() From e5ff3f18f5706a0bdf26bf0a68cfa22607d006ff Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Fri, 24 Aug 2012 18:04:16 -0400 Subject: [PATCH 507/641] Update bad versions for cURL constants This was updated according to the cURL symbol tables located here : http://curl.haxx.se/libcurl/c/symbols-in-versions.html --- ext/curl/interface.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 8050351d948..c31bce468e8 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -925,7 +925,11 @@ PHP_MINIT_FUNCTION(curl) #endif #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */ + REGISTER_CURL_CONSTANT(CURLE_SSH); REGISTER_CURL_CONSTANT(CURLOPT_FTP_SSL_CCC); + REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES); + REGISTER_CURL_CONSTANT(CURLOPT_SSH_PRIVATE_KEYFILE); + REGISTER_CURL_CONSTANT(CURLOPT_SSH_PUBLIC_KEYFILE); REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_ACTIVE); REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_NONE); REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_PASSIVE); @@ -940,13 +944,13 @@ PHP_MINIT_FUNCTION(curl) #if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */ REGISTER_CURL_CONSTANT(CURLOPT_KRBLEVEL); + REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS); + REGISTER_CURL_CONSTANT(CURLOPT_NEW_FILE_PERMS); #endif #if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */ REGISTER_CURL_CONSTANT(CURLOPT_APPEND); REGISTER_CURL_CONSTANT(CURLOPT_DIRLISTONLY); - REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS); - REGISTER_CURL_CONSTANT(CURLOPT_NEW_FILE_PERMS); REGISTER_CURL_CONSTANT(CURLOPT_USE_SSL); /* Curl SSL Constants */ REGISTER_CURL_CONSTANT(CURLUSESSL_ALL); @@ -955,6 +959,10 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLUSESSL_TRY); #endif +#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */ + REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5); +#endif + #if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */ REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TRANSFER_MODE); #endif @@ -964,7 +972,6 @@ PHP_MINIT_FUNCTION(curl) #endif #if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */ - REGISTER_CURL_CONSTANT(CURLE_SSH); REGISTER_CURL_CONSTANT(CURLINFO_APPCONNECT_TIME); REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP); @@ -972,10 +979,6 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLOPT_CRLFILE); REGISTER_CURL_CONSTANT(CURLOPT_ISSUERCERT); REGISTER_CURL_CONSTANT(CURLOPT_KEYPASSWD); - REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES); - REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5); - REGISTER_CURL_CONSTANT(CURLOPT_SSH_PRIVATE_KEYFILE); - REGISTER_CURL_CONSTANT(CURLOPT_SSH_PUBLIC_KEYFILE); REGISTER_CURL_CONSTANT(CURLSSH_AUTH_ANY); REGISTER_CURL_CONSTANT(CURLSSH_AUTH_DEFAULT); @@ -2085,6 +2088,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu #endif #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */ case CURLOPT_FTP_SSL_CCC: + case CURLOPT_SSH_AUTH_TYPES: #endif #if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */ case CURLOPT_CONNECTTIMEOUT_MS: @@ -2092,6 +2096,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu case CURLOPT_HTTP_TRANSFER_DECODING: case CURLOPT_TIMEOUT_MS: #endif +#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */ + case CURLOPT_NEW_DIRECTORY_PERMS: + case CURLOPT_NEW_FILE_PERMS: +#endif #if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */ case CURLOPT_USE_SSL: #elif LIBCURL_VERSION_NUM >= 0x070b00 /* Available since 7.11.0 */ @@ -2100,8 +2108,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu #if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */ case CURLOPT_APPEND: case CURLOPT_DIRLISTONLY: - case CURLOPT_NEW_DIRECTORY_PERMS: - case CURLOPT_NEW_FILE_PERMS: #else case CURLOPT_FTPAPPEND: case CURLOPT_FTPLISTONLY: @@ -2111,7 +2117,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu #endif #if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */ case CURLOPT_ADDRESS_SCOPE: - case CURLOPT_SSH_AUTH_TYPES: #endif #if LIBCURL_VERSION_NUM > 0x071301 /* Available since 7.19.1 */ case CURLOPT_CERTINFO: @@ -2187,7 +2192,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu #else case CURLOPT_KRB4LEVEL: #endif -#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */ +#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */ case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5: #endif #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ @@ -2631,11 +2636,13 @@ string_copy: #if LIBCURL_VERSION_NUM >= 0x070b00 /* Available since 7.11.0 */ case CURLOPT_NETRC_FILE: #endif +#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */ + case CURLOPT_SSH_PRIVATE_KEYFILE: + case CURLOPT_SSH_PUBLIC_KEYFILE: +#endif #if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */ case CURLOPT_CRLFILE: case CURLOPT_ISSUERCERT: - case CURLOPT_SSH_PRIVATE_KEYFILE: - case CURLOPT_SSH_PUBLIC_KEYFILE: #endif #if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */ case CURLOPT_SSH_KNOWNHOSTS: From 9ab45d3edbafa3ee751472c3f8d1fb3f51f38cf1 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Sat, 25 Aug 2012 01:21:17 -0400 Subject: [PATCH 508/641] Add missing constants in cURL --- ext/curl/interface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index c31bce468e8..899ea603c13 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -638,7 +638,6 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLOPT_QUOTE); REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE); REGISTER_CURL_CONSTANT(CURLOPT_RANGE); - REGISTER_CURL_CONSTANT(CURLOPT_READDATA); REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_REFERER); REGISTER_CURL_CONSTANT(CURLOPT_RESUME_FROM); @@ -681,6 +680,7 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLE_ABORTED_BY_CALLBACK); REGISTER_CURL_CONSTANT(CURLE_BAD_CALLING_ORDER); REGISTER_CURL_CONSTANT(CURLE_BAD_CONTENT_ENCODING); + REGISTER_CURL_CONSTANT(CURLE_BAD_DOWNLOAD_RESUME); REGISTER_CURL_CONSTANT(CURLE_BAD_FUNCTION_ARGUMENT); REGISTER_CURL_CONSTANT(CURLE_BAD_PASSWORD_ENTERED); REGISTER_CURL_CONSTANT(CURLE_COULDNT_CONNECT); @@ -713,12 +713,14 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLE_HTTP_PORT_FAILED); REGISTER_CURL_CONSTANT(CURLE_HTTP_POST_ERROR); REGISTER_CURL_CONSTANT(CURLE_HTTP_RANGE_ERROR); + REGISTER_CURL_CONSTANT(CURLE_HTTP_RETURNED_ERROR); REGISTER_CURL_CONSTANT(CURLE_LDAP_CANNOT_BIND); REGISTER_CURL_CONSTANT(CURLE_LDAP_SEARCH_FAILED); REGISTER_CURL_CONSTANT(CURLE_LIBRARY_NOT_FOUND); REGISTER_CURL_CONSTANT(CURLE_MALFORMAT_USER); REGISTER_CURL_CONSTANT(CURLE_OBSOLETE); REGISTER_CURL_CONSTANT(CURLE_OK); + REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEDOUT); REGISTER_CURL_CONSTANT(CURLE_OPERATION_TIMEOUTED); REGISTER_CURL_CONSTANT(CURLE_OUT_OF_MEMORY); REGISTER_CURL_CONSTANT(CURLE_PARTIAL_FILE); @@ -751,6 +753,7 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLINFO_HEADER_OUT); REGISTER_CURL_CONSTANT(CURLINFO_HEADER_SIZE); REGISTER_CURL_CONSTANT(CURLINFO_HTTP_CODE); + REGISTER_CURL_CONSTANT(CURLINFO_LASTONE); REGISTER_CURL_CONSTANT(CURLINFO_NAMELOOKUP_TIME); REGISTER_CURL_CONSTANT(CURLINFO_PRETRANSFER_TIME); REGISTER_CURL_CONSTANT(CURLINFO_PRIVATE); From 326aa087532d7eaecc8fefff58bb2a0b008b5ac8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 25 Aug 2012 21:14:51 +0800 Subject: [PATCH 509/641] Prefer no finally block for most situations --- Zend/zend_vm_def.h | 48 ++++++++++++------------ Zend/zend_vm_execute.h | 84 +++++++++++++++++++++--------------------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ce1674e4f38..92c5fcf40fe 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2173,6 +2173,7 @@ ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type) if (catch_op_num && finally_op_num) { /* EG(exception) || EG(prev_exception) */ if (catch_op_num > finally_op_num) { + zend_exception_save(TSRMLS_C); EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); } else { @@ -2183,6 +2184,7 @@ ZEND_VM_HELPER_EX(zend_finally_handler_leaving, ANY, ANY, int type) EX(leaving) = 0; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); } else if (finally_op_num) { + zend_exception_save(TSRMLS_C); if (type != ZEND_LEAVE) { EX(leaving) = type; } @@ -2233,12 +2235,12 @@ ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY) #if DEBUG_ZEND>=2 printf("Jumping to %d\n", opline->op1.opline_num); #endif - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_JMP); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } - ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); - ZEND_VM_CONTINUE(); /* CHECK_ME */ + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_JMP); } ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY) @@ -2975,10 +2977,10 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) } FREE_OP1_IF_VAR(); - if (EX(op_array)->has_finally_block) { - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); } ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) @@ -3051,10 +3053,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) FREE_OP1_IF_VAR(); - if (EX(op_array)->has_finally_block) { - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } - ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN_BY_REF); } ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) @@ -3398,11 +3400,11 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = el->brk; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } - ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); + EX(leaving_dest) = el->brk; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_BRK); } ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) @@ -3414,11 +3416,11 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); FREE_OP2(); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->cont; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } - ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); + EX(leaving_dest) = el->cont; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_CONT); } ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) @@ -3445,11 +3447,11 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) } break; } - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; - ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(opline->op1.jmp_addr); } - ZEND_VM_JMP(opline->op1.jmp_addr); + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_GOTO); } ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index bd191245741..1e0b2b50a98 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -760,6 +760,7 @@ static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE if (catch_op_num && finally_op_num) { /* EG(exception) || EG(prev_exception) */ if (catch_op_num > finally_op_num) { + zend_exception_save(TSRMLS_C); EX(leaving) = ZEND_THROW; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]); } else { @@ -770,6 +771,7 @@ static int ZEND_FASTCALL zend_finally_handler_leaving_SPEC(int type, ZEND_OPCODE EX(leaving) = 0; ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]); } else if (finally_op_num) { + zend_exception_save(TSRMLS_C); if (type != ZEND_LEAVE) { EX(leaving) = type; } @@ -820,12 +822,12 @@ static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) #if DEBUG_ZEND>=2 printf("Jumping to %d\n", opline->op1.opline_num); #endif - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; - return zend_finally_handler_leaving_SPEC(ZEND_JMP, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); + ZEND_VM_CONTINUE(); /* CHECK_ME */ } - ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); - ZEND_VM_CONTINUE(); /* CHECK_ME */ + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + return zend_finally_handler_leaving_SPEC(ZEND_JMP, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1530,11 +1532,11 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = el->brk; - return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } - ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); + EX(leaving_dest) = el->brk; + return zend_finally_handler_leaving_SPEC(ZEND_BRK, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1546,11 +1548,11 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), EX_Ts() TSRMLS_CC); - if (EG(active_op_array)->has_finally_block) { - EX(leaving_dest) = el->cont; - return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } - ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); + EX(leaving_dest) = el->cont; + return zend_finally_handler_leaving_SPEC(ZEND_CONT, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -1577,11 +1579,11 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - if (EX(op_array)->has_finally_block) { - EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; - return zend_finally_handler_leaving_SPEC(ZEND_GOTO, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + ZEND_VM_JMP(opline->op1.jmp_addr); } - ZEND_VM_JMP(opline->op1.jmp_addr); + EX(leaving_dest) = opline->op1.jmp_addr - EX(op_array)->opcodes; + return zend_finally_handler_leaving_SPEC(ZEND_GOTO, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2432,10 +2434,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG *EG(return_value_ptr_ptr) = ret; } - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -2506,10 +2508,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } } while (0); - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -6982,10 +6984,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -7056,10 +7058,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } } while (0); - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11438,10 +11440,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -11514,10 +11516,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27457,10 +27459,10 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EG(return_value_ptr_ptr) = ret; } - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) @@ -27531,10 +27533,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } } while (0); - if (EX(op_array)->has_finally_block) { - return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + if (EXPECTED(!EX(op_array)->has_finally_block)) { + return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } - return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); + return zend_finally_handler_leaving_SPEC(ZEND_RETURN_BY_REF, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) From d92a89fe52e89eef9527d1e27b5bb051ae24bc54 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 25 Aug 2012 21:47:53 +0800 Subject: [PATCH 510/641] Fixed bug (segfault while build with zts and GOTO vm-kind) --- NEWS | 1 + Zend/zend_vm_execute.skl | 2 +- Zend/zend_vm_gen.php | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9af7977feed..69cbb2a0fa5 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2012, PHP 5.3.16 - Core: + . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) . Fixed bug #62763 (register_shutdown_function and extending class). (Laruence) . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 18d0e293564..e5a143eaa79 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -4,8 +4,8 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC) { zend_execute_data *execute_data; zend_bool nested = 0; - zend_bool original_in_execution = EG(in_execution); {%HELPER_VARS%} + {%EXECUTION_STATUS%} {%INTERNAL_LABELS%} diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 86d65035922..2fff1a9c52c 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -850,6 +850,13 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, skip_blanks($f, $m[1], $m[3]."\n"); } break; + case "EXECUTION_STATUS": + if ($kind != ZEND_VM_KIND_GOTO) { + out($f, $m[1] . "zend_bool original_in_execution = EG(in_execution);\n"); + } else { + out($f, $m[1] . "zend_bool original_in_execution = op_array? EG(in_execution) : 0;\n"); + } + break; case "INTERNAL_LABELS": if ($kind == ZEND_VM_KIND_GOTO) { // Emit array of labels of opcode handlers and code for From 35951d4be0bd27c85519995a95429bd0d0a76a00 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 25 Aug 2012 22:23:14 +0800 Subject: [PATCH 511/641] Support list in foreach RFC: https://wiki.php.net/rfc/foreachlist --- NEWS | 1 + UPGRADING | 2 ++ Zend/tests/foreach_list.phpt | 43 +++++++++++++++++++++++++++++++++ Zend/zend_compile.c | 17 ++++++++----- Zend/zend_compile.h | 1 + Zend/zend_language_parser.y | 4 +-- tests/lang/foreachLoop.007.phpt | 2 +- 7 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 Zend/tests/foreach_list.phpt diff --git a/NEWS b/NEWS index 00f8ec6be9e..28b89baaac3 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 201?, PHP 5.5.0 - General improvements: + . Support list in foreach (https://wiki.php.net/rfc/foreachlist). (Laruence) . Implemented 'finally' keyword (https://wiki.php.net/rfc/finally). (Laruence) . Drop Windows XP and 2003 support. (Pierre) . Improve set_exception_handler while doing reset.(Laruence) diff --git a/UPGRADING b/UPGRADING index aeab14b48fc..ba556357ed4 100755 --- a/UPGRADING +++ b/UPGRADING @@ -31,6 +31,8 @@ PHP X.Y UPGRADE NOTES 2. New Features ======================================== +- Support list in foreach. (Laruence) + (wiki.php.net/rfc/foreachlist) - Support finally keyword. (Laruence) (wiki.php.net/rfc/finally) - Support constant array/string dereferencing. (Laruence) diff --git a/Zend/tests/foreach_list.phpt b/Zend/tests/foreach_list.phpt new file mode 100644 index 00000000000..a318f1aad95 --- /dev/null +++ b/Zend/tests/foreach_list.phpt @@ -0,0 +1,43 @@ +--TEST-- +foreach with list syntax +--FILE-- + list(list($a, $b), list($c, $d))) { + var_dump($key . $a . $b . $c . $d); +} + + +?> +--EXPECT-- +string(2) "12" +string(2) "34" +string(2) "ab" +string(2) "cd" +string(4) "1234" +string(4) "5678" +string(5) "01234" +string(5) "15678" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 2665870ab4f..b87b1908b6b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6320,13 +6320,18 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token GET_NODE(&value_node, opline->result); - if (assign_by_ref) { - zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC); - /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */ - zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC); - } else { - zend_do_assign(&dummy, value, &value_node TSRMLS_CC); + if (value->EA & ZEND_PARSED_LIST_EXPR) { + zend_do_list_end(&dummy, &value_node TSRMLS_CC); zend_do_free(&dummy TSRMLS_CC); + } else { + if (assign_by_ref) { + zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC); + /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */ + zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC); + } else { + zend_do_assign(&dummy, value, &value_node TSRMLS_CC); + zend_do_free(&dummy TSRMLS_CC); + } } if (key->op_type != IS_UNUSED) { diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 971860602ee..15c2ab7bc79 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -725,6 +725,7 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_PARSED_VARIABLE (1<<4) #define ZEND_PARSED_REFERENCE_VARIABLE (1<<5) #define ZEND_PARSED_NEW (1<<6) +#define ZEND_PARSED_LIST_EXPR (1<<7) /* unset types */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index cef82e33532..32f35fa2525 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -310,7 +310,7 @@ unticked_statement: foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); } | T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); } - variable foreach_optional_arg ')' { zend_check_writable_variable(&$6); zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); } + foreach_variable foreach_optional_arg ')' { zend_check_writable_variable(&$6); zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); } | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ @@ -429,10 +429,10 @@ foreach_optional_arg: | T_DOUBLE_ARROW foreach_variable { $$ = $2; } ; - foreach_variable: variable { zend_check_writable_variable(&$1); $$ = $1; } | '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.EA |= ZEND_PARSED_REFERENCE_VARIABLE; } + | T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' { $$ = $1; $$.EA = ZEND_PARSED_LIST_EXPR; } ; for_statement: diff --git a/tests/lang/foreachLoop.007.phpt b/tests/lang/foreachLoop.007.phpt index f47fdc735fa..269286d0242 100644 --- a/tests/lang/foreachLoop.007.phpt +++ b/tests/lang/foreachLoop.007.phpt @@ -8,4 +8,4 @@ foreach (array(1,2) as &$v) { } ?> --EXPECTF-- -Parse error: %s on line 3 +Fatal error: Cannot create references to elements of a temporary array expression in %sforeachLoop.007.php on line %d From f53225a99ebae56c7a20d6e3ad4efe6772dda3f9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 25 Aug 2012 17:40:08 +0200 Subject: [PATCH 512/641] Fix several issues and allow rewind only at/before first yield * Trying to resume a generator while it is already running now throws a fatal error. * Trying to use yield in finally while the generator is being force-closed (by GC) throws a fatal error. * Rewinding after the first yield now throws an Exception --- .../resume_running_generator_error.phpt | 17 +++ .../yield_in_force_closed_finally_error.phpt | 29 +++++ Zend/tests/generators/generator_rewind.phpt | 43 ++++++++ Zend/tests/generators/yield_in_finally.phpt | 29 +++++ Zend/zend_generators.c | 49 +++++++-- Zend/zend_generators.h | 11 +- Zend/zend_vm_def.h | 4 + Zend/zend_vm_execute.h | 100 ++++++++++++++++++ 8 files changed, 269 insertions(+), 13 deletions(-) create mode 100644 Zend/tests/generators/errors/resume_running_generator_error.phpt create mode 100644 Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt create mode 100644 Zend/tests/generators/generator_rewind.phpt create mode 100644 Zend/tests/generators/yield_in_finally.phpt diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt new file mode 100644 index 00000000000..567d72f3f94 --- /dev/null +++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt @@ -0,0 +1,17 @@ +--TEST-- +It is not possible to resume an already running generator +--FILE-- +next(); +} + +$gen = gen(); +$gen->send($gen); +$gen->next(); + +?> +--EXPECTF-- +Fatal error: Cannot resume an already running generator in %s on line %d diff --git a/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt b/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt new file mode 100644 index 00000000000..aada676a68e --- /dev/null +++ b/Zend/tests/generators/errors/yield_in_force_closed_finally_error.phpt @@ -0,0 +1,29 @@ +--TEST-- +yield cannot be used in a finally block when the generator is force-closed +--FILE-- +rewind(); +unset($gen); + +?> +--EXPECTF-- +before yield +before yield in finally + +Fatal error: Cannot yield from finally in a force-closed generator in %s on line %d diff --git a/Zend/tests/generators/generator_rewind.phpt b/Zend/tests/generators/generator_rewind.phpt new file mode 100644 index 00000000000..3224f6a9b6d --- /dev/null +++ b/Zend/tests/generators/generator_rewind.phpt @@ -0,0 +1,43 @@ +--TEST-- +A generator can only be rewinded before or at the first yield +--FILE-- +rewind(); +$gen->rewind(); +$gen->next(); + +try { + $gen->rewind(); +} catch (Exception $e) { + echo "\n", $e, "\n\n"; +} + +function gen2() { + echo "in generator\n"; + + if (false) yield; +} + +$gen = gen2(); +$gen->rewind(); + +?> +--EXPECTF-- +before yield +after yield + +exception 'Exception' with message 'Cannot rewind a generator that was already run' in %s:%d +Stack trace: +#0 %s(%d): Generator->rewind() +#1 {main} + +in generator diff --git a/Zend/tests/generators/yield_in_finally.phpt b/Zend/tests/generators/yield_in_finally.phpt new file mode 100644 index 00000000000..805484ad1d1 --- /dev/null +++ b/Zend/tests/generators/yield_in_finally.phpt @@ -0,0 +1,29 @@ +--TEST-- +yield can be used in finally (apart from forced closes) +--FILE-- +current()); +$gen->next(); + +?> +--EXPECTF-- +before return +before yield +string(%d) "yielded value" +after yield diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 3170ec9c33d..03294f7f0ea 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -31,11 +31,13 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio { if (generator->execute_data) { zend_execute_data *execute_data = generator->execute_data; + zend_op_array *op_array = execute_data->op_array; if (!finished_execution) { - zend_op_array *op_array = execute_data->op_array; if (op_array->has_finally_block) { - zend_uint op_num = execute_data->opline - op_array->opcodes; + /* -1 required because we want the last run opcode, not the + * next to-be-run one. */ + zend_uint op_num = execute_data->opline - op_array->opcodes - 1; zend_uint finally_op_num = 0; /* Find next finally block */ @@ -59,6 +61,7 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio if (finally_op_num) { execute_data->opline = &op_array->opcodes[finally_op_num]; execute_data->leaving = ZEND_RETURN; + generator->flags |= ZEND_GENERATOR_FORCED_CLOSE; zend_generator_resume(generator TSRMLS_CC); return; } @@ -66,7 +69,7 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio } if (!execute_data->symbol_table) { - zend_free_compiled_variables(execute_data->CVs, execute_data->op_array->last_var); + zend_free_compiled_variables(execute_data->CVs, op_array->last_var); } else { zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC); } @@ -83,8 +86,9 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio * a return statement) we have to free loop variables manually, as * we don't know whether the SWITCH_FREE / FREE opcodes have run */ if (!finished_execution) { - zend_op_array *op_array = execute_data->op_array; - zend_uint op_num = execute_data->opline - op_array->opcodes; + /* -1 required because we want the last run opcode, not the + * next to-be-run one. */ + zend_uint op_num = execute_data->opline - op_array->opcodes - 1; int i; for (i = 0; i < op_array->last_brk_cont; ++i) { @@ -411,6 +415,13 @@ void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ return; } + if (generator->flags & ZEND_GENERATOR_CURRENTLY_RUNNING) { + zend_error(E_ERROR, "Cannot resume an already running generator"); + } + + /* Drop the AT_FIRST_YIELD flag */ + generator->flags &= ~ZEND_GENERATOR_AT_FIRST_YIELD; + { /* Backup executor globals */ zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); @@ -455,7 +466,9 @@ void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ generator->execute_data->prev_execute_data->prev_execute_data = original_execute_data; /* Resume execution */ + generator->flags |= ZEND_GENERATOR_CURRENTLY_RUNNING; execute_ex(generator->execute_data TSRMLS_CC); + generator->flags &= ~ZEND_GENERATOR_CURRENTLY_RUNNING; /* Restore executor globals */ EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; @@ -489,6 +502,17 @@ static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_D { if (!generator->value) { zend_generator_resume(generator TSRMLS_CC); + generator->flags |= ZEND_GENERATOR_AT_FIRST_YIELD; + } +} +/* }}} */ + +static void zend_generator_rewind(zend_generator *generator TSRMLS_DC) /* {{{ */ +{ + zend_generator_ensure_initialized(generator TSRMLS_CC); + + if (!(generator->flags & ZEND_GENERATOR_AT_FIRST_YIELD)) { + zend_throw_exception(NULL, "Cannot rewind a generator that was already run", 0 TSRMLS_CC); } } /* }}} */ @@ -505,10 +529,7 @@ ZEND_METHOD(Generator, rewind) generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC); - zend_generator_ensure_initialized(generator TSRMLS_CC); - - /* Generators aren't rewindable, so rewind() only has to make sure that - * the generator is initialized, nothing more */ + zend_generator_rewind(generator TSRMLS_CC); } /* }}} */ @@ -721,13 +742,21 @@ static void zend_generator_iterator_move_forward(zend_object_iterator *iterator } /* }}} */ +static void zend_generator_iterator_rewind(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */ +{ + zend_generator *generator = (zend_generator *) iterator->data; + + zend_generator_rewind(generator TSRMLS_CC); +} +/* }}} */ + static zend_object_iterator_funcs zend_generator_iterator_functions = { zend_generator_iterator_dtor, zend_generator_iterator_valid, zend_generator_iterator_get_data, zend_generator_iterator_get_key, zend_generator_iterator_move_forward, - NULL + zend_generator_iterator_rewind }; zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 37ffbbd6ccb..e47b7ad885f 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -22,6 +22,8 @@ #define ZEND_GENERATORS_H BEGIN_EXTERN_C() +extern ZEND_API zend_class_entry *zend_ce_generator; +END_EXTERN_C() typedef struct _zend_generator { zend_object std; @@ -46,17 +48,20 @@ typedef struct _zend_generator { temp_variable *send_target; /* Largest used integer key for auto-incrementing keys */ long largest_used_integer_key; + + /* ZEND_GENERATOR_* flags */ + zend_uchar flags; } zend_generator; -extern ZEND_API zend_class_entry *zend_ce_generator; +static const zend_uchar ZEND_GENERATOR_CURRENTLY_RUNNING = 0x1; +static const zend_uchar ZEND_GENERATOR_FORCED_CLOSE = 0x2; +static const zend_uchar ZEND_GENERATOR_AT_FIRST_YIELD = 0x4; void zend_register_generator_ce(TSRMLS_D); zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC); void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC); void zend_generator_resume(zend_generator *generator TSRMLS_DC); -END_EXTERN_C() - #endif /* diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 216cd59bdbc..19031bc18dd 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5402,6 +5402,10 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index ebc0fb9c49c..6a5e2fff120 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4209,6 +4209,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -4899,6 +4903,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -5914,6 +5922,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -6624,6 +6636,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -7373,6 +7389,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -9436,6 +9456,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -10126,6 +10150,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -11141,6 +11169,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -11717,6 +11749,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -12404,6 +12440,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -16326,6 +16366,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -18405,6 +18449,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -20864,6 +20912,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -22001,6 +22053,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -24129,6 +24185,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -25616,6 +25676,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -26925,6 +26989,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -28234,6 +28302,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -28654,6 +28726,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -29960,6 +30036,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -33481,6 +33561,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -35429,6 +35513,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -37756,6 +37844,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -38752,6 +38844,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); @@ -40748,6 +40844,10 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* The generator object is stored in return_value_ptr_ptr */ zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr); + if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) { + zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator"); + } + /* Destroy the previously yielded value */ if (generator->value) { zval_ptr_dtor(&generator->value); From bd70d155885fdc087afba912c1b290615b864e2f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 25 Aug 2012 19:03:23 +0200 Subject: [PATCH 513/641] Remove implementation stubs for yield delegation I decided to leave out yield delegation for an initial proposal, so remove the stubs for it too. --- Zend/zend_compile.c | 23 ------------------- Zend/zend_compile.h | 1 - Zend/zend_language_parser.y | 3 --- Zend/zend_vm_def.h | 7 +----- Zend/zend_vm_execute.h | 45 ------------------------------------- Zend/zend_vm_opcodes.h | 3 +-- 6 files changed, 2 insertions(+), 80 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 563069118e4..d4201059b2e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2702,29 +2702,6 @@ void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_v } /* }}} */ -void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC) /* {{{ */ -{ - zend_op *opline; - - if (!CG(active_op_array)->function_name) { - zend_error(E_COMPILE_ERROR, "The \"yield*\" expression can only be used inside a function"); - } - - CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_DELEGATE_YIELD; - - SET_NODE(opline->op1, value); - SET_UNUSED(opline->op2); - - opline->result_type = IS_VAR; - opline->result.var = get_temporary_variable(CG(active_op_array)); - GET_NODE(result, opline->result); -} -/* }}} */ - static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */ { int try_catch_offset = CG(active_op_array)->last_try_catch++; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index acff761f88a..42f3ed405d4 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -496,7 +496,6 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_yield(znode *result, znode *value, const znode *key, zend_bool is_variable TSRMLS_DC); -void zend_do_delegate_yield(znode *result, const znode *value TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 29012b769ba..8b0f500895b 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -807,9 +807,6 @@ expr_without_variable: | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } | T_YIELD { zend_do_yield(&$$, NULL, NULL, 0 TSRMLS_CC); } - /*| T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); } - | T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); }*/ - | T_YIELD '*' expr { zend_do_delegate_yield(&$$, &$3 TSRMLS_CC); } | function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); } '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $3; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 19031bc18dd..101667957be 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3055,7 +3055,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); } -ZEND_VM_HANDLER(162, ZEND_GENERATOR_RETURN, ANY, ANY) +ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, ANY, ANY) { if (EX(op_array)->has_finally_block) { ZEND_VM_DISPATCH_TO_HELPER_EX(zend_finally_handler_leaving, type, ZEND_RETURN); @@ -5552,9 +5552,4 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE ZEND_VM_RETURN(); } -ZEND_VM_HANDLER(161, ZEND_DELEGATE_YIELD, CONST|TMP|VAR|CV, ANY) -{ - ZEND_VM_NEXT_OPCODE(); -} - ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper) diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6a5e2fff120..a6439674d5c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3177,11 +3177,6 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - ZEND_VM_NEXT_OPCODE(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -8556,11 +8551,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - ZEND_VM_NEXT_OPCODE(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -14014,11 +14004,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - ZEND_VM_NEXT_OPCODE(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -31430,11 +31415,6 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR ZEND_VM_NEXT_OPCODE(); } -static int ZEND_FASTCALL ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) -{ - ZEND_VM_NEXT_OPCODE(); -} - static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -45025,31 +45005,6 @@ void zend_init_opcodes_handlers(void) ZEND_YIELD_SPEC_CV_VAR_HANDLER, ZEND_YIELD_SPEC_CV_UNUSED_HANDLER, ZEND_YIELD_SPEC_CV_CV_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CONST_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_TMP_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_VAR_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, - ZEND_DELEGATE_YIELD_SPEC_CV_HANDLER, ZEND_GENERATOR_RETURN_SPEC_HANDLER, ZEND_GENERATOR_RETURN_SPEC_HANDLER, ZEND_GENERATOR_RETURN_SPEC_HANDLER, diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 0b4903ac365..7f943499548 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -161,5 +161,4 @@ #define ZEND_JMP_SET_VAR 158 #define ZEND_LEAVE 159 #define ZEND_YIELD 160 -#define ZEND_DELEGATE_YIELD 161 -#define ZEND_GENERATOR_RETURN 162 +#define ZEND_GENERATOR_RETURN 161 From 7c60aeef857f288661a6f95cf3aa45d6a6feff9b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 26 Aug 2012 11:37:05 +0800 Subject: [PATCH 514/641] Fixed bug #62931 & #62932 --- Zend/zend_compile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b87b1908b6b..6efc1e17bb6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6283,8 +6283,13 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token opline->extended_value |= ZEND_FE_FETCH_WITH_KEY; } - if ((key->op_type != IS_UNUSED) && (key->EA & ZEND_PARSED_REFERENCE_VARIABLE)) { + if ((key->op_type != IS_UNUSED)) { + if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) { zend_error(E_COMPILE_ERROR, "Key element cannot be a reference"); + } + if (key->EA & ZEND_PARSED_LIST_EXPR) { + zend_error(E_COMPILE_ERROR, "Cannot use list as Key element"); + } } if (value->EA & ZEND_PARSED_REFERENCE_VARIABLE) { From c6a5d192c8f23ce54c253decb8be727bddc4f3bf Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 26 Aug 2012 12:27:10 +0800 Subject: [PATCH 515/641] tabs --- Zend/zend_compile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6efc1e17bb6..d8257927fde 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6284,12 +6284,12 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token } if ((key->op_type != IS_UNUSED)) { - if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) { - zend_error(E_COMPILE_ERROR, "Key element cannot be a reference"); - } - if (key->EA & ZEND_PARSED_LIST_EXPR) { - zend_error(E_COMPILE_ERROR, "Cannot use list as Key element"); - } + if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) { + zend_error(E_COMPILE_ERROR, "Key element cannot be a reference"); + } + if (key->EA & ZEND_PARSED_LIST_EXPR) { + zend_error(E_COMPILE_ERROR, "Cannot use list as Key element"); + } } if (value->EA & ZEND_PARSED_REFERENCE_VARIABLE) { From 5ebbdecfeaaea1bc78450a2bb6d5ee280bf18dbd Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 26 Aug 2012 13:05:33 +0800 Subject: [PATCH 516/641] Fixed bug #62930, and more tests --- ...oreach_list.phpt => foreach_list_001.phpt} | 0 Zend/tests/foreach_list_002.phpt | 26 +++++++++++++++++++ Zend/tests/foreach_list_003.phpt | 13 ++++++++++ Zend/tests/foreach_list_004.phpt | 13 ++++++++++ Zend/zend_compile.c | 5 +++- 5 files changed, 56 insertions(+), 1 deletion(-) rename Zend/tests/{foreach_list.phpt => foreach_list_001.phpt} (100%) create mode 100644 Zend/tests/foreach_list_002.phpt create mode 100644 Zend/tests/foreach_list_003.phpt create mode 100644 Zend/tests/foreach_list_004.phpt diff --git a/Zend/tests/foreach_list.phpt b/Zend/tests/foreach_list_001.phpt similarity index 100% rename from Zend/tests/foreach_list.phpt rename to Zend/tests/foreach_list_001.phpt diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt new file mode 100644 index 00000000000..251870ba099 --- /dev/null +++ b/Zend/tests/foreach_list_002.phpt @@ -0,0 +1,26 @@ +--TEST-- +foreach with freak lists +--FILE-- + +--EXPECTF-- +int(1) +int(3) +string(1) "b" + +Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d +string(0) "" + +Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d +string(0) "" diff --git a/Zend/tests/foreach_list_003.phpt b/Zend/tests/foreach_list_003.phpt new file mode 100644 index 00000000000..8674ecd754f --- /dev/null +++ b/Zend/tests/foreach_list_003.phpt @@ -0,0 +1,13 @@ +--TEST-- +foreach with list key +--FILE-- + list(list(), $a)) { +} + +?> +--EXPECTF-- +Fatal error: Cannot use list as key element in %sforeach_list_003.php on line %d diff --git a/Zend/tests/foreach_list_004.phpt b/Zend/tests/foreach_list_004.phpt new file mode 100644 index 00000000000..fd48e8a1f34 --- /dev/null +++ b/Zend/tests/foreach_list_004.phpt @@ -0,0 +1,13 @@ +--TEST-- +foreach with empty list +--FILE-- + list()) { +} + +?> +--EXPECTF-- +Fatal error: Cannot use empty list in %sforeach_list_004.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d8257927fde..704db107cac 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6288,7 +6288,7 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token zend_error(E_COMPILE_ERROR, "Key element cannot be a reference"); } if (key->EA & ZEND_PARSED_LIST_EXPR) { - zend_error(E_COMPILE_ERROR, "Cannot use list as Key element"); + zend_error(E_COMPILE_ERROR, "Cannot use list as key element"); } } @@ -6326,6 +6326,9 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token GET_NODE(&value_node, opline->result); if (value->EA & ZEND_PARSED_LIST_EXPR) { + if (!CG(list_llist).head) { + zend_error(E_COMPILE_ERROR, "Cannot use empty list"); + } zend_do_list_end(&dummy, &value_node TSRMLS_CC); zend_do_free(&dummy TSRMLS_CC); } else { From e24194d15755fc574a39df1bc3a572394627f847 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 26 Aug 2012 18:28:15 +0800 Subject: [PATCH 517/641] Add test for #62907 --- Zend/tests/bug62907.phpt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Zend/tests/bug62907.phpt diff --git a/Zend/tests/bug62907.phpt b/Zend/tests/bug62907.phpt new file mode 100644 index 00000000000..c519a542952 --- /dev/null +++ b/Zend/tests/bug62907.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62907 (Double free when use traits) +--XFAIL-- +bug is not fixed yet +--FILE-- + Date: Sun, 26 Aug 2012 09:03:45 -0400 Subject: [PATCH 518/641] Fix bad version for CURLINFO_CERTINFO CURLINFO_CERTINFO is available since 7.19.1. The cURL extension allow to use it since this same version but the internal function create_certinfo used internally for CURLINFO_CERTINFO usage is only usable for version greater than 7.19.1 which will cause problem if the user is using the 7.19.1 cURL version --- ext/curl/interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 899ea603c13..7f865fe9586 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -786,6 +786,7 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5); /* Curl Share constants */ + REGISTER_CURL_CONSTANT(CURLSHOPT_NONE); REGISTER_CURL_CONSTANT(CURLSHOPT_SHARE); REGISTER_CURL_CONSTANT(CURLSHOPT_UNSHARE); @@ -814,6 +815,7 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE); REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE); REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD); + REGISTER_CURL_CONSTANT(CURL_TIMECOND_NONE); /* Curl version constants */ REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6); @@ -1743,7 +1745,7 @@ static void alloc_curl_handle(php_curl **ch) } /* }}} */ -#if LIBCURL_VERSION_NUM > 0x071301 +#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ /* {{{ split_certinfo */ static void split_certinfo(char *string, zval *hash) From 8e7081f3ac10f5b215358f7e245c9da21ea47278 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 26 Aug 2012 17:02:39 +0200 Subject: [PATCH 519/641] Merging PR 121 to add support for slow request counting on the PHP-FPM status page --- NEWS | 3 +++ sapi/fpm/fpm/fpm_php_trace.c | 2 ++ sapi/fpm/fpm/fpm_process_ctl.c | 8 ++++---- sapi/fpm/fpm/fpm_request.c | 4 ++-- sapi/fpm/fpm/fpm_scoreboard.c | 5 ++++- sapi/fpm/fpm/fpm_scoreboard.h | 3 ++- sapi/fpm/fpm/fpm_sockets.c | 2 +- sapi/fpm/fpm/fpm_status.c | 13 +++++++++---- 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index b7753d68dd2..f5b5fe05f6b 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,9 @@ PHP NEWS . Fixed bug #62836 (Seg fault or broken object references on unserialize()). (Laruence) +- FPM: + . Merged PR 121 by minitux to add support for slow request counting on PHP + FPM status page. (Lars) 16 Aug 2012, PHP 5.4.6 diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c index cd97aebb334..d95d66a754c 100644 --- a/sapi/fpm/fpm/fpm_php_trace.c +++ b/sapi/fpm/fpm/fpm_php_trace.c @@ -26,6 +26,7 @@ #include "fpm_children.h" #include "fpm_worker_pool.h" #include "fpm_process_ctl.h" +#include "fpm_scoreboard.h" #include "zlog.h" @@ -137,6 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC void fpm_php_trace(struct fpm_child_s *child) /* {{{ */ { TSRMLS_FETCH(); + fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, child->wp->scoreboard); FILE *slowlog; zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid); diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index 7840d17f8b9..76ea4d358e6 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -353,7 +353,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ #endif } } - fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); + fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); /* this is specific to PM_STYLE_ONDEMAND */ if (wp->config->pm == PM_STYLE_ONDEMAND) { @@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ if (idle < wp->config->pm_min_spare_servers) { if (wp->running_children >= wp->config->pm_max_children) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } @@ -407,7 +407,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children); if (children_to_fork <= 0) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } @@ -511,7 +511,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) / if (wp->running_children >= wp->config->pm_max_children) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 28332d0a926..bf431a08d03 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -54,7 +54,7 @@ void fpm_request_accepting() /* {{{ */ fpm_scoreboard_proc_release(proc); /* idle++, active-- */ - fpm_scoreboard_update(1, -1, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); + fpm_scoreboard_update(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); } /* }}} */ @@ -98,7 +98,7 @@ void fpm_request_reading_headers() /* {{{ */ fpm_scoreboard_proc_release(proc); /* idle--, active++, request++ */ - fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, NULL); + fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c index 4222f6037c7..24463a90ddd 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.c +++ b/sapi/fpm/fpm/fpm_scoreboard.c @@ -73,7 +73,7 @@ int fpm_scoreboard_init_main() /* {{{ */ } /* }}} */ -void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */ +void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */ { if (!scoreboard) { scoreboard = fpm_scoreboard; @@ -110,6 +110,9 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request if (max_children_reached >= 0) { scoreboard->max_children_reached = max_children_reached; } + if (slow_rq > 0) { + scoreboard->slow_rq += slow_rq; + } } else { if (scoreboard->idle + idle > 0) { scoreboard->idle += idle; diff --git a/sapi/fpm/fpm/fpm_scoreboard.h b/sapi/fpm/fpm/fpm_scoreboard.h index 136ea481a4a..f58a28737df 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.h +++ b/sapi/fpm/fpm/fpm_scoreboard.h @@ -64,13 +64,14 @@ struct fpm_scoreboard_s { unsigned int lq_len; unsigned int nprocs; int free_proc; + unsigned long int slow_rq; struct fpm_scoreboard_proc_s *procs[]; }; int fpm_scoreboard_init_main(); int fpm_scoreboard_init_child(struct fpm_worker_pool_s *wp); -void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard); +void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard); struct fpm_scoreboard_s *fpm_scoreboard_get(); struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *scoreboard, int child_index); diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index f56b9cfbd14..76759e7f25b 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -356,7 +356,7 @@ int fpm_sockets_init_main() /* {{{ */ } if (wp->listen_address_domain == FPM_AF_INET && fpm_socket_get_listening_queue(wp->listening_socket, NULL, &lq_len) >= 0) { - fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); + fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); } } diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 5f2c852c7d7..b9b9a8c0b6f 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -158,6 +158,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "total processes%d\n" "max active processes%d\n" "max children reached%u\n" + "slow requests%lu\n" "\n"; if (!full) { @@ -228,7 +229,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "%d\n" "%d\n" "%d\n" - "%u\n"; + "%u\n" + "%lu\n"; if (!full) { short_post = ""; @@ -277,7 +279,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "\"active processes\":%d," "\"total processes\":%d," "\"max active processes\":%d," - "\"max children reached\":%u"; + "\"max children reached\":%u," + "\"slow requests\":%lu"; if (!full) { short_post = "}"; @@ -326,7 +329,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "active processes: %d\n" "total processes: %d\n" "max active processes: %d\n" - "max children reached: %u\n"; + "max children reached: %u\n" + "slow requests: %lu\n"; if (full) { full_syntax = @@ -367,7 +371,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ scoreboard.active, scoreboard.idle + scoreboard.active, scoreboard.active_max, - scoreboard.max_children_reached); + scoreboard.max_children_reached, + scoreboard.slow_rq); PUTS(buffer); efree(buffer); From e7a714b35ecaf5760b1af7bd97eb2f0c613aa9f3 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 26 Aug 2012 17:02:39 +0200 Subject: [PATCH 520/641] Merging PR 121 to add support for slow request counting on the PHP-FPM status page --- sapi/fpm/fpm/fpm_php_trace.c | 2 ++ sapi/fpm/fpm/fpm_process_ctl.c | 8 ++++---- sapi/fpm/fpm/fpm_request.c | 4 ++-- sapi/fpm/fpm/fpm_scoreboard.c | 5 ++++- sapi/fpm/fpm/fpm_scoreboard.h | 3 ++- sapi/fpm/fpm/fpm_sockets.c | 2 +- sapi/fpm/fpm/fpm_status.c | 13 +++++++++---- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c index cd97aebb334..d95d66a754c 100644 --- a/sapi/fpm/fpm/fpm_php_trace.c +++ b/sapi/fpm/fpm/fpm_php_trace.c @@ -26,6 +26,7 @@ #include "fpm_children.h" #include "fpm_worker_pool.h" #include "fpm_process_ctl.h" +#include "fpm_scoreboard.h" #include "zlog.h" @@ -137,6 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC void fpm_php_trace(struct fpm_child_s *child) /* {{{ */ { TSRMLS_FETCH(); + fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, child->wp->scoreboard); FILE *slowlog; zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid); diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index 7840d17f8b9..76ea4d358e6 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -353,7 +353,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ #endif } } - fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); + fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); /* this is specific to PM_STYLE_ONDEMAND */ if (wp->config->pm == PM_STYLE_ONDEMAND) { @@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ if (idle < wp->config->pm_min_spare_servers) { if (wp->running_children >= wp->config->pm_max_children) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } @@ -407,7 +407,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children); if (children_to_fork <= 0) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } @@ -511,7 +511,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) / if (wp->running_children >= wp->config->pm_max_children) { if (!wp->warn_max_children) { - fpm_scoreboard_update(0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); + fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard); zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children); wp->warn_max_children = 1; } diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 28332d0a926..bf431a08d03 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -54,7 +54,7 @@ void fpm_request_accepting() /* {{{ */ fpm_scoreboard_proc_release(proc); /* idle++, active-- */ - fpm_scoreboard_update(1, -1, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); + fpm_scoreboard_update(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); } /* }}} */ @@ -98,7 +98,7 @@ void fpm_request_reading_headers() /* {{{ */ fpm_scoreboard_proc_release(proc); /* idle--, active++, request++ */ - fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, NULL); + fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c index 4222f6037c7..24463a90ddd 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.c +++ b/sapi/fpm/fpm/fpm_scoreboard.c @@ -73,7 +73,7 @@ int fpm_scoreboard_init_main() /* {{{ */ } /* }}} */ -void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */ +void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard) /* {{{ */ { if (!scoreboard) { scoreboard = fpm_scoreboard; @@ -110,6 +110,9 @@ void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int request if (max_children_reached >= 0) { scoreboard->max_children_reached = max_children_reached; } + if (slow_rq > 0) { + scoreboard->slow_rq += slow_rq; + } } else { if (scoreboard->idle + idle > 0) { scoreboard->idle += idle; diff --git a/sapi/fpm/fpm/fpm_scoreboard.h b/sapi/fpm/fpm/fpm_scoreboard.h index 136ea481a4a..f58a28737df 100644 --- a/sapi/fpm/fpm/fpm_scoreboard.h +++ b/sapi/fpm/fpm/fpm_scoreboard.h @@ -64,13 +64,14 @@ struct fpm_scoreboard_s { unsigned int lq_len; unsigned int nprocs; int free_proc; + unsigned long int slow_rq; struct fpm_scoreboard_proc_s *procs[]; }; int fpm_scoreboard_init_main(); int fpm_scoreboard_init_child(struct fpm_worker_pool_s *wp); -void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int action, struct fpm_scoreboard_s *scoreboard); +void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard); struct fpm_scoreboard_s *fpm_scoreboard_get(); struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *scoreboard, int child_index); diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index f56b9cfbd14..76759e7f25b 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -356,7 +356,7 @@ int fpm_sockets_init_main() /* {{{ */ } if (wp->listen_address_domain == FPM_AF_INET && fpm_socket_get_listening_queue(wp->listening_socket, NULL, &lq_len) >= 0) { - fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); + fpm_scoreboard_update(-1, -1, -1, (int)lq_len, -1, -1, 0, FPM_SCOREBOARD_ACTION_SET, wp->scoreboard); } } diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 5f2c852c7d7..b9b9a8c0b6f 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -158,6 +158,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "total processes%d\n" "max active processes%d\n" "max children reached%u\n" + "slow requests%lu\n" "\n"; if (!full) { @@ -228,7 +229,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "%d\n" "%d\n" "%d\n" - "%u\n"; + "%u\n" + "%lu\n"; if (!full) { short_post = ""; @@ -277,7 +279,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "\"active processes\":%d," "\"total processes\":%d," "\"max active processes\":%d," - "\"max children reached\":%u"; + "\"max children reached\":%u," + "\"slow requests\":%lu"; if (!full) { short_post = "}"; @@ -326,7 +329,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "active processes: %d\n" "total processes: %d\n" "max active processes: %d\n" - "max children reached: %u\n"; + "max children reached: %u\n" + "slow requests: %lu\n"; if (full) { full_syntax = @@ -367,7 +371,8 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ scoreboard.active, scoreboard.idle + scoreboard.active, scoreboard.active_max, - scoreboard.max_children_reached); + scoreboard.max_children_reached, + scoreboard.slow_rq); PUTS(buffer); efree(buffer); From e3ef84c59bf669a7dfc717af26ed1872bab397c9 Mon Sep 17 00:00:00 2001 From: Stuart Langley Date: Tue, 7 Aug 2012 13:06:13 +1000 Subject: [PATCH 521/641] Strong types for the result codes SUCCESS & FAILURE. These are common symbol names and using #defines can cause conflicts. --- Zend/zend.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend.h b/Zend/zend.h index de2a2e595e8..2c86f05cfa8 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -276,10 +276,10 @@ static const char long_min_digits[] = "9223372036854775808"; #define MAX_LENGTH_OF_DOUBLE 32 -#undef SUCCESS -#undef FAILURE -#define SUCCESS 0 -#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */ +typedef enum { + SUCCESS = 0, + FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */ +} RESULT_CODE; #include "zend_hash.h" #include "zend_ts_hash.h" From 48f40969179d3db8dade1e64a273a26b8aa2e2a1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 26 Aug 2012 17:46:01 +0200 Subject: [PATCH 522/641] Travis: Silence configure and make The large compile logs are hurting the poor browsers. This also drops two bogus configure options. --- travis/compile.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/travis/compile.sh b/travis/compile.sh index a0fc167a15b..b48bfe8e24e 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,6 +1,6 @@ #!/bin/bash ./buildconf -./configure \ +./configure --quiet \ --with-pdo-mysql \ --with-mysql \ --with-mysqli \ @@ -33,7 +33,5 @@ --with-gettext \ --enable-sockets \ --with-bz2 \ ---enable-bcmath \ ---enable-fastcgi \ ---with-mime-magic -make \ No newline at end of file +--enable-bcmath +make --quiet From 8831b000cab7103e25fc2acf224d0009ef0646d4 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sat, 25 Aug 2012 19:00:34 +0200 Subject: [PATCH 523/641] Require ICU >= 4.0 in configure --- acinclude.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index adb9599ce48..98e98f2af37 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2235,8 +2235,8 @@ AC_DEFUN([PHP_SETUP_ICU],[ icu_version=`expr [$]1 \* 1000 + [$]2` AC_MSG_RESULT([found $icu_version_full]) - if test "$icu_version" -lt "3004"; then - AC_MSG_ERROR([ICU version 3.4 or later is required]) + if test "$icu_version" -lt "4000"; then + AC_MSG_ERROR([ICU version 4.0 or later is required]) fi ICU_VERSION=$icu_version From 3d0857938d86b279e932de0558c3f4877e49bcec Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 19:44:05 +0200 Subject: [PATCH 524/641] zend_binary_strncasecmp_l used w/out declaration --- Zend/zend_operators.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index d28140e9e5b..08a6b19bd44 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -340,6 +340,7 @@ ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length); ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2); ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); From 8788cddfb36480cd4f0cb5c3aeec69134764ecfc Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 26 Aug 2012 20:06:47 +0200 Subject: [PATCH 525/641] Prefix RESULT_CODE enum with ZEND_ --- Zend/zend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend.h b/Zend/zend.h index 2c86f05cfa8..d2a4ef69578 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -279,7 +279,7 @@ static const char long_min_digits[] = "9223372036854775808"; typedef enum { SUCCESS = 0, FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */ -} RESULT_CODE; +} ZEND_RESULT_CODE; #include "zend_hash.h" #include "zend_ts_hash.h" From e95ad46186068cfe95cf54bc2f0085f393b62e58 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 20:42:18 +0200 Subject: [PATCH 526/641] Relax 4 dateformat tests for ICU 4.8 --- ext/intl/tests/dateformat_create_cal_arg.phpt | 16 ++++++++-------- .../tests/dateformat_formatObject_calendar.phpt | 8 ++++---- .../tests/dateformat_formatObject_datetime.phpt | 6 +++--- ext/intl/tests/dateformat_get_set_timezone.phpt | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt index 7490ecef492..53fb084af95 100644 --- a/ext/intl/tests/dateformat_create_cal_arg.phpt +++ b/ext/intl/tests/dateformat_create_cal_arg.phpt @@ -42,12 +42,12 @@ echo $df->format($ts), "\n"; ?> ==DONE== ---EXPECT-- -domingo, 1 de enero de 2012 00:00:00 GMT -domingo, 8 de Safar de 1433 00:00:00 GMT -domingo, 1 de enero de 2012 01:00:00 Hora estándar de Europa Central -sábado, 31 de diciembre de 2011 d.C. 23:00:00 Hora estándar de las Azores -sábado, 7 de Safar de 1433 AH 23:00:00 Hora estándar de las Azores -domingo, 8 de Safar de 1433 AH 00:00:00 GMT -domingo, 1 de enero de 2012 00:00:00 GMT +--EXPECTF-- +domingo%S 1 de enero de 2012 00:00:00 GMT +domingo%S 8 de Safar de 1433 00:00:00 GMT +domingo%S 1 de enero de 2012 01:00:00 Hora estándar de Europa Central +sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores +sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores +domingo%S 8 de Safar de 1433 AH 00:00:00 GMT +domingo%S 1 de enero de 2012 00:00:00 GMT ==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt index 03371a91ab6..0c61e4f2d00 100644 --- a/ext/intl/tests/dateformat_formatObject_calendar.phpt +++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt @@ -28,14 +28,14 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\ ?> ==DONE== ---EXPECT-- +--EXPECTF-- 01/01/2012 00:00:00 -Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental Jan 1, 2012 12:00:00 AM -1/1/12 12:00:00 AM Western European Standard Time +1/1/12 12:00:00 AM Western European %STime Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 06/02/1433 00:00:00 -Sunday, Safar 6, 1433 12:00:00 AM Western European Standard Time +Sunday, Safar 6, 1433 12:00:00 AM Western European %STime ==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt index bfc26cb80c9..6427ad5a988 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -23,11 +23,11 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; ?> ==DONE== ---EXPECT-- +--EXPECTF-- 01/01/2012 00:00:00 -Domingo, 1 de Janeiro de 2012 0:00:00 Hora Padrão da Europa Ocidental +Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental Jan 1, 2012 12:00:00 AM -1/1/12 12:00:00 AM Western European Standard Time +1/1/12 12:00:00 AM Western European %STime Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 ==DONE== diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt index b66653d8d04..41aa35b9cf3 100644 --- a/ext/intl/tests/dateformat_get_set_timezone.phpt +++ b/ext/intl/tests/dateformat_get_set_timezone.phpt @@ -38,24 +38,24 @@ d($df); ?> ==DONE== ---EXPECT-- +--EXPECTF-- Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00 string(12) "Europe/Minsk" string(12) "Europe/Minsk" -Sábado, 31 de Dezembro de 2011 23:00:00 Hora Padrão dos Açores +Sábado, 31 de Dezembro de 2011 23:00:00 Hor%s %Sdos Açores string(15) "Atlantic/Azores" string(15) "Atlantic/Azores" -Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central string(13) "Europe/Madrid" string(13) "Europe/Madrid" -Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central string(12) "Europe/Paris" string(12) "Europe/Paris" -Domingo, 1 de Janeiro de 2012 1:00:00 Hora Padrão da Europa Central +Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central string(16) "Europe/Amsterdam" string(16) "Europe/Amsterdam" From 1ce572ce2c6eec3d12722cdd65fd7af9a7004518 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 21:57:50 +0200 Subject: [PATCH 527/641] Bug #62933: compilation error with ICU 3.4 --- ext/intl/common/common_error.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index a0ee7c145ff..282172224c0 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -240,7 +240,9 @@ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) INTL_EXPOSE_CONST( U_IDNA_ACE_PREFIX_ERROR ); INTL_EXPOSE_CONST( U_IDNA_VERIFICATION_ERROR ); INTL_EXPOSE_CONST( U_IDNA_LABEL_TOO_LONG_ERROR ); +#if U_ICU_VERSION_MAJOR_NUM > 3 || U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM >= 6 INTL_EXPOSE_CONST( U_IDNA_ZERO_LENGTH_LABEL_ERROR ); +#endif #if U_ICU_VERSION_MAJOR_NUM > 3 || U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM >= 8 INTL_EXPOSE_CONST( U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR ); #endif From 949f6cd47312cdaa1603025af6bdd8e0ec6c425f Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 22:01:15 +0200 Subject: [PATCH 528/641] Announce on NEWS change in 1ce572c --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index f5b5fe05f6b..5cd11c8696f 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,9 @@ PHP NEWS . Fixed bug #62852 (Unserialize invalid DateTime causes crash). (reeze.xia@gmail.com) +- Intl: + . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) + - Installation: . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) From 011af74b23fd419b34d4aee85cac39ffdd217665 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:12:41 +0200 Subject: [PATCH 529/641] Fix version in check message --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 98e98f2af37..ad4f7474b38 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2226,7 +2226,7 @@ AC_DEFUN([PHP_SETUP_ICU],[ AC_MSG_RESULT([$icu_install_prefix]) dnl Check ICU version - AC_MSG_CHECKING([for ICU 3.4 or greater]) + AC_MSG_CHECKING([for ICU 4.0 or greater]) icu_version_full=`$ICU_CONFIG --version` ac_IFS=$IFS IFS="." From 72c807ad67f07ec391017f90771c2e9beb5dbed7 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:30:43 +0200 Subject: [PATCH 530/641] Allow Spoofchecker to be registered on ICU 49.1 --- ext/intl/php_intl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index efe0ddd2423..90e3573c1b5 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -70,7 +70,7 @@ #include "idn/idn.h" -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 # include "spoofchecker/spoofchecker_class.h" # include "spoofchecker/spoofchecker.h" # include "spoofchecker/spoofchecker_create.h" @@ -646,7 +646,7 @@ PHP_MINIT_FUNCTION( intl ) /* Expose IDN constants to PHP scripts. */ idn_register_constants(INIT_FUNC_ARGS_PASSTHRU); -#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2 +#if U_ICU_VERSION_MAJOR_NUM * 1000 + U_ICU_VERSION_MINOR_NUM >= 4002 /* Register 'Spoofchecker' PHP class */ spoofchecker_register_Spoofchecker_class( TSRMLS_C ); From 63a1801d195441bc681ff20ecf9dddac787824d8 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:39:53 +0200 Subject: [PATCH 531/641] NEWS for commit 72c807a --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 5cd11c8696f..2ecbb91f26b 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,7 @@ PHP NEWS (reeze.xia@gmail.com) - Intl: + . Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo) . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) - Installation: From 886a50a619e55c9c1a5597449d6c71c69ff6fef8 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:37:09 +0200 Subject: [PATCH 532/641] Fixed defective cloning in ext/intl classes See also bug #62915 --- ext/intl/dateformat/dateformat_class.c | 2 +- ext/intl/formatter/formatter_class.c | 2 +- ext/intl/msgformat/msgformat_class.c | 2 +- ext/intl/spoofchecker/spoofchecker_class.c | 2 +- ext/intl/tests/bug62915-2.phpt | 33 +++++++++++++++++++ .../transliterator/transliterator_class.c | 2 +- 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 ext/intl/tests/bug62915-2.phpt diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index 801ca3379e3..49f316f7876 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -92,7 +92,7 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC) DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC); + new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 8f399a67735..2246cd29a5c 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -86,7 +86,7 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC) NumberFormatter_object *nfo, *new_nfo; FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC); + new_obj_val = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index da1e1e595a7..bb3b55f39c6 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -84,7 +84,7 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) MessageFormatter_object *mfo, *new_mfo; MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC); + new_obj_val = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 507a2ca98e5..6c2b79034df 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -127,7 +127,7 @@ static zend_object_value spoofchecker_clone_obj(zval *object TSRMLS_DC) /* {{{ * sfo = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); intl_error_reset(SPOOFCHECKER_ERROR_P(sfo) TSRMLS_CC); - new_obj_val = Spoofchecker_ce_ptr->create_object(Spoofchecker_ce_ptr TSRMLS_CC); + new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_sfo = (Spoofchecker_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_sfo->zo, new_obj_val, &sfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt new file mode 100644 index 00000000000..bcb069cab68 --- /dev/null +++ b/ext/intl/tests/bug62915-2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #62915: cloning of several classes is defective +--SKIPIF-- +newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); +} +--EXPECT-- +string(1) "A" +string(1) "B" +string(1) "C" +string(1) "D" diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 8d4d0649e97..5ef80fb482c 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -162,7 +162,7 @@ static zend_object_value Transliterator_clone_obj( zval *object TSRMLS_DC ) to_orig = zend_object_store_get_object( object TSRMLS_CC ); intl_error_reset( INTL_DATA_ERROR_P( to_orig ) TSRMLS_CC ); - ret_val = Transliterator_ce_ptr->create_object( Transliterator_ce_ptr TSRMLS_CC ); + ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) TSRMLS_CC ); to_new = zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC ); zend_objects_clone_members( &to_new->zo, ret_val, From dacd11ea8989a442032b9fdbece581cf9d299904 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:44:54 +0200 Subject: [PATCH 533/641] Fixed cloning in ext/intl classes; master specific --- ext/intl/tests/bug62915.phpt | 24 ++++++++++++++++++++++++ ext/intl/timezone/timezone_class.cpp | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ext/intl/tests/bug62915.phpt diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt new file mode 100644 index 00000000000..e541d72d637 --- /dev/null +++ b/ext/intl/tests/bug62915.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62915: incomplete cloning of IntlTimeZone objects +--SKIPIF-- +getMessage()); +} +--EXPECT-- +string(39) "Cannot clone unconstructed IntlTimeZone" diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 27cf41a4cf4..374b1638512 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -225,7 +225,7 @@ static zend_object_value TimeZone_clone_obj(zval *object TSRMLS_DC) to_orig = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC); intl_error_reset(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC); - ret_val = TimeZone_ce_ptr->create_object(TimeZone_ce_ptr TSRMLS_CC); + ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); to_new = (TimeZone_object*)zend_object_store_get_object_by_handle( ret_val.handle TSRMLS_CC); From c11106734d0fbccccd81ac8332e5a4132d0c6a06 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:47:00 +0200 Subject: [PATCH 534/641] NEWS for 886a50a --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 2ecbb91f26b..770b160e97e 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ PHP NEWS - Intl: . Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo) . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) + . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) - Installation: . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) From 0410b4e60f6b4b3a105c0866b797dc47a58ec594 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Sun, 26 Aug 2012 23:37:09 +0200 Subject: [PATCH 535/641] Fixed defective cloning in ext/intl classes See also bug #62915 Cherry picked from 886a50a (I forgot about 5.3) Conflicts: ext/intl/spoofchecker/spoofchecker_class.c ext/intl/transliterator/transliterator_class.c --- NEWS | 1 + ext/intl/dateformat/dateformat_class.c | 2 +- ext/intl/formatter/formatter_class.c | 2 +- ext/intl/msgformat/msgformat_class.c | 2 +- ext/intl/tests/bug62915-2.phpt | 29 ++++++++++++++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 ext/intl/tests/bug62915-2.phpt diff --git a/NEWS b/NEWS index 69cbb2a0fa5..cd7333cbb22 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,7 @@ PHP NEWS - Intl: . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) + . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) - MySQLnd: . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence) diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index 85a67f7f9fc..a7227ef03d7 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -91,7 +91,7 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC) DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = IntlDateFormatter_ce_ptr->create_object(IntlDateFormatter_ce_ptr TSRMLS_CC); + new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 5790f0c2e19..9de1e1e96e6 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -85,7 +85,7 @@ zend_object_value NumberFormatter_object_clone(zval *object TSRMLS_DC) NumberFormatter_object *nfo, *new_nfo; FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = NumberFormatter_ce_ptr->create_object(NumberFormatter_ce_ptr TSRMLS_CC); + new_obj_val = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_nfo = (NumberFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, new_obj_val, &nfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 36d06d2d365..d6ba9b1c670 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -83,7 +83,7 @@ zend_object_value MessageFormatter_object_clone(zval *object TSRMLS_DC) MessageFormatter_object *mfo, *new_mfo; MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj_val = MessageFormatter_ce_ptr->create_object(MessageFormatter_ce_ptr TSRMLS_CC); + new_obj_val = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC); new_mfo = (MessageFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, new_obj_val, &mfo->zo, handle TSRMLS_CC); diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt new file mode 100644 index 00000000000..6bccf38ff92 --- /dev/null +++ b/ext/intl/tests/bug62915-2.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #62915: cloning of several classes is defective +--SKIPIF-- +newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); +} +--EXPECT-- +string(1) "A" +string(1) "B" +string(1) "C" From cec1786911eea3d515c044a407e22e9b162d7080 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 27 Aug 2012 10:23:23 +0800 Subject: [PATCH 536/641] Fixed bug #62938 (zend_do_bind_catch() used without declaration) --- Zend/zend_compile.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 15c2ab7bc79..3a6f94270ba 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -501,6 +501,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC); void zend_do_try(znode *try_token TSRMLS_DC); void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC); +void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC); void zend_do_end_catch(znode *catch_token TSRMLS_DC); void zend_do_finally(znode *finally_token TSRMLS_DC); void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC); From dd9478e6c871418a7e130e5f6cacc7eaa8d92cf4 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 27 Aug 2012 08:56:54 -0300 Subject: [PATCH 537/641] - Fixed compiler warnings --- ext/curl/interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 7f865fe9586..523bc1c6a0d 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2691,7 +2691,7 @@ string_copy: case CURLOPT_SHARE: { php_curlsh *sh = NULL; - ZEND_FETCH_RESOURCE(sh, php_curlsh *, zvalue, -1, le_curl_share_handle_name, le_curl_share_handle); + ZEND_FETCH_RESOURCE_NO_RETURN(sh, php_curlsh *, zvalue, -1, le_curl_share_handle_name, le_curl_share_handle); if (sh) { curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share); } @@ -3215,7 +3215,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) #if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */ /* {{{ _php_curl_reset_handlers() Reset all handlers of a given php_curl */ -static _php_curl_reset_handlers(php_curl *ch) +static void _php_curl_reset_handlers(php_curl *ch) { if (ch->handlers->write->stream) { Z_DELREF_P(ch->handlers->write->stream); @@ -3306,7 +3306,7 @@ PHP_FUNCTION(curl_escape) ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl); - if (res = curl_easy_escape(ch->cp, str, str_len)) { + if ((res = curl_easy_escape(ch->cp, str, str_len))) { RETVAL_STRING(res, 1); free(res); } else { @@ -3330,7 +3330,7 @@ PHP_FUNCTION(curl_unescape) ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl); - if (out = curl_easy_unescape(ch->cp, str, str_len, &out_len)) { + if ((out = curl_easy_unescape(ch->cp, str, str_len, &out_len))) { RETVAL_STRINGL(out, out_len, 1); free(out); } else { From f82dd2c77463e01cbcc9912be08f5e45cb1a384c Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Tue, 28 Aug 2012 14:06:18 +0200 Subject: [PATCH 538/641] Bug #62956: fixing private method signature validation In inheritance, if both methods are private, don not enforce the same signature. --- Zend/tests/bug61761.phpt | 3 ++- Zend/tests/bug62956.phpt | 20 ++++++++++++++++++++ Zend/zend_compile.c | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/bug62956.phpt diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt index 631f566eaa3..24c69ae792e 100755 --- a/Zend/tests/bug61761.phpt +++ b/Zend/tests/bug61761.phpt @@ -14,5 +14,6 @@ class B extends A } ?> +==DONE== --EXPECTF-- -Strict Standards: Declaration of B::test() should be compatible with A::test($a) in %sbug61761.php on line %d +==DONE== diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt new file mode 100644 index 00000000000..c8694d5beaa --- /dev/null +++ b/Zend/tests/bug62956.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT +--FILE-- + +==DONE== +--EXPECT-- +==DONE== diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 09383c12d09..bf458e114fb 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2935,6 +2935,11 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c return 1; } + /* If both methods are private do not enforce a signature */ + if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) { + return 1; + } + /* check number of arguments */ if (proto->common.required_num_args < fe->common.required_num_args || proto->common.num_args > fe->common.num_args) { From 6b1073a3a7030d70a684638f098dbf22affb5c63 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Tue, 28 Aug 2012 14:06:18 +0200 Subject: [PATCH 539/641] Bug #62956: fixing private method signature validation In inheritance, if both methods are private, don not enforce the same signature. --- Zend/tests/bug61761.phpt | 3 ++- Zend/tests/bug62956.phpt | 20 ++++++++++++++++++++ Zend/zend_compile.c | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/bug62956.phpt diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt index 631f566eaa3..24c69ae792e 100755 --- a/Zend/tests/bug61761.phpt +++ b/Zend/tests/bug61761.phpt @@ -14,5 +14,6 @@ class B extends A } ?> +==DONE== --EXPECTF-- -Strict Standards: Declaration of B::test() should be compatible with A::test($a) in %sbug61761.php on line %d +==DONE== diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt new file mode 100644 index 00000000000..c8694d5beaa --- /dev/null +++ b/Zend/tests/bug62956.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT +--FILE-- + +==DONE== +--EXPECT-- +==DONE== diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 704db107cac..f7b638f90cf 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2969,6 +2969,11 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c return 1; } + /* If both methods are private do not enforce a signature */ + if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) { + return 1; + } + /* check number of arguments */ if (proto->common.required_num_args < fe->common.required_num_args || proto->common.num_args > fe->common.num_args) { From 8b3c1a380a182655113b94b0b96551e98d05a8d3 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 30 Jun 2012 16:31:26 -0700 Subject: [PATCH 540/641] fix bug #55856: preg_replace should fail on trailing garbage --- NEWS | 4 ++++ ext/pcre/php_pcre.c | 32 ++++++++++++++++---------- ext/pcre/tests/null_bytes.phpt | 42 ++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 ext/pcre/tests/null_bytes.phpt diff --git a/NEWS b/NEWS index 770b160e97e..a6c68a2935c 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,10 @@ PHP NEWS - Installation: . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) +- PCRE: + . Fixed bug #55856 (preg_replace should fail on trailing garbage). + (reg dot php at alf dot nu) + - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index c9d707280cd..f61364cde96 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -275,7 +275,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le get to the end without encountering a delimiter. */ while (isspace((int)*(unsigned char *)p)) p++; if (*p == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, + p < regex + regex_len ? "Null byte in regex" : "Empty regular expression"); return NULL; } @@ -292,21 +293,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le delimiter = pp[5]; end_delimiter = delimiter; + pp = p; + if (start_delimiter == end_delimiter) { /* We need to iterate through the pattern, searching for the ending delimiter, but skipping the backslashed delimiters. If the ending delimiter is not found, display a warning. */ - pp = p; while (*pp != 0) { if (*pp == '\\' && pp[1] != 0) pp++; else if (*pp == delimiter) break; pp++; } - if (*pp == 0) { - php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter); - return NULL; - } } else { /* We iterate through the pattern, searching for the matching ending * delimiter. For each matching starting delimiter, we increment nesting @@ -314,7 +312,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le * reach the end of the pattern without matching, display a warning. */ int brackets = 1; /* brackets nesting level */ - pp = p; while (*pp != 0) { if (*pp == '\\' && pp[1] != 0) pp++; else if (*pp == end_delimiter && --brackets <= 0) @@ -323,10 +320,17 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le brackets++; pp++; } - if (*pp == 0) { - php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", end_delimiter); - return NULL; + } + + if (*pp == 0) { + if (pp < regex + regex_len) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex"); + } else if (start_delimiter == end_delimiter) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter); + } else { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending matching delimiter '%c' found", delimiter); } + return NULL; } /* Make a copy of the actual pattern. */ @@ -337,7 +341,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le /* Parse through the options, setting appropriate flags. Display a warning if we encounter an unknown modifier. */ - while (*pp != 0) { + while (pp < regex + regex_len) { switch (*pp++) { /* Perl compatible options */ case 'i': coptions |= PCRE_CASELESS; break; @@ -368,7 +372,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le break; default: - php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]); + if (pp[-1]) { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Unknown modifier '%c'", pp[-1]); + } else { + php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex"); + } efree(pattern); return NULL; } diff --git a/ext/pcre/tests/null_bytes.phpt b/ext/pcre/tests/null_bytes.phpt new file mode 100644 index 00000000000..9a3f433ffb1 --- /dev/null +++ b/ext/pcre/tests/null_bytes.phpt @@ -0,0 +1,42 @@ +--TEST-- +Zero byte test +--FILE-- + +--EXPECTF-- +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 3 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 4 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 5 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 6 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 7 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 9 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 10 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 11 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 12 + +Warning: preg_match(): Null byte in regex in %snull_bytes.php on line 13 + +Warning: preg_replace(): Null byte in regex in %snull_bytes.php on line 15 From 78cffe0c4dfadbffb4232da4321ccf6f7d5c2f67 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 28 Aug 2012 22:07:08 -0700 Subject: [PATCH 541/641] 5.4.7 branched --- NEWS | 2 ++ configure.in | 2 +- main/php_version.h | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index a6c68a2935c..99a30c81c91 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2012, PHP 5.4.8 + ?? ??? 2012, PHP 5.4.7 - Core: diff --git a/configure.in b/configure.in index e5e1cd63752..b03f6cc8c09 100644 --- a/configure.in +++ b/configure.in @@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...); PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=4 -PHP_RELEASE_VERSION=7 +PHP_RELEASE_VERSION=8 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/main/php_version.h b/main/php_version.h index 3315661b7a9..d00d43dc4d7 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 4 -#define PHP_RELEASE_VERSION 7 +#define PHP_RELEASE_VERSION 8 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.4.7-dev" +#define PHP_VERSION "5.4.8-dev" #define PHP_VERSION_ID 50407 From 55b3386a81f1a40787f6b6c3129562725edceb2c Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 28 Aug 2012 22:10:34 -0700 Subject: [PATCH 542/641] update version id too --- main/php_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/php_version.h b/main/php_version.h index d00d43dc4d7..0efdef14a57 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -5,4 +5,4 @@ #define PHP_RELEASE_VERSION 8 #define PHP_EXTRA_VERSION "-dev" #define PHP_VERSION "5.4.8-dev" -#define PHP_VERSION_ID 50407 +#define PHP_VERSION_ID 50408 From 602bb125c3af3942af9fd2bf72ec8bc4197e73bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 29 Aug 2012 12:33:55 +0200 Subject: [PATCH 543/641] Merge 5.3.16 NEWS in. --- NEWS | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index cd7333cbb22..c696dea3c70 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2012, PHP 5.3.16 +?? ??? 2012, PHP 5.3.17 - Core: . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) @@ -10,18 +10,13 @@ PHP NEWS . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia) - . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK - with run-test.php). (Laruence) - CURL: . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) - . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). - (r.hampartsumyan@gmail.com, Laruence) - DateTime: . Fixed bug #62852 (Unserialize invalid DateTime causes crash). (reeze.xia@gmail.com) - . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) - Intl: . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) @@ -33,22 +28,37 @@ PHP NEWS - PDO: . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) -- Reflection: - . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong - result). (Laruence) - - Session: . Fixed bug (segfault due to retval is not initialized). (Laruence) - SPL: . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) (Laruence) - . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance - gives Segmentation fault). (Laruence, Gustavo) - Enchant: . Fixed bug #62838 (enchant_dict_quick_check() destroys zval, but fails to - initialize it). (Tony, Mateusz Goik). + initialize it). (Tony, Mateusz Goik). + +16 Aug 2012, PHP 5.3.16 + +- Core: + . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK + with run-test.php). (Laruence) + +- CURL: + . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). + (r.hampartsumyan@gmail.com, Laruence) + +- DateTime: + . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + +- Reflection: + . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong + result). (Laruence) + +- SPL: + . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance + gives Segmentation fault). (Laruence, Gustavo) 19 Jul 2012, PHP 5.3.15 From 677de8568ae43d3b83f1558dcd15f1008119129c Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 29 Aug 2012 17:49:02 +0200 Subject: [PATCH 544/641] updated mpir version --- win32/build/libs_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 39281d7387f..0d1af3d1b4f 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -6,7 +6,7 @@ jpeglib-6b libcurl-7.24.0 libiconv-1.11 libmcrypt-2.5.8 -libmpir-1.3.1 +libmpir-2.5.1 libpng-1.2.46 libpq-8.3.6 libssh2-1.3.0 From cc07038fa9b2a59893c52fb0c515a1fb03e56d5c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 29 Aug 2012 20:31:34 +0200 Subject: [PATCH 545/641] Make sure that exception is thrown on rewind() after closing too --- Zend/tests/generators/generator_rewind.phpt | 16 ++++++++++++++++ Zend/zend_generators.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Zend/tests/generators/generator_rewind.phpt b/Zend/tests/generators/generator_rewind.phpt index 3224f6a9b6d..af885ef3820 100644 --- a/Zend/tests/generators/generator_rewind.phpt +++ b/Zend/tests/generators/generator_rewind.phpt @@ -21,6 +21,14 @@ try { echo "\n", $e, "\n\n"; } +$gen = gen(); +foreach ($gen as $v) { } +try { + foreach ($gen as $v) { } +} catch (Exception $e) { + echo "\n", $e, "\n\n"; +} + function gen2() { echo "in generator\n"; @@ -40,4 +48,12 @@ Stack trace: #0 %s(%d): Generator->rewind() #1 {main} +before yield +after yield + +exception 'Exception' with message 'Cannot rewind a generator that was already run' in %s:%d +Stack trace: +#0 %s(%d): unknown() +#1 {main} + in generator diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 03294f7f0ea..0eb17d02937 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -500,7 +500,7 @@ void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{ */ static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */ { - if (!generator->value) { + if (generator->execute_data && !generator->value) { zend_generator_resume(generator TSRMLS_CC); generator->flags |= ZEND_GENERATOR_AT_FIRST_YIELD; } From bef79588d543db996d092191ac498751a1cc161f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 29 Aug 2012 20:46:56 +0200 Subject: [PATCH 546/641] Fix segfault when traversing a by-ref generator twice If you try to traverse an already closed generator an exception will now be thrown. Furthermore this changes the error for traversing a by-val generator by-ref from an E_ERROR to an Exception. --- ...n_ref_generator_iterated_by_ref_error.phpt | 7 ++++++- Zend/tests/generators/generator_rewind.phpt | 19 +++++++++++-------- Zend/zend_generators.c | 8 +++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt index 9c618d25156..de5b22f6ba6 100644 --- a/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt +++ b/Zend/tests/generators/errors/non_ref_generator_iterated_by_ref_error.phpt @@ -10,4 +10,9 @@ foreach ($gen as &$value) { } ?> --EXPECTF-- -Fatal error: You can only iterate a generator by-reference if it declared that it yields by-reference in %s on line %d +Fatal error: Uncaught exception 'Exception' with message 'You can only iterate a generator by-reference if it declared that it yields by-reference' in %s:%d +Stack trace: +#0 %s(%d): unknown() +#1 {main} + thrown in %s on line %d + diff --git a/Zend/tests/generators/generator_rewind.phpt b/Zend/tests/generators/generator_rewind.phpt index af885ef3820..c4b5bbbdf49 100644 --- a/Zend/tests/generators/generator_rewind.phpt +++ b/Zend/tests/generators/generator_rewind.phpt @@ -21,21 +21,27 @@ try { echo "\n", $e, "\n\n"; } -$gen = gen(); +function &gen2() { + $foo = 'bar'; + yield $foo; + yield $foo; +} + +$gen = gen2(); foreach ($gen as $v) { } try { foreach ($gen as $v) { } } catch (Exception $e) { - echo "\n", $e, "\n\n"; + echo $e, "\n\n"; } -function gen2() { +function gen3() { echo "in generator\n"; if (false) yield; } -$gen = gen2(); +$gen = gen3(); $gen->rewind(); ?> @@ -48,10 +54,7 @@ Stack trace: #0 %s(%d): Generator->rewind() #1 {main} -before yield -after yield - -exception 'Exception' with message 'Cannot rewind a generator that was already run' in %s:%d +exception 'Exception' with message 'Cannot traverse an already closed generator' in %s:%d Stack trace: #0 %s(%d): unknown() #1 {main} diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 0eb17d02937..60fa8b64911 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -766,8 +766,14 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC); + if (!generator->execute_data) { + zend_throw_exception(NULL, "Cannot traverse an already closed generator", 0 TSRMLS_CC); + return NULL; + } + if (by_ref && !(generator->execute_data->op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) { - zend_error(E_ERROR, "You can only iterate a generator by-reference if it declared that it yields by-reference"); + zend_throw_exception(NULL, "You can only iterate a generator by-reference if it declared that it yields by-reference", 0 TSRMLS_CC); + return NULL; } iterator = emalloc(sizeof(zend_generator_iterator)); From dbc7809b1746ef5dd895e6cd369134cb5270ae0b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 29 Aug 2012 20:49:14 +0200 Subject: [PATCH 547/641] Fix typos --- Zend/zend_generators.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 60fa8b64911..c22d745bc36 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -301,7 +301,7 @@ static void zend_generator_clone_storage(zend_generator *orig, zend_generator ** Z_ADDREF_P(execute_data->object); } - /* Prev execute data contains an additional stack frame (for proper) + /* Prev execute data contains an additional stack frame (for proper * backtraces) which has to be copied. */ clone->execute_data->prev_execute_data = emalloc(sizeof(zend_execute_data)); memcpy(clone->execute_data->prev_execute_data, execute_data->prev_execute_data, sizeof(zend_execute_data)); @@ -643,9 +643,9 @@ ZEND_METHOD(Generator, send) RETURN_ZVAL(generator->value, 1, 0); } } +/* }}} */ - -/* {{{ proto void Generator::__wakeup +/* {{{ proto void Generator::__wakeup() * Throws an Exception as generators can't be serialized */ ZEND_METHOD(Generator, __wakeup) { From de884997e0bc5cfc49b955099f369d1beae941b0 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 30 Aug 2012 09:32:13 -0300 Subject: [PATCH 548/641] - Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" Windows registry) --- win32/registry.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/win32/registry.c b/win32/registry.c index 45e842b455f..638d85ae52c 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -77,12 +77,13 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_ value_len = max_value+1; if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) == ERROR_SUCCESS) { if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) { - ht = (HashTable*)malloc(sizeof(HashTable)); if (!ht) { - return ret; + ht = (HashTable*)malloc(sizeof(HashTable)); + if (!ht) { + return ret; + } + zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1); } - zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1); - data = (zval*)malloc(sizeof(zval)); if (!data) { return ret; From 8afb848e18187974df79d3ddc8d215695d7cf632 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 30 Aug 2012 09:33:35 -0300 Subject: [PATCH 549/641] - BFN --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index cd7333cbb22..2ef6084e99e 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ PHP NEWS - Core: . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) + . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" + Windows registry). (aserbulov at parallels dot com) . Fixed bug #62763 (register_shutdown_function and extending class). (Laruence) . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) From 5dc2cef370885c552c20f3ff44bccd402850de9e Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 31 Aug 2012 11:22:43 +0800 Subject: [PATCH 550/641] Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes) --- NEWS | 2 ++ Zend/zend_operators.c | 3 +++ tests/lang/compare_objects_basic2.phpt | 8 ++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 2ef6084e99e..a6e05be5685 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.3.16 - Core: + . Fixed bug #62976 (Notice: could not be converted to int when comparing + some builtin classes). (Laruence) . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" Windows registry). (aserbulov at parallels dot com) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index e6fe67e7649..aea63faeddc 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1489,6 +1489,9 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { ret = compare_function(result, op1, op_free TSRMLS_CC); zend_free_obj_get_result(op_free TSRMLS_CC); return ret; + } else if (Z_TYPE_P(op1) == IS_OBJECT) { + ZVAL_LONG(result, 1); + return SUCCESS; } } if (!converted) { diff --git a/tests/lang/compare_objects_basic2.phpt b/tests/lang/compare_objects_basic2.phpt index a2c34d06ad8..7e4786cd289 100644 --- a/tests/lang/compare_objects_basic2.phpt +++ b/tests/lang/compare_objects_basic2.phpt @@ -20,9 +20,5 @@ var_dump($obj1 == $obj2); ===DONE=== --EXPECTF-- Simple test comparing two objects with different compare callback handler - -Notice: Object of class X could not be converted to int in %s on line %d - -Notice: Object of class DateTime could not be converted to int in %s on line %d -bool(true) -===DONE=== \ No newline at end of file +bool(false) +===DONE=== From 167108d73cf7f37efb75bc32cef38ea4602ea229 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Fri, 31 Aug 2012 18:55:43 +0200 Subject: [PATCH 551/641] assert() user message Added 2nd, optional, param to assert. When passed in it will be added to the printed warnings and passed as a 4th param to a callback. PR 150 by Lonny Kapelushnik --- NEWS | 2 + ext/standard/assert.c | 48 +++++++++++++++----- ext/standard/tests/assert/assert04.phpt | 5 +- ext/standard/tests/assert/assert_error1.phpt | 11 +++-- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/NEWS b/NEWS index 28b89baaac3..1ee977974a5 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ PHP NEWS (srgoogleguy, Gustavo) . Implemented FR #60738 (Allow 'set_error_handler' to handle NULL). (Laruence, Nikita Popov) + . Added optional second argument for assert() to specify custom message. Patch + by Lonny Kapelushnik (lonny@lonnylot.com). (Lars) - cURL: . Added support for CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPT_APPEND, diff --git a/ext/standard/assert.c b/ext/standard/assert.c index a2c50d5cb67..0ff3f9b7ef1 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */ } /* }}} */ -/* {{{ proto int assert(string|bool assertion) +/* {{{ proto int assert(string|bool assertion[, string description]) Checks if assertion is false */ PHP_FUNCTION(assert) { zval **assertion; - int val; + int val, description_len = 0; char *myeval = NULL; - char *compiled_string_description; + char *compiled_string_description, *description; if (! ASSERTG(active)) { RETURN_TRUE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &assertion) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s", &assertion, &description, &description_len) == FAILURE) { return; } @@ -167,7 +167,11 @@ PHP_FUNCTION(assert) compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); - php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + if (description_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, description, myeval); + } if (ASSERTG(bail)) { zend_bailout(); } @@ -196,7 +200,7 @@ PHP_FUNCTION(assert) } if (ASSERTG(callback)) { - zval *args[3]; + zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0); zval *retval; int i; uint lineno = zend_get_executed_lineno(TSRMLS_C); @@ -214,19 +218,38 @@ PHP_FUNCTION(assert) ZVAL_FALSE(retval); /* XXX do we want to check for error here? */ - call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + if (description_len == 0) { + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + for (i = 0; i <= 2; i++) { + zval_ptr_dtor(&(args[i])); + } + } else { + MAKE_STD_ZVAL(args[3]); + ZVAL_STRINGL(args[3], SAFE_STRING(description), description_len, 1); - for (i = 0; i <= 2; i++) { - zval_ptr_dtor(&(args[i])); + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 4, args TSRMLS_CC); + for (i = 0; i <= 3; i++) { + zval_ptr_dtor(&(args[i])); + } } + + efree(args); zval_ptr_dtor(&retval); } if (ASSERTG(warning)) { - if (myeval) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + if (description_len == 0) { + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: \"%s\" failed", description, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s failed", description); + } } } @@ -321,3 +344,4 @@ PHP_FUNCTION(assert_options) * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */ + diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0da23186e64..bffadcb97c6 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -15,7 +15,7 @@ assert(1); /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2,3); +assert(2, "failure", 3); /* Wrong parameter count in assert_options */ assert_options(ASSERT_ACTIVE, 0, 2); @@ -36,7 +36,7 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d +Warning: assert() expects at most 2 parameters, 3 given in %s on line %d Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d @@ -45,3 +45,4 @@ Warning: assert_options() expects parameter 1 to be long, %unicode_string_option Warning: assert(): Assertion failed in %s on line %d Warning: assert(): Assertion failed in %s on line %d + diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt index 6211f1c918b..657b411f67e 100644 --- a/ext/standard/tests/assert/assert_error1.phpt +++ b/ext/standard/tests/assert/assert_error1.phpt @@ -20,19 +20,19 @@ function handler($errno, $errstr) { //Wrong number of parameters for assert_options() assert_options(ASSERT_WARNING, 1); -var_dump($rao=assert_options(ASSERT_CALLBACK,"f1",1)); +var_dump($rao = assert_options(ASSERT_CALLBACK, "f1", 1)); //Unknown option for assert_options() -var_dump($rao=assert_options("F1","f1")); +var_dump($rao=assert_options("F1", "f1")); //Wrong number of parameters for assert() $sa="0 != 0"; -var_dump($r2=assert($sa,1)); +var_dump($r2 = assert($sa, "message", 1)); //Catch recoverable error with handler -var_dump($rc=assert('aa=sd+as+safsafasfaçsafçsafç')); +var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç')); --EXPECTF-- Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d NULL @@ -40,5 +40,6 @@ NULL Warning: assert_options() expects parameter 1 to be long, string given in %s on line %d NULL -Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d +Warning: assert() expects at most 2 parameters, 3 given in %s on line %d NULL + From 64c168efc5fad8e9761b23dd02a99f5e5a1b46c2 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Fri, 31 Aug 2012 19:01:57 +0200 Subject: [PATCH 552/641] Tests for the previous assert() with user message --- ext/standard/tests/assert/assert_basic6.phpt | 26 +++++++++++++++++ ext/standard/tests/assert/assert_error2.phpt | 30 ++++++++++++++++++++ ext/standard/tests/assert/assert_error3.phpt | 21 ++++++++++++++ ext/standard/tests/assert/assert_error4.phpt | 21 ++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 ext/standard/tests/assert/assert_basic6.phpt create mode 100644 ext/standard/tests/assert/assert_error2.phpt create mode 100644 ext/standard/tests/assert/assert_error3.phpt create mode 100644 ext/standard/tests/assert/assert_error4.phpt diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt new file mode 100644 index 00000000000..2a73713437e --- /dev/null +++ b/ext/standard/tests/assert/assert_basic6.phpt @@ -0,0 +1,26 @@ +--TEST-- +assert() - basic - Test that bailout works +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 1 +assert.bail = 0 +--FILE-- + Date: Fri, 31 Aug 2012 19:04:53 +0200 Subject: [PATCH 553/641] assert() user message Added 2nd, optional, param to assert. When passed in it will be added to the printed warnings and passed as a 4th param to a callback. PR 150 by Lonny Kapelushnik --- NEWS | 2 + ext/standard/assert.c | 48 +++++++++++++++----- ext/standard/tests/assert/assert04.phpt | 5 +- ext/standard/tests/assert/assert_basic6.phpt | 26 +++++++++++ ext/standard/tests/assert/assert_error1.phpt | 11 +++-- ext/standard/tests/assert/assert_error2.phpt | 30 ++++++++++++ ext/standard/tests/assert/assert_error3.phpt | 21 +++++++++ ext/standard/tests/assert/assert_error4.phpt | 21 +++++++++ 8 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 ext/standard/tests/assert/assert_basic6.phpt create mode 100644 ext/standard/tests/assert/assert_error2.phpt create mode 100644 ext/standard/tests/assert/assert_error3.phpt create mode 100644 ext/standard/tests/assert/assert_error4.phpt diff --git a/NEWS b/NEWS index 97cb3d0fad3..d88aa18783e 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,8 @@ PHP NEWS handler). (Lonny Kapelushnik) . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call constructor). (Stas) + . Added optional second argument for assert() to specify custom message. Patch + by Lonny Kapelushnik (lonny@lonnylot.com). (Lars) - CURL: . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed). diff --git a/ext/standard/assert.c b/ext/standard/assert.c index a2c50d5cb67..0ff3f9b7ef1 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */ } /* }}} */ -/* {{{ proto int assert(string|bool assertion) +/* {{{ proto int assert(string|bool assertion[, string description]) Checks if assertion is false */ PHP_FUNCTION(assert) { zval **assertion; - int val; + int val, description_len = 0; char *myeval = NULL; - char *compiled_string_description; + char *compiled_string_description, *description; if (! ASSERTG(active)) { RETURN_TRUE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &assertion) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s", &assertion, &description, &description_len) == FAILURE) { return; } @@ -167,7 +167,11 @@ PHP_FUNCTION(assert) compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); - php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + if (description_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, description, myeval); + } if (ASSERTG(bail)) { zend_bailout(); } @@ -196,7 +200,7 @@ PHP_FUNCTION(assert) } if (ASSERTG(callback)) { - zval *args[3]; + zval **args = safe_emalloc(description_len == 0 ? 3 : 4, sizeof(zval **), 0); zval *retval; int i; uint lineno = zend_get_executed_lineno(TSRMLS_C); @@ -214,19 +218,38 @@ PHP_FUNCTION(assert) ZVAL_FALSE(retval); /* XXX do we want to check for error here? */ - call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + if (description_len == 0) { + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); + for (i = 0; i <= 2; i++) { + zval_ptr_dtor(&(args[i])); + } + } else { + MAKE_STD_ZVAL(args[3]); + ZVAL_STRINGL(args[3], SAFE_STRING(description), description_len, 1); - for (i = 0; i <= 2; i++) { - zval_ptr_dtor(&(args[i])); + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 4, args TSRMLS_CC); + for (i = 0; i <= 3; i++) { + zval_ptr_dtor(&(args[i])); + } } + + efree(args); zval_ptr_dtor(&retval); } if (ASSERTG(warning)) { - if (myeval) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + if (description_len == 0) { + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion \"%s\" failed", myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Assertion failed"); + if (myeval) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: \"%s\" failed", description, myeval); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s failed", description); + } } } @@ -321,3 +344,4 @@ PHP_FUNCTION(assert_options) * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */ + diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0da23186e64..bffadcb97c6 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -15,7 +15,7 @@ assert(1); /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2,3); +assert(2, "failure", 3); /* Wrong parameter count in assert_options */ assert_options(ASSERT_ACTIVE, 0, 2); @@ -36,7 +36,7 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects exactly 1 parameter, 2 given in %s on line %d +Warning: assert() expects at most 2 parameters, 3 given in %s on line %d Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d @@ -45,3 +45,4 @@ Warning: assert_options() expects parameter 1 to be long, %unicode_string_option Warning: assert(): Assertion failed in %s on line %d Warning: assert(): Assertion failed in %s on line %d + diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt new file mode 100644 index 00000000000..2a73713437e --- /dev/null +++ b/ext/standard/tests/assert/assert_basic6.phpt @@ -0,0 +1,26 @@ +--TEST-- +assert() - basic - Test that bailout works +--INI-- +assert.active = 1 +assert.warning = 1 +assert.callback = f1 +assert.quiet_eval = 1 +assert.bail = 0 +--FILE-- + Date: Sat, 1 Sep 2012 14:17:39 +0800 Subject: [PATCH 554/641] Fixed bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables) The get_zval_ptr_ptr of spl_array handler should act as same as the vm's --- NEWS | 2 ++ ext/spl/spl_array.c | 70 ++++++++++++++++++++----------------- ext/spl/tests/bug62978.phpt | 50 ++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 32 deletions(-) create mode 100644 ext/spl/tests/bug62978.phpt diff --git a/NEWS b/NEWS index a6e05be5685..ae828215f32 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,8 @@ PHP NEWS . Fixed bug (segfault due to retval is not initialized). (Laruence) - SPL: + . Bug #62987 (Assigning to ArrayObject[null][something] overrides all + undefined variables). (Laruence) . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) (Laruence) . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 80ca5be6128..11540decd91 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -312,38 +312,41 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, long index; HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); -/* We cannot get the pointer pointer so we don't allow it here for now - if (check_inherited && intern->fptr_offset_get) { - return zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", NULL, offset); - }*/ - if (!offset) { return &EG(uninitialized_zval_ptr); } if ((type == BP_VAR_W || type == BP_VAR_RW) && (ht->nApplyCount > 0)) { zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); - return &EG(uninitialized_zval_ptr);; + return &EG(error_zval_ptr);; } switch(Z_TYPE_P(offset)) { + case IS_NULL: + Z_STRVAL_P(offset) = ""; + Z_STRLEN_P(offset) = 0; case IS_STRING: if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { - if (type == BP_VAR_W || type == BP_VAR_RW) { - zval *value; - ALLOC_INIT_ZVAL(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); - zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval); - return retval; - } else { - zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); - return &EG(uninitialized_zval_ptr); + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); + case BP_VAR_UNSET: + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + case BP_VAR_W: { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); + } } - } else { - return retval; } - case IS_DOUBLE: + return retval; case IS_RESOURCE: + zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset)); + case IS_DOUBLE: case IS_BOOL: case IS_LONG: if (offset->type == IS_DOUBLE) { @@ -352,23 +355,27 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - if (type == BP_VAR_W || type == BP_VAR_RW) { - zval *value; - ALLOC_INIT_ZVAL(value); - zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), NULL); - zend_hash_index_find(ht, index, (void **) &retval); - return retval; - } else { - zend_error(E_NOTICE, "Undefined offset: %ld", index); - return &EG(uninitialized_zval_ptr); + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE, "Undefined offset: %ld", index); + case BP_VAR_UNSET: + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE, "Undefined offset: %ld", index); + case BP_VAR_W: { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), (void **)&retval); + } } - } else { - return retval; } - break; + return retval; default: zend_error(E_WARNING, "Illegal offset type"); - return &EG(uninitialized_zval_ptr); + return (type == BP_VAR_W || type == BP_VAR_RW) ? + &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr); } } /* }}} */ @@ -664,7 +671,6 @@ SPL_METHOD(Array, offsetSet) spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC); } /* }}} */ - void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt new file mode 100644 index 00000000000..94068d56045 --- /dev/null +++ b/ext/spl/tests/bug62978.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables) +--FILE-- + Date: Sat, 1 Sep 2012 14:37:45 +0800 Subject: [PATCH 555/641] Remove extra blank in notice message, should act as same as vm --- ext/spl/spl_array.c | 14 +++++++------- ext/spl/spl_iterators.c | 2 +- .../tests/arrayObject___construct_basic2.phpt | 4 ++-- .../tests/arrayObject___construct_basic3.phpt | 4 ++-- .../tests/arrayObject___construct_basic4.phpt | 10 +++++----- .../tests/arrayObject___construct_basic5.phpt | 10 +++++----- ext/spl/tests/arrayObject_magicMethods1.phpt | 4 ++-- ext/spl/tests/arrayObject_magicMethods3.phpt | 4 ++-- ext/spl/tests/arrayObject_magicMethods4.phpt | 4 ++-- ext/spl/tests/arrayObject_magicMethods6.phpt | 4 ++-- ext/spl/tests/arrayObject_setFlags_basic1.phpt | 4 ++-- ext/spl/tests/array_001.phpt | 8 ++++---- ext/spl/tests/array_010.phpt | 8 ++++---- ext/spl/tests/bug45622.phpt | 2 +- ext/spl/tests/bug45622b.phpt | 4 ++-- ext/spl/tests/bug54323.phpt | 2 +- ext/spl/tests/bug62978.phpt | 8 ++++---- ext/spl/tests/iterator_044.phpt | 16 ++++++++-------- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 0b3b5a3e54c..3c6b41edbc9 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -323,13 +323,13 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); case BP_VAR_W: { zval *value; ALLOC_INIT_ZVAL(value); @@ -351,13 +351,13 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined offset: %ld", index); + zend_error(E_NOTICE, "Undefined offset: %ld", index); case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval_ptr); break; case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined offset: %ld", index); + zend_error(E_NOTICE, "Undefined offset: %ld", index); case BP_VAR_W: { zval *value; ALLOC_INIT_ZVAL(value); @@ -520,11 +520,11 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval } if (ht == &EG(symbol_table)) { if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } } else { if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) { - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } else { spl_array_object *obj = intern; @@ -570,7 +570,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval return; } if (zend_hash_index_del(ht, index) == FAILURE) { - zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset)); + zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset)); } break; default: diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e5dc030730e..098d7dc1e29 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2820,7 +2820,7 @@ SPL_METHOD(CachingIterator, offsetGet) } if (zend_symtable_find(HASH_OF(intern->u.caching.zcache), arKey, nKeyLength+1, (void**)&value) == FAILURE) { - zend_error(E_NOTICE, "Undefined index: %s", arKey); + zend_error(E_NOTICE, "Undefined index: %s", arKey); return; } diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt index 9ff0e4257a4..bd27c427742 100644 --- a/ext/spl/tests/arrayObject___construct_basic2.phpt +++ b/ext/spl/tests/arrayObject___construct_basic2.phpt @@ -63,7 +63,7 @@ bool(true) Notice: Undefined property: ArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,7 +91,7 @@ bool(true) Notice: Undefined property: MyArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt index 1abd1a1ab12..11a17a6dc46 100644 --- a/ext/spl/tests/arrayObject___construct_basic3.phpt +++ b/ext/spl/tests/arrayObject___construct_basic3.phpt @@ -63,7 +63,7 @@ bool(true) Notice: Undefined property: ArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,7 +91,7 @@ bool(true) Notice: Undefined property: MyArrayObject::$prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt index 80f5e0861e5..b0809de0d4e 100644 --- a/ext/spl/tests/arrayObject___construct_basic4.phpt +++ b/ext/spl/tests/arrayObject___construct_basic4.phpt @@ -61,11 +61,11 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 39 +Notice: Undefined index: prop in %s on line 39 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,9 +91,9 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt index 5368d250a12..8c44ee2ce44 100644 --- a/ext/spl/tests/arrayObject___construct_basic5.phpt +++ b/ext/spl/tests/arrayObject___construct_basic5.phpt @@ -61,11 +61,11 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 39 +Notice: Undefined index: prop in %s on line 39 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: @@ -91,9 +91,9 @@ bool(true) bool(true) - Unset: -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 -Notice: Undefined index: prop in %s on line 40 +Notice: Undefined index: prop in %s on line 40 NULL NULL - After: diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt index b1de4a951e4..ec4812f1079 100644 --- a/ext/spl/tests/arrayObject_magicMethods1.phpt +++ b/ext/spl/tests/arrayObject_magicMethods1.phpt @@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 42 +Notice: Undefined index: nonexistent in %s on line 42 NULL string(11) "new.changed" Original wrapped object: @@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 60 +Notice: Undefined index: nonexistent in %s on line 60 Original wrapped object: object(UsesMagic)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt index 16a6a3b80c5..6231ceabb7f 100644 --- a/ext/spl/tests/arrayObject_magicMethods3.phpt +++ b/ext/spl/tests/arrayObject_magicMethods3.phpt @@ -102,7 +102,7 @@ object(ArrayObject)#2 (1) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 42 +Notice: Undefined index: nonexistent in %s on line 42 NULL string(11) "new.changed" Original wrapped object: @@ -171,7 +171,7 @@ object(ArrayObject)#2 (1) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 60 +Notice: Undefined index: nonexistent in %s on line 60 Original wrapped object: object(UsesMagic)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt index 3c9f78781ad..9580dc5ae72 100644 --- a/ext/spl/tests/arrayObject_magicMethods4.phpt +++ b/ext/spl/tests/arrayObject_magicMethods4.phpt @@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 45 +Notice: Undefined index: nonexistent in %s on line 45 NULL string(11) "new.changed" Original wrapped object: @@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 63 +Notice: Undefined index: nonexistent in %s on line 63 Original wrapped object: object(C)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt index 45a0e4a768d..b43f56c2b06 100644 --- a/ext/spl/tests/arrayObject_magicMethods6.phpt +++ b/ext/spl/tests/arrayObject_magicMethods6.phpt @@ -107,7 +107,7 @@ object(UsesMagic)#2 (2) { --> Read existent, non-existent and dynamic: string(7) "changed" -Notice: Undefined index: nonexistent in %s on line 45 +Notice: Undefined index: nonexistent in %s on line 45 NULL string(11) "new.changed" Original wrapped object: @@ -180,7 +180,7 @@ object(UsesMagic)#2 (2) { --> Unset existent, non-existent and dynamic: -Notice: Undefined index: nonexistent in %s on line 63 +Notice: Undefined index: nonexistent in %s on line 63 Original wrapped object: object(C)#1 (3) { ["b"]=> diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt index d8d4f2e96d5..391b0eeae71 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt @@ -44,8 +44,8 @@ string(21) "array element.changed" --> Remove the array element and try access again: bool(false) -Notice: Undefined index: p in %s on line 10 +Notice: Undefined index: p in %s on line 10 NULL -Notice: Undefined index: p in %s on line 12 +Notice: Undefined index: p in %s on line 12 string(8) ".changed" diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt index d9fb57c4ceb..b55fcba1fdc 100755 --- a/ext/spl/tests/array_001.phpt +++ b/ext/spl/tests/array_001.phpt @@ -79,15 +79,15 @@ object(ArrayObject)#%d (1) { } int(0) -Notice: Undefined offset: 6 in %sarray_001.php on line %d +Notice: Undefined offset: 6 in %sarray_001.php on line %d NULL -Notice: Undefined index: b in %sarray_001.php on line %d +Notice: Undefined index: b in %sarray_001.php on line %d NULL -Notice: Undefined offset: 7 in %sarray_001.php on line %d +Notice: Undefined offset: 7 in %sarray_001.php on line %d -Notice: Undefined index: c in %sarray_001.php on line %d +Notice: Undefined index: c in %sarray_001.php on line %d object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(2) { diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt index 6b331e4b516..d2f3de7f6dc 100755 --- a/ext/spl/tests/array_010.phpt +++ b/ext/spl/tests/array_010.phpt @@ -94,10 +94,10 @@ int(1) string(3) "3rd" int(4) -Notice: Undefined index: 5th in %sarray_010.php on line %d +Notice: Undefined index: 5th in %sarray_010.php on line %d NULL -Notice: Undefined offset: 6 in %sarray_010.php on line %d +Notice: Undefined offset: 6 in %sarray_010.php on line %d NULL ===offsetSet=== WRITE 1 @@ -128,9 +128,9 @@ array(6) { string(9) "changed 6" } -Notice: Undefined offset: 7 in %sarray_010.php on line %d +Notice: Undefined offset: 7 in %sarray_010.php on line %d -Notice: Undefined index: 8th in %sarray_010.php on line %d +Notice: Undefined index: 8th in %sarray_010.php on line %d array(4) { [0]=> string(3) "1st" diff --git a/ext/spl/tests/bug45622.phpt b/ext/spl/tests/bug45622.phpt index c47b62cbdfd..a8fe2c46414 100644 --- a/ext/spl/tests/bug45622.phpt +++ b/ext/spl/tests/bug45622.phpt @@ -42,7 +42,7 @@ bool(true) --> Remove the array element and try access again: bool(false) -Notice: Undefined index: p in %s on line %d +Notice: Undefined index: p in %s on line %d NULL --> Re-add the real property: diff --git a/ext/spl/tests/bug45622b.phpt b/ext/spl/tests/bug45622b.phpt index 9d49392111c..f101a8459da 100644 --- a/ext/spl/tests/bug45622b.phpt +++ b/ext/spl/tests/bug45622b.phpt @@ -25,9 +25,9 @@ isset($ao->prop4); --EXPECTF-- Doesn't trigger __get. -Notice: Undefined index: prop1 in %s on line 11 +Notice: Undefined index: prop1 in %s on line 11 Doesn't trigger __set. Doesn't trigger __unset. -Notice: Undefined index: prop3 in %s on line 17 +Notice: Undefined index: prop3 in %s on line 17 Shouldn't trigger __isset. \ No newline at end of file diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/bug54323.phpt index 35a16a4637d..df6416a0f18 100644 --- a/ext/spl/tests/bug54323.phpt +++ b/ext/spl/tests/bug54323.phpt @@ -19,6 +19,6 @@ function testAccess($c, $ao) { --EXPECTF-- Notice: Undefined property: C::$prop in %sbug54323.php on line 14 -Notice: Undefined index: prop in %sbug54323.php on line 14 +Notice: Undefined index: prop in %sbug54323.php on line 14 NULL NULL diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt index 94068d56045..0d91609f887 100644 --- a/ext/spl/tests/bug62978.phpt +++ b/ext/spl/tests/bug62978.phpt @@ -25,7 +25,7 @@ var_dump($a[$fp]); fclose($fp); --EXPECTF-- -Notice: Undefined index: epic_magic in %sbug62978.php on line %d +Notice: Undefined index: epic_magic in %sbug62978.php on line %d NULL Notice: Undefined index: epic_magic in %sbug62978.php on line %d @@ -34,17 +34,17 @@ NULL Notice: Undefined variable: c in %sbug62978.php on line %d NULL -Notice: Undefined index: epic_magic in %sbug62978.php on line %d +Notice: Undefined index: epic_magic in %sbug62978.php on line %d NULL Notice: Undefined index: epic_magic in %sbug62978.php on line %d NULL -Notice: Undefined index: epic_magic in %sbug62978.php on line %d +Notice: Undefined index: epic_magic in %sbug62978.php on line %d NULL bool(false) Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d -Notice: Undefined offset: %d in %sbug62978.php on line %d +Notice: Undefined offset: %d in %sbug62978.php on line %d NULL diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt index 6d255311753..1271ccaa649 100755 --- a/ext/spl/tests/iterator_044.phpt +++ b/ext/spl/tests/iterator_044.phpt @@ -81,7 +81,7 @@ NULL int(0) bool(false) -Notice: Undefined index: 0 in %siterator_044.php on line %d +Notice: Undefined index: 0 in %siterator_044.php on line %d NULL ===1=== object(stdClass)#%d (0) { @@ -97,31 +97,31 @@ object(MyFoo)#%d (0) { } bool(false) -Notice: Undefined index: foo in %siterator_044.php on line %d +Notice: Undefined index: foo in %siterator_044.php on line %d NULL ===3=== NULL bool(false) -Notice: Undefined index: in %siterator_044.php on line %d +Notice: Undefined index: in %siterator_044.php on line %d NULL ===4=== int(2) bool(false) -Notice: Undefined index: 2 in %siterator_044.php on line %d +Notice: Undefined index: 2 in %siterator_044.php on line %d NULL ===5=== string(3) "foo" bool(false) -Notice: Undefined index: foo in %siterator_044.php on line %d +Notice: Undefined index: foo in %siterator_044.php on line %d NULL ===6=== int(3) bool(false) -Notice: Undefined index: 3 in %siterator_044.php on line %d +Notice: Undefined index: 3 in %siterator_044.php on line %d NULL ===FILL=== ===0=== @@ -146,7 +146,7 @@ int(1) NULL bool(false) -Notice: Undefined index: in %siterator_044.php on line %d +Notice: Undefined index: in %siterator_044.php on line %d NULL ===4=== int(2) @@ -160,6 +160,6 @@ int(1) int(3) bool(false) -Notice: Undefined index: 3 in %siterator_044.php on line %d +Notice: Undefined index: 3 in %siterator_044.php on line %d NULL ===DONE=== From 1b5b839312b2ec1f6d38f826a592edf83188fc1e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 1 Sep 2012 20:10:12 +0200 Subject: [PATCH 556/641] Drop obsolete test --- tests/lang/foreachLoop.007.phpt | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tests/lang/foreachLoop.007.phpt diff --git a/tests/lang/foreachLoop.007.phpt b/tests/lang/foreachLoop.007.phpt deleted file mode 100644 index 269286d0242..00000000000 --- a/tests/lang/foreachLoop.007.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -Foreach loop tests - error case: reference to constant array. ---FILE-- - ---EXPECTF-- -Fatal error: Cannot create references to elements of a temporary array expression in %sforeachLoop.007.php on line %d From dffffdeb3df0b05e79213e52667f3061dc9d635e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 1 Sep 2012 20:31:40 +0200 Subject: [PATCH 557/641] Fix leak when yielding array as key The code was copy-pasted and I forgot to change OP1 to OP2 in that one place. --- Zend/tests/generators/yield_array_key.phpt | 18 ++++++++++++++++++ Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 16 ++++++++-------- 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 Zend/tests/generators/yield_array_key.phpt diff --git a/Zend/tests/generators/yield_array_key.phpt b/Zend/tests/generators/yield_array_key.phpt new file mode 100644 index 00000000000..5afba00de83 --- /dev/null +++ b/Zend/tests/generators/yield_array_key.phpt @@ -0,0 +1,18 @@ +--TEST-- +Array keys can be yielded from generators +--FILE-- + 1; +} + +$gen = gen(); +var_dump($gen->key()); +var_dump($gen->current()); + +?> +--EXPECT-- +array(0) { +} +int(1) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ffd81b03785..f683ff29727 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5511,7 +5511,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!IS_OP1_TMP_FREE()) { + if (!IS_OP2_TMP_FREE()) { zval_copy_ctor(copy); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index b0e05b1296a..f8a89050400 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -5005,7 +5005,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!0) { + if (!1) { zval_copy_ctor(copy); } @@ -9553,7 +9553,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!1) { + if (!0) { zval_copy_ctor(copy); } @@ -11266,7 +11266,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!1) { + if (!0) { zval_copy_ctor(copy); } @@ -11846,7 +11846,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!1) { + if (!0) { zval_copy_ctor(copy); } @@ -12537,7 +12537,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!1) { + if (!0) { zval_copy_ctor(copy); } @@ -18543,7 +18543,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!0) { + if (!1) { zval_copy_ctor(copy); } @@ -27081,7 +27081,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!0) { + if (!1) { zval_copy_ctor(copy); } @@ -35600,7 +35600,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG INIT_PZVAL_COPY(copy, key); /* Temporary variables don't need ctor copying */ - if (!0) { + if (!1) { zval_copy_ctor(copy); } From f7d51df5c65e47a5ef8a6d81f2e13044dd926492 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 1 Sep 2012 16:55:51 -0700 Subject: [PATCH 558/641] fix NEWS --- NEWS | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 62e203849ad..60bb2354500 100644 --- a/NEWS +++ b/NEWS @@ -2,11 +2,21 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.8 +- Core: + . Added optional second argument for assert() to specify custom message. Patch + by Lonny Kapelushnik (lonny@lonnylot.com). (Lars) + . Fixed bug #62976 (Notice: could not be converted to int when comparing + some builtin classes). (Laruence) + . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" + Windows registry). (aserbulov at parallels dot com) + +- SPL: + . Bug #62987 (Assigning to ArrayObject[null][something] overrides all + undefined variables). (Laruence) + ?? ??? 2012, PHP 5.4.7 - Core: - . Fixed bug #62976 (Notice: could not be converted to int when comparing - some builtin classes). (Laruence) . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) . Fixed bug #62844 (parse_url() does not recognize //). (Andrew Faulds). . Fixed bug #62829 (stdint.h included on platform where HAVE_STDINT_H is not @@ -25,8 +35,6 @@ PHP NEWS handler). (Lonny Kapelushnik) . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call constructor). (Stas) - . Added optional second argument for assert() to specify custom message. Patch - by Lonny Kapelushnik (lonny@lonnylot.com). (Lars) - CURL: . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed). @@ -64,8 +72,6 @@ PHP NEWS when close handler call exit). (Laruence) - SPL: - . Bug #62987 (Assigning to ArrayObject[null][something] overrides all - undefined variables). (Laruence) . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) (Laruence) . Implemented FR #62840 (Add sort flag to ArrayObject::ksort). (Laruence) From 4e84f725544153d5b6fff99adc274d11f79b9079 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 2 Sep 2012 13:15:23 +0800 Subject: [PATCH 559/641] Fix test failed due to new Token T_YIELD --- ext/tokenizer/tests/bug60097.phpt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/tokenizer/tests/bug60097.phpt b/ext/tokenizer/tests/bug60097.phpt index e9f1bd6f6c9..2116866c934 100644 --- a/ext/tokenizer/tests/bug60097.phpt +++ b/ext/tokenizer/tests/bug60097.phpt @@ -17,7 +17,7 @@ array(14) { [0]=> array(3) { [0]=> - int(373) + int(374) [1]=> string(6) " array(3) { [0]=> - int(377) + int(378) [1]=> string(8) "<< array(3) { [0]=> - int(380) + int(381) [1]=> string(1) "{" [2]=> @@ -46,7 +46,7 @@ array(14) { [3]=> array(3) { [0]=> - int(309) + int(310) [1]=> string(2) "$s" [2]=> @@ -57,7 +57,7 @@ array(14) { [5]=> array(3) { [0]=> - int(377) + int(378) [1]=> string(8) "<< array(3) { [0]=> - int(378) + int(379) [1]=> string(4) "DOC2" [2]=> @@ -76,7 +76,7 @@ array(14) { [7]=> array(3) { [0]=> - int(376) + int(377) [1]=> string(1) " " @@ -90,7 +90,7 @@ array(14) { [10]=> array(3) { [0]=> - int(314) + int(315) [1]=> string(1) " " @@ -100,7 +100,7 @@ array(14) { [11]=> array(3) { [0]=> - int(378) + int(379) [1]=> string(4) "DOC1" [2]=> @@ -111,7 +111,7 @@ array(14) { [13]=> array(3) { [0]=> - int(376) + int(377) [1]=> string(1) " " From e212de4a4492cd9dce8e45133604aa87083a0a92 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 2 Sep 2012 08:01:18 +0200 Subject: [PATCH 560/641] Initializing optional argument description in assert() --- ext/standard/assert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 0ff3f9b7ef1..15fbefd51ce 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -143,7 +143,7 @@ PHP_FUNCTION(assert) zval **assertion; int val, description_len = 0; char *myeval = NULL; - char *compiled_string_description, *description; + char *compiled_string_description, *description = NULL; if (! ASSERTG(active)) { RETURN_TRUE; From 89948c7fbe487e5d75f7b02fe0c29238f556f341 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 2 Sep 2012 08:01:18 +0200 Subject: [PATCH 561/641] Initializing optional argument description in assert() --- ext/standard/assert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 0ff3f9b7ef1..15fbefd51ce 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -143,7 +143,7 @@ PHP_FUNCTION(assert) zval **assertion; int val, description_len = 0; char *myeval = NULL; - char *compiled_string_description, *description; + char *compiled_string_description, *description = NULL; if (! ASSERTG(active)) { RETURN_TRUE; From 069c4486234ce70a6cb2e9b0adb9066f1f2bf343 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 2 Sep 2012 16:52:53 +0800 Subject: [PATCH 562/641] folder --- Zend/zend_closures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6f2ded37539..c7527b4ff97 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -78,7 +78,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ /* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] ) Create a closure from another one and bind to another object and scope */ -ZEND_METHOD(Closure, bind) /* {{{ */ +ZEND_METHOD(Closure, bind) { zval *newthis, *zclosure, *scope_arg = NULL; zend_closure *closure; From 133f610bb18831a6d64061cd6e4e7f7779bf1581 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 2 Sep 2012 14:52:05 +0200 Subject: [PATCH 563/641] Allow null as a default value for length in mb_substr() and mb_strcut() --- NEWS | 4 ++++ ext/mbstring/mbstring.c | 16 ++++++++++++---- .../tests/mb_str_functions_opt-parameter.phpt | 2 -- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 60bb2354500..836cf971c0d 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,10 @@ PHP NEWS . Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables). (Laruence) +- mbstring: + . Allow passing null as a default value to mb_substr() and mb_strcut(). Patch + by Alexander Moskaliov via GitHub PR #133. (Lars) + ?? ??? 2012, PHP 5.4.7 - Core: diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 0d2b53a7ca9..76654edbf89 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr) char *str, *encoding; long from, len; int mblen, str_len, encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", &str, &str_len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr) string.val = (unsigned char *)str; string.len = str_len; - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = str_len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* measures length */ @@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut) char *encoding; long from, len; int encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; mbfl_string_init(&string); string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut) } } - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = string.len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* if "from" position is negative, count start position from the end diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt index e4a235df308..5fb642f9b2e 100644 --- a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt +++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt @@ -28,5 +28,3 @@ baz baz foo ==DONE== ---XFAIL-- -mb functions fail to allow null instead of actual value From 352a1956b60059f9792cac840d57b184c7305667 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 2 Sep 2012 14:52:05 +0200 Subject: [PATCH 564/641] Allow null as a default value for length in mb_substr() and mb_strcut() --- ext/mbstring/mbstring.c | 16 +++++++--- .../tests/mb_str_functions_opt-parameter.phpt | 30 +++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 ext/mbstring/tests/mb_str_functions_opt-parameter.phpt diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 47f5fa4defa..0861fa64812 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr) char *str, *encoding; long from, len; int mblen, str_len, encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", &str, &str_len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr) string.val = (unsigned char *)str; string.len = str_len; - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = str_len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* measures length */ @@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut) char *encoding; long from, len; int encoding_len; + zval **z_len = NULL; mbfl_string string, result, *ret; mbfl_string_init(&string); string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut) } } - if (argc < 3) { + if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = string.len; + } else { + convert_to_long_ex(z_len); + len = Z_LVAL_PP(z_len); } /* if "from" position is negative, count start position from the end diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt new file mode 100644 index 00000000000..5fb642f9b2e --- /dev/null +++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt @@ -0,0 +1,30 @@ +--TEST-- +Optional long parameter might be null +--FILE-- + +==DONE== +--EXPECT-- +1 +2 +1 +2 +barbaz +baz +barbaz +baz +baz +baz +foo +==DONE== From ad0da9ae60c8ed4c4331346fc6bf8343374049c9 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Sun, 2 Sep 2012 23:29:56 +0800 Subject: [PATCH 565/641] Implemented ReflectionFunction::isGenerator() --- ext/reflection/php_reflection.c | 9 ++++ .../ReflectionFunction_isGenerator_basic.phpt | 52 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7c9981924de..deabcbe7a43 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3086,6 +3086,14 @@ ZEND_METHOD(reflection_function, isDeprecated) } /* }}} */ +/* {{{ proto public bool ReflectionFunction::isGenerator() + Returns whether this function is a generator */ +ZEND_METHOD(reflection_function, isGenerator) +{ + _function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_GENERATOR); +} +/* }}} */ + /* {{{ proto public bool ReflectionFunction::inNamespace() Returns whether this function is defined in namespace */ ZEND_METHOD(reflection_function, inNamespace) @@ -5696,6 +5704,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = { ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0) + ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0) ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0) diff --git a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt new file mode 100644 index 00000000000..c4889b12bc5 --- /dev/null +++ b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt @@ -0,0 +1,52 @@ +--TEST-- +ReflectionFunction::isGenerator() +--FILE-- +isGenerator()); + +$rf2 = new ReflectionFunction($closure2); +var_dump($rf2->isGenerator()); + +function func1() { + return 'func1'; +} + +function func2() { + yield 'func2'; +} + +$rf1 = new ReflectionFunction('func1'); +var_dump($rf1->isGenerator()); + +$rf2 = new ReflectionFunction('func2'); +var_dump($rf2->isGenerator()); + + +class Foo { + public function f1() { + } + + public function f2() { + yield; + } +} + +$rc = new ReflectionClass('Foo'); +foreach($rc->getMethods() as $m) { + var_dump($m->isGenerator()); +} +?> +--EXPECTF-- +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) From a26390ef0c22be3637795d9b5ab1c445e1d3f847 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Sun, 2 Sep 2012 22:10:23 +0200 Subject: [PATCH 566/641] Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty string or false --- NEWS | 4 ++++ ext/filter/filter_private.h | 6 ++++-- ext/filter/logical_filters.c | 7 +++++-- ext/filter/tests/bug49510.phpt | 36 ++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 ext/filter/tests/bug49510.phpt diff --git a/NEWS b/NEWS index 836cf971c0d..1dd3e0d991f 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Allow passing null as a default value to mb_substr() and mb_strcut(). Patch by Alexander Moskaliov via GitHub PR #133. (Lars) +- Filter extension: + . Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty + string or false. (Lars) + ?? ??? 2012, PHP 5.4.7 - Core: diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index daa688b4acf..2ec2f62fae7 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -99,12 +99,14 @@ } \ return; \ -#define PHP_FILTER_TRIM_DEFAULT(p, len) { \ +#define PHP_FILTER_TRIM_DEFAULT(p, len) PHP_FILTER_TRIM_DEFAULT_EX(p, len, 1); + +#define PHP_FILTER_TRIM_DEFAULT_EX(p, len, return_if_empty) { \ while ((len > 0) && (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\v' || *p == '\n')) { \ p++; \ len--; \ } \ - if (len < 1) { \ + if (len < 1 && return_if_empty) { \ RETURN_VALIDATION_FAILED \ } \ while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \ diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 5c3811ab255..4de6b83e00f 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -235,12 +235,15 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int len = Z_STRLEN_P(value); int ret; - PHP_FILTER_TRIM_DEFAULT(str, len); + PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); /* returns true for "1", "true", "on" and "yes" * returns false for "0", "false", "off", "no", and "" * null otherwise. */ switch (len) { + case 0: + ret = 0; + break; case 1: if (*str == '1') { ret = 1; @@ -286,7 +289,7 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ ret = -1; } - if (ret == -1) { + if (ret == -1) { RETURN_VALIDATION_FAILED } else { zval_dtor(value); diff --git a/ext/filter/tests/bug49510.phpt b/ext/filter/tests/bug49510.phpt new file mode 100644 index 00000000000..3f365cc4312 --- /dev/null +++ b/ext/filter/tests/bug49510.phpt @@ -0,0 +1,36 @@ +--TEST-- +#49510 boolean validation fails with FILTER_NULL_ON_FAILURE +--FILE-- + +==DONE== +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +NULL +==DONE== From 4cca6241e03f0abd442fd867f397b14b3be9d0bd Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Sep 2012 11:38:08 +0400 Subject: [PATCH 567/641] Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) --- ext/soap/tests/bugs/bug50997.phpt | 16 +++++++++ ext/soap/tests/bugs/bug50997.wsdl | 54 +++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 ext/soap/tests/bugs/bug50997.phpt create mode 100644 ext/soap/tests/bugs/bug50997.wsdl diff --git a/ext/soap/tests/bugs/bug50997.phpt b/ext/soap/tests/bugs/bug50997.phpt new file mode 100644 index 00000000000..0508aaccdcb --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) +--SKIPIF-- + +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- + 1, 'exceptions'=>0)); +$params = array('code'=>'foo'); +$soapClient->newOperation($params); +echo $soapClient->__getLastRequest(); +?> +--EXPECT-- + +foo diff --git a/ext/soap/tests/bugs/bug50997.wsdl b/ext/soap/tests/bugs/bug50997.wsdl new file mode 100644 index 00000000000..16c6d367523 --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.wsdl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 7e816c0921b4fee488d47b8a060ef820a7c46e38 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Sep 2012 11:46:47 +0400 Subject: [PATCH 568/641] Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) --- ext/soap/tests/bugs/bug50997.phpt | 16 +++++++++ ext/soap/tests/bugs/bug50997.wsdl | 54 +++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 ext/soap/tests/bugs/bug50997.phpt create mode 100644 ext/soap/tests/bugs/bug50997.wsdl diff --git a/ext/soap/tests/bugs/bug50997.phpt b/ext/soap/tests/bugs/bug50997.phpt new file mode 100644 index 00000000000..0508aaccdcb --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) +--SKIPIF-- + +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- + 1, 'exceptions'=>0)); +$params = array('code'=>'foo'); +$soapClient->newOperation($params); +echo $soapClient->__getLastRequest(); +?> +--EXPECT-- + +foo diff --git a/ext/soap/tests/bugs/bug50997.wsdl b/ext/soap/tests/bugs/bug50997.wsdl new file mode 100644 index 00000000000..16c6d367523 --- /dev/null +++ b/ext/soap/tests/bugs/bug50997.wsdl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 485c09a3765b900aea182ddd2dded2286fb0749a Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Sep 2012 11:49:58 +0400 Subject: [PATCH 569/641] Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). --- NEWS | 4 ++++ ext/soap/php_encoding.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ae828215f32..a0e8a686421 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,10 @@ PHP NEWS - Session: . Fixed bug (segfault due to retval is not initialized). (Laruence) +- SOAP + . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). + (Dmitry) + - SPL: . Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables). (Laruence) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 97a79a349e7..ee28d99dc05 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1834,11 +1834,12 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * zend_hash_internal_pointer_reset_ex(model->u.content, &pos); while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) { - if (!model_to_xml_object(node, *tmp, object, style, (*tmp)->min_occurs > 0 TSRMLS_CC)) { - if ((*tmp)->min_occurs > 0) { + if (!model_to_xml_object(node, *tmp, object, style, strict && ((*tmp)->min_occurs > 0) TSRMLS_CC)) { + if (!strict || (*tmp)->min_occurs > 0) { return 0; } } + strict = 1; zend_hash_move_forward_ex(model->u.content, &pos); } return 1; @@ -1861,7 +1862,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * return ret; } case XSD_CONTENT_GROUP: { - return model_to_xml_object(node, model->u.group->model, object, style, model->min_occurs > 0 TSRMLS_CC); + return model_to_xml_object(node, model->u.group->model, object, style, strict && model->min_occurs > 0 TSRMLS_CC); } default: break; From 0ab27c35a47901173f22d9e50ca75de0263c45a5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Sep 2012 11:51:08 +0400 Subject: [PATCH 570/641] Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 1dd3e0d991f..6d79a949191 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ PHP NEWS . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" Windows registry). (aserbulov at parallels dot com) +- SOAP + . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). + (Dmitry) + - SPL: . Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables). (Laruence) From 2659f5e88e9e76594aff0d0c27500514dfef2cb2 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Sep 2012 11:52:42 +0400 Subject: [PATCH 571/641] Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) --- ext/soap/php_encoding.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 84d603b5910..5addec4ff2d 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1818,11 +1818,12 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * zend_hash_internal_pointer_reset_ex(model->u.content, &pos); while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) { - if (!model_to_xml_object(node, *tmp, object, style, (*tmp)->min_occurs > 0 TSRMLS_CC)) { - if ((*tmp)->min_occurs > 0) { + if (!model_to_xml_object(node, *tmp, object, style, strict && ((*tmp)->min_occurs > 0) TSRMLS_CC)) { + if (!strict || (*tmp)->min_occurs > 0) { return 0; } } + strict = 1; zend_hash_move_forward_ex(model->u.content, &pos); } return 1; @@ -1845,7 +1846,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * return ret; } case XSD_CONTENT_GROUP: { - return model_to_xml_object(node, model->u.group->model, object, style, model->min_occurs > 0 TSRMLS_CC); + return model_to_xml_object(node, model->u.group->model, object, style, strict && model->min_occurs > 0 TSRMLS_CC); } default: break; From ff0aa24054c166de64993ef608ccbb8486c64ba5 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Mon, 3 Sep 2012 13:37:34 +0200 Subject: [PATCH 572/641] forked two tests for windows * bug55544.phpt - VT vs. EXT at the start of the data block, but the data can still be decoded correctly * bug_52944.phpt works with the corrupted data and has some different out Most likely the ASM optimization under windows is responsible for this behaviour. --- ext/zlib/tests/bug55544-win.phpt | Bin 0 -> 427 bytes ext/zlib/tests/bug55544.phpt | Bin 361 -> 430 bytes ext/zlib/tests/bug_52944-win.phpt | 161 ++++++++++++++++++++++++++++++ ext/zlib/tests/bug_52944.phpt | 5 +- 4 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 ext/zlib/tests/bug55544-win.phpt create mode 100644 ext/zlib/tests/bug_52944-win.phpt diff --git a/ext/zlib/tests/bug55544-win.phpt b/ext/zlib/tests/bug55544-win.phpt new file mode 100644 index 0000000000000000000000000000000000000000..03fd6b1c9084ea195235f55523c46482c76e8338 GIT binary patch literal 427 zcmZ{gK~94}6own)LdQe+#6`h$OcUEpD>ju*EzwXSq`D&%C``l|!a%S!p1`Ho@E|5$ zz~ea7#=7xs|M$KB{~yLKaa@eiWf{Y9x7+P>K;?5UUL`&Y( ziv(6FouBfu$jZVC_+yqwLQu{$gt2pN+U8iEJRf99hN7n;VzuU_+z+ErRccnzfaeg> zNL9oG%@nPV=mJzx&P9={_Qdw4P7B&CIMd)rhvuDWH8prf`@e|H!9rdM;4EF%{0kaf zNPE*VrS~S)-j+16W|E$`uI&vCgV?S|EMqz{tt&lV(M)cP%^R{U7bF~% zgev_Xb8>GJqkiY%>t16$2cI9ijrWtcubuk(TAq;Mh}=4I%iv5tr@({-Jftk{!P;cz O=gS@pgCNSb8u|u`(}e~A literal 0 HcmV?d00001 diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt index ca4214a46fbb1c7a30c92cec6961f9f224036735..a0d22f4fcebf4846da6781f424f87821626de5ea 100644 GIT binary patch delta 78 zcmaFKw2pZ~w@YT4f<|#^QgKOEr=Pl}LNym>N@l8t hQgL=>fkIw>i9%X_kwST9UP^v>v67}WSM9{E`vAad81(=E delta 9 QcmZ3-{E}%x_rweL02S8+_W%F@ diff --git a/ext/zlib/tests/bug_52944-win.phpt b/ext/zlib/tests/bug_52944-win.phpt new file mode 100644 index 00000000000..e3919951bce --- /dev/null +++ b/ext/zlib/tests/bug_52944-win.phpt @@ -0,0 +1,161 @@ +--TEST-- +Bug #52944 (segfault with zlib filter and corrupted data) +--SKIPIF-- + + = 1.2.7 on windows'); +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip not for windows"); } --INI-- allow_url_fopen=1 From 72473962a9722ee0a8107909f32c145d3b44f906 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 5 Sep 2012 09:50:55 +0400 Subject: [PATCH 573/641] Fixed bug #62991 (Segfault with generator and closure) --- Zend/tests/bug62991.phpt | 50 ++++++++++++++++++++++++++++++++++++++++ Zend/zend_generators.c | 14 +++++++++++ 2 files changed, 64 insertions(+) create mode 100644 Zend/tests/bug62991.phpt diff --git a/Zend/tests/bug62991.phpt b/Zend/tests/bug62991.phpt new file mode 100644 index 00000000000..cb4ff933591 --- /dev/null +++ b/Zend/tests/bug62991.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #62991 (Segfault with generator and closure) +--FILE-- + +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +okey diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index c22d745bc36..3d4fdd2c5ff 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -154,6 +154,12 @@ void zend_generator_close(zend_generator *generator, zend_bool finished_executio efree(prev_execute_data); } + /* Free a clone of closure */ + if (op_array->fn_flags & ZEND_ACC_CLOSURE) { + destroy_op_array(op_array TSRMLS_CC); + efree(op_array); + } + efree(execute_data); generator->execute_data = NULL; } @@ -358,6 +364,14 @@ zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ zval *return_value; zend_generator *generator; + /* Create a clone of closure, because it may be destroyed */ + if (op_array->fn_flags & ZEND_ACC_CLOSURE) { + zend_op_array *op_array_copy = (zend_op_array*)emalloc(sizeof(zend_op_array)); + *op_array_copy = *op_array; + function_add_ref(op_array_copy); + op_array = op_array_copy; + } + /* Create new execution context. We have to back up and restore * EG(current_execute_data) and EG(opline_ptr) here because the function * modifies it. */ From 6c0508f8d5d5a62adb37a76bc682c94540199ee3 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 5 Sep 2012 09:58:22 +0400 Subject: [PATCH 574/641] Fixed bug #62907 (Double free when use traits) --- NEWS | 1 + Zend/tests/bug62907.phpt | 2 -- Zend/zend_compile.c | 7 ++++--- Zend/zend_compile.h | 2 ++ Zend/zend_opcode.c | 14 +++++++++++++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e09664a1a49..22d3f664e23 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ PHP NEWS some builtin classes). (Laruence) . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" Windows registry). (aserbulov at parallels dot com) + . Fixed bug #62907 (Double free when use traits). (Dmitry) - SOAP . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). diff --git a/Zend/tests/bug62907.phpt b/Zend/tests/bug62907.phpt index c519a542952..53ab17cb325 100644 --- a/Zend/tests/bug62907.phpt +++ b/Zend/tests/bug62907.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #62907 (Double free when use traits) ---XFAIL-- -bug is not fixed yet --FILE-- trait_method->method_name, aliases[i]->trait_method->mname_len, fn->common.function_name, fnname_len) == 0)) { fn_copy = *fn; function_add_ref(&fn_copy); - /* this function_name is never destroyed, because its refcount - greater than 1 and classes are always destoyed before the - traits they use */ + /* this function_name is never destroyed, because ZEND_ACC_ALIAS + flag is set */ fn_copy.common.function_name = aliases[i]->alias; + fn_copy.common.fn_flags |= ZEND_ACC_ALIAS; /* if it is 0, no modifieres has been changed */ if (aliases[i]->modifiers) { @@ -3914,6 +3914,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, /* is not in hashtable, thus, function is not to be excluded */ fn_copy = *fn; function_add_ref(&fn_copy); + fn_copy.common.fn_flags |= ZEND_ACC_ALIAS; /* apply aliases which are not qualified by a class name, or which have not * alias name, just setting visibility */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index f164122785b..79ace0c3c3e 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -207,6 +207,8 @@ typedef struct _zend_try_catch_element { #define ZEND_ACC_RETURN_REFERENCE 0x4000000 #define ZEND_ACC_DONE_PASS_TWO 0x8000000 +#define ZEND_ACC_ALIAS 0x10000000 + char *zend_visibility_string(zend_uint fn_flags); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 19fd71e763d..6eab0ae309a 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -267,6 +267,15 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce) } } +static int zend_clear_trait_method_name(zend_op_array *op_array TSRMLS_DC) +{ + if (op_array->function_name && (op_array->fn_flags & ZEND_ACC_ALIAS) == 0) { + efree(op_array->function_name); + op_array->function_name = NULL; + } + return 0; +} + ZEND_API void destroy_zend_class(zend_class_entry **pce) { zend_class_entry *ce = *pce; @@ -298,6 +307,9 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce) } zend_hash_destroy(&ce->properties_info); str_efree(ce->name); + if ((ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { + zend_hash_apply(&ce->function_table, (apply_func_t)zend_clear_trait_method_name TSRMLS_CC); + } zend_hash_destroy(&ce->function_table); zend_hash_destroy(&ce->constants_table); if (ce->num_interfaces > 0 && ce->interfaces) { @@ -387,7 +399,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) } efree(op_array->opcodes); - if (op_array->function_name) { + if (op_array->function_name && (op_array->fn_flags & ZEND_ACC_ALIAS) == 0) { efree((char*)op_array->function_name); } if (op_array->doc_comment) { From 4a7d1b4ed8987188c3a628601ad9a027bf88b7eb Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 5 Sep 2012 12:53:29 +0200 Subject: [PATCH 575/641] - fix build, declarations must be 1st in a contextgit checkout -f master --- Zend/zend_generators.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 3d4fdd2c5ff..83025eacd16 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -363,6 +363,9 @@ zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ { zval *return_value; zend_generator *generator; + zend_execute_data *current_execute_data; + zend_op **opline_ptr; + zend_execute_data *execute_data; /* Create a clone of closure, because it may be destroyed */ if (op_array->fn_flags & ZEND_ACC_CLOSURE) { @@ -375,9 +378,9 @@ zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */ /* Create new execution context. We have to back up and restore * EG(current_execute_data) and EG(opline_ptr) here because the function * modifies it. */ - zend_execute_data *current_execute_data = EG(current_execute_data); - zend_op **opline_ptr = EG(opline_ptr); - zend_execute_data *execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC); + current_execute_data = EG(current_execute_data); + opline_ptr = EG(opline_ptr); + execute_data = zend_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC); EG(current_execute_data) = current_execute_data; EG(opline_ptr) = opline_ptr; From 954e7a3b3ca115b619b1b326ae4ae31a7cf196db Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 5 Sep 2012 13:00:04 +0200 Subject: [PATCH 576/641] - fix build, there was no tsrm context there, doing a fetch but this is horribly slow, this fix needs improvement (or simply add a TSRM context in the signature in master --- Zend/zend_opcode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 6eab0ae309a..4c6a784a881 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -308,6 +308,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce) zend_hash_destroy(&ce->properties_info); str_efree(ce->name); if ((ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { + TSRMLS_FETCH(); zend_hash_apply(&ce->function_table, (apply_func_t)zend_clear_trait_method_name TSRMLS_CC); } zend_hash_destroy(&ce->function_table); From d64d9e335147173507d39c759c54320e2c20c9ed Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 5 Sep 2012 23:08:05 +0800 Subject: [PATCH 577/641] year++ --- ext/date/lib/astro.c | 2 +- ext/date/lib/dow.c | 2 +- ext/date/lib/interval.c | 2 +- ext/date/lib/parse_date.c | 2 +- ext/date/lib/parse_iso_intervals.c | 2 +- ext/date/lib/parse_tz.c | 2 +- ext/date/lib/timelib.c | 2 +- ext/date/lib/timelib.h | 2 +- ext/date/lib/timelib_structs.h | 2 +- ext/date/lib/tm2unixtime.c | 2 +- ext/date/lib/unixtime2tm.c | 2 +- ext/dba/libcdb/cdb.c | 2 +- ext/dba/libcdb/cdb.h | 2 +- ext/dba/libcdb/cdb_make.c | 2 +- ext/dba/libcdb/cdb_make.h | 2 +- ext/dba/libcdb/uint32.c | 2 +- ext/dba/libcdb/uint32.h | 2 +- ext/dba/libflatfile/flatfile.c | 2 +- ext/dba/libflatfile/flatfile.h | 2 +- ext/dba/libinifile/inifile.c | 2 +- ext/dba/libinifile/inifile.h | 2 +- ext/gd/libgd/xbm.c | 2 +- ext/interbase/interbase.rc | 2 +- ext/standard/url_scanner_ex.c | 2 +- netware/start.c | 2 +- sapi/fpm/fpm/fastcgi.c | 2 +- sapi/fpm/fpm/fastcgi.h | 2 +- sapi/fpm/fpm/fpm_main.c | 6 +++--- sapi/litespeed/lsapi_main.c | 6 +++--- sapi/litespeed/lsapidef.h | 2 +- sapi/litespeed/lsapilib.c | 2 +- sapi/litespeed/lsapilib.h | 2 +- win32/build/deplister.c | 2 +- win32/build/template.rc | 2 +- 34 files changed, 38 insertions(+), 38 deletions(-) diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c index 0438f98904a..064700f9121 100644 --- a/ext/date/lib/astro.c +++ b/ext/date/lib/astro.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c index b33e8eab723..9cb9c9cd28e 100644 --- a/ext/date/lib/dow.c +++ b/ext/date/lib/dow.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c index af150fc8023..451b4631911 100644 --- a/ext/date/lib/interval.c +++ b/ext/date/lib/interval.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 42741079ed2..0e21ecc00c5 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -4,7 +4,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_iso_intervals.c b/ext/date/lib/parse_iso_intervals.c index 2c5ed427064..5f052221b83 100644 --- a/ext/date/lib/parse_iso_intervals.c +++ b/ext/date/lib/parse_iso_intervals.c @@ -4,7 +4,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c index b8d8448c940..009a2ad4e63 100644 --- a/ext/date/lib/parse_tz.c +++ b/ext/date/lib/parse_tz.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index 5e65a6e4cf9..43eedf780c6 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index 9667fa2dae4..671d37fd9e8 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h index 4f67b7a6cba..6662d91b1b5 100644 --- a/ext/date/lib/timelib_structs.h +++ b/ext/date/lib/timelib_structs.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c index c4830bbef0c..6085bb14dae 100644 --- a/ext/date/lib/tm2unixtime.c +++ b/ext/date/lib/tm2unixtime.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c index a76fa80991e..48709f42fca 100644 --- a/ext/date/lib/unixtime2tm.c +++ b/ext/date/lib/unixtime2tm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index 5c26b4fd9f2..cfce91e080e 100644 --- a/ext/dba/libcdb/cdb.c +++ b/ext/dba/libcdb/cdb.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h index 3530cb493ca..7cdca004983 100644 --- a/ext/dba/libcdb/cdb.h +++ b/ext/dba/libcdb/cdb.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c index 600b8dd0f91..014db032ebd 100644 --- a/ext/dba/libcdb/cdb_make.c +++ b/ext/dba/libcdb/cdb_make.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h index 828abe03155..062cffb05c6 100644 --- a/ext/dba/libcdb/cdb_make.h +++ b/ext/dba/libcdb/cdb_make.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c index e869d512fbb..b56cbf26f84 100644 --- a/ext/dba/libcdb/uint32.c +++ b/ext/dba/libcdb/uint32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h index 692590e2276..68ea1c0cd87 100644 --- a/ext/dba/libcdb/uint32.h +++ b/ext/dba/libcdb/uint32.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index 081af745f94..4d738af7b59 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h index e7ce3a76402..65d099fbc72 100644 --- a/ext/dba/libflatfile/flatfile.h +++ b/ext/dba/libflatfile/flatfile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c index f7157ed0fee..2d290e026ef 100644 --- a/ext/dba/libinifile/inifile.c +++ b/ext/dba/libinifile/inifile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h index e69fd08b06c..5b7e377d86f 100644 --- a/ext/dba/libinifile/inifile.h +++ b/ext/dba/libinifile/inifile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c index c83b0ad13e2..f4165d52b79 100644 --- a/ext/gd/libgd/xbm.c +++ b/ext/gd/libgd/xbm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/interbase/interbase.rc b/ext/interbase/interbase.rc index 7fa8f50f339..ad3287be31c 100644 --- a/ext/interbase/interbase.rc +++ b/ext/interbase/interbase.rc @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index f33f99a4980..943242f343f 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -4,7 +4,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/netware/start.c b/netware/start.c index 43510fc22c5..b842749257a 100644 --- a/netware/start.c +++ b/netware/start.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index e2e208aa7fd..f77c9fb4d64 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/fpm/fpm/fastcgi.h b/sapi/fpm/fpm/fastcgi.h index 7a9f3ef363d..f39559d2560 100644 --- a/sapi/fpm/fpm/fastcgi.h +++ b/sapi/fpm/fpm/fastcgi.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 9c314f51c61..b058d7a9f3b 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -1703,9 +1703,9 @@ int main(int argc, char *argv[]) SG(request_info).no_headers = 1; #if ZEND_DEBUG - php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2009 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2012 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #else - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2009 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2012 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif php_request_shutdown((void *) 0); fcgi_shutdown(); diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index a197225b4b8..bb532d83620 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -719,9 +719,9 @@ static int cli_main( int argc, char * argv[] ) case 'v': if (php_request_startup(TSRMLS_C) != FAILURE) { #if ZEND_DEBUG - php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2012 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #else - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2004 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2012 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); #endif #ifdef PHP_OUTPUT_NEWAPI php_output_end_all(TSRMLS_C); diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h index 276c579b2cb..68f73c4e25e 100644 --- a/sapi/litespeed/lsapidef.h +++ b/sapi/litespeed/lsapidef.h @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index a3297346d6f..fe89ebab28f 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h index 8a604fbf1ef..701b5284c93 100644 --- a/sapi/litespeed/lsapilib.h +++ b/sapi/litespeed/lsapilib.h @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/win32/build/deplister.c b/win32/build/deplister.c index bf91b96d523..f99da512282 100644 --- a/win32/build/deplister.c +++ b/win32/build/deplister.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/win32/build/template.rc b/win32/build/template.rc index 2db88964971..606b08a244b 100644 --- a/win32/build/template.rc +++ b/win32/build/template.rc @@ -65,7 +65,7 @@ BEGIN #endif VALUE "FileVersion", EXT_VERSION VALUE "InternalName", INTERNAL_NAME - VALUE "LegalCopyright", "Copyright © 1997-2010 The PHP Group" + VALUE "LegalCopyright", "Copyright © 1997-2012 The PHP Group" VALUE "LegalTrademarks", "PHP" VALUE "OriginalFilename", FILE_NAME VALUE "ProductName", "PHP" From 5f9023ca381fbd25a99562420b14b0d93564198b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 5 Sep 2012 23:41:42 +0800 Subject: [PATCH 578/641] Correct PHP version --- ext/mysqli/mysqli_libmysql.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysqli/mysqli_libmysql.h b/ext/mysqli/mysqli_libmysql.h index 65c69bf282d..228cde279e0 100644 --- a/ext/mysqli/mysqli_libmysql.h +++ b/ext/mysqli/mysqli_libmysql.h @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- - | PHP Version 6 | + | PHP Version 5 | ---------------------------------------------------------------------- | Copyright (c) 2007 The PHP Group | ---------------------------------------------------------------------- From a3d078bd8f48b40496d4bbebb42a291f168ea999 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 5 Sep 2012 23:43:59 +0800 Subject: [PATCH 579/641] correct PHP version & year++ --- ext/date/lib/parse_date.re | 2 +- ext/date/lib/parse_iso_intervals.re | 2 +- ext/standard/url_scanner_ex.c | 2 +- ext/standard/url_scanner_ex.re | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 16c45a21198..cca88580eb5 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re index 8610803e396..e52868865b8 100644 --- a/ext/date/lib/parse_iso_intervals.re +++ b/ext/date/lib/parse_iso_intervals.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index c7e4a38d286..1ec269de303 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -2,7 +2,7 @@ #line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ - | PHP Version 6 | + | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index e7218a14f1f..2e37cf0ba4d 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -1,8 +1,8 @@ /* +----------------------------------------------------------------------+ - | PHP Version 6 | + | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | From 94582f93986cfb5a43feb047bc914a0a029286d2 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 5 Sep 2012 23:47:21 +0800 Subject: [PATCH 580/641] year++ missed the .re files in 5.3 --- ext/date/lib/parse_date.re | 2 +- ext/date/lib/parse_iso_intervals.re | 2 +- ext/standard/url_scanner_ex.re | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 16c45a21198..cca88580eb5 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re index 8610803e396..e52868865b8 100644 --- a/ext/date/lib/parse_iso_intervals.re +++ b/ext/date/lib/parse_iso_intervals.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index e9fc0b5f56c..fdc61033d26 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2012 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | From b29dc146b9311c14186c14bcb1c8ae5288b65d73 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 6 Sep 2012 11:26:40 +0400 Subject: [PATCH 581/641] - Fixed bug #61767 (Shutdown functions not called in certain error situation) - Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function) --- NEWS | 6 +++++- Zend/tests/bug51394.phpt | 6 ++++++ Zend/tests/bug60909_1.phpt | 24 ++++++++++++++++++++++++ Zend/tests/bug60909_2.phpt | 20 ++++++++++++++++++++ Zend/tests/bug61767.phpt | 34 ++++++++++++++++++++++++++++++++++ Zend/zend.c | 23 +++++++++++++++++++++++ Zend/zend_object_handlers.c | 1 + 7 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/bug60909_1.phpt create mode 100644 Zend/tests/bug60909_2.phpt create mode 100644 Zend/tests/bug61767.phpt diff --git a/NEWS b/NEWS index a0e8a686421..a1ff9b9ffa8 100644 --- a/NEWS +++ b/NEWS @@ -13,9 +13,13 @@ PHP NEWS . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) . Fixed bug #62716 (munmap() is called with the incorrect length). (slangley@google.com) - . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia) + . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) + . Fixed bug #61767 (Shutdown functions not called in certain error + situation). (Dmitry) . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php). (Laruence) + . Fixed bug #60909 (custom error handler throwing Exception + fatal error + = no shutdown function). (Dmitry) - CURL: . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) diff --git a/Zend/tests/bug51394.phpt b/Zend/tests/bug51394.phpt index 537574c9d5d..406de13a9bf 100644 --- a/Zend/tests/bug51394.phpt +++ b/Zend/tests/bug51394.phpt @@ -13,4 +13,10 @@ function eh() set_error_handler("eh"); $a = $empty($b); --EXPECTF-- +Warning: Uncaught exception 'Exception' with message 'error!' in %sbug51394.php:4 +Stack trace: +#0 %sbug51394.php(9): eh(8, 'Undefined varia...', '%s', 9, Array) +#1 {main} + thrown in %sbug51394.php on line 4 + Fatal error: Function name must be a string in %sbug51394.php on line 9 \ No newline at end of file diff --git a/Zend/tests/bug60909_1.phpt b/Zend/tests/bug60909_1.phpt new file mode 100644 index 00000000000..5150dfc025c --- /dev/null +++ b/Zend/tests/bug60909_1.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function). +--FILE-- +foo(); +--EXPECTF-- +Error handler called (Undefined variable: undefined) + +Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:13 +Stack trace: +#0 %sbug61767.php(13): {closure}(8, 'Undefined varia...', '%s', 13, Array) +#1 {main} + thrown in %sbug61767.php on line 13 + +Fatal error: Call to a member function foo() on a non-object in %sbug61767.php on line 13 +Shutting down +Array +( + [type] => 1 + [message] => Call to a member function foo() on a non-object + [file] => %sbug61767.php + [line] => 13 +) diff --git a/Zend/zend.c b/Zend/zend.c index ea32346dae1..bd53d551834 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -997,6 +997,29 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ zend_stack labels_stack; TSRMLS_FETCH(); + /* Report about uncaught exception in case of fatal errors */ + if (EG(exception)) { + switch (type) { + case E_CORE_ERROR: + case E_ERROR: + case E_RECOVERABLE_ERROR: + case E_PARSE: + case E_COMPILE_ERROR: + case E_USER_ERROR: + if (zend_is_executing(TSRMLS_C)) { + error_lineno = zend_get_executed_lineno(TSRMLS_C); + } + zend_exception_error(EG(exception), E_WARNING TSRMLS_CC); + EG(exception) = NULL; + if (zend_is_executing(TSRMLS_C) && EG(opline_ptr)) { + active_opline->lineno = error_lineno; + } + break; + default: + break; + } + } + /* Obtain relevant filename and lineno */ switch (type) { case E_CORE_ERROR: diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 288a5dfc927..eae47d9c5a4 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1272,6 +1272,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty if (retval) { zval_ptr_dtor(&retval); } + EG(exception) = NULL; zend_error(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name); return FAILURE; } From dabe89c6f36a03117e1614546dd90de80b9e90d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Sep 2012 18:46:33 +0200 Subject: [PATCH 582/641] -enable VC11 (vc2012) --- win32/build/config.w32 | 9 +++++++-- win32/build/confutils.js | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 92347e76b53..cca70540bf0 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -163,8 +163,13 @@ if (VCVERS >= 1500 && PHP_MP != 'disable') { } // General link flags -DEFINE("LDFLAGS", "/nologo /version:" + - PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION); + +if (VCVERS >= 1700) { + DEFINE("LDFLAGS", "/nologo "); +} else { + DEFINE("LDFLAGS", "/nologo /version:" + + PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION); +} // General DLL link flags DEFINE("DLL_LDFLAGS", "/dll "); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index d1f7eca57d3..1362e63ead6 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -46,6 +46,7 @@ VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)'; VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)'; VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)'; VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)'; +VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)'; var VC_VERSIONS_SHORT = new Array(); VC_VERSIONS_SHORT[1200] = 'VC6'; @@ -54,6 +55,7 @@ VC_VERSIONS_SHORT[1310] = 'VC7.1'; VC_VERSIONS_SHORT[1400] = 'VC8'; VC_VERSIONS_SHORT[1500] = 'VC9'; VC_VERSIONS_SHORT[1600] = 'VC10'; +VC_VERSIONS_SHORT[1700] = 'VC11'; if (PROGRAM_FILES == null) { PROGRAM_FILES = "C:\\Program Files"; From 57bebfcbdc24cf688e2a522c3047ff8f0be1b2b6 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Sun, 9 Sep 2012 23:02:50 +0200 Subject: [PATCH 583/641] fixed test for bug #52944 also for darwin --- ext/zlib/tests/bug_52944-darwin.phpt | 24 +++ ext/zlib/tests/bug_52944-win.phpt | 185 +++---------------- ext/zlib/tests/bug_52944.phpt | 188 +++----------------- ext/zlib/tests/bug_52944_corrupted_data.inc | 142 +++++++++++++++ 4 files changed, 217 insertions(+), 322 deletions(-) create mode 100644 ext/zlib/tests/bug_52944-darwin.phpt create mode 100644 ext/zlib/tests/bug_52944_corrupted_data.inc diff --git a/ext/zlib/tests/bug_52944-darwin.phpt b/ext/zlib/tests/bug_52944-darwin.phpt new file mode 100644 index 00000000000..c25babadf57 --- /dev/null +++ b/ext/zlib/tests/bug_52944-darwin.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #52944 (segfault with zlib filter and corrupted data) +--SKIPIF-- + + - + - + Date: Mon, 10 Sep 2012 10:05:15 +0800 Subject: [PATCH 584/641] Fix doc bug #63032 (Number of release in documentation). Also add a bonus grammar fix. --- CODING_STANDARDS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CODING_STANDARDS b/CODING_STANDARDS index ae8ee041902..7413be453ca 100644 --- a/CODING_STANDARDS +++ b/CODING_STANDARDS @@ -2,11 +2,11 @@ PHP Coding Standards ======================== -This file lists several standards that any programmer, adding or changing -code in PHP, should follow. Since this file was added at a very late +This file lists several standards that any programmer adding or changing +code in PHP should follow. Since this file was added at a very late stage of the development of PHP v3.0, the code base does not (yet) fully follow it, but it's going in that general direction. Since we are now -well into the version 4 releases, many sections have been recoded to use +well into version 5 releases, many sections have been recoded to use these rules. Code Implementation From 62d86209cf83b6b1288b0c7567ace45b5be6025b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 10 Sep 2012 14:54:18 +0400 Subject: [PATCH 585/641] Fixed unintendent clearance of PHP_OUTPUT_ACTIVATED flag --- main/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/output.c b/main/output.c index d4eaa6701db..e100057ca97 100644 --- a/main/output.c +++ b/main/output.c @@ -214,7 +214,7 @@ PHPAPI void php_output_register_constants(TSRMLS_D) * Used by SAPIs to disable output */ PHPAPI void php_output_set_status(int status TSRMLS_DC) { - OG(flags) = status & 0xf; + OG(flags) = (OG(flags) & ~0xf) | (status & 0xf); } /* }}} */ From 0a25a0241ed1c90b83d71b94a45b841e74e68c98 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 10 Sep 2012 23:08:54 +0800 Subject: [PATCH 586/641] Fix the wrong use of snprintf which is introduced in 1d2f61904987133d542c68cd349cf313d0bef1c8 --- ext/fileinfo/libmagic.patch | 6 ++---- ext/fileinfo/libmagic/apprentice.c | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index 30364fb978c..1fc656ef1e9 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -316,8 +316,6 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { -- int errs = 0; -+ int errs = 0, mflen = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; - size_t slen, files = 0, maxfiles = 0; @@ -356,7 +354,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } while ((d = readdir(dir)) != NULL) { - if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) { -+ if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { ++ if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -379,7 +377,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } } - filearr[files++] = mfn; -+ filearr[files++] = estrndup(mfn, mflen); ++ filearr[files++] = estrndup(mfn); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 98bde27a2d7..f5f99395a36 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -753,7 +753,7 @@ private int apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { - int errs = 0, mflen = 0; + int errs = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; size_t files = 0, maxfiles = 0; @@ -782,7 +782,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } while ((d = readdir(dir)) != NULL) { - if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { + if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -804,7 +804,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } } - filearr[files++] = estrndup(mfn, mflen); + filearr[files++] = estrdup(mfn); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); From 328a3d9f1384d3555833345dbe879e4d99922a35 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 11 Sep 2012 11:43:47 +0800 Subject: [PATCH 587/641] regenerate patch, and save a strlen --- ext/fileinfo/libmagic.patch | 307 ++++++----------------------- ext/fileinfo/libmagic/apprentice.c | 10 +- 2 files changed, 63 insertions(+), 254 deletions(-) diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index 1fc656ef1e9..15f6a6dadd1 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -1,6 +1,6 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c ---- libmagic.origin/apprentice.c 2012-07-15 18:17:24.802087661 +0800 -+++ libmagic/apprentice.c 2012-07-15 18:22:49.650087425 +0800 +--- libmagic.origin/apprentice.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/apprentice.c 2012-09-11 11:36:51.000000000 +0800 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@ -316,12 +316,14 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { +- int errs = 0; ++ int errs = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; - size_t slen, files = 0, maxfiles = 0; - char **filearr = NULL, *mfn; + size_t files = 0, maxfiles = 0; -+ char **filearr = NULL, mfn[MAXPATHLEN]; ++ char **filearr = NULL; struct stat st; DIR *dir; struct dirent *d; @@ -339,7 +341,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c marraycount = 0; /* print silly verbose header for USG compat. */ -@@ -778,14 +773,16 @@ +@@ -778,14 +773,18 @@ (void)fprintf(stderr, "%s\n", usg_hdr); /* load directory or file */ @@ -347,6 +349,8 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c + /* FIXME: Read file names and sort them to prevent + non-determinism. See Debian bug #488562. */ + if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { ++ int mflen; ++ char mfn[MAXPATHLEN]; dir = opendir(fn); if (!dir) { errs++; @@ -354,11 +358,11 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } while ((d = readdir(dir)) != NULL) { - if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) { -+ if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { ++ if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; -@@ -793,7 +790,6 @@ +@@ -793,7 +792,6 @@ goto out; } if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) { @@ -366,7 +370,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c continue; } if (files >= maxfiles) { -@@ -803,20 +799,19 @@ +@@ -803,20 +801,19 @@ if ((filearr = CAST(char **, realloc(filearr, mlen))) == NULL) { file_oomem(ms, mlen); @@ -377,7 +381,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } } - filearr[files++] = mfn; -+ filearr[files++] = estrndup(mfn); ++ filearr[files++] = estrndup(mfn, (mflen > sizeof(mfn) - 1)? sizeof(mfn) - 1: mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); @@ -389,7 +393,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c } free(filearr); } else -@@ -882,12 +877,7 @@ +@@ -882,12 +879,7 @@ for (i = 0; i < marraycount; i++) mentrycount += marray[i].cont_count; @@ -403,7 +407,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c mentrycount = 0; for (i = 0; i < marraycount; i++) { -@@ -896,9 +886,14 @@ +@@ -896,9 +888,14 @@ mentrycount += marray[i].cont_count; } out: @@ -421,7 +425,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c if (errs) { *magicp = NULL; *nmagicp = 0; -@@ -1175,14 +1170,13 @@ +@@ -1175,14 +1172,13 @@ return -1; } me = &(*mentryp)[*nmentryp - 1]; @@ -440,7 +444,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c me->mp = m = nm; me->max_count = CAST(uint32_t, cnt); } -@@ -1194,23 +1188,13 @@ +@@ -1194,23 +1190,13 @@ struct magic_entry *mp; maxmagic += ALLOC_INCR; @@ -467,7 +471,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c me->mp = m; me->max_count = ALLOC_CHUNK; } else -@@ -1353,6 +1337,10 @@ +@@ -1353,6 +1339,10 @@ if (m->type == FILE_INVALID) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "type `%s' invalid", l); @@ -478,7 +482,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return -1; } -@@ -1361,7 +1349,7 @@ +@@ -1361,7 +1351,7 @@ m->mask_op = 0; if (*l == '~') { @@ -487,7 +491,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->mask_op |= FILE_OPINVERSE; else if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "'~' invalid for string types"); -@@ -1370,7 +1358,7 @@ +@@ -1370,7 +1360,7 @@ m->str_range = 0; m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0; if ((op = get_op(*l)) != -1) { @@ -496,7 +500,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c uint64_t val; ++l; m->mask_op |= op; -@@ -1558,11 +1546,6 @@ +@@ -1558,11 +1548,6 @@ if (check_format(ms, m) == -1) return -1; } @@ -508,7 +512,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->mimetype[0] = '\0'; /* initialise MIME type to none */ if (m->cont_level == 0) ++(*nmentryp); /* make room for next */ -@@ -2195,56 +2178,69 @@ +@@ -2195,56 +2180,69 @@ /* * handle a compiled file. @@ -601,7 +605,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c ptr = (uint32_t *)(void *)*magicp; if (*ptr != MAGICNO) { if (swap4(*ptr) != MAGICNO) { -@@ -2259,35 +2255,55 @@ +@@ -2259,35 +2257,55 @@ else version = ptr[1]; if (version != VERSIONNO) { @@ -673,7 +677,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return -1; } -@@ -2301,42 +2317,49 @@ +@@ -2301,42 +2319,49 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn) { @@ -734,7 +738,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c return rv; } -@@ -2349,6 +2372,7 @@ +@@ -2349,6 +2374,7 @@ { const char *p, *q; char *buf; @@ -742,7 +746,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c if (strip) { if ((p = strrchr(fn, '/')) != NULL) -@@ -2370,14 +2394,14 @@ +@@ -2370,14 +2396,14 @@ q++; /* Compatibility with old code that looked in .mime */ if (ms->flags & MAGIC_MIME) { @@ -761,7 +765,7 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c /* Compatibility with old code that looked in .mime */ if (strstr(p, ".mime") != NULL) -@@ -2467,7 +2491,7 @@ +@@ -2467,7 +2493,7 @@ m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); m->lineno = swap4((uint32_t)m->lineno); @@ -771,8 +775,8 @@ diff -u libmagic.origin/apprentice.c libmagic/apprentice.c m->str_flags = swap4(m->str_flags); } diff -u libmagic.origin/ascmagic.c libmagic/ascmagic.c ---- libmagic.origin/ascmagic.c 2012-07-15 18:17:24.762087659 +0800 -+++ libmagic/ascmagic.c 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/ascmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/ascmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -139,10 +139,8 @@ /* malloc size is a conservative overestimate; could be improved, or at least realloced after conversion. */ @@ -797,8 +801,8 @@ diff -u libmagic.origin/ascmagic.c libmagic/ascmagic.c return rv; } diff -u libmagic.origin/cdf.c libmagic/cdf.c ---- libmagic.origin/cdf.c 2012-07-15 18:17:24.822087659 +0800 -+++ libmagic/cdf.c 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/cdf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf.c 2012-09-11 11:33:55.000000000 +0800 @@ -43,7 +43,17 @@ #include #endif @@ -861,8 +865,8 @@ diff -u libmagic.origin/cdf.c libmagic/cdf.c (void)fprintf(stderr, "timestamp %s\n", buf); } else { diff -u libmagic.origin/cdf.h libmagic/cdf.h ---- libmagic.origin/cdf.h 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/cdf.h 2012-07-15 18:20:42.730087520 +0800 +--- libmagic.origin/cdf.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf.h 2012-09-11 11:33:55.000000000 +0800 @@ -35,7 +35,7 @@ #ifndef _H_CDF_ #define _H_CDF_ @@ -899,8 +903,8 @@ diff -u libmagic.origin/cdf.h libmagic/cdf.h void cdf_swap_header(cdf_header_t *); void cdf_unpack_header(cdf_header_t *, char *); diff -u libmagic.origin/cdf_time.c libmagic/cdf_time.c ---- libmagic.origin/cdf_time.c 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/cdf_time.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/cdf_time.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/cdf_time.c 2012-09-11 11:33:55.000000000 +0800 @@ -96,7 +96,7 @@ } @@ -958,8 +962,8 @@ diff -u libmagic.origin/cdf_time.c libmagic/cdf_time.c static const char *ref = "Sat Apr 23 01:30:00 1977"; char *p, *q; diff -u libmagic.origin/compress.c libmagic/compress.c ---- libmagic.origin/compress.c 2012-07-15 18:17:24.730087657 +0800 -+++ libmagic/compress.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/compress.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/compress.c 2012-09-11 11:33:55.000000000 +0800 @@ -32,6 +32,7 @@ * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new @@ -1120,9 +1124,10 @@ diff -u libmagic.origin/compress.c libmagic/compress.c } -#endif +#endif /* if PHP_FILEINFO_UNCOMPRESS */ +Only in libmagic: diff diff -u libmagic.origin/file.h libmagic/file.h ---- libmagic.origin/file.h 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/file.h 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/file.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/file.h 2012-09-11 11:33:55.000000000 +0800 @@ -33,11 +33,9 @@ #ifndef __file_h__ #define __file_h__ @@ -1294,8 +1299,8 @@ diff -u libmagic.origin/file.h libmagic/file.h + #endif /* __file_h__ */ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c ---- libmagic.origin/fsmagic.c 2012-07-15 18:17:24.730087657 +0800 -+++ libmagic/fsmagic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/fsmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/fsmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -59,27 +59,21 @@ # define minor(dev) ((dev) & 0xff) #endif @@ -1506,10 +1511,10 @@ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c -#else - if (file_printf(ms, "block special") == -1) - return -1; - #endif +-#endif - } - return 1; --#endif + #endif - /* TODO add code to handle V7 MUX and Blit MUX files */ + #ifdef S_IFIFO @@ -1619,8 +1624,8 @@ diff -u libmagic.origin/fsmagic.c libmagic/fsmagic.c /* diff -u libmagic.origin/funcs.c libmagic/funcs.c ---- libmagic.origin/funcs.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/funcs.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/funcs.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/funcs.c 2012-09-11 11:33:55.000000000 +0800 @@ -41,52 +41,42 @@ #if defined(HAVE_WCTYPE_H) #include @@ -1914,10 +1919,9 @@ diff -u libmagic.origin/funcs.c libmagic/funcs.c + return rep_cnt; } + -Common subdirectories: libmagic.origin/.libs and libmagic/.libs diff -u libmagic.origin/magic.c libmagic/magic.c ---- libmagic.origin/magic.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/magic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/magic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/magic.c 2012-09-11 11:33:55.000000000 +0800 @@ -25,11 +25,6 @@ * SUCH DAMAGE. */ @@ -2294,8 +2298,8 @@ diff -u libmagic.origin/magic.c libmagic/magic.c public const char * magic_error(struct magic_set *ms) diff -u libmagic.origin/magic.h libmagic/magic.h ---- libmagic.origin/magic.h 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/magic.h 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/magic.h 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/magic.h 2012-09-11 11:33:55.000000000 +0800 @@ -85,6 +85,7 @@ const char *magic_getpath(const char *, int); @@ -2313,8 +2317,8 @@ diff -u libmagic.origin/magic.h libmagic/magic.h int magic_errno(magic_t); diff -u libmagic.origin/print.c libmagic/print.c ---- libmagic.origin/print.c 2012-07-15 18:21:02.846087501 +0800 -+++ libmagic/print.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/print.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/print.c 2012-09-11 11:33:55.000000000 +0800 @@ -29,6 +29,9 @@ * print.c - debugging printout routines */ @@ -2507,206 +2511,9 @@ diff -u libmagic.origin/print.c libmagic/print.c } protected const char * -diff -u libmagic.origin/print.c.rej libmagic/print.c.rej ---- libmagic.origin/print.c.rej 2012-07-15 18:17:24.762087659 +0800 -+++ libmagic/print.c.rej 2012-07-15 18:20:27.186087168 +0800 -@@ -1,12 +1,184 @@ ----- libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 --+++ libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 --@@ -29,9 +29,6 @@ -- * print.c - debugging printout routines -- */ -+--- libmagic.orig/print.c 2012-05-29 14:40:41.710960045 +0200 -++++ libmagic/print.c 2012-05-29 14:34:03.770376387 +0200 -+@@ -48,174 +51,21 @@ - ---#include "php.h" ---#include "main/snprintf.h" -+ #define SZOF(a) (sizeof(a) / sizeof(a[0])) -+ -+-#ifndef COMPILE_ONLY -+-protected void -+-file_mdump(struct magic *m) -+-{ -+- private const char optyp[] = { FILE_OPS }; -+- -+- (void) fprintf(stderr, "%u: %.*s %u", m->lineno, -+- (m->cont_level & 7) + 1, ">>>>>>>>", m->offset); -+- -+- if (m->flag & INDIR) { -+- (void) fprintf(stderr, "(%s,", -+- /* Note: type is unsigned */ -+- (m->in_type < file_nnames) ? -+- file_names[m->in_type] : "*bad*"); -+- if (m->in_op & FILE_OPINVERSE) -+- (void) fputc('~', stderr); -+- (void) fprintf(stderr, "%c%u),", -+- ((size_t)(m->in_op & FILE_OPS_MASK) < -+- SZOF(optyp)) ? -+- optyp[m->in_op & FILE_OPS_MASK] : '?', -+- m->in_offset); -+- } -+- (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", -+- /* Note: type is unsigned */ -+- (m->type < file_nnames) ? file_names[m->type] : "*bad*"); -+- if (m->mask_op & FILE_OPINVERSE) -+- (void) fputc('~', stderr); -+- -+- if (IS_STRING(m->type)) { -+- if (m->str_flags) { -+- (void) fputc('/', stderr); -+- if (m->str_flags & STRING_COMPACT_WHITESPACE) -+- (void) fputc(CHAR_COMPACT_WHITESPACE, stderr); -+- if (m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) -+- (void) fputc(CHAR_COMPACT_OPTIONAL_WHITESPACE, -+- stderr); -+- if (m->str_flags & STRING_IGNORE_LOWERCASE) -+- (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); -+- if (m->str_flags & STRING_IGNORE_UPPERCASE) -+- (void) fputc(CHAR_IGNORE_UPPERCASE, stderr); -+- if (m->str_flags & REGEX_OFFSET_START) -+- (void) fputc(CHAR_REGEX_OFFSET_START, stderr); -+- if (m->str_flags & STRING_TEXTTEST) -+- (void) fputc(CHAR_TEXTTEST, stderr); -+- if (m->str_flags & STRING_BINTEST) -+- (void) fputc(CHAR_BINTEST, stderr); -+- if (m->str_flags & PSTRING_1_BE) -+- (void) fputc(CHAR_PSTRING_1_BE, stderr); -+- if (m->str_flags & PSTRING_2_BE) -+- (void) fputc(CHAR_PSTRING_2_BE, stderr); -+- if (m->str_flags & PSTRING_2_LE) -+- (void) fputc(CHAR_PSTRING_2_LE, stderr); -+- if (m->str_flags & PSTRING_4_BE) -+- (void) fputc(CHAR_PSTRING_4_BE, stderr); -+- if (m->str_flags & PSTRING_4_LE) -+- (void) fputc(CHAR_PSTRING_4_LE, stderr); -+- if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) -+- (void) fputc( -+- CHAR_PSTRING_LENGTH_INCLUDES_ITSELF, -+- stderr); -+- } -+- if (m->str_range) -+- (void) fprintf(stderr, "/%u", m->str_range); -+- } -+- else { -+- if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp)) -+- (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr); -+- else -+- (void) fputc('?', stderr); -+- -+- if (m->num_mask) { -+- (void) fprintf(stderr, "%.8llx", -+- (unsigned long long)m->num_mask); -+- } -+- } -+- (void) fprintf(stderr, ",%c", m->reln); -+- -+- if (m->reln != 'x') { -+- switch (m->type) { -+- case FILE_BYTE: -+- case FILE_SHORT: -+- case FILE_LONG: -+- case FILE_LESHORT: -+- case FILE_LELONG: -+- case FILE_MELONG: -+- case FILE_BESHORT: -+- case FILE_BELONG: -+- (void) fprintf(stderr, "%d", m->value.l); -+- break; -+- case FILE_BEQUAD: -+- case FILE_LEQUAD: -+- case FILE_QUAD: -+- (void) fprintf(stderr, "%" INT64_T_FORMAT "d", -+- (unsigned long long)m->value.q); -+- break; -+- case FILE_PSTRING: -+- case FILE_STRING: -+- case FILE_REGEX: -+- case FILE_BESTRING16: -+- case FILE_LESTRING16: -+- case FILE_SEARCH: -+- file_showstr(stderr, m->value.s, (size_t)m->vallen); -+- break; -+- case FILE_DATE: -+- case FILE_LEDATE: -+- case FILE_BEDATE: -+- case FILE_MEDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime(m->value.l, 1)); -+- break; -+- case FILE_LDATE: -+- case FILE_LELDATE: -+- case FILE_BELDATE: -+- case FILE_MELDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime(m->value.l, 0)); -+- break; -+- case FILE_QDATE: -+- case FILE_LEQDATE: -+- case FILE_BEQDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime((uint32_t)m->value.q, 1)); -+- break; -+- case FILE_QLDATE: -+- case FILE_LEQLDATE: -+- case FILE_BEQLDATE: -+- (void)fprintf(stderr, "%s,", -+- file_fmttime((uint32_t)m->value.q, 0)); -+- break; -+- case FILE_FLOAT: -+- case FILE_BEFLOAT: -+- case FILE_LEFLOAT: -+- (void) fprintf(stderr, "%G", m->value.f); -+- break; -+- case FILE_DOUBLE: -+- case FILE_BEDOUBLE: -+- case FILE_LEDOUBLE: -+- (void) fprintf(stderr, "%G", m->value.d); -+- break; -+- case FILE_DEFAULT: -+- /* XXX - do anything here? */ -+- break; -+- default: -+- (void) fputs("*bad*", stderr); -+- break; -+- } -+- } -+- (void) fprintf(stderr, ",\"%s\"]\n", m->desc); -+-} -+-#endif -+- -+ /*VARARGS*/ -+ protected void -+ file_magwarn(struct magic_set *ms, const char *f, ...) -+ { -+ va_list va; -++ char *expanded_format; -++ TSRMLS_FETCH(); -+ -+- /* cuz we use stdout for most, stderr here */ -+- (void) fflush(stdout); - - -- #include "file.h" -+- if (ms->file) -+- (void) fprintf(stderr, "%s, %lu: ", ms->file, -+- (unsigned long)ms->line); -+- (void) fprintf(stderr, "Warning: "); -+ va_start(va, f); -+- (void) vfprintf(stderr, f, va); -++ vasprintf(&expanded_format, f, va); -+ va_end(va); -+- (void) fputc('\n', stderr); -++ -++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format); -++ -++ free(expanded_format); -+ } - -- #ifndef lint -+ protected const char * diff -u libmagic.origin/readcdf.c libmagic/readcdf.c ---- libmagic.origin/readcdf.c 2012-07-15 18:17:24.734087660 +0800 -+++ libmagic/readcdf.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/readcdf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/readcdf.c 2012-09-11 11:33:55.000000000 +0800 @@ -30,7 +30,11 @@ #endif @@ -2753,8 +2560,8 @@ diff -u libmagic.origin/readcdf.c libmagic/readcdf.c if ((ec = strchr(c, '\n')) != NULL) *ec = '\0'; diff -u libmagic.origin/readelf.c libmagic/readelf.c ---- libmagic.origin/readelf.c 2012-07-15 18:17:25.046087660 +0800 -+++ libmagic/readelf.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/readelf.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/readelf.c 2012-09-11 11:33:55.000000000 +0800 @@ -49,7 +49,7 @@ off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, @@ -2910,8 +2717,8 @@ diff -u libmagic.origin/readelf.c libmagic/readelf.c if (fstat(fd, &st) == -1) { diff -u libmagic.origin/softmagic.c libmagic/softmagic.c ---- libmagic.origin/softmagic.c 2012-07-15 18:17:24.722087658 +0800 -+++ libmagic/softmagic.c 2012-07-15 18:20:42.734087519 +0800 +--- libmagic.origin/softmagic.c 2012-09-11 11:09:26.000000000 +0800 ++++ libmagic/softmagic.c 2012-09-11 11:33:55.000000000 +0800 @@ -41,6 +41,11 @@ #include #include diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index f5f99395a36..d11bd159a88 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -753,11 +753,11 @@ private int apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, const char *fn, int action) { - int errs = 0; + int errs = 0; struct magic_entry *marray; uint32_t marraycount, i, mentrycount = 0, starttest; size_t files = 0, maxfiles = 0; - char **filearr = NULL, mfn[MAXPATHLEN]; + char **filearr = NULL; struct stat st; DIR *dir; struct dirent *d; @@ -776,13 +776,15 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, /* FIXME: Read file names and sort them to prevent non-determinism. See Debian bug #488562. */ if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { + int mflen; + char mfn[MAXPATHLEN]; dir = opendir(fn); if (!dir) { errs++; goto out; } while ((d = readdir(dir)) != NULL) { - if (snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name) < 0) { + if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) { file_oomem(ms, strlen(fn) + strlen(d->d_name) + 2); errs++; @@ -804,7 +806,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, goto out; } } - filearr[files++] = estrdup(mfn); + filearr[files++] = estrndup(mfn, (mflen > sizeof(mfn) - 1)? sizeof(mfn) - 1: mflen); } closedir(dir); qsort(filearr, files, sizeof(*filearr), cmpstrp); From e06c47ca2ab482ab5e6ba47a9249a9b9417cb1b4 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Tue, 11 Sep 2012 21:14:51 +1200 Subject: [PATCH 588/641] Provide a specific error message if date.timezone value is invalid. --- ext/date/php_date.c | 7 ++++++- ext/date/tests/date_default_timezone_get-4.phpt | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 ext/date/tests/date_default_timezone_get-4.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 7c4e7820bb5..eac6ca505fb 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -862,9 +862,14 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) } } else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { return DATEG(default_timezone); + } else if (*DATEG(default_timezone)) { + /* Invalid date.timezone value */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "date.timezone value '%s' is invalid. We selected the timezone 'UTC' for now.", DATEG(default_timezone)); + } else { + /* No date.timezone value */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); } /* Fallback to UTC */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); return "UTC"; } diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt new file mode 100644 index 00000000000..e76d4e3ed26 --- /dev/null +++ b/ext/date/tests/date_default_timezone_get-4.phpt @@ -0,0 +1,11 @@ +--TEST-- +date_default_timezone_get() function [4] +--INI-- +date.timezone=Incorrect/Zone +--FILE-- + +--EXPECTF-- +Warning: date_default_timezone_get(): date.timezone value 'Incorrect/Zone' is invalid. We selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d +UTC From 79e6635cb66a9efd47d48012bafe00f2897b0814 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 11 Sep 2012 18:02:19 +0800 Subject: [PATCH 589/641] Rearrange the codes, remove empty lines --- ext/date/php_date.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index eac6ca505fb..e43ff19a5be 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -738,7 +738,6 @@ PHP_RSHUTDOWN_FUNCTION(date) #define SUNFUNCS_RET_STRING 1 #define SUNFUNCS_RET_DOUBLE 2 - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(date) { @@ -860,9 +859,10 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } - } else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { - return DATEG(default_timezone); } else if (*DATEG(default_timezone)) { + if (timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { + return DATEG(default_timezone); + } /* Invalid date.timezone value */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "date.timezone value '%s' is invalid. We selected the timezone 'UTC' for now.", DATEG(default_timezone)); } else { @@ -887,7 +887,6 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D) } /* }}} */ - /* {{{ date() and gmdate() data */ #include "ext/standard/php_smart_str.h" @@ -1323,7 +1322,6 @@ PHPAPI signed long php_parse_date(char *string, signed long *now) } /* }}} */ - /* {{{ proto int strtotime(string time [, int now ]) Convert string representation of date and time to a timestamp */ PHP_FUNCTION(strtotime) @@ -1384,7 +1382,6 @@ PHP_FUNCTION(strtotime) } /* }}} */ - /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { @@ -1493,7 +1490,6 @@ PHP_FUNCTION(gmmktime) } /* }}} */ - /* {{{ proto bool checkdate(int month, int day, int year) Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) From f6000a01e286f855a7f40fcad738a1f9b00aa81e Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 11 Sep 2012 18:09:47 +0800 Subject: [PATCH 590/641] Capitalize the warning message --- ext/date/php_date.c | 2 +- ext/date/tests/date_default_timezone_get-4.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e43ff19a5be..765da9ec458 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -864,7 +864,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) return DATEG(default_timezone); } /* Invalid date.timezone value */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "date.timezone value '%s' is invalid. We selected the timezone 'UTC' for now.", DATEG(default_timezone)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid date.timezone value '%s', we selected the timezone 'UTC' for now.", DATEG(default_timezone)); } else { /* No date.timezone value */ php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt index e76d4e3ed26..6d1982bc13d 100644 --- a/ext/date/tests/date_default_timezone_get-4.phpt +++ b/ext/date/tests/date_default_timezone_get-4.phpt @@ -7,5 +7,5 @@ date.timezone=Incorrect/Zone echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- -Warning: date_default_timezone_get(): date.timezone value 'Incorrect/Zone' is invalid. We selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d +Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d UTC From 5246d6f02e52798e343bd5208692f1a5ed89b9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 12 Sep 2012 09:05:28 +0100 Subject: [PATCH 591/641] Generators & UPGRADING --- UPGRADING | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UPGRADING b/UPGRADING index ba556357ed4..59dfbb436ac 100755 --- a/UPGRADING +++ b/UPGRADING @@ -40,6 +40,8 @@ PHP X.Y UPGRADE NOTES - Add support for using empty() on the result of function calls and other expressions. Thus it is now possible to write empty(getArray()), for example. (https://wiki.php.net/rfc/empty_isset_exprs) +- Added generators. + (https://wiki.php.net/rfc/generators) ======================================== 2. Changes in SAPI modules From 0cc0f73fc333649739ecb48eb20401e639be43ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 12 Sep 2012 23:35:05 +0200 Subject: [PATCH 592/641] fix NEWS after releses --- NEWS | 95 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/NEWS b/NEWS index a1ff9b9ffa8..c9d1f0ed14d 100644 --- a/NEWS +++ b/NEWS @@ -1,53 +1,18 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2012, PHP 5.3.16 +?? ??? 2012, PHP 5.3.18 - Core: . Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes). (Laruence) - . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) - . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" - Windows registry). (aserbulov at parallels dot com) - . Fixed bug #62763 (register_shutdown_function and extending class). - (Laruence) - . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) - . Fixed bug #62716 (munmap() is called with the incorrect length). - (slangley@google.com) - . Fixed bug #62460 (php binaries installed as binary.dSYM). (Reeze Xia) . Fixed bug #61767 (Shutdown functions not called in certain error situation). (Dmitry) - . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK - with run-test.php). (Laruence) . Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function). (Dmitry) -- CURL: - . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) - . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). - (r.hampartsumyan@gmail.com, Laruence) - -- DateTime: - . Fixed bug #62852 (Unserialize invalid DateTime causes crash). - (reeze.xia@gmail.com) - . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence) - - Intl: - . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) -- MySQLnd: - . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence) - -- PDO: - . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) - -- Reflection: - . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong - result). (Laruence) - -- Session: - . Fixed bug (segfault due to retval is not initialized). (Laruence) - - SOAP . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). (Dmitry) @@ -55,15 +20,69 @@ PHP NEWS - SPL: . Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables). (Laruence) + +13 Sep 2012, PHP 5.3.17 + +- Core: + . Fixed bug (segfault while build with zts and GOTO vm-kind). (Laruence) + . Fixed bug #62955 (Only one directive is loaded from "Per Directory Values" + Windows registry). (aserbulov at parallels dot com) + . Fixed bug #62763 (register_shutdown_function and extending class). + (Laruence) + . Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence) + . Fixed bug #62716 (munmap() is called with the incorrect length). + (slangley@google.com) + . Fixed bug ##62460 (php binaries installed as binary.dSYM). (Reeze Xia) + +- CURL: + . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) + +- DateTime: + . Fixed bug #62852 (Unserialize invalid DateTime causes crash). + (reeze.xia@gmail.com) + +- Intl: + . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) + +- MySQLnd: + . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence) + +- PDO: + . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence) + +- Session: + . Fixed bug (segfault due to retval is not initialized). (Laruence) + +- SPL: . Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) (Laruence) - . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance - gives Segmentation fault). (Laruence, Gustavo) - Enchant: . Fixed bug #62838 (enchant_dict_quick_check() destroys zval, but fails to initialize it). (Tony, Mateusz Goik). +16 Aug 2012, PHP 5.3.16 + +- Core: + . Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK + with run-test.php). (Laruence) + +- CURL: + . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false). + (r.hampartsumyan@gmail.com, Laruence) + +- DateTime: + . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence) + +- Reflection: + . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong + result). (Laruence) + +- SPL: + . Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance + gives Segmentation fault). (Laruence, Gustavo) + + 19 Jul 2012, PHP 5.3.15 - Zend Engine: From 33fcec5c4ffb1a64bc4fb833f789072fc8bf732f Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 13 Sep 2012 20:19:23 +0200 Subject: [PATCH 593/641] Update RELEASE PROCESS Some parts of the release process are outdated, not needed anymore or still reference cvs. --- README.RELEASE_PROCESS | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/README.RELEASE_PROCESS b/README.RELEASE_PROCESS index b09ec53c139..b6209686c74 100644 --- a/README.RELEASE_PROCESS +++ b/README.RELEASE_PROCESS @@ -135,33 +135,34 @@ Rolling a stable release 2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``. -3. **Merge** all related sections in NEWS (f.e. merge the 4.4.1RC1 and 4.4.0 sections) +3. **Merge** all related sections in NEWS (f.e. merge the 5.4.1RC1 and 5.4.0 sections) 4. Commit those changes 5. run the "scripts/dev/credits" script in php-src and commit the changes in the credits files in ext/standard. -6. tag the repository with the version f.e. "``cvs tag php_4_4_1``" +6. tag the repository with the version f.e. "``git tag -s php-5.4.1``" (of course, you need to change that to the version you're rolling an RC for). When making 5.X release, you need to tag the Zend directory separately!! 7. Bump up the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS`` again, to the **next** version. F.e. if the release candidate -was "4.4.1RC1" then the new one should be "4.4.1RC2-dev" - regardless if we get +was "5.4.1RC1" then the new one should be "5.4.1RC2-dev" - regardless if we get a new RC or not. This is to make sure ``version_compare()`` can correctly work. 8. Commit those changes -9. Log in onto the snaps box and go into the correct tree (f.e. the PHP_4_4 -branch if you're rolling 4.4.x releases). +9. Log in onto the snaps box and go into the correct tree (f.e. the PHP-5.4 +branch if you're rolling 5.5.x releases). -10. You do not have to update the tree, but of course you can with "``cvs up -dP``". +10. You do not have to update the tree, but of course you can with "``git pull +origin ``". -11. run: ``./makedist php 4.4.1``, this will export the tree, create configure +11. run: ``./makedist php 5.4.1``, this will export the tree, create configure and build two tarballs (one gz and one bz2). -12. Commit those two tarballs to CVS (phpweb/distributions) +12. Commit those two tarballs to Git (php-distributions.git) 13. Once the release has been tagged, contact the PHP Windows development team (internals-win@lists.php.net) so that Windows binaries can be created. Once @@ -179,6 +180,9 @@ Getting the stable release announced a. ``php bin/bumpRelease 5`` (or ``php bin/bumpRelease 4`` for PHP4) + b. In case multiple PHP minor versions are in active development you have + to manually copy the old information to include/releases.inc + 2. Edit ``phpweb/include/version.inc`` and change (X=major release number): a. ``$PHP_X_VERSION`` to the correct version @@ -195,7 +199,7 @@ Getting the stable release announced f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows") 3. Update the ChangeLog file for the given major version -f.e. ``ChangeLog-4.php`` from the NEWS file +f.e. ``ChangeLog-5.php`` from the NEWS file a. go over the list and put every element on one line @@ -215,9 +219,9 @@ f.e. ``ChangeLog-4.php`` from the NEWS file V. ``s/FR #\([0-9]\+\)/FR /`` -4. ``cp releases/4_4_0.php releases/4_4_1.php`` +4. ``cp releases/5_4_0.php releases/5_4_1.php`` -5. ``cvs add releases/4_4_1.php`` +5. ``git add releases/5_4_1.php`` 6. Update the ``releases/*.php`` file with relevant data. The release announcement file should list in detail: @@ -240,17 +244,6 @@ to upgrade. php-general@lists.php.net and internals@lists.php.net with a text similar to http://news.php.net/php.internals/17222. -10. Update ``php-bugs-web/include/functions.php`` to include the new version -number, and remove the RC from there. - -11. Update ``qaweb/include/release-qa.php`` - - - Update $QA_RELEASES with the appropriate information, which means bumping - the version number to an upcoming version. - - Example: If PHP 5.3.7 is being released, then PHP 5.3.8 is the next QA version, - so replace 5.3.7 with 5.3.8 within $QA_RELEASES. - Re-releasing the same version (or -pl) -------------------------------------- From 9e91d621e3202a95a8c2d2ba261495ac30ec4008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Thu, 13 Sep 2012 23:08:30 +0200 Subject: [PATCH 594/641] This will become 5.3.18 --- configure.in | 2 +- main/php_version.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index d8965833132..885191519eb 100644 --- a/configure.in +++ b/configure.in @@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h) PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=3 -PHP_RELEASE_VERSION=16 +PHP_RELEASE_VERSION=18 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/main/php_version.h b/main/php_version.h index 3107a2808a3..2ec95204562 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 3 -#define PHP_RELEASE_VERSION 16 +#define PHP_RELEASE_VERSION 18 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.3.16-dev" -#define PHP_VERSION_ID 50316 +#define PHP_VERSION "5.3.18-dev" +#define PHP_VERSION_ID 50318 From bbf5978e2641d924c2d4d1c47210756943a28f7b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 13 Sep 2012 22:40:55 -0700 Subject: [PATCH 595/641] Fixed bug #60901 (Improve "tail" syntax for AIX installation) --- ext/oci8/config.m4 | 8 ++++---- ext/oci8/package.xml | 29 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index 0634e962886..976eb9e8462 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -49,8 +49,8 @@ AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[ AC_DEFUN([AC_OCI8IC_VERSION],[ AC_MSG_CHECKING([Oracle Instant Client library version compatibility]) OCI8_LCS_BASE=$PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME - OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc - OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -1` + OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -n1` # Oracle 10g, 11g etc + OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -n1` if test -f "$OCI8_NNZ" && test -f "$OCI8_LCS"; then if test ! -f "$OCI8_LCS_BASE"; then AC_MSG_ERROR([Link from $OCI8_LCS_BASE to $OCI8_LCS_BASE.*.1 not found]) @@ -65,7 +65,7 @@ AC_DEFUN([AC_OCI8IC_VERSION],[ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[ AC_MSG_CHECKING([Oracle library version compatibility]) OCI8_LCS_BASE=$OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME - OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc + OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -n1` # Oracle 10g, 11g etc if test -s "$OCI8_DIR/orainst/unix.rgs"; then OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4` test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3 @@ -278,7 +278,7 @@ if test "$PHP_OCI8" != "no"; then dnl user must pass in the library directory. But on Linux we default dnl to the most recent version in /usr/lib which is where the Oracle dnl Instant Client RPM gets installed. - PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'` + PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | tail -n1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'` if test -z "$PHP_OCI8_INSTANT_CLIENT"; then AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib libraries not found. Try --with-oci8=instantclient,DIR]) fi diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index d3a912832f4..59aeb5e4bd7 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -37,8 +37,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> - 1.4.7 - 1.4.7 + 1.4.8 + 1.4.8 stable @@ -46,11 +46,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> PHP - Fixed bug #59985 (show normal warning text for OCI_NO_DATA) - Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup) - Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc) - Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size - Improve internal initalization failure error messages + Fixed bug 60901 (Improve installation "tail" syntax for AIX) @@ -414,6 +410,25 @@ http://pear.php.net/dtd/package-2.0.xsd"> + + + 1.4.7 + 1.4.7 + + + stable + stable + + PHP + + Fixed bug #59985 (show normal warning text for OCI_NO_DATA) + Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup) + Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc) + Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size + Improve internal initalization failure error messages + + + 1.4.6 From 9f44844d7ce9485e543dada5f5314dd0487a7512 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 13 Sep 2012 22:43:10 -0700 Subject: [PATCH 596/641] Change package.xml fix description --- ext/oci8/package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index 59aeb5e4bd7..eac3f06552c 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -46,7 +46,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> PHP - Fixed bug 60901 (Improve installation "tail" syntax for AIX) + Fixed bug #60901 (Improve "tail" syntax for AIX installation) From e766f85405cd936a07a30a045f419199b6c02ed7 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 15 Sep 2012 11:26:21 +0800 Subject: [PATCH 597/641] Revert "Fixed bug #62852 (Unserialize invalid DateTime causes crash)" see: http://news.php.net/php.bugs/173451 This reverts commit 46a3f257724df7b85cc8c3e6374c36ed9ee783b4. --- ext/date/php_date.c | 16 ++++------------ ext/date/tests/bug62852.phpt | 15 --------------- 2 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 ext/date/tests/bug62852.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index d9e6a289b45..e8a457052ec 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2544,9 +2544,6 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) { convert_to_long(*z_timezone_type); if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) { - zend_error_handling error_handling; - - zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); convert_to_string(*z_timezone); switch (Z_LVAL_PP(z_timezone_type)) { @@ -2554,9 +2551,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat case TIMELIB_ZONETYPE_ABBR: { char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2); snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); - php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC); + php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); - break; + return 1; } case TIMELIB_ZONETYPE_ID: @@ -2570,15 +2567,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat tzobj->tzi.tz = tzi; tzobj->initialized = 1; - php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC); + php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); - break; - default: - zend_restore_error_handling(&error_handling TSRMLS_CC); - return 0; + return 1; } - zend_restore_error_handling(&error_handling TSRMLS_CC); - return 1; } } } diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt deleted file mode 100644 index 6426a80fb86..00000000000 --- a/ext/date/tests/bug62852.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #62852 (Unserialize invalid DateTime causes crash) ---INI-- -date.timezone=GMT ---FILE-- -getMessage()); -} -?> ---EXPECTF-- -string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): Double time specification" From 1b13ff6ec7969999052ed1b5315f8651b633a617 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 15 Sep 2012 11:29:47 +0800 Subject: [PATCH 598/641] Add XFAIL test for bug #62852 --- NEWS | 4 ---- ext/date/tests/bug62852.phpt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 ext/date/tests/bug62852.phpt diff --git a/NEWS b/NEWS index c9d1f0ed14d..7e52997f592 100644 --- a/NEWS +++ b/NEWS @@ -37,10 +37,6 @@ PHP NEWS - CURL: . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) -- DateTime: - . Fixed bug #62852 (Unserialize invalid DateTime causes crash). - (reeze.xia@gmail.com) - - Intl: . Fix null pointer dereferences in some classes of ext/intl. (Gustavo) diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt new file mode 100644 index 00000000000..2c23138035b --- /dev/null +++ b/ext/date/tests/bug62852.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #62852 (Unserialize invalid DateTime causes crash) +--INI-- +date.timezone=GMT +--XFAIL-- +bug is not fixed yet +--FILE-- + +--EXPECTF-- From 7609fb433afaef3b2d0279c673481f879842e92a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 15 Sep 2012 11:32:44 +0800 Subject: [PATCH 599/641] Remove bug fixed entry --- NEWS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NEWS b/NEWS index db6f7f48d27..a7441a5cc30 100644 --- a/NEWS +++ b/NEWS @@ -58,10 +58,6 @@ PHP NEWS (Pierrick) . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick) -- DateTime: - . Fixed bug #62852 (Unserialize invalid DateTime causes crash). - (reeze.xia@gmail.com) - - Intl: . Fixed Spoofchecker not being registered on ICU 49.1. (Gustavo) . Fix bug #62933 (ext/intl compilation error on icu 3.4.1). (Gustavo) From 4c6678d6058fd740a9e186b49f9daa72d09ed300 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 15 Sep 2012 11:50:16 +0800 Subject: [PATCH 600/641] Fixed bug #63093 (Segfault while load extension failed in zts-build). --- NEWS | 2 ++ Zend/zend_API.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7e52997f592..181e66d3880 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2012, PHP 5.3.18 - Core: + . Fixed bug #63093 (Segfault while load extension failed in zts-build). + (Laruence) . Fixed bug #62976 (Notice: could not be converted to int when comparing some builtin classes). (Laruence) . Fixed bug #61767 (Shutdown functions not called in certain error diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 70cf0c7af87..cf96743ee27 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2122,7 +2122,9 @@ void module_destructor(zend_module_entry *module) /* {{{ */ /* Deinitilaise module globals */ if (module->globals_size) { #ifdef ZTS - ts_free_id(*module->globals_id_ptr); + if (*module->globals_id_ptr) { + ts_free_id(*module->globals_id_ptr); + } #else if (module->globals_dtor) { module->globals_dtor(module->globals_ptr TSRMLS_CC); From 84202c367e4a7c6db8228af223c3ed9a112335a3 Mon Sep 17 00:00:00 2001 From: Mark Jones Date: Fri, 14 Sep 2012 08:59:14 -0600 Subject: [PATCH 601/641] commit for php bug 61421 enabling SHA2 and RMD160 for openssl signature verification --- ext/openssl/openssl.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7187a9601e6..2b8cfd571aa 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -69,7 +69,13 @@ #define OPENSSL_ALGO_MD2 4 #endif #define OPENSSL_ALGO_DSS1 5 - +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL +#define OPENSSL_ALGO_SHA224 6 +#define OPENSSL_ALGO_SHA256 7 +#define OPENSSL_ALGO_SHA384 8 +#define OPENSSL_ALGO_SHA512 9 +#define OPENSSL_ALGO_RMD160 10 +#endif #define DEBUG_SMIME 0 /* FIXME: Use the openssl constants instead of @@ -954,6 +960,23 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */ case OPENSSL_ALGO_DSS1: mdtype = (EVP_MD *) EVP_dss1(); break; +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL + case OPENSSL_ALGO_SHA224: + mdtype = (EVP_MD *) EVP_sha224(); + break; + case OPENSSL_ALGO_SHA256: + mdtype = (EVP_MD *) EVP_sha256(); + break; + case OPENSSL_ALGO_SHA384: + mdtype = (EVP_MD *) EVP_sha384(); + break; + case OPENSSL_ALGO_SHA512: + mdtype = (EVP_MD *) EVP_sha512(); + break; + case OPENSSL_ALGO_RMD160: + mdtype = (EVP_MD *) EVP_ripemd160(); + break; +#endif default: return NULL; break; @@ -1048,6 +1071,13 @@ PHP_MINIT_FUNCTION(openssl) REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); +#if OPENSSL_VERSION_NUMBER >= 0x0090708fL + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); +#endif /* flags for S/MIME */ REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); From 56425ee61080c5e666613e88777ee665e858b367 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 15 Sep 2012 23:02:10 -0700 Subject: [PATCH 602/641] news for bug #61421 --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index c3d15104f94..ed08594042e 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,10 @@ PHP NEWS . Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function). (Dmitry) +- OpenSSL: + . Implemented FR #61421 (OpenSSL signature verification missing RMD160, + SHA224, SHA256, SHA384, SHA512). (Mark Jones) + - SOAP . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). (Dmitry) From 27542db4e70c388346fc9983b9c7d58248aaa52d Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 12 Sep 2012 19:34:59 +0300 Subject: [PATCH 603/641] Respond with 501 to unknown request methods Fixed typo Moved 501 response from dispatch to event_read_request Return return value of send_error_page --- NEWS | 4 ++++ sapi/cli/php_cli_server.c | 41 ++++++++++++++++++---------------- sapi/cli/php_http_parser.c | 7 +++--- sapi/cli/php_http_parser.h | 2 ++ sapi/cli/tests/bug61679.phpt | 43 ++++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 sapi/cli/tests/bug61679.phpt diff --git a/NEWS b/NEWS index ed08594042e..68f423200e9 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2012, PHP 5.4.8 +- CLI server: + . Changed response to unknown HTTP method to 501 according to RFC. + (Niklas Lindgren). + - Core: . Fixed bug #63093 (Segfault while load extension failed in zts-build). (Laruence) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index e80ab68f806..4d15db44aff 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -116,7 +116,7 @@ typedef struct php_cli_server_poller { } php_cli_server_poller; typedef struct php_cli_server_request { - enum php_http_method request_method; + enum php_http_method request_method; int protocol_version; char *request_uri; size_t request_uri_len; @@ -247,7 +247,8 @@ static php_cli_server_http_reponse_status_code_pair status_map[] = { static php_cli_server_http_reponse_status_code_pair template_map[] = { { 400, "

%s

Your browser sent a request that this server could not understand.

" }, { 404, "

%s

The requested resource %s was not found on this server.

" }, - { 500, "

%s

The server is temporality unavaiable.

" } + { 500, "

%s

The server is temporarily unavailable.

" }, + { 501, "

%s

Request method not supported.

" } }; static php_cli_server_ext_mime_type_pair mime_type_map[] = { @@ -275,7 +276,7 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu ZEND_DECLARE_MODULE_GLOBALS(cli_server); -/* {{{ static char php_cli_server_css[] +/* {{{ static char php_cli_server_css[] * copied from ext/standard/info.c */ static const char php_cli_server_css[] = "