diff --git a/NEWS b/NEWS index 0577aa23fc3..82da2edfddf 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ PHP NEWS - Curl: . Fixed deprecation warning at compile time. (Max Kellermann) + . Fixed bug GH-10270 (Unable to return CURL_READFUNC_PAUSE in readfunc + callback). (Pierrick Charron) - Date: . Fix GH-10447 ('p' format specifier does not yield 'Z' for 00:00). (Derick) @@ -56,6 +58,9 @@ PHP NEWS . Fixed bug #60994 (Reading a multibyte CLOB caps at 8192 chars). (Michael Voříšek) +- PGSQL: + . Fix GH-10672 (pg_lo_open segfaults in the strict_types mode). (girgias) + - Phar: . Fix incorrect check in phar tar parsing. (nielsdos) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 16cb3f06343..13e1464d4d9 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 b5c4b77ad3f..88b2a4e0321 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2364,7 +2364,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.