ID: 50477 Updated by: j...@php.net Reported By: pcdinh at gmail dot com -Status: Open +Status: Feedback Bug Type: cURL related Operating System: Windows XP PHP Version: 5.2.11 New Comment:
Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2009-12-15 11:05:06] pcdinh at gmail dot com Description: ------------ As stated at http://php.net/manual/en/function.curl-close.php an invocation to curl_close($ch) will "Closes a cURL session and frees all resources. The cURL handle, ch , is also deleted. " However, it does not. Curl seems to work differently than other functions that produce a resource as well. Curl does not pass by reference implicitly For example: // create an image resource $image = imagecreate(100, 100); $im = new stdClass(); $im->res = $image; // pass by reference var_dump($image); var_dump($im->res); imagedestroy($image); var_dump($image); // will print resource(4) of type (Unknown) var_dump($im->res); // will print resource(4) of type (Unknown) After calling imagedestroy($image), $image and $im->res are deleted Reproduce code: --------------- $s = curl_init(); $im = new stdClass(); $im->res = $s; // resource is passed by reference var_dump($s); // will print: resource(5) of type (curl) var_dump($im->res); // will print: resource(5) of type (curl) curl_close($s); var_dump($s); var_dump($im->res); Expected result: ---------------- $s = curl_init(); $im = new stdClass(); $im->res = $s; // resource is passed by reference var_dump($s); // will print: resource(5) of type (curl) var_dump($im->res); // will print: resource(5) of type (curl) curl_close($s); var_dump($s); // (expected): resource(5) of type (Unknown) var_dump($im->res); // (expected): resource(5) of type (Unknown) Actual result: -------------- $s = curl_init(); $im = new stdClass(); $im->res = $s; // resource is actually passed by value var_dump($s); // will print: resource(5) of type (curl) var_dump($im->res); // will print: resource(5) of type (curl) curl_close($s); var_dump($s); // (actual): resource(5) of type (curl) var_dump($im->res); // (actual): resource(5) of type (curl) $s becomes invalid but $im->res is still valid for subsequent operations. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50477&edit=1