--- embedaddon/php/Zend/zend_ini_scanner.l 2012/02/21 23:47:52 1.1.1.1 +++ embedaddon/php/Zend/zend_ini_scanner.l 2013/07/22 01:32:15 1.1.1.3 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2013 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 | @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini_scanner.l,v 1.1.1.1 2012/02/21 23:47:52 misho Exp $ */ +/* $Id: zend_ini_scanner.l,v 1.1.1.3 2013/07/22 01:32:15 misho Exp $ */ #include #include "zend.h" @@ -228,12 +228,15 @@ int zend_ini_open_file_for_scanning(zend_file_handle * 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; @@ -442,11 +445,39 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})| return '='; } -{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ +{RAW_VALUE_CHARS} { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + char *sc = NULL; + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR) { + case '\n': + case '\r': + goto end_raw_value_chars; + break; + case ';': + if (sc == NULL) { + sc = YYCURSOR; + } + /* no break */ + default: + YYCURSOR++; + break; + } + } +end_raw_value_chars: + yyleng = YYCURSOR - SCNG(yy_text); + + /* Eat trailing semicolons */ + while (yytext[yyleng - 1] == ';') { + yyleng--; + } + /* Eat leading and trailing double quotes */ if (yytext[0] == '"' && yytext[yyleng - 1] == '"') { SCNG(yy_text)++; yyleng = yyleng - 2; + } else if (sc) { + YYCURSOR = sc; + yyleng = YYCURSOR - SCNG(yy_text); } RETURN_TOKEN(TC_RAW, yytext, yyleng); }