atom feed15 messages in net.php.lists.internals[PHP-DEV] Need karma for committing t...
FromSent OnAttachments
Alexey SheinMay 17, 2011 6:40 am.txt, .txt
Pierre JoyeMay 17, 2011 6:53 am 
Ferenc KovacsMay 17, 2011 7:02 am 
Alexey SheinMay 17, 2011 7:09 am 
Gustavo LopesMay 17, 2011 7:21 am 
Alexey SheinMay 17, 2011 7:27 am 
Alexey SheinMay 17, 2011 8:01 am 
Alexey SheinMay 19, 2011 11:59 pm.txt
Gustavo LopesMay 20, 2011 4:11 am 
Pierre JoyeMay 20, 2011 4:13 am 
Gustavo LopesMay 20, 2011 4:29 am 
Alexey SheinMay 20, 2011 4:49 am 
Alexey SheinMay 27, 2011 3:40 am.txt, .txt
Philip OlsonMay 30, 2011 9:36 am 
Alexey SheinMay 30, 2011 11:31 pm 
Subject:[PHP-DEV] Need karma for committing test patches
From:Alexey Shein (con@gmail.com)
Date:May 17, 2011 6:40:30 am
List:net.php.lists.internals
Attachments:

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--