Commit graph

144 commits

Author SHA1 Message Date
Olly Betts
7983c83116 Fix case of expected functions and globals
The updated tests.php is case sensitive.
2021-05-04 15:49:30 +12:00
Olly Betts
c45fb9d2e1 Add member_pointer_const_runme.php 2021-05-04 15:29:46 +12:00
Olly Betts
0d028d8942 Rework tests.php
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.
2021-05-04 15:26:45 +12:00
Olly Betts
32283991c5 Don't generate a .php wrapper file by default
It's now only generated if something to put in it is specified via:

%pragma(php) include=...

or

%pragma(php) code=...
2021-05-04 14:14:56 +12:00
Olly Betts
61f00daee4 Fix extension= value for PHP < 7.2 2021-05-04 08:04:36 +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
81d1618777 Adjust director_finalizer_runme.php
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).
2021-05-03 16:07:50 +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
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
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
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
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
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
14edc26c8d Add PHP run test for global_vars 2021-04-17 06:11:49 +12:00
Olly Betts
a51a5c77f2 Modernise checks for PHP NULL and resources 2021-04-17 05:36:13 +12:00
Olly Betts
12bcd36923 Filter less in check::functions()
Stop filtering /^new_/ - we no longer generate these for classes, so
only the li_carrays and li_carrays_cpp testcases generate new_* flat
functions, and it's helpful to check those are generated.

Stop filtering /_(alter|get)_newobject$/' - we no longer generate
these, as they weren't used or documented.
2021-04-17 04:14:33 +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
b430832a08 Restore checks for flat functions in php testcases 2021-04-14 12:44:48 +12:00
Olly Betts
8cb0c185ac Restore checks for globals in php testcases 2021-04-14 11:15:43 +12:00
Olly Betts
50f92dca08 Mark wrapped abstract classes
This allows restoring reflection checks in testcase director_abstract.
2021-04-14 10:59:12 +12:00
Olly Betts
40906ae856 Reenable check::classes() and check::classmethods() 2021-04-14 10:05:20 +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
904f5a65d8 Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-03-31 04:53:40 +13:00
Olly Betts
49d923b917 php: Fix director_overload_runme.php printing empty line 2021-03-30 10:56:23 +13:00
Olly Betts
8ded9d8dae Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-03-25 17:45:17 +13:00
Olly Betts
704ec59f29 [php] Fix widespread use of bare strings in testsuite
These generate warnings with PHP 7.3, which will become errors in a
future version.
2021-03-25 16:17:06 +13:00
Olly Betts
1eee194a88 [php] Fix test failures due to undefined GETSET constant
Move the constant into the class - the definition outside the class
doesn't seem to work with PHP 7.3.
2021-03-24 12:16:29 +13:00
Olly Betts
e54d44c4be php: Omit closing ?> in manual and examples
PSR-12 says "The closing ?> tag MUST be omitted from files containing
only PHP".
2021-03-23 11:47:19 +13:00
Olly Betts
3584c7d49c Add initial support for PHP8
Testcase director_overload2 is failing, but the rest of the testsuite
passes.
2021-03-19 19:30:27 +13:00
Olly Betts
b7dedecfdd php: Fix char* typecheck typemap to accept Null
The corresponding in typemap already does.

Fixes #1655, reported by CJSlominski.
2021-03-19 08:34:15 +13:00
Olly Betts
2e7da86b2c php: Fix overloaded directed methods with non-void return
We were treating  such methods like constructors and assigning to the
internal _cPtr, which just seems bizarrely wrong.

Fixes #1900
2021-03-18 10:58:44 +13:00
Olly Betts
6afc3e3504 Update PHP director_basic expected classes+funcs
Fixes warnings from test suite introduced in
c259702314.
2021-03-17 09:35:39 +13:00
William S Fulton
f318bb8286 Add missing clean targets
template_typedef_cplx2 files are generated by the template_typedef_import.multicpptest
but can also be cleaned by the template_typedef_cplx2.cpptest target.
2020-10-10 15:02:26 +01:00
William S Fulton
5d976b0ebe Fix php testcase warning 2019-04-30 23:44:41 +01:00
Olly Betts
9db02a1e6b Update PHP testsuite for vadz's new cars 2019-02-12 10:27:31 +13:00
Olly Betts
6833bb7e0f [PHP] Make the testsuite fail on any PHP diagnostic 2019-02-09 12:52:25 +13:00
Olly Betts
785481cc62 Fix PHP testsuite check::get() helper
This was trying to return a reference, but that doesn't actually work
for all the things it's used for, and none of the uses require the
return value to be a reference.
2019-02-09 11:45:57 +13:00
Olly Betts
cf785d7071 Avoid uses of undeclared variables in PHP testsuite 2019-02-09 11:45:29 +13:00
Olly Betts
aa7eb05071 Disable broken 'this' check in director_unroll_runme.php
This was comparing an unset property on two objects matched - they
do, but the check we actually intend here is that they wrap the same C++
object.  We don't seem to be able to accomplish the desired check for
PHP, so just disable this for now.
2019-02-09 11:43:49 +13:00
Olly Betts
660d51c7ca Remove blank line from end of php_pragma_runme.php
Because this was after the closing ?> it was resulting in a blank
line in the testcase output.
2019-02-09 09:00:31 +13:00
Olly Betts
8e4d135929 [PHP] Add quotes to another bareword string
Seems I missed one when I fixed all the others in the testsuite.
2019-02-08 18:10:32 +13:00
Olly Betts
3f9ebb31b9 [PHP] Don't generate code referencing undefined $r
This could happen in overloaded methods which returned void and took at
least one const std::string& parameter.
2019-02-08 18:09:52 +13:00
Olly Betts
7345a33ccf [php] Make test helper methods static
We call them all statically so they ought to be static (PHP issues
a diagnostic about this, but that seems to be hidden by default).
2019-02-08 18:04:07 +13:00