Commit graph

22,166 commits

Author SHA1 Message Date
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
5e2114501f Pass NULL instead of an empty zend_function_entry 2021-04-21 19:11:21 +12:00
Olly Betts
af5030bca1 Just call the internal class entry internal_ce
It's just a local variable, so no need to carefully name it after
the class.
2021-04-21 18:34:26 +12:00
Olly Betts
2920ba1cf6 Use malloc() not emalloc() when free() gets used 2021-04-21 18:18:59 +12:00
Olly Betts
3f9723b896 Use PTR instead of zv for SWIG_remove() parameter
The parameter is a general pointer, not necessarily a zval.
2021-04-21 18:16:56 +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
ac676d1a6c Remove bogus zend_string_release() in magic methods
We shouldn't be freeing the property name here.
2021-04-21 18:16:08 +12:00
Olly Betts
508d9f7279 Eliminate unused code in generated __isset methods 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
3e8373b09a Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-04-21 16:05:24 +12:00
Olly Betts
f198ff0a43 Fix more "allows to" and other typos 2021-04-21 15:54:46 +12:00
Even Rouault
abda4caeae swigrun.swg: fix typo
Spotted by lintian QA tool used by Debian packaging
2021-04-21 15:49:15 +12:00
Olly Betts
1d617c2b9b perl5: Enable more testcases 2021-04-21 15:46:41 +12:00
Olly Betts
5840aca0d9 php: Enable more testcases 2021-04-21 15:46: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
f1aaeeea1c Fix -prefix to prefix PHP class names 2021-04-20 18:23:23 +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
f24ea7c162 php: Enable prefix testcase
This tests that the SWIG/PHP -prefix command line option works.  It
has a _runme.php and the testcase passes, but it wasn't listed to
be run.
2021-04-20 12:11:13 +12:00
Olly Betts
f45bf4db23 php: Fix director_profile_runme.php
Since 76c2c4675b the fn method is
renamed to c_fn, because `fn` was added as a keyword in PHP 7.4.
2021-04-20 12:04:02 +12:00
Olly Betts
d084173ee7 php: Enable testcase director_stl
This already had a _runme.php which passes as-is, but wasn't listed to
be run.
2021-04-20 12:02:21 +12:00
Olly Betts
e44ac904c4 java: Remove duplicate li_std_map entry
It's in CPP_STD_TEST_CASES so no need for Java to specifically add
it to CPP_TEST_CASES.
2021-04-20 11:56:27 +12:00
Olly Betts
ff1c88f5ba Hook up sym testcase
This has existed since at least the "great merge" and even has a
_runme.php, but seems to have never actually been listed as a testcase
to run.
2021-04-20 11:56:27 +12:00
Olly Betts
b1923af3ee Remove left-over arrayptr_runme.php
The arrayptr testcase was eliminated back in 2003 by
da53ad7bf2.
2021-04-19 19:06:10 +12:00
Olly Betts
1bf23edc06 Remove PHP-specific testcase workarounds
The changes on this branch mean these are no longer required.
2021-04-19 18:57:17 +12:00
Olly Betts
9a82261e4a Fix GCC -Wstringop-truncation warning
The code in testcase memberin_extend_c would end up without a
terminating nul if passed a 50 byte string, and then make_upper()
would run off the end of the buffer.

Fix by using strncat() (which always nul terminates the result, and
also doesn't zero-fill the tail of the buffer if the result is
shorter).
2021-04-19 18:13:02 +12:00
Olly Betts
8d09b1263b Fix GCC -Wsign-compare warning 2021-04-19 17:54:21 +12:00
Olly Betts
06350181d2 Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-04-19 17:43:46 +12:00
Olly Betts
5ec65fde0a Initialise _v to 0 in typecheck case
This avoids using _v uninitialised if there's an empty typecheck
typemap, such as the dummy one we have for std::initializer_list.

Fixes GCC warning on cpp11_initializer_list testcase when compiled
with -O2.
2021-04-19 17:42:22 +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
7f74c4c1cd Generate list of string compares for __isset()
Previously we checked for a <varname>_get() method instead, but that
will misfire for an method actually called foo_get() in the C++ API
being wrapped.
2021-04-19 16:04:02 +12:00
Olly Betts
84559bc441 Clean up code to generate magic property methods 2021-04-19 15:12:42 +12:00
Olly Betts
dbfe84651f [ci] Try -std=c++11 instead of -std=gnu++11 2021-04-19 14:25:03 +12:00
Olly Betts
8f0f2159d1 [ci] Set CPPSTD=c++11 for PHP
Otherwise SWIG defaults to forcing -std=c++98.
2021-04-19 13:43:35 +12:00
Olly Betts
d6f9f4b6c0 Make examples fail on any PHP diagnostic
Previously we called set_error_handler() in tests.php to do this, but
that only sets it for the test-suite.  Now we set it in on the PHP
command line, which works for both.
2021-04-19 13:40:46 +12:00
Olly Betts
e22dd47ff5 [ci] Run PHP tests on bionic
Seems the compiler in xenial doesn't support C++11 by default.
2021-04-19 12:05:18 +12:00
Olly Betts
3aa8b56a9a [ci] Fix edit mistake in previous commit 2021-04-19 11:55:00 +12:00
Olly Betts
3f7aed1a17 [ci] Specify --enable-cpp11-testing directly
Specifying CPP11=1 also passes -std=c++11 to the compiler, which is
really unhelpful here as that disables all GNU extensions which breaks
the PHP C API headers.
2021-04-19 11:41:42 +12:00
Olly Betts
ed86e68fe1 Remove variable which is set but never used 2021-04-19 11:37:21 +12:00
Olly Betts
09d06843d1 Fix PHP sync example
Mostly it was missing `%include <std_string.i>`
2021-04-19 11:26:32 +12:00
Olly Betts
a49cc60772 Adjust PHP sync example
Make it work with how globals are actually wrapped.  It looks like
this example has never been right, but nobody noticed before PHP 8
started warning about the use of unset variables.

This reveals that handling of std::string properties needs fixing.
2021-04-18 10:00:34 +12:00
Olly Betts
3b63ef27fe [ci] Enable --enable-cpp11-testing for PHP 2021-04-18 08:15:55 +12:00
Olly Betts
f8c7dbb676 [ci] Reduce appveyor to one MSVC Python build
Building once with a different compiler on a different platform is
useful, but running multiple builds for languages I'm not working
on is a waste of donated CPU time, and having CI reported as failing
because the Python builds on cygwin aren't currently working is
downright unhelpful.
2021-04-18 08:07:20 +12:00
Olly Betts
0a437cddcc Simplify magic property methods 2021-04-17 19:01:32 +12:00
Olly Betts
db358d1e42 Expand li_std_string_runme.php
Re-enable a disabled check and implement more checks based on those
in perl5/li_std_string_runme.pl.
2021-04-17 18:53:50 +12:00
Olly Betts
e76308be92 Simplify globalvariableHandler() further 2021-04-17 07:39:41 +12:00