Commit graph

195 commits

Author SHA1 Message Date
Olly Betts
2629764e3f Remove remnants of attempts to wrap to PHP global vars
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.
2021-04-17 05:59:18 +12:00
Olly Betts
dcdaaba7ba Eliminate $zend_obj typemap variable
We can just get the zend_class_entry from the swig_type_info when
we need it.
2021-04-16 13:13:24 +12:00
Olly Betts
97733543e2 Fix directorout typemap for const TYPE &
Previous we were returning a pointer or reference to a local
variable.
2021-04-15 12:50:32 +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
836258b9d3 Fix some cases of converting PHP NULL to C++ NULL
Fixes testcase overload_null for PHP 8.0
2021-04-13 16:53:52 +12:00
Olly Betts
3b43a7bf9b Refactor to eliminate SWIG_ConvertResourcePtr() 2021-04-13 13:22:03 +12:00
Olly Betts
762a309373 Fix typemap formatting incosistencies 2021-04-13 10:31:22 +12:00
Olly Betts
0a72bfc630 Eliminate tempPointer variable 2021-04-13 10:18:47 +12:00
Olly Betts
60e7deda2c Eliminate non-standard $lower_param typemap variable 2021-04-13 10:03:03 +12:00
Olly Betts
d2eb06fbc0 Merge 2 functionally identical typemaps
The only difference is code formatting.
2021-04-13 09:53:14 +12:00
Olly Betts
5161acdd24 Eliminate direct reference to c_result in typemap
Typemaps should use $result.
2021-04-13 09:07:31 +12:00
Olly Betts
9987d7168a Implement type-checking of wrapped objects
The testsuite now all passes (with PHP 7.4 at least)
2021-04-12 17:29:39 +12:00
Olly Betts
8fd2a1cb75 Fix mixed declarations and code
SWIG still aims to generate C90-compatible code.
2021-04-05 17:35:58 +12:00
Olly Betts
f0e0f7e391 Rename userNewObj to newobject
Better to use the same name we use elsewhere.
2021-04-05 17:30:43 +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
e0cffb81dd Eliminate SWIG_classWrapper property
Instead set the _cPtr property to PHP NULL to signal that this object
uses swig_object_wrapper.
2021-04-01 15:10:10 +13:00
Olly Betts
5838f10aa0 wrap fake class constants via C API 2021-04-01 14:40:32 +13:00
Olly Betts
c863ca8b1f Use zstring access macros
These are likely to be more future-proof than accessing struct members
directly.
2021-03-29 18:18:37 +13:00
Olly Betts
f56d8ce103 Fix memory leak in director upcall check 2021-03-29 18:17:19 +13:00
Olly Betts
5482a02dd4 Fix handling of strongly-typed enums
Testcase cpp11_strongly_typed_enumerations.cpptest now passes.
2021-03-29 17:53:05 +13:00
Olly Betts
3f1286ba4f Use standard SWIG overload dispatch
Instead of having a slightly modified PHP-specific variant of
Swig_overload_dispatch we now advance the ParmList over the this
pointer.
2021-03-29 17:41:01 +13:00
Olly Betts
4b055c343d Fix compatibility with PHP8 2021-03-28 19:46:51 +13:00
Olly Betts
b45bd65dbc Add compatibility for PHP 7.3 and earlier 2021-03-28 06:58:46 +13:00
Olly Betts
dfa5353f27 Eliminate extras hash table
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.
2021-03-27 19:57:37 +13:00
Olly Betts
c03679acef Improve how we allocate swig_object_wrapper
Use zend_object_alloc() and put the zend_object member last so that
Zend can put object properties after it.
2021-03-26 17:15:34 +13:00
Olly Betts
d87b3fb745 Add FIXME comment
This looks to be the reason why testcases overload_null and
overload_polymorphic are failing.
2021-03-26 16:45:14 +13:00
Olly Betts
0da436aa83 Simplify assignment 2021-03-26 16:41:39 +13:00
Olly Betts
478bdcdfbf Whitespace tweaks 2021-03-26 16:41:28 +13:00
Olly Betts
f77113ea71 php: Eliminate SWIG_ZEND_NAMED_FE
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.
2021-03-26 13:58:02 +13:00
Olly Betts
2ba0f82720 Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-03-26 12:00:59 +13:00
Olly Betts
3fba8e7daa php: Trim trailing whitespace from PHP typemaps 2021-03-26 10:19:57 +13:00
Olly Betts
c882f39e3c [php] Fix misleadingly indented void* in typemap 2021-03-26 10:06:43 +13:00
Olly Betts
76c2c4675b [PHP] Update PHP keyword list
Add PHP keywords 'fn' (added in 7.4) and 'match' (added in 8.0) to the
list SWIG knows to automatically rename.
2021-03-26 08:24:40 +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
d15fe23c5f Merge branch 'gsoc2017-php7-classes-via-c-api' of https://github.com/nihal95/swig into gsoc2017-php7-classes-via-c-api 2021-03-25 16:25:33 +13:00
Olly Betts
351f981952 [php] Fix SWIG_ZEND_CONSTANT_SET_FLAGS for PHP < 7.3 2021-03-24 12:15:39 +13:00
Olly Betts
9f84ca8a00 [php] Fix function constants for PHP 7.3
The code we were generating no longer compiled.
2021-03-24 12:15:39 +13:00
Olly Betts
786efd0ae0 Eliminate irrelevant formatting differences from master 2021-03-24 11:59:25 +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
71475b0af9 Improve PHP object creation
Reportedly the code we were using in the directorin case gave segfaults
in PHP 7.2 and later - we've been unable to reproduce these, but the new
approach is also simpler and should be bit faster too.

Fixes #1527, #1975
2021-03-19 08:45:33 +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
William S Fulton
52063a732b Consistent parameter names for std::pair 2019-02-14 22:44:27 +00:00
William S Fulton
6d27ead9c0 Add STL container copy constructors where missing
Also provide consistent copy constructor declarations.
2019-02-14 18:53:05 +00:00
William S Fulton
e26f6bb4e2 Add missing typedefs to std::vector + typedef corrections
Tests for std::vector of pointers added which check
 std::vector<T*>::const_reference and std::vector<T*>::reference
usage which gave compilation errors in Python and Perl which had
specialized these vectors incorrectly.
2019-02-13 22:46:28 +00:00
William S Fulton
a47c2553f5 Add missing typedefs to std::pair 2019-02-13 22:46:28 +00:00
William S Fulton
9dd33e6367 Add missing typedefs to std::map 2019-02-13 22:46:27 +00:00
William S Fulton
6d0c495fd0 Add missing parameter names in STL container wrappers
Mostly in STL copy constructors.

Best to have parameter names as they make their way into the wrappers in
some target languages.
2019-02-13 22:45:47 +00:00
William S Fulton
8c207dd3a9 Merge branch 'master' of git+ssh://github.com/swig/swig
* 'master' of git+ssh://github.com/swig/swig:
  [Python] Fix some errors in the documentation for -threads
  Fixed typo in Perl5 docs.
  Update PHP testsuite for vadz's new cars
  [php] Whitespace improvements in generated C/C++ code
  Fix hardcoded _v in PHP typecheck typemaps
2019-02-12 18:53:46 +00:00
William S Fulton
68e86614ff Create a consistent stl.i library file
Same file now for all languages except R which is still missing std_map.i.
Recent Java changes adding in std_set.i removed.
2019-02-12 18:46:05 +00:00
Olly Betts
950473d77e [php] Whitespace improvements in generated C/C++ code 2019-02-12 10:14:25 +13:00