joseph-montanez / raylib-php

PHP 8 Bindings to raylib
zlib License
167 stars 9 forks source link

Supported PHP Versions #3

Open nawarian opened 4 years ago

nawarian commented 4 years ago

I came to report an issue while compiling the extension using php 7.3.16.

  1. The ZEND_THIS constant Seems like the constant ZEND_THIS is not available there. Before this value used to be fetched with getThis() in this repo. With php 7.4 it works. Replacing ZEND_THIS with getThis() solves the issue on php 7.3.

  2. The zend_std_write_property() call Another thing quite common in this repo is the following line:

value = zend_std_write_property(object, member, value, cache_slot);

This happens, for example, here: https://github.com/joseph-montanez/raylib-php/blob/89a9f1fe951897ae31a9df4bc8af7ce9db20d5b1/raylib-charinfo.c#L231

This seems to be problematic on php 7.3.16 as zend_std_write_property() returns void and value is a zval, passed for writing as the third parameter. Removing the assignment seems to solve the issue.

Note: I'm running MacOS Catalina. But this seems to be independent from build environment.


What is the minimum version supported?

I'd be happy to send out some pull requests if php 7.3 is supposed to be supported. I'm not a C expert but I think I can help a bit there.

Cheers!

joseph-montanez commented 4 years ago

Thanks, initially I was limiting the scope to just PHP 7.4, as the stubs require PHP 7.4 due to type signatures in method calls. However, supporting PHP 7.3 via the C code isn't an issue. Thanks for catching this I'll make an update to change this and test on 7.3.

joseph-montanez commented 4 years ago

Just an update I've been trying on and off to support 7.3. While I am able to build, the property writers are segment faulting. So this will have to be an ongoing effort. I don't want this to slow down the binding's implementation, so, for now, I'll push 7.3 support to a different branch. I looked at how php-src handles 7.4 and 7.3 and they don't, they just keep completely different repos, so if-defs are not littered all over the place for various php versions.