These are all the same, and the NULL check performed is done inside
zend_objects_destroy_object() anyway, so we can just set the dtor
to zend_objects_destroy_object (which is what in-tree PHP extensions
do.)
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.
getThis(z) checks that z is a PHP object and returns ZEND_THIS if it
is, and NULL otherwise. In all our uses we know that z is a PHP object
(and we'd try to dereference NULL if it were returned!)
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.
This PR removes the closing `?>` PHP tag from generated files. [PSR-2](https://www.php-fig.org/psr/psr-2/) states:
> The closing `?>` tag MUST be omitted from files containing only PHP.
A problem might occur if files with any character after the closing tag are used with `include` or `require`. It might trigger an output and disallow HTTP header manipulation. See the popular [_headers already sent_](https://stackoverflow.com/a/8028987/1847340) debate on SO.
Finally removed support for %pragma(php4) which was deprecated back in
2008. The replacement is %pragma(php), which has been supported since
at least 2005.
PHP5 is no longer actively supported by the PHP developers and security
support for it ends completely at the end of 2018, so it doesn't make
sense to include support for it in the upcoming SWIG 4.0.0 release.
See #701.
- Fixes generation of director method declarations containing C++11 ref-qualifiers.
- Fixes generation of director method declarations returning more complex types such
as const ref pointers.
- Rewrite Swig_method_call to use more up to date code in the core.
The directorin typemaps will now generate a temporary variable
(specified after the type), such as:
%typemap(directorin) MyType (MyType *temp) { ... use temp ... }
The shared_ptr director typemaps have been fixed for use in functions
that take more than one parameter.
- This fixes the problem of no reaching parent class variables.
Note: Any extra variables set by __set function are stored in the parent class's extras
hastable under swig_object_wrapper.
- This fixes director_basic test case. Uses the new flow in director class methods.
- It also correctly fixes the double free problem in director_detect.
- Rename class entry variables to SWIGTYPE_class_ce
- Refactor factory code to use SWIGTYPE_class_ce to create objects
- Refactor ConvertPtr to work of wrapped class objects.
- Change the need of runtime check on old or new flow at wrapper generation time.
- Change the check on add ZEND_ACC_ABSTRACT to GetFlag(n, "abstract") && Swig_directorclass(Swig_methodclass(n))
- workaround to solve abstract testcases at the moment.
- Remove redundant code in class handler for getting namespaces (Not the correct approact) and use of zend_register_class_alias_ex.
- Refactor choosing of class name to use sym:name by default.
- Change enum_scope_template test to use class enums.
- Move the conversion of void* of ptr in swig wrapper to class pointer to Lib files.
- Synchronize between old and new flow. Old flow to accept newly created objects,
with the use of a new property SWIG_classWrapper to newly created objects.
- ZEND_BEGIN_ARG_INFO_EX to hold exact number of arguments required.
- Fix the constructor overloading bug in the in-house Swig_class_overload_dispatch function
- Add helper function to check if the class is wrapped.
- Add ZEND_ACC_ABSTRACT to virtual functions to make the class abstract.
- Change how wname is selected for staticmemberfn.
- Helper function to get names without namespace getNameWithoutNamespace.
- Fix bugs on class entry level at class handler.
- Move all entry level code to class handler from class decleration.
- Checking if base.item is null before using it.
- Check if the parent class is wrapped before using its class entry.
Code Refactor
- Refactor code for return type of SWIGTYPE
- Workaround for Namespaced classes.
- Refactor code of SWIG_SetZval to take care of objects in class constructor.
- Introduce SWIG_generalize_object to generalize each object to swig object wrapper.
- Catch feature:immutable instead of feature:warnfilter - 462 for missing setter.
- Refactor code to create PHP objects for all instances of value, reference and pointer return types of C++ objects.
- Introduce getAccessMode to get the Access Mode of a method for generating Wrapper.
- Refactor free_object creation to include need_free condition. This is to check if there is a need to free. (Virtual Protected Destructors)
- Support for feature:exceptionclass. Extends class Exception.
- Improve condition check in Director class constructor to distinguish between, extended class creation or not.
Swig::Director::swig_is_overridden_method is used.
- rewire return of type SWIGTYPE
- {NULL, NULL, NULL} to ZEND_FE_END
- feature:warnfilter - 462 of missing setter
- refactor code of return type (replaced)
- support conversion_operator
Refactor Code
- Support Director Classes.
- %rename support of class names and method names.
- Creation and destruction methods after inline code.
- Test case check::function return true. - Needs Fixup
- Support different return types of pointers. - Fixup
- Support the rename functionality in class names.
- Redirect the resource destructor to the class desctructor if its a class resource - Object pointers.
This is to keep compatibility and consistency with the older way.
Shape::nshapes static variable's setter and getter methods can be
accessed by Shape::nshapes(10),Shape::nshapes() respectively.
MSHUTDOWN, RINIT, RSHUTDOWN and MINFO are often empty, so check and
omit them if this is the case, and set the module structure entry to
NULL instead. Reduces code size, number of external functions on the
module, and runtime overhead a little (RINIT and RSHUTDOWN are called
on every request when used with a webserver).
PHP 7.1 no longer supports calling methods with fewer parameters
than declared, so we need to generate __construct() with default
values for all but the first parameter.
Previously we emitted a separate one for every wrapped function,
but typically many functions have the same number of parameters
and combinations of parameters passed by reference or not.
This change significantly reduces both the size of the generated
wrapper, and of the compiled PHP extension module (e.g. by ~6% for
the stripped extension module for Xapian's PHP7 bindings).
This is SWIG's default for every language except PHP, and now is a
good time to make this change so that once we drop PHP5 support, we'll
have the same default everywhere. It's easy to override the default
with -cppext cxx to get the PHP5 behaviour.
PHP5's C extension API has changed substantially so you need to use
-php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
Previously the return value of call_user_function() was ignored and we
checked an uninitialised value instead. Fixes#627. Based on patch
from Sergey Seroshtan.
* char-escaping:
Add missing string_constant.i testcase
changes file update for char wrappers
C# char wrappers fixes for enum values, static const member char values and %csconst
D testing added for %dmanifestconst and char constants
Fix wrapping D constants using %dmanifestconst
Php fix for enum value of '\0'
Fix static const char member variables wrappers with %javaconst(1).
Expand char testing in enums and %constant
Java char changes file update
Java enum and static member variable escaping fix for chars
Add tests for enum values and static const member variables chars containing escape sequences
Minor documentation tweak
Conflicts:
CHANGES.current
Use ZEND_FE_END (introduced sometime around 5.2) to obtain the correct
number of arguments for zend_function_entry. Fallback to the original
3 argument initializer if not defined, however, this will not fix the
initializer warning though for some older versions of PHP.
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
changed to be consistent with other languages. The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).
*** POTENTIAL INCOMPATIBILITY ***
builds of PHP (SF bug #3166423). Instead we now wrap it in a
SWIG_FAIL() function which we annotate as "noreturn" for GCC to
avoids warnings. This also reduces the size of the compiled
wrapper (e.g. the stripped size is 6% for Xapian's PHP bindings).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13077 626c5289-ae23-0410-ae9c-e8d60b6d4f22