[Pkg-php-commits] [php/debian-sid] Cherry-pick fix for bug php#52827 (cURL leaks handle and causes assertion error (CURLOPT_STDERR))

Ondřej Surý ondrej at sury.org
Wed Nov 17 09:48:09 UTC 2010


---
 debian/patches/bug52827.patch |   45 +++++++++++++++++++++++++++++++++++++++++
 debian/patches/series         |    1 +
 2 files changed, 46 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/bug52827.patch

diff --git a/debian/patches/bug52827.patch b/debian/patches/bug52827.patch
new file mode 100644
index 0000000..03571d6
--- /dev/null
+++ b/debian/patches/bug52827.patch
@@ -0,0 +1,45 @@
+--- a/ext/curl/interface.c
++++ b/ext/curl/interface.c
+@@ -1816,7 +1816,6 @@ static int _php_curl_setopt(php_curl *ch
+ 						}
+ 						zval_add_ref(zvalue);
+ 						ch->handlers->std_err = *zvalue;
+-						zend_list_addref(Z_LVAL_PP(zvalue));
+ 					} else {
+ 						php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
+ 						RETVAL_FALSE;
+--- /dev/null
++++ b/ext/curl/tests/bug52827.phpt
+@@ -0,0 +1,32 @@
++--TEST--
++Bug #52827 (curl_setopt with CURLOPT_STDERR erroneously increments the resource refcount)
++--SKIPIF--
++<?php
++
++if (!extension_loaded('curl')) {
++	exit("skip curl extension not loaded");
++}
++
++?>
++--FILE--
++<?php
++$s = fopen('php://temp/maxmemory=1024','wb+');
++
++/* force conversion of inner stream to STDIO.
++ * This is not necessary in Windows because the
++ * cast to a FILE* handle in curl_setopt already
++ * forces the conversion in that platform. The
++ * reason for this conversion is that the memory
++ * stream has an ugly but working mechanism to
++ * prevent being double freed when it's encapsulated,
++ * while STDIO streams don't. */
++$i = 0;
++while ($i++ < 5000) {
++fwrite($s, str_repeat('a',1024));
++}
++$handle=curl_init('http://www.example.com');
++curl_setopt($handle, CURLOPT_STDERR, $s);
++
++echo "Done.";
++--EXPECTF--
++Done.
diff --git a/debian/patches/series b/debian/patches/series
index 10fbc0d..8243b28 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -62,3 +62,4 @@ bug52573.patch
 bug52487.patch
 bug50481.patch
 fix_crash_in__php_mssql_get_column_content_without_type.patch
+bug52827.patch
-- 
1.7.1





More information about the Pkg-php-commits mailing list