File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / curl / tests / bug52827.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:53 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>