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

php8 compat #8

Closed
wants to merge 2 commits into from
Closed

php8 compat #8

wants to merge 2 commits into from

Conversation

stefansaraev
Copy link
Contributor

^ as title says.

@ipimpat
Copy link

ipimpat commented Apr 18, 2021

Could this be merged in ?

@hcodina
Copy link

hcodina commented Oct 5, 2021

Hi,
I needed modification done in this PR to build your extension against PHP8
PHP Api Version: 20200930
Zend Module Api No: 20200930
Zend Extension Api No: 420200930

On top of this PR,I needed to replace call_user_function_ex by call_user_function
You can find my patch attached.

With these modification, I succeed in building and loading the extension.

# mkdir /etc/php.d
# echo 'extension=dbus.so'> /etc/php.d/dbus.ini
# php --ri dbus
dbus

Dbus support => enabled

Version => 0.2.0
#

@hcodina
Copy link

hcodina commented Oct 5, 2021

My additional patch:

From 8cf66c4b5dd657ca14552b27a42901db0a5e9280 Mon Sep 17 00:00:00 2001
From: Herve Codina <herve.codina@bootlin.com>
Date: Mon, 4 Oct 2021 17:13:45 +0200
Subject: [PATCH] Fix compatibility with php8 - call_user_function_ex

This patch fixes compatibility with php8 replacing
call_user_function_ex by call_user_function.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 dbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dbus.c b/dbus.c
index a98e2ea..6fa9897 100644
--- a/dbus.c
+++ b/dbus.c
@@ -1015,8 +1015,8 @@ php_dbus_do_method_call(php_dbus_obj *dbus,
 		method_args = safe_emalloc(sizeof(zval *), num_elems, 0);
 	}
 
-	if (call_user_function_ex(EG(function_table), object, &callback, &retval,
-				              num_elems, method_args, 0, NULL) == SUCCESS) {
+	if (call_user_function(EG(function_table), object, &callback, &retval,
+				              num_elems, method_args) == SUCCESS) {
 		if (!Z_ISUNDEF(retval)) {
 			reply = dbus_message_new_method_return(msg);
 			php_dbus_append_parameters(reply, &retval, NULL,
-- 
2.31.1

@hcodina
Copy link

hcodina commented Oct 5, 2021

Is there any plan to merge the PR and my patch ?

Best regards,
Hervé Codina

@stefansaraev
Copy link
Contributor Author

thanks @hcodina

I have included your commit in this PR. our project does not use php8 atm, as debian bullseye decided to stay on php7.4, but I have compiled and tested your commit with php7.3 (debian buster) and php7.4 (debian bullseye) and it's all good.

dbus.c Outdated Show resolved Hide resolved
if (call_user_function_ex(EG(function_table), object, &callback, &retval,
num_elems, method_args, 0, NULL) == SUCCESS) {
if (call_user_function(EG(function_table), object, &callback, &retval,
num_elems, method_args) == SUCCESS) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this continue to work with PHP 7.2ish?

stefansaraev and others added 2 commits November 25, 2021 19:41
This patch fixes compatibility with php8 replacing
call_user_function_ex by call_user_function.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
@stefansaraev
Copy link
Contributor Author

@derickr I have checked php 7.0 and php 7.2 sources, and it looks like usage of call_user_function is correct, and it should work.

@derickr
Copy link
Owner

derickr commented Apr 28, 2022

I'm going to close this PR, as it does not address the main PHP 8 issue: the property handlers.

@derickr derickr closed this Apr 28, 2022
@stefansaraev stefansaraev deleted the php8 branch April 28, 2022 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants