Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proto for 8.1.0beta2 #118

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ config.status
config.sub
configure
configure.in
configure.ac
http.la
install-sh
lcov_data
libtool
ltmain.sh
ltmain.sh.backup
missing
mkinstalldirs
modules/
pecl_http-*.tgz
*.lo
*.o
run-tests.php
run-tests.sh
tests/*.diff
tests/*.exp
tests/*.log
Expand Down
12 changes: 12 additions & 0 deletions src/php_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,11 @@ static int notify(zend_object_iterator *iter, void *puser)
return ZEND_HASH_APPLY_STOP;
}

#if PHP_VERSION_ID < 80100
ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0)
#else
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_notify, 0, 0, IS_VOID, 0)
#endif
ZEND_ARG_OBJ_INFO(0, request, http\\Client\\Request, 1)
ZEND_ARG_INFO(0, progress)
ZEND_END_ARG_INFO();
Expand Down Expand Up @@ -1032,7 +1036,11 @@ static PHP_METHOD(HttpClient, notify)
RETVAL_ZVAL(getThis(), 1, 0);
}

#if PHP_VERSION_ID < 80100
ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1)
#else
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_attach, 0, 1, IS_VOID, 0)
#endif
ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, attach)
Expand Down Expand Up @@ -1061,7 +1069,11 @@ static PHP_METHOD(HttpClient, attach)
RETVAL_ZVAL(getThis(), 1, 0);
}

#if PHP_VERSION_ID < 80100
ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1)
#else
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_detach, 0, 1, IS_VOID, 0)
#endif
ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, detach)
Expand Down
1 change: 1 addition & 0 deletions tests/client002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ echo "Test\n";

class Observer implements SplObserver
{
#[ReturnTypeWillChange]
function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) {
echo "P";
if ($progress->info !== "prepare" && $client->getProgressInfo($request) != $progress) {
Expand Down
1 change: 1 addition & 0 deletions tests/client012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var_dump(

$client->attach($observer = new class implements SplObserver {
public $data = [];
#[ReturnTypeWillChange]
function update(SplSubject $client, $req = null, $progress = null) {
$ti = $client->getTransferInfo($req);
if (isset($ti->tls_session["internals"])) {
Expand Down
3 changes: 3 additions & 0 deletions tests/client013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ class Client extends http\Client {
public $pi;
}
class ProgressObserver1 implements SplObserver {
#[ReturnTypeWillChange]
function update(SplSubject $c, $r = null) {
if ($c->getProgressInfo($r)) $c->pi .= "-";
}
}
class ProgressObserver2 implements SplObserver {
#[ReturnTypeWillChange]
function update(SplSubject $c, $r = null) {
if ($c->getProgressInfo($r)) $c->pi .= ".";
}
Expand All @@ -30,6 +32,7 @@ class CallbackObserver implements SplObserver {
function __construct($callback) {
$this->callback = $callback;
}
#[ReturnTypeWillChange]
function update(SplSubject $c, $r = null) {
call_user_func($this->callback, $c, $r);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/client030.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo "Test\n";
include "helper/server.inc";

class test implements SplObserver {
#[ReturnTypeWillChange]
function update(SplSubject $client) {
$client->once();
}
Expand All @@ -33,4 +34,4 @@ server("proxy.inc", function($port) {
--EXPECTF--
Test
int(200)
===DONE===
===DONE===
1 change: 1 addition & 0 deletions tests/envresponse016.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include "skipif.inc";
echo "Test\n";

class closer extends php_user_filter {
#[ReturnTypeWillChange]
function filter ($in, $out, &$consumed, $closing) {
while ($bucket = stream_bucket_make_writeable($in)) {
stream_bucket_append($out, $bucket);
Expand Down