I need karma to commit test fixes: 1) session_encode_basic - added serialize_precision=100 ini setting
2) fix for http://bugs.php.net/48203: there's a segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec, i.e. like this: $fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); fclose($fp); // <-- premature close of $fp caused a crash! curl_exec($ch); // segfault All tests run ok on php5.3 php5.4 and trunk. Could somebody review this patch since I'm new to developing php and could make some silly mistakes? I already have an account: shein -- Regards, Shein Alexey
Index: trunk/ext/curl/interface.c =================================================================== --- trunk/ext/curl/interface.c (revision 311121) +++ trunk/ext/curl/interface.c (working copy) @@ -2204,6 +2204,16 @@ ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl); + // check if custom std_err is not already closed + if (ch->handlers->std_err) { + php_stream *stream; + + if (!(php_stream_from_zval_no_verify(stream, &ch->handlers->std_err))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "STDERR file handle is incorrect"); + curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr); + } + } + _php_curl_cleanup_handle(ch); error = curl_easy_perform(ch->cp); Index: trunk/ext/curl/tests/bug48203.phpt =================================================================== --- trunk/ext/curl/tests/bug48203.phpt (revision 311121) +++ trunk/ext/curl/tests/bug48203.phpt (working copy) @@ -18,16 +18,23 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); -curl_setopt($ch, CURLOPT_URL, ""); +curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); fclose($fp); // <-- premature close of $fp caused a crash! curl_exec($ch); +curl_close($ch); + echo "Ok\n"; ?> --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> ---EXPECT-- +--EXPECTF-- +Warning: curl_exec(): %d is not a valid stream resource in %s on line %d + +Warning: curl_exec(): STDERR file handle is incorrect in %s on line %d +* About to connect() %a +* Closing connection #0 Ok Index: branches/PHP_5_3/ext/curl/interface.c =================================================================== --- branches/PHP_5_3/ext/curl/interface.c (revision 311132) +++ branches/PHP_5_3/ext/curl/interface.c (working copy) @@ -2208,6 +2208,16 @@ ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl); + // check if custom std_err is not already closed + if (ch->handlers->std_err) { + php_stream *stream; + + if (!(php_stream_from_zval_no_verify(stream, &ch->handlers->std_err))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "STDERR file handle is incorrect"); + curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr); + } + } + _php_curl_cleanup_handle(ch); error = curl_easy_perform(ch->cp); Index: branches/PHP_5_3/ext/curl/tests/bug48203.phpt =================================================================== --- branches/PHP_5_3/ext/curl/tests/bug48203.phpt (revision 311132) +++ branches/PHP_5_3/ext/curl/tests/bug48203.phpt (working copy) @@ -18,16 +18,23 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); -curl_setopt($ch, CURLOPT_URL, ""); +curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); fclose($fp); // <-- premature close of $fp caused a crash! curl_exec($ch); +curl_close($ch); + echo "Ok\n"; ?> --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> ---EXPECT-- +--EXPECTF-- +Warning: curl_exec(): %d is not a valid stream resource in %s on line %d + +Warning: curl_exec(): STDERR file handle is incorrect in %s on line %d +* About to connect() %a +* Closing connection #0 Ok Index: branches/PHP_5_4/ext/curl/interface.c =================================================================== --- branches/PHP_5_4/ext/curl/interface.c (revision 311121) +++ branches/PHP_5_4/ext/curl/interface.c (working copy) @@ -2204,6 +2204,16 @@ ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl); + // check if custom std_err is not already closed + if (ch->handlers->std_err) { + php_stream *stream; + + if (!(php_stream_from_zval_no_verify(stream, &ch->handlers->std_err))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "STDERR file handle is incorrect"); + curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr); + } + } + _php_curl_cleanup_handle(ch); error = curl_easy_perform(ch->cp); Index: branches/PHP_5_4/ext/curl/tests/bug48203.phpt =================================================================== --- branches/PHP_5_4/ext/curl/tests/bug48203.phpt (revision 311121) +++ branches/PHP_5_4/ext/curl/tests/bug48203.phpt (working copy) @@ -18,16 +18,23 @@ curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); -curl_setopt($ch, CURLOPT_URL, ""); +curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); fclose($fp); // <-- premature close of $fp caused a crash! curl_exec($ch); +curl_close($ch); + echo "Ok\n"; ?> --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> ---EXPECT-- +--EXPECTF-- +Warning: curl_exec(): %d is not a valid stream resource in %s on line %d + +Warning: curl_exec(): STDERR file handle is incorrect in %s on line %d +* About to connect() %a +* Closing connection #0 Ok
Index: trunk/ext/session/tests/session_encode_basic.phpt =================================================================== --- trunk/ext/session/tests/session_encode_basic.phpt (revision 311121) +++ trunk/ext/session/tests/session_encode_basic.phpt (working copy) @@ -1,5 +1,7 @@ --TEST-- Test session_encode() function : basic functionality +--INI-- +serialize_precision=100 --SKIPIF-- <?php include('skipif.inc'); ?> --FILE-- Index: branches/PHP_5_3/ext/session/tests/session_encode_basic.phpt =================================================================== --- branches/PHP_5_3/ext/session/tests/session_encode_basic.phpt (revision 311132) +++ branches/PHP_5_3/ext/session/tests/session_encode_basic.phpt (working copy) @@ -1,5 +1,7 @@ --TEST-- Test session_encode() function : basic functionality +--INI-- +serialize_precision=100 --SKIPIF-- <?php include('skipif.inc'); ?> --FILE-- Index: branches/PHP_5_4/ext/session/tests/session_encode_basic.phpt =================================================================== --- branches/PHP_5_4/ext/session/tests/session_encode_basic.phpt (revision 311121) +++ branches/PHP_5_4/ext/session/tests/session_encode_basic.phpt (working copy) @@ -1,5 +1,7 @@ --TEST-- Test session_encode() function : basic functionality +--INI-- +serialize_precision=100 --SKIPIF-- <?php include('skipif.inc'); ?> --FILE--
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php