php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch parse_ini_file_memleak.patch for *General Issues Bug #61087Patch version 2012-02-23 17:32 UTC Return to Bug #61087 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: nikic@php.netIndex: trunk/Zend/zend_ini_scanner_defs.h =================================================================== --- trunk/Zend/zend_ini_scanner_defs.h (revision 323449) +++ trunk/Zend/zend_ini_scanner_defs.h (working copy) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Jan 03 10:40:06 2011 */ +/* Generated by re2c 0.13.5 on Thu Feb 23 18:10:59 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { Index: trunk/Zend/zend_ini_scanner.c =================================================================== --- trunk/Zend/zend_ini_scanner.c (revision 323449) +++ trunk/Zend/zend_ini_scanner.c (working copy) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Jan 03 10:40:06 2011 */ +/* Generated by re2c 0.13.5 on Thu Feb 23 18:10:59 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -230,12 +230,15 @@ char *buf; size_t size; - if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE || - init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE - ) { + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } + if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { + zend_file_handle_dtor(fh TSRMLS_CC); + return FAILURE; + } + yy_scan_buffer(buf, size TSRMLS_CC); return SUCCESS; @@ -330,7 +333,7 @@ } } -#line 334 "Zend/zend_ini_scanner.c" +#line 337 "Zend/zend_ini_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -459,7 +462,7 @@ yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 426 "Zend/zend_ini_scanner.l" +#line 429 "Zend/zend_ini_scanner.l" { /* Get option name */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -469,7 +472,7 @@ RETURN_TOKEN(TC_LABEL, yytext, yyleng); } -#line 473 "Zend/zend_ini_scanner.c" +#line 476 "Zend/zend_ini_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yyaccept = 0; @@ -478,24 +481,24 @@ yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 544 "Zend/zend_ini_scanner.l" +#line 547 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; } -#line 487 "Zend/zend_ini_scanner.c" +#line 490 "Zend/zend_ini_scanner.c" yy6: YYDEBUG(6, *YYCURSOR); ++YYCURSOR; yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 549 "Zend/zend_ini_scanner.l" +#line 552 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; } -#line 499 "Zend/zend_ini_scanner.c" +#line 502 "Zend/zend_ini_scanner.c" yy8: YYDEBUG(8, *YYCURSOR); yych = *++YYCURSOR; @@ -530,11 +533,11 @@ ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 472 "Zend/zend_ini_scanner.l" +#line 475 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } -#line 538 "Zend/zend_ini_scanner.c" +#line 541 "Zend/zend_ini_scanner.c" yy12: YYDEBUG(12, *YYCURSOR); yyaccept = 1; @@ -551,11 +554,11 @@ goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 559 "Zend/zend_ini_scanner.c" +#line 562 "Zend/zend_ini_scanner.c" yy16: YYDEBUG(16, *YYCURSOR); ++YYCURSOR; @@ -564,7 +567,7 @@ yy17: YYDEBUG(17, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 436 "Zend/zend_ini_scanner.l" +#line 439 "Zend/zend_ini_scanner.l" { /* Start option value */ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { yy_push_state(ST_RAW TSRMLS_CC); @@ -573,7 +576,7 @@ } return '='; } -#line 577 "Zend/zend_ini_scanner.c" +#line 580 "Zend/zend_ini_scanner.c" yy18: YYDEBUG(18, *YYCURSOR); yych = *++YYCURSOR; @@ -629,7 +632,7 @@ ++YYCURSOR; YYDEBUG(24, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 355 "Zend/zend_ini_scanner.l" +#line 358 "Zend/zend_ini_scanner.l" { /* Section start */ /* Enter section data lookup state */ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { @@ -639,7 +642,7 @@ } return TC_SECTION; } -#line 643 "Zend/zend_ini_scanner.c" +#line 646 "Zend/zend_ini_scanner.c" yy25: YYDEBUG(25, *YYCURSOR); ++YYCURSOR; @@ -669,7 +672,7 @@ } YYDEBUG(30, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 380 "Zend/zend_ini_scanner.l" +#line 383 "Zend/zend_ini_scanner.l" { /* Start of option with offset */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -682,7 +685,7 @@ RETURN_TOKEN(TC_OFFSET, yytext, yyleng); } -#line 686 "Zend/zend_ini_scanner.c" +#line 689 "Zend/zend_ini_scanner.c" yy31: YYDEBUG(31, *YYCURSOR); ++YYCURSOR; @@ -730,11 +733,11 @@ yy33: YYDEBUG(33, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 418 "Zend/zend_ini_scanner.l" +#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 738 "Zend/zend_ini_scanner.c" +#line 741 "Zend/zend_ini_scanner.c" yy34: YYDEBUG(34, *YYCURSOR); ++YYCURSOR; @@ -804,11 +807,11 @@ yy41: YYDEBUG(41, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 422 "Zend/zend_ini_scanner.l" +#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 812 "Zend/zend_ini_scanner.c" +#line 815 "Zend/zend_ini_scanner.c" yy42: YYDEBUG(42, *YYCURSOR); ++YYCURSOR; @@ -923,13 +926,13 @@ yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 933 "Zend/zend_ini_scanner.c" +#line 936 "Zend/zend_ini_scanner.c" yy57: YYDEBUG(57, *YYCURSOR); yych = *++YYCURSOR; @@ -1009,14 +1012,14 @@ yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 560 "Zend/zend_ini_scanner.l" +#line 563 "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); SCNG(lineno)++; return END_OF_LINE; } -#line 1020 "Zend/zend_ini_scanner.c" +#line 1023 "Zend/zend_ini_scanner.c" yy66: YYDEBUG(66, *YYCURSOR); yych = *++YYCURSOR; @@ -1156,7 +1159,7 @@ yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 504 "Zend/zend_ini_scanner.l" +#line 507 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1192,7 +1195,7 @@ zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); return TC_QUOTED_STRING; } -#line 1196 "Zend/zend_ini_scanner.c" +#line 1199 "Zend/zend_ini_scanner.c" yy77: YYDEBUG(77, *YYCURSOR); ++YYCURSOR; @@ -1201,12 +1204,12 @@ yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 499 "Zend/zend_ini_scanner.l" +#line 502 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; } -#line 1210 "Zend/zend_ini_scanner.c" +#line 1213 "Zend/zend_ini_scanner.c" yy79: YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; @@ -1215,12 +1218,12 @@ ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 1224 "Zend/zend_ini_scanner.c" +#line 1227 "Zend/zend_ini_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); ++YYCURSOR; @@ -1320,11 +1323,11 @@ yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 490 "Zend/zend_ini_scanner.l" +#line 493 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 1328 "Zend/zend_ini_scanner.c" +#line 1331 "Zend/zend_ini_scanner.c" yy88: YYDEBUG(88, *YYCURSOR); yyaccept = 0; @@ -1341,23 +1344,23 @@ yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 1349 "Zend/zend_ini_scanner.c" +#line 1352 "Zend/zend_ini_scanner.c" yy91: YYDEBUG(91, *YYCURSOR); ++YYCURSOR; yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 1361 "Zend/zend_ini_scanner.c" +#line 1364 "Zend/zend_ini_scanner.c" yy93: YYDEBUG(93, *YYCURSOR); yych = *++YYCURSOR; @@ -1419,11 +1422,11 @@ yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 1427 "Zend/zend_ini_scanner.c" +#line 1430 "Zend/zend_ini_scanner.c" yy99: YYDEBUG(99, *YYCURSOR); yyaccept = 3; @@ -1449,11 +1452,11 @@ yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 1457 "Zend/zend_ini_scanner.c" +#line 1460 "Zend/zend_ini_scanner.c" yy101: YYDEBUG(101, *YYCURSOR); yych = *++YYCURSOR; @@ -1464,12 +1467,12 @@ yy103: YYDEBUG(103, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 393 "Zend/zend_ini_scanner.l" +#line 396 "Zend/zend_ini_scanner.l" { /* End of section or an option offset */ BEGIN(INITIAL); return ']'; } -#line 1473 "Zend/zend_ini_scanner.c" +#line 1476 "Zend/zend_ini_scanner.c" yy104: YYDEBUG(104, *YYCURSOR); yyaccept = 0; @@ -1759,7 +1762,7 @@ ++YYCURSOR; YYDEBUG(128, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -1768,18 +1771,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1772 "Zend/zend_ini_scanner.c" +#line 1775 "Zend/zend_ini_scanner.c" yy129: YYDEBUG(129, *YYCURSOR); ++YYCURSOR; YYDEBUG(130, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 1783 "Zend/zend_ini_scanner.c" +#line 1786 "Zend/zend_ini_scanner.c" yy131: YYDEBUG(131, *YYCURSOR); yyaccept = 0; @@ -1884,12 +1887,12 @@ ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 567 "Zend/zend_ini_scanner.l" +#line 570 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1893 "Zend/zend_ini_scanner.c" +#line 1896 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; @@ -1898,7 +1901,7 @@ yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 445 "Zend/zend_ini_scanner.l" +#line 448 "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] == '"') { @@ -1907,7 +1910,7 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1911 "Zend/zend_ini_scanner.c" +#line 1914 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; @@ -1929,13 +1932,13 @@ yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 458 "Zend/zend_ini_scanner.l" +#line 461 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1939 "Zend/zend_ini_scanner.c" +#line 1942 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; @@ -1963,13 +1966,13 @@ yy149: YYDEBUG(149, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1973 "Zend/zend_ini_scanner.c" +#line 1976 "Zend/zend_ini_scanner.c" yy150: YYDEBUG(150, *YYCURSOR); yych = *++YYCURSOR; @@ -2068,21 +2071,21 @@ yy160: YYDEBUG(160, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 454 "Zend/zend_ini_scanner.l" +#line 457 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2076 "Zend/zend_ini_scanner.c" +#line 2079 "Zend/zend_ini_scanner.c" yy161: YYDEBUG(161, *YYCURSOR); ++YYCURSOR; YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 2086 "Zend/zend_ini_scanner.c" +#line 2089 "Zend/zend_ini_scanner.c" yy163: YYDEBUG(163, *YYCURSOR); ++YYCURSOR; @@ -2091,13 +2094,13 @@ yy164: YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 374 "Zend/zend_ini_scanner.l" +#line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2101 "Zend/zend_ini_scanner.c" +#line 2104 "Zend/zend_ini_scanner.c" yy165: YYDEBUG(165, *YYCURSOR); ++YYCURSOR; @@ -2219,11 +2222,11 @@ yy174: YYDEBUG(174, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 490 "Zend/zend_ini_scanner.l" +#line 493 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2227 "Zend/zend_ini_scanner.c" +#line 2230 "Zend/zend_ini_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 0; @@ -2242,23 +2245,23 @@ yy177: YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 2250 "Zend/zend_ini_scanner.c" +#line 2253 "Zend/zend_ini_scanner.c" yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2262 "Zend/zend_ini_scanner.c" +#line 2265 "Zend/zend_ini_scanner.c" yy180: YYDEBUG(180, *YYCURSOR); yych = *++YYCURSOR; @@ -2320,11 +2323,11 @@ yy185: YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 2328 "Zend/zend_ini_scanner.c" +#line 2331 "Zend/zend_ini_scanner.c" yy186: YYDEBUG(186, *YYCURSOR); yyaccept = 3; @@ -2350,11 +2353,11 @@ yy187: YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2358 "Zend/zend_ini_scanner.c" +#line 2361 "Zend/zend_ini_scanner.c" yy188: YYDEBUG(188, *YYCURSOR); yych = *++YYCURSOR; @@ -2367,13 +2370,13 @@ yy190: YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 374 "Zend/zend_ini_scanner.l" +#line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2377 "Zend/zend_ini_scanner.c" +#line 2380 "Zend/zend_ini_scanner.c" yy191: YYDEBUG(191, *YYCURSOR); ++YYCURSOR; @@ -2685,7 +2688,7 @@ ++YYCURSOR; YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -2694,18 +2697,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2698 "Zend/zend_ini_scanner.c" +#line 2701 "Zend/zend_ini_scanner.c" yy220: YYDEBUG(220, *YYCURSOR); ++YYCURSOR; YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 2709 "Zend/zend_ini_scanner.c" +#line 2712 "Zend/zend_ini_scanner.c" yy222: YYDEBUG(222, *YYCURSOR); yyaccept = 0; @@ -2885,12 +2888,12 @@ yy228: YYDEBUG(228, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 567 "Zend/zend_ini_scanner.l" +#line 570 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2894 "Zend/zend_ini_scanner.c" +#line 2897 "Zend/zend_ini_scanner.c" yy229: YYDEBUG(229, *YYCURSOR); yyaccept = 0; @@ -2899,11 +2902,11 @@ yy230: YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 486 "Zend/zend_ini_scanner.l" +#line 489 "Zend/zend_ini_scanner.l" { /* Get everything else as option/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2907 "Zend/zend_ini_scanner.c" +#line 2910 "Zend/zend_ini_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); yyaccept = 1; @@ -2912,24 +2915,24 @@ yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 540 "Zend/zend_ini_scanner.l" +#line 543 "Zend/zend_ini_scanner.l" { RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); } -#line 2920 "Zend/zend_ini_scanner.c" +#line 2923 "Zend/zend_ini_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); ++YYCURSOR; yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 458 "Zend/zend_ini_scanner.l" +#line 461 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2933 "Zend/zend_ini_scanner.c" +#line 2936 "Zend/zend_ini_scanner.c" yy235: YYDEBUG(235, *YYCURSOR); yych = *++YYCURSOR; @@ -2943,23 +2946,23 @@ yy237: YYDEBUG(237, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 476 "Zend/zend_ini_scanner.l" +#line 479 "Zend/zend_ini_scanner.l" { /* Boolean operators */ return yytext[0]; } -#line 2951 "Zend/zend_ini_scanner.c" +#line 2954 "Zend/zend_ini_scanner.c" yy238: YYDEBUG(238, *YYCURSOR); ++YYCURSOR; yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2963 "Zend/zend_ini_scanner.c" +#line 2966 "Zend/zend_ini_scanner.c" yy240: YYDEBUG(240, *YYCURSOR); yych = *++YYCURSOR; @@ -3035,11 +3038,11 @@ yy245: YYDEBUG(245, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3043 "Zend/zend_ini_scanner.c" +#line 3046 "Zend/zend_ini_scanner.c" yy246: YYDEBUG(246, *YYCURSOR); yyaccept = 2; @@ -3050,13 +3053,13 @@ ++YYCURSOR; YYDEBUG(248, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 480 "Zend/zend_ini_scanner.l" +#line 483 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3060 "Zend/zend_ini_scanner.c" +#line 3063 "Zend/zend_ini_scanner.c" yy249: YYDEBUG(249, *YYCURSOR); yyaccept = 4; @@ -3092,11 +3095,11 @@ yy250: YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 3100 "Zend/zend_ini_scanner.c" +#line 3103 "Zend/zend_ini_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); yyaccept = 4; @@ -3588,11 +3591,11 @@ yy267: YYDEBUG(267, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 418 "Zend/zend_ini_scanner.l" +#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 3596 "Zend/zend_ini_scanner.c" +#line 3599 "Zend/zend_ini_scanner.c" yy268: YYDEBUG(268, *YYCURSOR); ++YYCURSOR; @@ -3792,11 +3795,11 @@ yy274: YYDEBUG(274, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 422 "Zend/zend_ini_scanner.l" +#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 3800 "Zend/zend_ini_scanner.c" +#line 3803 "Zend/zend_ini_scanner.c" yy275: YYDEBUG(275, *YYCURSOR); ++YYCURSOR; @@ -4172,13 +4175,13 @@ yy287: YYDEBUG(287, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4182 "Zend/zend_ini_scanner.c" +#line 4185 "Zend/zend_ini_scanner.c" yy288: YYDEBUG(288, *YYCURSOR); yych = *++YYCURSOR; @@ -4390,7 +4393,7 @@ ++YYCURSOR; YYDEBUG(300, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -4399,18 +4402,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4403 "Zend/zend_ini_scanner.c" +#line 4406 "Zend/zend_ini_scanner.c" yy301: YYDEBUG(301, *YYCURSOR); ++YYCURSOR; YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 4414 "Zend/zend_ini_scanner.c" +#line 4417 "Zend/zend_ini_scanner.c" yy303: YYDEBUG(303, *YYCURSOR); ++YYCURSOR; @@ -4539,7 +4542,7 @@ yy313: YYDEBUG(313, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 403 "Zend/zend_ini_scanner.l" +#line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -4549,28 +4552,28 @@ RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4553 "Zend/zend_ini_scanner.c" +#line 4556 "Zend/zend_ini_scanner.c" yy314: YYDEBUG(314, *YYCURSOR); ++YYCURSOR; YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 4563 "Zend/zend_ini_scanner.c" +#line 4566 "Zend/zend_ini_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); ++YYCURSOR; YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 413 "Zend/zend_ini_scanner.l" +#line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4574 "Zend/zend_ini_scanner.c" +#line 4577 "Zend/zend_ini_scanner.c" yy318: YYDEBUG(318, *YYCURSOR); ++YYCURSOR; @@ -4584,6 +4587,6 @@ goto yy313; } } -#line 576 "Zend/zend_ini_scanner.l" +#line 579 "Zend/zend_ini_scanner.l" } Index: trunk/Zend/zend_ini_scanner.l =================================================================== --- trunk/Zend/zend_ini_scanner.l (revision 323449) +++ trunk/Zend/zend_ini_scanner.l (working copy) @@ -228,12 +228,15 @@ char *buf; size_t size; - if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE || - init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE - ) { + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } + if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { + zend_file_handle_dtor(fh TSRMLS_CC); + return FAILURE; + } + yy_scan_buffer(buf, size TSRMLS_CC); return SUCCESS; Index: trunk/ext/standard/tests/file/bug61087.phpt =================================================================== --- trunk/ext/standard/tests/file/bug61087.phpt (revision 0) +++ trunk/ext/standard/tests/file/bug61087.phpt (working copy) @@ -0,0 +1,12 @@ +--TEST-- +Bug #61087 (Memory leak in parse_ini_file when specifying invalid scanner mode) +--FILE-- +<?php + +// the used file is actually irrelevant, so just use this file +// even though it's not an .ini +parse_ini_file(__FILE__, false, 100); + +?> +--EXPECTF-- +Warning: Invalid scanner mode in %s on line %d Index: branches/PHP_5_3/Zend/zend_ini_scanner_defs.h =================================================================== --- branches/PHP_5_3/Zend/zend_ini_scanner_defs.h (revision 323449) +++ branches/PHP_5_3/Zend/zend_ini_scanner_defs.h (working copy) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Aug 26 18:01:17 2011 */ +/* Generated by re2c 0.13.5 on Thu Feb 23 18:24:24 2012 */ #line 3 "Zend/zend_ini_scanner_defs.h" enum YYCONDTYPE { Index: branches/PHP_5_3/Zend/zend_ini_scanner.c =================================================================== --- branches/PHP_5_3/Zend/zend_ini_scanner.c (revision 323449) +++ branches/PHP_5_3/Zend/zend_ini_scanner.c (working copy) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Fri Aug 26 18:01:17 2011 */ +/* Generated by re2c 0.13.5 on Thu Feb 23 18:24:24 2012 */ #line 1 "Zend/zend_ini_scanner.l" /* +----------------------------------------------------------------------+ @@ -230,12 +230,15 @@ char *buf; size_t size; - if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE || - init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE - ) { + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } + if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { + zend_file_handle_dtor(fh TSRMLS_CC); + return FAILURE; + } + yy_scan_buffer(buf, size TSRMLS_CC); return SUCCESS; @@ -330,7 +333,7 @@ } } -#line 334 "Zend/zend_ini_scanner.c" +#line 337 "Zend/zend_ini_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -459,7 +462,7 @@ yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 426 "Zend/zend_ini_scanner.l" +#line 429 "Zend/zend_ini_scanner.l" { /* Get option name */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -469,7 +472,7 @@ RETURN_TOKEN(TC_LABEL, yytext, yyleng); } -#line 473 "Zend/zend_ini_scanner.c" +#line 476 "Zend/zend_ini_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yyaccept = 0; @@ -478,24 +481,24 @@ yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 544 "Zend/zend_ini_scanner.l" +#line 547 "Zend/zend_ini_scanner.l" { /* eat whitespace */ goto restart; } -#line 487 "Zend/zend_ini_scanner.c" +#line 490 "Zend/zend_ini_scanner.c" yy6: YYDEBUG(6, *YYCURSOR); ++YYCURSOR; yy7: YYDEBUG(7, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 549 "Zend/zend_ini_scanner.l" +#line 552 "Zend/zend_ini_scanner.l" { SCNG(lineno)++; return END_OF_LINE; } -#line 499 "Zend/zend_ini_scanner.c" +#line 502 "Zend/zend_ini_scanner.c" yy8: YYDEBUG(8, *YYCURSOR); yych = *++YYCURSOR; @@ -530,11 +533,11 @@ ++YYCURSOR; YYDEBUG(11, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 472 "Zend/zend_ini_scanner.l" +#line 475 "Zend/zend_ini_scanner.l" { /* Disallow these chars outside option values */ return yytext[0]; } -#line 538 "Zend/zend_ini_scanner.c" +#line 541 "Zend/zend_ini_scanner.c" yy12: YYDEBUG(12, *YYCURSOR); yyaccept = 1; @@ -551,11 +554,11 @@ goto yy54; YYDEBUG(15, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 559 "Zend/zend_ini_scanner.c" +#line 562 "Zend/zend_ini_scanner.c" yy16: YYDEBUG(16, *YYCURSOR); ++YYCURSOR; @@ -564,7 +567,7 @@ yy17: YYDEBUG(17, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 436 "Zend/zend_ini_scanner.l" +#line 439 "Zend/zend_ini_scanner.l" { /* Start option value */ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { yy_push_state(ST_RAW TSRMLS_CC); @@ -573,7 +576,7 @@ } return '='; } -#line 577 "Zend/zend_ini_scanner.c" +#line 580 "Zend/zend_ini_scanner.c" yy18: YYDEBUG(18, *YYCURSOR); yych = *++YYCURSOR; @@ -629,7 +632,7 @@ ++YYCURSOR; YYDEBUG(24, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 355 "Zend/zend_ini_scanner.l" +#line 358 "Zend/zend_ini_scanner.l" { /* Section start */ /* Enter section data lookup state */ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) { @@ -639,7 +642,7 @@ } return TC_SECTION; } -#line 643 "Zend/zend_ini_scanner.c" +#line 646 "Zend/zend_ini_scanner.c" yy25: YYDEBUG(25, *YYCURSOR); ++YYCURSOR; @@ -669,7 +672,7 @@ } YYDEBUG(30, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 380 "Zend/zend_ini_scanner.l" +#line 383 "Zend/zend_ini_scanner.l" { /* Start of option with offset */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -682,7 +685,7 @@ RETURN_TOKEN(TC_OFFSET, yytext, yyleng); } -#line 686 "Zend/zend_ini_scanner.c" +#line 689 "Zend/zend_ini_scanner.c" yy31: YYDEBUG(31, *YYCURSOR); ++YYCURSOR; @@ -730,11 +733,11 @@ yy33: YYDEBUG(33, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 418 "Zend/zend_ini_scanner.l" +#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 738 "Zend/zend_ini_scanner.c" +#line 741 "Zend/zend_ini_scanner.c" yy34: YYDEBUG(34, *YYCURSOR); ++YYCURSOR; @@ -804,11 +807,11 @@ yy41: YYDEBUG(41, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 422 "Zend/zend_ini_scanner.l" +#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 812 "Zend/zend_ini_scanner.c" +#line 815 "Zend/zend_ini_scanner.c" yy42: YYDEBUG(42, *YYCURSOR); ++YYCURSOR; @@ -923,13 +926,13 @@ yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 933 "Zend/zend_ini_scanner.c" +#line 936 "Zend/zend_ini_scanner.c" yy57: YYDEBUG(57, *YYCURSOR); yych = *++YYCURSOR; @@ -1009,14 +1012,14 @@ yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 560 "Zend/zend_ini_scanner.l" +#line 563 "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); SCNG(lineno)++; return END_OF_LINE; } -#line 1020 "Zend/zend_ini_scanner.c" +#line 1023 "Zend/zend_ini_scanner.c" yy66: YYDEBUG(66, *YYCURSOR); yych = *++YYCURSOR; @@ -1156,7 +1159,7 @@ yy76: YYDEBUG(76, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 504 "Zend/zend_ini_scanner.l" +#line 507 "Zend/zend_ini_scanner.l" { /* Escape double quoted string contents */ if (YYCURSOR > YYLIMIT) { return 0; @@ -1192,7 +1195,7 @@ zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); return TC_QUOTED_STRING; } -#line 1196 "Zend/zend_ini_scanner.c" +#line 1199 "Zend/zend_ini_scanner.c" yy77: YYDEBUG(77, *YYCURSOR); ++YYCURSOR; @@ -1201,12 +1204,12 @@ yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 499 "Zend/zend_ini_scanner.l" +#line 502 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string ends */ yy_pop_state(TSRMLS_C); return '"'; } -#line 1210 "Zend/zend_ini_scanner.c" +#line 1213 "Zend/zend_ini_scanner.c" yy79: YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; @@ -1215,12 +1218,12 @@ ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 1224 "Zend/zend_ini_scanner.c" +#line 1227 "Zend/zend_ini_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); ++YYCURSOR; @@ -1320,11 +1323,11 @@ yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 490 "Zend/zend_ini_scanner.l" +#line 493 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 1328 "Zend/zend_ini_scanner.c" +#line 1331 "Zend/zend_ini_scanner.c" yy88: YYDEBUG(88, *YYCURSOR); yyaccept = 0; @@ -1341,23 +1344,23 @@ yy90: YYDEBUG(90, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 1349 "Zend/zend_ini_scanner.c" +#line 1352 "Zend/zend_ini_scanner.c" yy91: YYDEBUG(91, *YYCURSOR); ++YYCURSOR; yy92: YYDEBUG(92, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 1361 "Zend/zend_ini_scanner.c" +#line 1364 "Zend/zend_ini_scanner.c" yy93: YYDEBUG(93, *YYCURSOR); yych = *++YYCURSOR; @@ -1419,11 +1422,11 @@ yy98: YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 1427 "Zend/zend_ini_scanner.c" +#line 1430 "Zend/zend_ini_scanner.c" yy99: YYDEBUG(99, *YYCURSOR); yyaccept = 3; @@ -1449,11 +1452,11 @@ yy100: YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 1457 "Zend/zend_ini_scanner.c" +#line 1460 "Zend/zend_ini_scanner.c" yy101: YYDEBUG(101, *YYCURSOR); yych = *++YYCURSOR; @@ -1464,12 +1467,12 @@ yy103: YYDEBUG(103, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 393 "Zend/zend_ini_scanner.l" +#line 396 "Zend/zend_ini_scanner.l" { /* End of section or an option offset */ BEGIN(INITIAL); return ']'; } -#line 1473 "Zend/zend_ini_scanner.c" +#line 1476 "Zend/zend_ini_scanner.c" yy104: YYDEBUG(104, *YYCURSOR); yyaccept = 0; @@ -1759,7 +1762,7 @@ ++YYCURSOR; YYDEBUG(128, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -1768,18 +1771,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1772 "Zend/zend_ini_scanner.c" +#line 1775 "Zend/zend_ini_scanner.c" yy129: YYDEBUG(129, *YYCURSOR); ++YYCURSOR; YYDEBUG(130, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 1783 "Zend/zend_ini_scanner.c" +#line 1786 "Zend/zend_ini_scanner.c" yy131: YYDEBUG(131, *YYCURSOR); yyaccept = 0; @@ -1884,12 +1887,12 @@ ++YYCURSOR; YYDEBUG(138, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 567 "Zend/zend_ini_scanner.l" +#line 570 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 1893 "Zend/zend_ini_scanner.c" +#line 1896 "Zend/zend_ini_scanner.c" yy139: YYDEBUG(139, *YYCURSOR); ++YYCURSOR; @@ -1898,7 +1901,7 @@ yy140: YYDEBUG(140, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 445 "Zend/zend_ini_scanner.l" +#line 448 "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] == '"') { @@ -1907,7 +1910,7 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 1911 "Zend/zend_ini_scanner.c" +#line 1914 "Zend/zend_ini_scanner.c" yy141: YYDEBUG(141, *YYCURSOR); yyaccept = 0; @@ -1929,13 +1932,13 @@ yy143: YYDEBUG(143, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 458 "Zend/zend_ini_scanner.l" +#line 461 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1939 "Zend/zend_ini_scanner.c" +#line 1942 "Zend/zend_ini_scanner.c" yy144: YYDEBUG(144, *YYCURSOR); yych = *++YYCURSOR; @@ -1963,13 +1966,13 @@ yy149: YYDEBUG(149, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 1973 "Zend/zend_ini_scanner.c" +#line 1976 "Zend/zend_ini_scanner.c" yy150: YYDEBUG(150, *YYCURSOR); yych = *++YYCURSOR; @@ -2068,21 +2071,21 @@ yy160: YYDEBUG(160, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 454 "Zend/zend_ini_scanner.l" +#line 457 "Zend/zend_ini_scanner.l" { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2076 "Zend/zend_ini_scanner.c" +#line 2079 "Zend/zend_ini_scanner.c" yy161: YYDEBUG(161, *YYCURSOR); ++YYCURSOR; YYDEBUG(162, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 2086 "Zend/zend_ini_scanner.c" +#line 2089 "Zend/zend_ini_scanner.c" yy163: YYDEBUG(163, *YYCURSOR); ++YYCURSOR; @@ -2091,13 +2094,13 @@ yy164: YYDEBUG(164, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 374 "Zend/zend_ini_scanner.l" +#line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2101 "Zend/zend_ini_scanner.c" +#line 2104 "Zend/zend_ini_scanner.c" yy165: YYDEBUG(165, *YYCURSOR); ++YYCURSOR; @@ -2219,11 +2222,11 @@ yy174: YYDEBUG(174, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 490 "Zend/zend_ini_scanner.l" +#line 493 "Zend/zend_ini_scanner.l" { /* Get rest as section/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2227 "Zend/zend_ini_scanner.c" +#line 2230 "Zend/zend_ini_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 0; @@ -2242,23 +2245,23 @@ yy177: YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 2250 "Zend/zend_ini_scanner.c" +#line 2253 "Zend/zend_ini_scanner.c" yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2262 "Zend/zend_ini_scanner.c" +#line 2265 "Zend/zend_ini_scanner.c" yy180: YYDEBUG(180, *YYCURSOR); yych = *++YYCURSOR; @@ -2320,11 +2323,11 @@ yy185: YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 2328 "Zend/zend_ini_scanner.c" +#line 2331 "Zend/zend_ini_scanner.c" yy186: YYDEBUG(186, *YYCURSOR); yyaccept = 3; @@ -2350,11 +2353,11 @@ yy187: YYDEBUG(187, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 2358 "Zend/zend_ini_scanner.c" +#line 2361 "Zend/zend_ini_scanner.c" yy188: YYDEBUG(188, *YYCURSOR); yych = *++YYCURSOR; @@ -2367,13 +2370,13 @@ yy190: YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 374 "Zend/zend_ini_scanner.l" +#line 377 "Zend/zend_ini_scanner.l" { /* End of section */ BEGIN(INITIAL); SCNG(lineno)++; return ']'; } -#line 2377 "Zend/zend_ini_scanner.c" +#line 2380 "Zend/zend_ini_scanner.c" yy191: YYDEBUG(191, *YYCURSOR); ++YYCURSOR; @@ -2685,7 +2688,7 @@ ++YYCURSOR; YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -2694,18 +2697,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 2698 "Zend/zend_ini_scanner.c" +#line 2701 "Zend/zend_ini_scanner.c" yy220: YYDEBUG(220, *YYCURSOR); ++YYCURSOR; YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 2709 "Zend/zend_ini_scanner.c" +#line 2712 "Zend/zend_ini_scanner.c" yy222: YYDEBUG(222, *YYCURSOR); yyaccept = 0; @@ -2885,12 +2888,12 @@ yy228: YYDEBUG(228, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 567 "Zend/zend_ini_scanner.l" +#line 570 "Zend/zend_ini_scanner.l" { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } -#line 2894 "Zend/zend_ini_scanner.c" +#line 2897 "Zend/zend_ini_scanner.c" yy229: YYDEBUG(229, *YYCURSOR); yyaccept = 0; @@ -2899,11 +2902,11 @@ yy230: YYDEBUG(230, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 486 "Zend/zend_ini_scanner.l" +#line 489 "Zend/zend_ini_scanner.l" { /* Get everything else as option/offset value */ RETURN_TOKEN(TC_STRING, yytext, yyleng); } -#line 2907 "Zend/zend_ini_scanner.c" +#line 2910 "Zend/zend_ini_scanner.c" yy231: YYDEBUG(231, *YYCURSOR); yyaccept = 1; @@ -2912,24 +2915,24 @@ yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 540 "Zend/zend_ini_scanner.l" +#line 543 "Zend/zend_ini_scanner.l" { RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); } -#line 2920 "Zend/zend_ini_scanner.c" +#line 2923 "Zend/zend_ini_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); ++YYCURSOR; yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 458 "Zend/zend_ini_scanner.l" +#line 461 "Zend/zend_ini_scanner.l" { /* End of option value */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 2933 "Zend/zend_ini_scanner.c" +#line 2936 "Zend/zend_ini_scanner.c" yy235: YYDEBUG(235, *YYCURSOR); yych = *++YYCURSOR; @@ -2943,23 +2946,23 @@ yy237: YYDEBUG(237, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 476 "Zend/zend_ini_scanner.l" +#line 479 "Zend/zend_ini_scanner.l" { /* Boolean operators */ return yytext[0]; } -#line 2951 "Zend/zend_ini_scanner.c" +#line 2954 "Zend/zend_ini_scanner.c" yy238: YYDEBUG(238, *YYCURSOR); ++YYCURSOR; yy239: YYDEBUG(239, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 494 "Zend/zend_ini_scanner.l" +#line 497 "Zend/zend_ini_scanner.l" { /* Double quoted '"' string start */ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC); return '"'; } -#line 2963 "Zend/zend_ini_scanner.c" +#line 2966 "Zend/zend_ini_scanner.c" yy240: YYDEBUG(240, *YYCURSOR); yych = *++YYCURSOR; @@ -3035,11 +3038,11 @@ yy245: YYDEBUG(245, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 468 "Zend/zend_ini_scanner.l" +#line 471 "Zend/zend_ini_scanner.l" { /* Get number option value as string */ RETURN_TOKEN(TC_NUMBER, yytext, yyleng); } -#line 3043 "Zend/zend_ini_scanner.c" +#line 3046 "Zend/zend_ini_scanner.c" yy246: YYDEBUG(246, *YYCURSOR); yyaccept = 2; @@ -3050,13 +3053,13 @@ ++YYCURSOR; YYDEBUG(248, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 480 "Zend/zend_ini_scanner.l" +#line 483 "Zend/zend_ini_scanner.l" { /* Make = used in option value to trigger error */ yyless(0); BEGIN(INITIAL); return END_OF_LINE; } -#line 3060 "Zend/zend_ini_scanner.c" +#line 3063 "Zend/zend_ini_scanner.c" yy249: YYDEBUG(249, *YYCURSOR); yyaccept = 4; @@ -3092,11 +3095,11 @@ yy250: YYDEBUG(250, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 464 "Zend/zend_ini_scanner.l" +#line 467 "Zend/zend_ini_scanner.l" { /* Get constant option value */ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng); } -#line 3100 "Zend/zend_ini_scanner.c" +#line 3103 "Zend/zend_ini_scanner.c" yy251: YYDEBUG(251, *YYCURSOR); yyaccept = 4; @@ -3588,11 +3591,11 @@ yy267: YYDEBUG(267, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 418 "Zend/zend_ini_scanner.l" +#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 3596 "Zend/zend_ini_scanner.c" +#line 3599 "Zend/zend_ini_scanner.c" yy268: YYDEBUG(268, *YYCURSOR); ++YYCURSOR; @@ -3792,11 +3795,11 @@ yy274: YYDEBUG(274, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 422 "Zend/zend_ini_scanner.l" +#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 3800 "Zend/zend_ini_scanner.c" +#line 3803 "Zend/zend_ini_scanner.c" yy275: YYDEBUG(275, *YYCURSOR); ++YYCURSOR; @@ -4172,13 +4175,13 @@ yy287: YYDEBUG(287, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 554 "Zend/zend_ini_scanner.l" +#line 557 "Zend/zend_ini_scanner.l" { /* Comment */ BEGIN(INITIAL); SCNG(lineno)++; return END_OF_LINE; } -#line 4182 "Zend/zend_ini_scanner.c" +#line 4185 "Zend/zend_ini_scanner.c" yy288: YYDEBUG(288, *YYCURSOR); yych = *++YYCURSOR; @@ -4390,7 +4393,7 @@ ++YYCURSOR; YYDEBUG(300, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 365 "Zend/zend_ini_scanner.l" +#line 368 "Zend/zend_ini_scanner.l" { /* Raw string */ /* Eat leading and trailing single quotes */ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') { @@ -4399,18 +4402,18 @@ } RETURN_TOKEN(TC_RAW, yytext, yyleng); } -#line 4403 "Zend/zend_ini_scanner.c" +#line 4406 "Zend/zend_ini_scanner.c" yy301: YYDEBUG(301, *YYCURSOR); ++YYCURSOR; YYDEBUG(302, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 398 "Zend/zend_ini_scanner.l" +#line 401 "Zend/zend_ini_scanner.l" { /* Variable start */ yy_push_state(ST_VARNAME TSRMLS_CC); return TC_DOLLAR_CURLY; } -#line 4414 "Zend/zend_ini_scanner.c" +#line 4417 "Zend/zend_ini_scanner.c" yy303: YYDEBUG(303, *YYCURSOR); ++YYCURSOR; @@ -4539,7 +4542,7 @@ yy313: YYDEBUG(313, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 403 "Zend/zend_ini_scanner.l" +#line 406 "Zend/zend_ini_scanner.l" { /* Variable name */ /* Eat leading whitespace */ EAT_LEADING_WHITESPACE(); @@ -4549,28 +4552,28 @@ RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } -#line 4553 "Zend/zend_ini_scanner.c" +#line 4556 "Zend/zend_ini_scanner.c" yy314: YYDEBUG(314, *YYCURSOR); ++YYCURSOR; YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 572 "Zend/zend_ini_scanner.l" +#line 575 "Zend/zend_ini_scanner.l" { return 0; } -#line 4563 "Zend/zend_ini_scanner.c" +#line 4566 "Zend/zend_ini_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); ++YYCURSOR; YYDEBUG(317, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 413 "Zend/zend_ini_scanner.l" +#line 416 "Zend/zend_ini_scanner.l" { /* Variable end */ yy_pop_state(TSRMLS_C); return '}'; } -#line 4574 "Zend/zend_ini_scanner.c" +#line 4577 "Zend/zend_ini_scanner.c" yy318: YYDEBUG(318, *YYCURSOR); ++YYCURSOR; @@ -4584,6 +4587,6 @@ goto yy313; } } -#line 576 "Zend/zend_ini_scanner.l" +#line 579 "Zend/zend_ini_scanner.l" } Index: branches/PHP_5_3/Zend/zend_ini_scanner.l =================================================================== --- branches/PHP_5_3/Zend/zend_ini_scanner.l (revision 323449) +++ branches/PHP_5_3/Zend/zend_ini_scanner.l (working copy) @@ -228,12 +228,15 @@ char *buf; size_t size; - if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE || - init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE - ) { + if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) { return FAILURE; } + if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) { + zend_file_handle_dtor(fh TSRMLS_CC); + return FAILURE; + } + yy_scan_buffer(buf, size TSRMLS_CC); return SUCCESS; Index: branches/PHP_5_3/ext/standard/tests/file/bug61087.phpt =================================================================== --- branches/PHP_5_3/ext/standard/tests/file/bug61087.phpt (revision 0) +++ branches/PHP_5_3/ext/standard/tests/file/bug61087.phpt (working copy) @@ -0,0 +1,12 @@ +--TEST-- +Bug #61087 (Memory leak in parse_ini_file when specifying invalid scanner mode) +--FILE-- +<?php + +// the used file is actually irrelevant, so just use this file +// even though it's not an .ini +parse_ini_file(__FILE__, false, 100); + +?> +--EXPECTF-- +Warning: Invalid scanner mode in %s on line %d Index: branches/PHP_5_3/NEWS =================================================================== --- branches/PHP_5_3/NEWS (revision 323449) +++ branches/PHP_5_3/NEWS (working copy) @@ -24,6 +24,7 @@ . Fixed bug #60227 (header() cannot detect the multi-line header with CR). (rui, Gustavo) . Fixed bug #51860 (Include fails with toplevel symlink to /). (Dmitry) + . Fixed bug #61087 (Memory leak in parse_ini_file when specifying invalid scanner mode). (Nikic, Laruence) - Firebird Database extension (ibase): . Fixed bug #60802 (ibase_trans() gives segfault when passing params). |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Sat Nov 23 11:01:28 2024 UTC |