Skip to content

Commit cf86c6b

Browse files
committed
ext/curl: CURLOPT_FOLLOWLOCATION option handling.
it had been considered as boolean for years but since 8.13, it can accept values beyond 1L, respectively CURLFOLLOW_OBEYCODE and CURLFOLLOW_FIRSTONLY.
1 parent 7cc7ae9 commit cf86c6b

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

ext/curl/curl.stub.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,19 @@
497497
*/
498498
const CURLOPT_DEBUGFUNCTION = UNKNOWN;
499499

500+
#if LIBCURL_VERSION_NUM >= 0x080d00 /* Available since 8.13.0 */
501+
/**
502+
* @var int
503+
* @cvalue CURLFOLLOW_OBEYCODE
504+
*/
505+
const CURLFOLLOW_OBEYCODE = UNKNOWN;
506+
/**
507+
* @var int
508+
* @cvalue CURLFOLLOW_FIRSTONLY
509+
*/
510+
const CURLFOLLOW_FIRSTONLY = UNKNOWN;
511+
#endif
512+
500513
/**
501514
* @var int
502515
* @cvalue CURLINFO_TEXT

ext/curl/curl_arginfo.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/curl/interface.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
18631863
#if LIBCURL_VERSION_NUM >= 0x080900 /* Available since 8.9.0 */
18641864
case CURLOPT_TCP_KEEPCNT:
18651865
#endif
1866+
case CURLOPT_FOLLOWLOCATION:
18661867
lval = zval_get_long(zvalue);
18671868
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
18681869
(PG(open_basedir) && *PG(open_basedir)) && (lval & CURLPROTO_FILE)) {
@@ -2210,11 +2211,6 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
22102211
/* Do nothing, just backward compatibility */
22112212
break;
22122213

2213-
case CURLOPT_FOLLOWLOCATION:
2214-
lval = zend_is_true(zvalue);
2215-
error = curl_easy_setopt(ch->cp, option, lval);
2216-
break;
2217-
22182214
case CURLOPT_POSTFIELDS:
22192215
if (Z_TYPE_P(zvalue) == IS_ARRAY) {
22202216
if (zend_hash_num_elements(Z_ARRVAL_P(zvalue)) == 0) {

0 commit comments

Comments
 (0)