#49066 [Opn->Ver]: CURLOPT_FAILONERROR does not work when CURLOPT_FOLLOWLOCATION is true

From: Date: Mon, 03 Aug 2009 22:54:48 +0000
Subject: #49066 [Opn->Ver]: CURLOPT_FAILONERROR does not work when CURLOPT_FOLLOWLOCATION is true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140617@lists.php.net to get a copy of this message
ID: 49066 Updated by: jani@php.net Reported By: peaceable_whale at hotmail dot com -Status: Open +Status: Verified Bug Type: cURL related -Operating System: Windows +Operating System: * -PHP Version: 5.3.0 +PHP Version: 5.*, 6SVN (2009-08-04) New Comment: A bit more readable script: <?php error_reporting(E_ALL^E_WARNING); $request=curl_init("http://example.com/X"); curl_setopt_array($request, array( CURL_HTTP_VERSION_1_1 => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_FAILONERROR => true, CURLOPT_RETURNTRANSFER=>true, ) ); var_dump(curl_exec($request)); ?> To reproduce: # sapi/cli/php -n -dopen_basedir=. test.php Previous Comments: ------------------------------------------------------------------------ [2009-08-02 05:09:43] peaceable_whale at hotmail dot com The path of the root folder of your website. ------------------------------------------------------------------------ [2009-08-02 00:47:10] jani@php.net And what it should be set to? : ------------------------------------------------------------------------ [2009-07-26 19:19:10] peaceable_whale at hotmail dot com It should be open_basedir) ------------------------------------------------------------------------ [2009-07-26 19:18:02] jani@php.net What is "open_dir" ?? ------------------------------------------------------------------------ [2009-07-26 16:16:22] peaceable_whale at hotmail dot com The previous submitted code doesn't reflect the problem correctly... The followings are the corrected information: Description: ------------ CURLOPT_FAILONERROR does not work when CURLOPT_FOLLOWLOCATION is true and open_dir is set. PHP Version: ------------ PHP 5.3.0 NTS VC9 Reproduce code: --------------- <?php error_reporting(E_ALL^E_WARNING); header("Content-Type: text/plain; charset=UTF-8"); header("X-Content-Type-Options: nosniff"); $request=curl_init("http://example.com/X"); curl_setopt_array($request,array(CURL_HTTP_VERSION_1_1=>true,CURLOPT_USERAGENT=>"PHP/".phpversion(),CURLOPT_FOLLOWLOCATION=>true,CURLOPT_FAILONERROR=>true,CURLOPT_RETURNTRANSFER=>true)); echo (curl_exec($request)===false?"false":"true")."\r\n"; curl_close($request); ?> Expected result: ---------------- false Actual result: -------------- true) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/49066 -- Edit this bug report at http://bugs.php.net/?id=49066&edit=1

« previous php.bugs (#140617) next »