Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/standard/strnatcmp.c branches/PHP_5_3/ext/standard/strnatcmp.c trunk/ext/standard/strnatcmp.c
Could you add some test for this bug too? --Jani On 09/28/2009 04:29 PM, Rasmus Lerdorf wrote: rasmus Mon, 28 Sep 2009 13:29:53 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288896 Log: Fix for bug #49698 Bug: http://bugs.php.net/49698 (Open) Unexpected change in strnatcasecmp() Changed paths: U php/php-src/branches/PHP_5_2/ext/standard/strnatcmp.c U php/php-src/branches/PHP_5_3/ext/standard/strnatcmp.c U php/php-src/trunk/ext/standard/strnatcmp.c Modified: php/php-src/branches/PHP_5_2/ext/standard/strnatcmp.c === --- php/php-src/branches/PHP_5_2/ext/standard/strnatcmp.c 2009-09-28 13:11:21 UTC (rev 288895) +++ php/php-src/branches/PHP_5_2/ext/standard/strnatcmp.c 2009-09-28 13:29:53 UTC (rev 288896) @@ -116,12 +116,12 @@ while (1) { ca = *ap; cb = *bp; - /* skip over leading zeros unless they are followed by punctuation */ - while (leading ca == '0' (ap+1 aend) !ispunct(*(ap+1))) { + /* skip over leading zeros */ + while (leading ca == '0' (ap+1 aend) isdigit(*(ap+1))) { ca = *++ap; } - while (leading cb == '0' (bp+1 bend) !ispunct(*(bp+1))) { + while (leading cb == '0' (bp+1 bend) isdigit(*(bp+1))) { cb = *++bp; } Modified: php/php-src/branches/PHP_5_3/ext/standard/strnatcmp.c === --- php/php-src/branches/PHP_5_3/ext/standard/strnatcmp.c 2009-09-28 13:11:21 UTC (rev 288895) +++ php/php-src/branches/PHP_5_3/ext/standard/strnatcmp.c 2009-09-28 13:29:53 UTC (rev 288896) @@ -116,12 +116,12 @@ while (1) { ca = *ap; cb = *bp; - /* skip over leading zeros unless they are followed by punctuation */ - while (leading ca == '0' (ap+1 aend) !ispunct(*(ap+1))) { + /* skip over leading zeros */ + while (leading ca == '0' (ap+1 aend) isdigit(*(ap+1))) { ca = *++ap; } - while (leading cb == '0' (bp+1 bend) !ispunct(*(bp+1))) { + while (leading cb == '0' (bp+1 bend) isdigit(*(bp+1))) { cb = *++bp; } Modified: php/php-src/trunk/ext/standard/strnatcmp.c === --- php/php-src/trunk/ext/standard/strnatcmp.c 2009-09-28 13:11:21 UTC (rev 288895) +++ php/php-src/trunk/ext/standard/strnatcmp.c 2009-09-28 13:29:53 UTC (rev 288896) @@ -112,12 +112,12 @@ while (1) { ca = a[ai]; cb = b[bi]; - /* skip over leading zeros unless they are followed by punctuation */ - while (leading ca == '0' (ai+1 a_len) !ispunct(a[ai+1])) { + /* skip over leading zeros */ + while (leading ca == '0' (ai+1 a_len) isdigit(a[ai+1])) { ca = a[++ai]; } - while (leading cb == '0' (bi+1 b_len) !ispunct(b[bi+1])) { + while (leading cb == '0' (bi+1 b_len) isdigit(a[ai+1])) { cb = b[++bi]; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/date/tests/date_sunrise_variation5.phpt branches/PHP_5_2/ext/date/tests/date_sunset_variation5.phpt branches/PHP_5_3/ext/date/tests/date_sunrise_varia
rasmus Tue, 29 Sep 2009 13:56:51 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288940 Log: Fix date_sunrise/date_sunset tests Changed paths: U php/php-src/branches/PHP_5_2/ext/date/tests/date_sunrise_variation5.phpt U php/php-src/branches/PHP_5_2/ext/date/tests/date_sunset_variation5.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/date_sunrise_variation5.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/date_sunset_variation5.phpt U php/php-src/trunk/ext/date/tests/date_sunrise_variation5.phpt U php/php-src/trunk/ext/date/tests/date_sunset_variation5.phpt Modified: php/php-src/branches/PHP_5_2/ext/date/tests/date_sunrise_variation5.phpt === --- php/php-src/branches/PHP_5_2/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/branches/PHP_5_2/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,13 +113,13 @@ bool(false) --int 12345-- -string(5) 09:52 -float(9.882%d) -int(1218169377) +string(5) 09:51 +float(9.855%d) +int(1218169278) --int -12345-- string(5) 09:54 -float(9.909%d) +float(9.909782098) int(1218169475) --empty array-- Modified: php/php-src/branches/PHP_5_2/ext/date/tests/date_sunset_variation5.phpt === --- php/php-src/branches/PHP_5_2/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/branches/PHP_5_2/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,9 +113,9 @@ bool(false) --int 12345-- -string(5) 19:19 -float(19.319%d) -int(1218203349) +string(5) 19:20 +float(19.340%d) +int(1218203424) --int -12345-- bool(false) Modified: php/php-src/branches/PHP_5_3/ext/date/tests/date_sunrise_variation5.phpt === --- php/php-src/branches/PHP_5_3/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/branches/PHP_5_3/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,13 +113,13 @@ bool(false) --int 12345-- -string(5) 09:52 -float(9.882%d) -int(1218169377) +string(5) 09:51 +float(9.855%d) +int(1218169278) --int -12345-- string(5) 09:54 -float(9.909%d) +float(9.909782098) int(1218169475) --empty array-- Modified: php/php-src/branches/PHP_5_3/ext/date/tests/date_sunset_variation5.phpt === --- php/php-src/branches/PHP_5_3/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/branches/PHP_5_3/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,9 +113,9 @@ bool(false) --int 12345-- -string(5) 19:19 -float(19.319%d) -int(1218203349) +string(5) 19:20 +float(19.340%d) +int(1218203424) --int -12345-- bool(false) Modified: php/php-src/trunk/ext/date/tests/date_sunrise_variation5.phpt === --- php/php-src/trunk/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/trunk/ext/date/tests/date_sunrise_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,13 +113,13 @@ bool(false) --int 12345-- -unicode(5) 09:52 -float(9.882%d) -int(1218169377) +string(5) 09:51 +float(9.855%d) +int(1218169278) --int -12345-- -unicode(5) 09:54 -float(9.909%d) +string(5) 09:54 +float(9.909782098) int(1218169475) --empty array-- Modified: php/php-src/trunk/ext/date/tests/date_sunset_variation5.phpt === --- php/php-src/trunk/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:40:45 UTC (rev 288939) +++ php/php-src/trunk/ext/date/tests/date_sunset_variation5.phpt 2009-09-29 13:56:51 UTC (rev 288940) @@ -113,9 +113,9 @@ bool(false) --int 12345-- -unicode(5) 19:19 -float(19.319%d) -int(1218203349) +string(5) 19:20 +float(19.340%d) +int(1218203424) --int -12345-- bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_2/ext/posix/posix.c PHP_5_3/ext/posix/posix.c
rasmus Tue, 29 Sep 2009 14:02:50 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288943 Log: Add missing open_basedir check in posix_mkfifo Changed paths: U php/php-src/branches/PHP_5_2/ext/posix/posix.c U php/php-src/branches/PHP_5_3/ext/posix/posix.c Modified: php/php-src/branches/PHP_5_2/ext/posix/posix.c === --- php/php-src/branches/PHP_5_2/ext/posix/posix.c 2009-09-29 14:01:33 UTC (rev 288942) +++ php/php-src/branches/PHP_5_2/ext/posix/posix.c 2009-09-29 14:02:50 UTC (rev 288943) @@ -679,7 +679,8 @@ RETURN_FALSE; } - if (PG(safe_mode) (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) || + (PG(safe_mode) (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR { RETURN_FALSE; } Modified: php/php-src/branches/PHP_5_3/ext/posix/posix.c === --- php/php-src/branches/PHP_5_3/ext/posix/posix.c 2009-09-29 14:01:33 UTC (rev 288942) +++ php/php-src/branches/PHP_5_3/ext/posix/posix.c 2009-09-29 14:02:50 UTC (rev 288943) @@ -840,7 +840,8 @@ RETURN_FALSE; } - if (PG(safe_mode) (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) || + (PG(safe_mode) (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR { RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/posix/ posix.c
rasmus Tue, 29 Sep 2009 14:03:49 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288944 Log: Add missing open_basedir check in posix_mkfifo Changed paths: U php/php-src/trunk/ext/posix/posix.c Modified: php/php-src/trunk/ext/posix/posix.c === --- php/php-src/trunk/ext/posix/posix.c 2009-09-29 14:02:50 UTC (rev 288943) +++ php/php-src/trunk/ext/posix/posix.c 2009-09-29 14:03:49 UTC (rev 288944) @@ -873,6 +873,10 @@ RETURN_FALSE; } + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC)) { + RETURN_FALSE; + } + result = mkfifo(path, mode); if (result 0) { POSIX_G(last_error) = errno; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_2/NEWS PHP_5_2/ext/standard/file.c PHP_5_3/NEWS PHP_5_3/ext/standard/file.c
rasmus Tue, 29 Sep 2009 14:14:02 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288945 Log: Fixed a safe_mode bypass in tempnam() identified by Grzegorz Stachowiak. Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/standard/file.c U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/standard/file.c Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2009-09-29 14:03:49 UTC (rev 288944) +++ php/php-src/branches/PHP_5_2/NEWS 2009-09-29 14:14:02 UTC (rev 288945) @@ -1,6 +1,10 @@ PHP NEWS ||| ?? ??? 20??, PHP 5.2.12 +- Fixed a safe_mode bypass in tempnam() identified by Grzegorz Stachowiak. + (Rasmus) +- Fixed a open_basedir bypass in posix_mkfifo() identified by Grzegorz + Stachowiak. (Rasmus) - Fixed bug #49698 (Unexpected change in strnatcasecmp()). (Rasmus) - Fixed bug #49647 (DOMUserData does not exist). (Rob) - Fixed bug #49630 (imap_listscan function missing). (Felipe) Modified: php/php-src/branches/PHP_5_2/ext/standard/file.c === --- php/php-src/branches/PHP_5_2/ext/standard/file.c2009-09-29 14:03:49 UTC (rev 288944) +++ php/php-src/branches/PHP_5_2/ext/standard/file.c2009-09-29 14:14:02 UTC (rev 288945) @@ -838,6 +838,10 @@ convert_to_string_ex(arg1); convert_to_string_ex(arg2); + if (PG(safe_mode) (!php_checkuid(dir, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + RETURN_FALSE; + } + if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) { RETURN_FALSE; } Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2009-09-29 14:03:49 UTC (rev 288944) +++ php/php-src/branches/PHP_5_3/NEWS 2009-09-29 14:14:02 UTC (rev 288945) @@ -8,6 +8,10 @@ - Implemented FR #49253 (added support for libcurl's CERTINFO option). (Linus Nielsen Feltzing li...@haxx.se) +- Fixed a safe_mode bypass in tempnam() identified by Grzegorz Stachowiak. + (Rasmus) +- Fixed a open_basedir bypass in posix_mkfifo() identified by Grzegorz + Stachowiak. (Rasmus) - Fixed bug #49698 (Unexpected change in strnatcasecmp()). (Rasmus) - Fixed bug #49647 (DOMUserData does not exist). (Rob) - Fixed bug #49630 (imap_listscan function missing). (Felipe) Modified: php/php-src/branches/PHP_5_3/ext/standard/file.c === --- php/php-src/branches/PHP_5_3/ext/standard/file.c2009-09-29 14:03:49 UTC (rev 288944) +++ php/php-src/branches/PHP_5_3/ext/standard/file.c2009-09-29 14:14:02 UTC (rev 288945) @@ -846,6 +846,10 @@ return; } + if (PG(safe_mode) (!php_checkuid(dir, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + RETURN_FALSE; + } + if (php_check_open_basedir(dir TSRMLS_CC)) { RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/standard/tests/general_functions/bug49692.phpt branches/PHP_5_3/ext/standard/tests/general_functions/bug49692.phpt trunk/ext/standard/tests/general_fu
rdohms Tue, 29 Sep 2009 14:34:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288946 Log: Fixing tests for head and wrong SKIPIF blocks Changed paths: U php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/bug49692.phpt U php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49692.phpt U php/php-src/trunk/ext/standard/tests/general_functions/bug49692.phpt Modified: php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/bug49692.phpt === --- php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:14:02 UTC (rev 288945) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:34:06 UTC (rev 288946) @@ -2,10 +2,6 @@ Bug #49692: parse_ini_file() throws errors when key contains '/' (forward slash) --CREDITS-- Rafael Dohms rdohms [at] gmail [dot] com ---SKIPIF-- -?php - if (!extension_loaded(gd)) die(skip GD not present); -? --FILE-- ?php Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49692.phpt === --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:14:02 UTC (rev 288945) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:34:06 UTC (rev 288946) @@ -2,10 +2,6 @@ Bug #49692: parse_ini_file() throws errors when key contains '/' (forward slash) --CREDITS-- Rafael Dohms rdohms [at] gmail [dot] com ---SKIPIF-- -?php - if (!extension_loaded(gd)) die(skip GD not present); -? --FILE-- ?php Modified: php/php-src/trunk/ext/standard/tests/general_functions/bug49692.phpt === --- php/php-src/trunk/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:14:02 UTC (rev 288945) +++ php/php-src/trunk/ext/standard/tests/general_functions/bug49692.phpt 2009-09-29 14:34:06 UTC (rev 288946) @@ -2,10 +2,6 @@ Bug #49692: parse_ini_file() throws errors when key contains '/' (forward slash) --CREDITS-- Rafael Dohms rdohms [at] gmail [dot] com ---SKIPIF-- -?php - if (!extension_loaded(gd)) die(skip GD not present); -? --FILE-- ?php @@ -14,11 +10,11 @@ ? --EXPECTF-- array(1) { - [sitemap]= + [usitemap]= array(2) { -[/home]= -string(13) default:index -[/info]= -string(12) default:info +[u/home]= +unicode(13) default:index +[u/info]= +unicode(12) default:info } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
uw Tue, 29 Sep 2009 16:37:50 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288953 Log: Fixing test Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-29 16:35:42 UTC (rev 288952) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-29 16:37:50 UTC (rev 288953) @@ -50,17 +50,19 @@ if (in_array($i, $valid_attr)) continue; $invalid_attr = $i; - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { printf([006a] Expecting boolean/false for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); + } } for ($i = 0; $i 10; $i++) { do { - $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); + $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX)); } while (in_array($invalid_attr, $valid_attr)); - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf([006b] Expecting boolean/true for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); + } } $stmt-close(); Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-29 16:35:42 UTC (rev 288952) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-29 16:37:50 UTC (rev 288953) @@ -50,17 +50,19 @@ if (in_array($i, $valid_attr)) continue; $invalid_attr = $i; - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { printf([006a] Expecting boolean/false for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); + } } for ($i = 0; $i 10; $i++) { do { - $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); + $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX)); } while (in_array($invalid_attr, $valid_attr)); - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf([006b] Expecting boolean/true for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); + } } $stmt-close(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ext/standard/ file.c
felipe Tue, 29 Sep 2009 23:36:30 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288971 Log: - Fix build Changed paths: U php/php-src/branches/PHP_5_2/ext/standard/file.c Modified: php/php-src/branches/PHP_5_2/ext/standard/file.c === --- php/php-src/branches/PHP_5_2/ext/standard/file.c2009-09-29 23:05:59 UTC (rev 288970) +++ php/php-src/branches/PHP_5_2/ext/standard/file.c2009-09-29 23:36:30 UTC (rev 288971) @@ -838,7 +838,7 @@ convert_to_string_ex(arg1); convert_to_string_ex(arg2); - if (PG(safe_mode) (!php_checkuid(dir, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + if (PG(safe_mode) (!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_ALLOW_ONLY_DIR))) { RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/curl/interface.c branches/PHP_5_2/ext/curl/php_curl.h branches/PHP_5_3/NEWS branches/PHP_5_3/ext/curl/interface.c branches/PHP_5
iliaaWed, 30 Sep 2009 02:34:17 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288973 Log: Fixed bug #49517 (cURL's CURLOPT_FILE prevents file from being deleted after fclose). Bug: http://bugs.php.net/49517 (Verified) cURL's CURLOPT_FILE prevents file from being deleted after fclose Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/curl/interface.c U php/php-src/branches/PHP_5_2/ext/curl/php_curl.h U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/curl/interface.c U php/php-src/branches/PHP_5_3/ext/curl/php_curl.h U php/php-src/trunk/ext/curl/interface.c U php/php-src/trunk/ext/curl/php_curl.h Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2009-09-29 23:50:57 UTC (rev 288972) +++ php/php-src/branches/PHP_5_2/NEWS 2009-09-30 02:34:17 UTC (rev 288973) @@ -13,6 +13,8 @@ mbstring.strict_mode is turned on). (Moriyoshi) - Fixed bug #49531 (CURLOPT_INFILESIZE sometimes causes warning CURLPROTO_FILE cannot be set). (Felipe) +- Fixed bug #49517 (cURL's CURLOPT_FILE prevents file from being deleted after + fclose). (Ilia) - Fixed bug #49354 (mb_strcut() cuts wrong length when offset is in the middle of a multibyte character). (Moriyoshi) - Fixed bug #49528 (UTF-16 strings prefixed by BOMs wrondly converted). Modified: php/php-src/branches/PHP_5_2/ext/curl/interface.c === --- php/php-src/branches/PHP_5_2/ext/curl/interface.c 2009-09-29 23:50:57 UTC (rev 288972) +++ php/php-src/branches/PHP_5_2/ext/curl/interface.c 2009-09-30 02:34:17 UTC (rev 288973) @@ -1228,10 +1228,22 @@ dupch-cp = cp; dupch-uses = 0; + if (ch-handlers-write-stream) { + Z_ADDREF_P(dupch-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) { + Z_ADDREF_P(ch-handlers-read-stream); + } + dupch-handlers-read-stream = ch-handlers-read-stream; dupch-handlers-read-method = ch-handlers-read-method; dupch-handlers-write_header-method = ch-handlers-write_header-method; + if (ch-handlers-write_header-stream) { + Z_ADDREF_P(ch-handlers-write_header-stream); + } + dupch-handlers-write_header-stream = ch-handlers-write_header-stream; dupch-handlers-write-fp = ch-handlers-write-fp; dupch-handlers-write_header-fp = ch-handlers-write_header-fp; @@ -1457,9 +1469,10 @@ switch (option) { case CURLOPT_FILE: if (((php_stream *) what)-mode[0] != 'r' || ((php_stream *) what)-mode[1] == '+') { - zend_list_addref(Z_LVAL_PP(zvalue)); + Z_ADDREF_PP(zvalue); ch-handlers-write-fp = fp; ch-handlers-write-method = PHP_CURL_FILE; + ch-handlers-write-stream = *zvalue; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, the provided file handle is not writable); RETVAL_FALSE; @@ -1468,9 +1481,10 @@ break; case CURLOPT_WRITEHEADER: if (((php_stream *) what)-mode[0] != 'r' || ((php_stream *) what)-mode[1] == '+') { - zend_list_addref(Z_LVAL_PP(zvalue)); + Z_ADDREF_PP(zvalue); ch-handlers-write_header-fp = fp; ch-handlers-write_header-method = PHP_CURL_FILE; + ch-handlers-write_header-stream = *zvalue; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, the provided file handle is not writable); RETVAL_FALSE; @@ -1478,9 +1492,10 @@ } break; case CURLOPT_INFILE: - zend_list_addref(Z_LVAL_PP(zvalue)); + Z_ADDREF_PP(zvalue); ch-handlers-read-fp = fp; ch-handlers-read-fd = Z_LVAL_PP(zvalue); + ch-handlers-read-stream = *zvalue; break; case CURLOPT_STDERR: if (((php_stream *) what)-mode[0] != 'r' || ((php_stream *) what)-mode[1] == '+') { @@ -2129,6 +2144,16 @@ efree(ch-header.str); } + if (ch-handlers-write_header-stream) { + zval_ptr_dtor(ch-handlers-write_header-stream); + } + if (ch-handlers-write-stream) { + zval_ptr_dtor(ch-handlers-write-stream); + } + if (ch-handlers-read-stream) { + zval_ptr_dtor(ch-handlers-read-stream); + } + efree(ch-handlers-write); efree(ch-handlers-write_header); efree(ch-handlers-read); Modified: php/php-src/branches/PHP_5_2/ext/curl/php_curl.h === --- php/php-src/branches/PHP_5_2/ext/curl/php_curl.h 2009-09-29 23:50:57 UTC (rev 288972) +++ php/php-src/branches/PHP_5_2/ext/curl/php_curl.h 2009-09-30 02:34:17 UTC (rev 288973) @@ -86,6 +86,7 @@ smart_str buf; int method; int type; + zval *stream; } php_curl_write; typedef struct { @@ -94,6 +95,7 @@ FILE*fp; longfd; int