Commit graph

131 commits

Author SHA1 Message Date
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
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
Olly Betts
75810c0bdc [php] Fix comment typo in testsuite 2019-02-08 15:33:37 +13:00
Olly Betts
cadd97ac4f [php] Fix widespread use of bare strings in testsuite
These generate warnings with PHP 7.3, which will become errors in a
future version.
2019-02-08 15:32:30 +13:00
Olly Betts
21b3c06de6 [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.
2019-02-08 14:58:01 +13:00
William S Fulton
b7db45661a Fix overloading for non-pointers and NULL - Php 2018-12-30 12:00:49 +00:00
William S Fulton
220a735ec5 Update php test 2018-10-09 19:37:07 +01:00
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton
50cb18087d test-suite fixes (2) for compilers that don't support varargs
Split director_exception testcase into two so that testing throw(),
with no arguments, that is nothrows, can be tested separately to throw()
taking arguments. [The throw keyword needs to be removed for C++
compilation in C++11 and later when it was deprecated.]
2018-05-06 09:46:37 +01:00
William S Fulton
08210236ef Fix newobject3 testcase
Fixes Octave problem which has a template called product.
2017-10-10 08:05:21 +01:00
Olly Betts
0ca47dd7cc CHANGES.current entry and regression test for previous commit 2017-10-09 11:09:58 +13:00
William S Fulton
0a9113dcba Correct php testcase 2017-09-19 07:37:29 +01:00
William S Fulton
9e2a12416c Fix type promotion wrapping some non-trivial constant expressions
This was previously an integral type instead of a floating point type:
2017-09-18 07:06:27 +01:00
William S Fulton
90ba174fce Fix generated code for constant expressions containing wchar_t L literals.
Such as:
  # define __WCHAR_MAX    (0x7fffffff + L'\0')

Reported on swig-user mailing list.
2017-09-17 19:02:55 +01:00
Nihal
6c991d6c67 Remove abstractness check in PHP7 test cases 2017-09-01 00:44:57 +05:30