Re: [PHP-CVS] com php-src: Skip test if directory does not exist: tests/security/open_basedir_001.phpt
On Nov 15, 2012, at 22:45, Ferenc Kovacs tyr...@gmail.com wrote: why not using create_directories() from open_basedir.inc ? We need a directory we can use in the phpt INI section. It has to exist during PHP startup. What we might do is add preprocessing to the INI section so we could I.e. set open_basedir=$PHP_SRC/ext and depend on PHP's source tree layout. I fear this opens a can of worms of new issues though. If you have a good solution: Feel free to apply it! :) Skipping a security test is bad (as is a failing security test) Thinking about it more: /tmp might work. We might set open_basedir to /tmp and create a directory /tmp/php_open_basedir_12456 inside the test and use that inside the test. Will try that when home. johannes On Thu, Nov 15, 2012 at 12:49 PM, Pierre Joye pierre@gmail.com wrote: it would be much better to use the current directory or root tests directory for this kind of tests. Maybe adding a kind of constant we can expand in run-tests.php? On Thu, Nov 15, 2012 at 12:28 PM, Johannes Schlüter johan...@php.net wrote: Commit:7468fc0e374ad8cd8db482e6c228cdaae8aed075 Author:Johannes Schlüter johan...@php.net Thu, 15 Nov 2012 12:28:19 +0100 Parents: f5d8b638c7864150db3e7d39ecf3808850c82e0f Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7468fc0e374ad8cd8db482e6c228cdaae8aed075 Log: Skip test if directory does not exist Would be good to run this using a directory which is existing everywhere. Changed paths: M tests/security/open_basedir_001.phpt Diff: diff --git a/tests/security/open_basedir_001.phpt b/tests/security/open_basedir_001.phpt index e05861a..9ea9559 100644 --- a/tests/security/open_basedir_001.phpt +++ b/tests/security/open_basedir_001.phpt @@ -5,6 +5,9 @@ openbase_dir runtime tightning if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for unix'); } +if (!is_dir(/usr/local/bin)) { + die('skip.. no /usr/local/bin on this machine'); +} --INI-- open_basedir=/usr/local --FILE-- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ferenc Kovács @Tyr43l - http://tyrael.hu
[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: Zend/zend_ini_scanner.c Zend/zend_ini_scanner_defs.h
Commit:99edb55e417aeb7e5a9eaad4eac68a9e074bfc0f Author:Pierrick Charron pierr...@php.net Fri, 16 Nov 2012 18:24:42 -0500 Parents: 15ab75be8ad014c6fff5f2b908824ef18150a7ea c886691100eb554c01f14b69bd142e21c84ae6f6 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=99edb55e417aeb7e5a9eaad4eac68a9e074bfc0f Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: Regenerate Zend ini scanner Conflicts: Zend/zend_ini_scanner.c Zend/zend_ini_scanner_defs.h Changed paths: MM Zend/zend_ini_scanner.c MM Zend/zend_ini_scanner_defs.h Diff: diff --cc Zend/zend_ini_scanner.c index 94c48c8,b713163..a481cbd --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@@ -1,4 -1,4 +1,4 @@@ - /* Generated by re2c 0.13.5 on Thu Jun 7 17:48:25 2012 */ -/* Generated by re2c 0.13.5 on Fri Nov 16 17:44:02 2012 */ ++/* Generated by re2c 0.13.5 on Fri Nov 16 18:24:06 2012 */ #line 1 Zend/zend_ini_scanner.l /* +--+ diff --cc Zend/zend_ini_scanner_defs.h index 0c04713,50a5aea..1fe4c0c --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@@ -1,4 -1,4 +1,4 @@@ - /* Generated by re2c 0.13.5 on Thu Jun 7 17:48:25 2012 */ -/* Generated by re2c 0.13.5 on Fri Nov 16 17:44:02 2012 */ ++/* Generated by re2c 0.13.5 on Fri Nov 16 18:24:06 2012 */ #line 3 Zend/zend_ini_scanner_defs.h enum YYCONDTYPE { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value: NEWS Zend/zend_ini_scanner.l ext/standard/tests/file/bug51094.phpt ext/standard/tests/file/bug6
Commit:6dff07aa8c6fcf6cd84a2d1726ffcaeef74b9969 Author:Pierrick Charron pierr...@php.net Fri, 16 Nov 2012 18:04:14 -0500 Parents: 7468fc0e374ad8cd8db482e6c228cdaae8aed075 Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6dff07aa8c6fcf6cd84a2d1726ffcaeef74b9969 Log: Fixed bug #63512 parse_ini_file() with INI_SCANNER_RAW removes quotes from value Restore the old behavior but keep bug 51094 fixed Bugs: https://bugs.php.net/63512 https://bugs.php.net/51094 Changed paths: M NEWS M Zend/zend_ini_scanner.l M ext/standard/tests/file/bug51094.phpt A ext/standard/tests/file/bug63512.phpt Diff: diff --git a/NEWS b/NEWS index bca9590..4f89d07 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||| ?? ??? 2ß12, PHP 5.3.20 +- Zend Engine: + . Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes +from value). (Pierrick) - Core: . Fixed bug #63451 (config.guess file does not have AIX 7 defined, shared objects are not created). (kemcline at au1 dot ibm dot com) diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 8aeb076..2a21e77 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,33 +445,40 @@ SECTION_VALUE_CHARS ([^$\n\r;'\]\\]|(\\{ANY_CHAR})|{LITERAL_DOLLAR}) return '='; } -ST_RAW[] { +ST_RAW{RAW_VALUE_CHARS} { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + char *sc = NULL; while (YYCURSOR YYLIMIT) { - switch (*YYCURSOR++) { + switch (*YYCURSOR) { case '\n': - SCNG(lineno)++; - break; case '\r': - if (*YYCURSOR != '\n') { - SCNG(lineno)++; - } + goto end_raw_value_chars; break; - case '': - yyleng = YYCURSOR - SCNG(yy_text) - 2; - SCNG(yy_text)++; - RETURN_TOKEN(TC_RAW, yytext, yyleng); - case '\\': - if (YYCURSOR YYLIMIT) { - YYCURSOR++; + case ';': + if (sc == NULL) { + sc = YYCURSOR; } + /* no break */ + default: + YYCURSOR++; break; } } +end_raw_value_chars: yyleng = YYCURSOR - SCNG(yy_text); - RETURN_TOKEN(TC_RAW, yytext, yyleng); -} -ST_RAW{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */ + /* 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); } diff --git a/ext/standard/tests/file/bug51094.phpt b/ext/standard/tests/file/bug51094.phpt index 7823558..f35dfb6 100644 --- a/ext/standard/tests/file/bug51094.phpt +++ b/ext/standard/tests/file/bug51094.phpt @@ -15,7 +15,7 @@ $ini = parse_ini_string(ini=\r\niniraw, null, INI_SCANNER_RAW); var_dump($ini['ini']); --EXPECTF-- string(7) ini;raw -string(8) ini;raw +string(4) ini string(3) ini string(7) iniraw string(0) diff --git a/ext/standard/tests/file/bug63512.phpt b/ext/standard/tests/file/bug63512.phpt new file mode 100644 index 000..049db26 --- /dev/null +++ b/ext/standard/tests/file/bug63512.phpt @@ -0,0 +1,33 @@ +--TEST-- +Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes from value). +--FILE-- +?php + +$array = parse_ini_string(' + int = 123 + constant = INSTALL_ROOT + quotedString = string + a = INSTALL_ROOT waa + b = INSTALL_ROOT + c = waa INSTALL_ROOT + d = INSTALL_ROOT INSTALL_ROOT', false, INI_SCANNER_RAW); + +var_dump($array); +--EXPECTF-- +array(7) { + [int]= + string(3) 123 +
[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: Zend/zend_ini_scanner.c Zend/zend_ini_scanner_defs.h
Commit:8c97c79d77f968318113a99a3c560de4366a2643 Author:Pierrick Charron pierr...@php.net Fri, 16 Nov 2012 18:28:04 -0500 Parents: 30d659144a069da7de78b8740f429316c085c99e 99edb55e417aeb7e5a9eaad4eac68a9e074bfc0f Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8c97c79d77f968318113a99a3c560de4366a2643 Log: Merge branch 'PHP-5.4' into PHP-5.5 * PHP-5.4: Regenerate Zend ini scanner Conflicts: Zend/zend_ini_scanner.c Zend/zend_ini_scanner_defs.h Changed paths: MM Zend/zend_ini_scanner.c MM Zend/zend_ini_scanner_defs.h Diff: diff --cc Zend/zend_ini_scanner.c index 470f5236,a481cbd..1c7f306 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@@ -1,4 -1,4 +1,4 @@@ - /* Generated by re2c 0.13.5 on Thu Jun 7 17:55:40 2012 */ -/* Generated by re2c 0.13.5 on Fri Nov 16 18:24:06 2012 */ ++/* Generated by re2c 0.13.5 on Fri Nov 16 18:27:25 2012 */ #line 1 Zend/zend_ini_scanner.l /* +--+ diff --cc Zend/zend_ini_scanner_defs.h index 9c99cc4,1fe4c0c..b985f34 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@@ -1,4 -1,4 +1,4 @@@ - /* Generated by re2c 0.13.5 on Thu Jun 7 17:55:41 2012 */ -/* Generated by re2c 0.13.5 on Fri Nov 16 18:24:06 2012 */ ++/* Generated by re2c 0.13.5 on Fri Nov 16 18:27:25 2012 */ #line 3 Zend/zend_ini_scanner_defs.h enum YYCONDTYPE { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php