Olly Betts
6e6d720d88
Fix segfault in exception class creation
...
We can't safely lookup the Exception class entry at MINIT time, but we
can just use zend_ce_exception instead, which will be a bit faster too.
2021-05-04 13:12:15 +12:00
Olly Betts
586eb24efe
php: Stop using dl()
...
With modern PHP it only works with the CLI version of PHP, so it's
better to direct users to load the extension via "extension=" in
php.ini.
Suggested by ferdynator in #1529 .
2021-05-03 18:42:28 +12:00
Olly Betts
04bacf689b
Implement director-disown for PHP
2021-05-03 16:00:30 +12:00
Olly Betts
837dfa1e7e
Fix directorout SWIGTYPE typemaps
2021-04-22 17:51:14 +12:00
Olly Betts
a6a52f2f79
Eliminate remaining use of $needNewFlow
2021-04-22 15:14:38 +12:00
Olly Betts
50426aae20
Make PHP directors work more like other languages
...
A PHP exception now gets translated to a C++ exception to skips over C++
code to get back to PHP, avoiding the need to gate every directorout
typemap on EG(exception).
2021-04-22 14:40:21 +12:00
Olly Betts
10d87100ea
Whitespace tweaks
2021-04-22 12:25:13 +12:00
Olly Betts
ad61e33e22
Wrap pointer to member as object not resource
2021-04-22 07:56:25 +12:00
Olly Betts
50b13275dc
Fix mixed declarations and code
2021-04-22 07:42:39 +12:00
Olly Betts
2920ba1cf6
Use malloc() not emalloc() when free() gets used
2021-04-21 18:18:59 +12:00
Olly Betts
49d5909b08
Use $1 instead of result in out typemaps
2021-04-21 18:16:08 +12:00
Olly Betts
33feca7527
Eliminate SWIG_SetZval()
...
$needNewFlow is now only used for a different hack in a directorout
typemap.
2021-04-21 18:16:08 +12:00
Olly Betts
5577257301
Eliminate $needNewFlow from factory.i
...
$needNewFlow in an output typemap is now only relevant when wrapping
to a PHP __construct method, and there the return type is known so
factory.i isn't useful.
2021-04-21 16:32:56 +12:00
Olly Betts
2804e3b208
Fix mixed declarations and code
2021-04-21 16:05:41 +12:00
Olly Betts
c705ef8f32
Use PHP objects instead of resources to wrap pointers
...
Pointer to member is currently still wrapped as a resource.
2021-04-21 15:40:35 +12:00
Olly Betts
26f218327b
Don't special case NULL in the REF in typemap
...
PHP doesn't accept literal NULL for a parameter passed by reference;
passing a variable with a value of NULL is just like passing a
variable with a different value - we get a PHP reference to the
variable, not NULL.
2021-04-20 16:24:18 +12:00
Olly Betts
8d09b1263b
Fix GCC -Wsign-compare warning
2021-04-19 17:54:21 +12:00
Olly Betts
175b8d8542
Fix -Wimplicit-fallthrough warnings
...
We already have the magic comment to do this, but they weren't in
quite the right place.
2021-04-19 16:54:36 +12:00
Olly Betts
90e65e17fc
Remote Lib/php/globalvar.i
...
It's unused since 2629764e3f but it
seems I failed to actually remove it there.
2021-04-19 16:54:36 +12:00
Olly Betts
2f888a851e
Fix GCC -Wempty-body warning
2021-04-19 16:54:36 +12:00
Olly Betts
2629764e3f
Remove remnants of attempts to wrap to PHP global vars
...
This isn't really workable since PHP doesn't support intercepting
accesses to global variables (nor to static class properties, so
we can't wrap C/C++ global variables that way either).
The _get() and _set() function wrappers actually work and have
been generated for a very long time.
2021-04-17 05:59:18 +12:00
Olly Betts
dcdaaba7ba
Eliminate $zend_obj typemap variable
...
We can just get the zend_class_entry from the swig_type_info when
we need it.
2021-04-16 13:13:24 +12:00
Olly Betts
97733543e2
Fix directorout typemap for const TYPE &
...
Previous we were returning a pointer or reference to a local
variable.
2021-04-15 12:50:32 +12:00
Olly Betts
451998f27b
Fix in typemap for void** and void*&
...
Mark the parameter as "byref" and write back through the reference
after the call.
Adjust testcase argout to uncomment the part that's meant to test this,
and to remove lingering traces of PHP's old call-time pass-by-reference
(which was completely removed before PHP 7).
Fixes #1457
2021-04-14 17:05:19 +12:00
Olly Betts
836258b9d3
Fix some cases of converting PHP NULL to C++ NULL
...
Fixes testcase overload_null for PHP 8.0
2021-04-13 16:53:52 +12:00
Olly Betts
3b43a7bf9b
Refactor to eliminate SWIG_ConvertResourcePtr()
2021-04-13 13:22:03 +12:00
Olly Betts
762a309373
Fix typemap formatting incosistencies
2021-04-13 10:31:22 +12:00
Olly Betts
0a72bfc630
Eliminate tempPointer variable
2021-04-13 10:18:47 +12:00
Olly Betts
60e7deda2c
Eliminate non-standard $lower_param typemap variable
2021-04-13 10:03:03 +12:00
Olly Betts
d2eb06fbc0
Merge 2 functionally identical typemaps
...
The only difference is code formatting.
2021-04-13 09:53:14 +12:00
Olly Betts
5161acdd24
Eliminate direct reference to c_result in typemap
...
Typemaps should use $result.
2021-04-13 09:07:31 +12:00
Olly Betts
9987d7168a
Implement type-checking of wrapped objects
...
The testsuite now all passes (with PHP 7.4 at least)
2021-04-12 17:29:39 +12:00
Olly Betts
8fd2a1cb75
Fix mixed declarations and code
...
SWIG still aims to generate C90-compatible code.
2021-04-05 17:35:58 +12:00
Olly Betts
f0e0f7e391
Rename userNewObj to newobject
...
Better to use the same name we use elsewhere.
2021-04-05 17:30:43 +12:00
Olly Betts
40da8bcbb6
php: Wrap classes using only swig_object_wrapper
...
We no longer use PHP resources to wrap classes, and the proxy classes no
longer has a _cPtr property.
2021-04-04 07:45:20 +12:00
Olly Betts
e0cffb81dd
Eliminate SWIG_classWrapper property
...
Instead set the _cPtr property to PHP NULL to signal that this object
uses swig_object_wrapper.
2021-04-01 15:10:10 +13:00
Olly Betts
5838f10aa0
wrap fake class constants via C API
2021-04-01 14:40:32 +13:00
Olly Betts
c863ca8b1f
Use zstring access macros
...
These are likely to be more future-proof than accessing struct members
directly.
2021-03-29 18:18:37 +13:00
Olly Betts
f56d8ce103
Fix memory leak in director upcall check
2021-03-29 18:17:19 +13:00
Olly Betts
5482a02dd4
Fix handling of strongly-typed enums
...
Testcase cpp11_strongly_typed_enumerations.cpptest now passes.
2021-03-29 17:53:05 +13:00
Olly Betts
3f1286ba4f
Use standard SWIG overload dispatch
...
Instead of having a slightly modified PHP-specific variant of
Swig_overload_dispatch we now advance the ParmList over the this
pointer.
2021-03-29 17:41:01 +13:00
Olly Betts
4b055c343d
Fix compatibility with PHP8
2021-03-28 19:46:51 +13:00
Olly Betts
b45bd65dbc
Add compatibility for PHP 7.3 and earlier
2021-03-28 06:58:46 +13:00
Olly Betts
dfa5353f27
Eliminate extras hash table
...
This was used to store custom properties, but we can just ask the PHP
object to store them like it normally would, after checking for our
custom pseudo-properties.
2021-03-27 19:57:37 +13:00
Olly Betts
c03679acef
Improve how we allocate swig_object_wrapper
...
Use zend_object_alloc() and put the zend_object member last so that
Zend can put object properties after it.
2021-03-26 17:15:34 +13:00
Olly Betts
d87b3fb745
Add FIXME comment
...
This looks to be the reason why testcases overload_null and
overload_polymorphic are failing.
2021-03-26 16:45:14 +13:00
Olly Betts
0da436aa83
Simplify assignment
2021-03-26 16:41:39 +13:00
Olly Betts
478bdcdfbf
Whitespace tweaks
2021-03-26 16:41:28 +13:00
Olly Betts
f77113ea71
php: Eliminate SWIG_ZEND_NAMED_FE
...
It existed to work around const-correctness issues in older versions of
PHP's C API. It's conceivable user code might be using it, but unlikely
and the switch to creating classes via the API is a natural time for a
compatibility break.
2021-03-26 13:58:02 +13:00
Olly Betts
2ba0f82720
Merge branch 'master' into gsoc2017-php7-classes-via-c-api
2021-03-26 12:00:59 +13:00