PHP 7.0 fails to parse `?` before a parameter type (meaning Nullable in
newer versions), so just omit these parameter type declarations in
the testcase until we drop PHP 7.0 support.
Also drop some `var_dump($x);` left over from debugging this testcase.
I missed that this change breaks cpp_static, which seems to be to do
with handling the combined getter and setter we emit for static
member variables. Reverting while I figure out how to handle that.
This reverts commit a277748870.
Found via `codespell -q 3 -L ans,anumber,ba,bae,chello,clos,cmo,coo,dout,fo,funktion,goin,inout,methid,nd,nin,nnumber,object,objekt,od,ois,packag,parm,parms,pres,statics,strack,struc,tempdate,te,thru,uint,upto,writen`
Move HAVE_CXX11 into makefiles so that running test-suite
from top level directory or in the language's test-suite directory
is consistent. For example, running 'make check-java-test-suite'
behaves the same as 'cd Examples/test-suite/java && make check'.
The regex pattern to upper-case things containing an `i` had incorrect
escaping (`\\(`...`\\)` instead of `(`...`)`) so `import` didn't get
renamed.
This wasn't detected because there were no `_runme` files for this
testcase, so add rename_camel_runme.php which uses reflection to check
the wrapped PHP classes, functions and constants are all named as
expected.
Also expand coverage of converting to underscore case and add coverage
for converting to lower-camel-case.
Related to #1041.
These functions are added in a number of testcases but for all
languages not just Python. It's tedious having to update the
PHP expected function lists for them, so let's just filter them
out.
Adding full support for these in expressions seems hard to do without
introducing conflicts into the parser grammar, but in fact all reported
cases have had parentheses around the comparison and we can support that
with a few restrictions on the left side of `<`.
Fixes#80 and #635. Also https://sourceforge.net/p/swig/bugs/1139/
The typemaps for long long and unsigned long long didn't handle a
string input correctly, and long_long_runme.php had a flawed test
in this case.
Fixes#2155
Since the switch to wrapping classes using PHP's C API, we now
internally need to be able to tell if a PHP object is of or derived
from a class that is wrapped by SWIG so we know if we can offset the
zend_object pointer to get to the swig_object_wrapper. If we try to
do this to an object which isn't wrapped by SWIG then we invoke C/C++
undefined behaviour (and typically get a segmentation fault).
This check is implemented by having a SWIG\wrapped empty interface which
we make all SWIG-wrapped classes implement simply so we can test for it
to detect such classes.
Fixes#2125
A few files had just <? which only works when the short_open_tag option
is on. It is on by default (at least in current PHP versions) and we
explicitly tell PHP not to read php.ini, but the PHP docs recommended to
avoid it, and PHP can be built with --disable-short-tags.
The previous version didn't really test anything useful. Now we
check that trying to instantiate any of the abstract classes fails
with the expected error.
This function doesn't do anything currently so these missing calls are a
latent issue. It could be used for e.g. memory leak checking in the
future though, and it's potentially a useful place to add code when
debugging.
Previously this relied on getting all known classes/functions/etc
when it was loaded, and then again after the PHP module being
tested was loaded. This approach no longer works now we've
stopped loading modules using dl(), so use ReflectionExtension
instead to get information about a specific extension.
This is likely also faster than wading through lists including
everything predefined by PHP.
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.
Without inventing a SWIG/PHP-specific mechanism, we can't really
finalise objects in the way the testcase expects, so adjust the
testcase minimally so we avoid triggering C++ undefined behaviour
(use-after-free).