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.
These were deprecated nearly 20 years ago and attempts to use them
have generated a deprecation warning for most of that time.
Addresses #1984 for PHP.
These were added as part of the changes to add director support for
PHP, but have never actually been used by anything SWIG generates,
and they aren't documented so shouldn't be used externally.
Removing these exposed a bug in the arginfo generation where we emitted
a ZEND_ARG_INFO for a varargs "parameter", which this commit also fixes.
Use zend_call_known_instance_method() instead of call_user_function(),
since this way PHP seems to know that context of the call is from within
the same object.
Fixes testcases director_nested and director_protected which were giving
errors for PHP 8 and warnings for PHP 7.
These names lack a "SWIG_" prefix to help prevent collisions with code
being wrapped, but they're each only used in one place so just inline
them there.
These are all the same, and the NULL check performed is done inside
zend_objects_destroy_object() anyway, so we can just set the dtor
to zend_objects_destroy_object (which is what in-tree PHP extensions
do.)
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.
getThis(z) checks that z is a PHP object and returns ZEND_THIS if it
is, and NULL otherwise. In all our uses we know that z is a PHP object
(and we'd try to dereference NULL if it were returned!)
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.