diff --git a/ext/curl/interface.c b/ext/curl/interface.c index b85b6cbdbd2..859bc8a1a09 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -811,6 +811,8 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) if (Z_TYPE(retval) == IS_STRING) { length = MIN((int) (size * nmemb), Z_STRLEN(retval)); memcpy(data, Z_STRVAL(retval), length); + } else if (Z_TYPE(retval) == IS_LONG) { + length = Z_LVAL_P(&retval); } zval_ptr_dtor(&retval); } diff --git a/ext/curl/tests/curl_pause_001.phpt b/ext/curl/tests/curl_pause_001.phpt new file mode 100644 index 00000000000..1fce0dd4afa --- /dev/null +++ b/ext/curl/tests/curl_pause_001.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test CURL_READFUNC_PAUSE and curl_pause() +--EXTENSIONS-- +curl +--FILE-- +res++]; + } +} + +$inputHandle = fopen(__FILE__, 'r'); + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=input"); +curl_setopt($ch, CURLOPT_UPLOAD, 1); +curl_setopt($ch, CURLOPT_READFUNCTION, new Input); +curl_setopt($ch, CURLOPT_INFILE, $inputHandle); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + +$mh = curl_multi_init(); +curl_multi_add_handle($mh, $ch); +do { + $status = curl_multi_exec($mh, $active); + curl_pause($ch, CURLPAUSE_CONT); + if ($active) { + usleep(100); + curl_multi_select($mh); + } +} while ($active && $status == CURLM_OK); + +echo curl_multi_getcontent($ch); +?> +--EXPECT-- +string(15) "Foo bar baz qux" diff --git a/ext/curl/tests/responder/get.inc b/ext/curl/tests/responder/get.inc index 4ed9ae02823..c139c8c7d43 100644 --- a/ext/curl/tests/responder/get.inc +++ b/ext/curl/tests/responder/get.inc @@ -4,6 +4,9 @@ case 'post': var_dump($_POST); break; + case 'input': + var_dump(file_get_contents('php://input')); + break; case 'getpost': var_dump($_GET); var_dump($_POST); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 1aebb3d4884..5157c0e6162 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2338,7 +2338,7 @@ PHP_FUNCTION(pg_lo_open) CHECK_PGSQL_LINK(link); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), - "Ols", &pgsql_link, pgsql_link_ce, &oid_long, &mode) == SUCCESS) { + "OlS", &pgsql_link, pgsql_link_ce, &oid_long, &mode) == SUCCESS) { if (oid_long <= (zend_long)InvalidOid) { zend_value_error("Invalid OID value passed"); RETURN_THROWS(); diff --git a/ext/pgsql/tests/gh10672.phpt b/ext/pgsql/tests/gh10672.phpt new file mode 100644 index 00000000000..2f334e573da --- /dev/null +++ b/ext/pgsql/tests/gh10672.phpt @@ -0,0 +1,39 @@ +--TEST-- +GH-10672 (pg_lo_open segfaults in the strict_types mode) +--EXTENSIONS-- +pgsql +--SKIPIF-- + +--FILE-- + +--EXPECT-- +The large object has been opened successfully.