Nikita Popov
d0fd2be642
Revert removal of private __clone() methods
...
I thought these were redundant, because we already NULL out the
clone_obj object handler. However, it turns out that reflection is
using private __clone() to determine clonability (isCloneable) for
the case where we only have a class, rather than an object.
As such, removing these methods would be a BC break.
This reverts commit e7131a4e9f
.
This reverts commit 55bd88ce0d
.
2019-01-14 09:19:30 +01:00
Nikita Popov
e219ec144e
Implement typed properties
...
RFC: https://wiki.php.net/rfc/typed_properties_v2
This is a squash of PR #3734 , which is a squash of PR #3313 .
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
jvoisin
fbdaabba62
Fix some sign-related issues in comparisons
2019-01-09 10:01:12 +01:00
Nikita Popov
ba5cb2eb32
Remove unnecessary uses of object_and_properties_init
...
Use object_init_ex instead if the properties are NULL.
2019-01-07 16:00:29 +01:00
Nikita Popov
55bd88ce0d
Remove redundant __clone() methods from Reflection
...
Reflection classes already use NULLed clone_obj to signal that they
cannot be cloned, so it's not necessary to additionally declare a
throwing __clone() method.
2018-11-26 14:00:42 +01:00
Dmitry Stogov
0f7f1498be
Use ZEND_THIS macro to hide implementation details in extensions code.
2018-11-15 19:54:19 +03:00
Dmitry Stogov
c6ad0b92b7
Replace getThis() by EX(This), when additional check is not necessary.
2018-11-14 02:44:25 +03:00
Dmitry Stogov
d57cd36e47
Immutable clases and op_arrays.
...
Squashed commit of the following:
commit cd0c36c3f9
Merge: 4740dabb84
ad6738e886
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 14:43:38 2018 +0300
Merge branch 'master' into immutable
* master:
Remove the "auto" encoding
Fixed bug #77025
Add vtbls for EUC-TW encoding
commit 4740dabb84
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 14:12:28 2018 +0300
Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes.
commit ad7a78b253
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:46:30 2018 +0300
Added comment
commit 0276ea5187
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:42:43 2018 +0300
Added type cast
commit c63fc5d5f1
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:36:51 2018 +0300
Moved static class members initialization into the proper place.
commit b945548e93
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:21:03 2018 +0300
Removed redundand assertion
commit d5a4108840
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:19:13 2018 +0300
Removed duplicate code
commit 8dadca8864
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:05:43 2018 +0300
Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros.
commit 9ef07c88bd
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 10:48:29 2018 +0300
typo
commit a06f0f3d3a
Merge: 94099586ec
3412345ffe
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 10:47:07 2018 +0300
Merge branch 'master' into immutable
* master:
Remove unused variable makefile_am_files
Classify object handlers are required/optional
Add support for getting SKIP_TAGSTART and SKIP_WHITE options
Remove some obsolete config_vars.mk occurrences
Remove bsd_converted from .gitignore
Remove configuration parser and scanners ignores
Remove obsolete buildconf.stamp from .gitignore
[ci skip] Add magicdata.patch exception to .gitignore
Remove outdated ext/spl/examples items from .gitignore
Remove unused test.inc in ext/iconv/tests
commit 94099586ec
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Oct 15 23:34:01 2018 +0300
Immutable clases and op_arrays
2018-10-17 15:52:50 +03:00
Nikita Popov
1cfbb21790
Classify object handlers are required/optional
2018-10-16 20:53:59 +02:00
Peter Kokot
902d39a3a7
Trim trailing whitespace in source code files
2018-10-13 14:14:50 +02:00
Nikita Popov
f48ee1ff58
Clarify that the get_properties handler is required
...
Some places were checking for non-null get_properties, some weren't.
Make it clear that the handler is required and such checks are not
necessary.
2018-10-04 12:46:50 +02:00
Nikita Popov
1e14b7a369
Write to correct smart_str
...
Mixed this up during the migration to ZEND_HASH_FOREACH.
2018-10-03 11:03:55 +02:00
Nikita Popov
a659d16adf
Merge branch 'PHP-7.3'
2018-10-03 10:50:38 +02:00
Nikita Popov
9f3ea20320
Merge branch 'PHP-7.2' into PHP-7.3
2018-10-03 10:50:27 +02:00
Nikita Popov
54aa76167b
Merge branch 'PHP-7.1' into PHP-7.2
2018-10-03 10:50:16 +02:00
Nikita Popov
945f315506
Reflection: Copy invoke function also in the variadic case
...
It doesn't matter how the parameters are provided, we always have
to copy the trampoline invoke function.
2018-10-03 10:48:42 +02:00
Nikita Popov
ac96a57818
Remove uses of apply_with_arguments API in reflection
...
Instead of ZEND_HASH_FOREACH. As a side-effect, this fixes a latent
bug in _addmethod, where a zval was interpreted as a zval*.
Also apply some optimizations to getProperties() while at it: For
declared properties, use the HT key instead of unmangling the
property name. For dynamic properties check INDIRECT instead of
looking up prop info to determine if the property is dynamic.
2018-10-03 10:37:42 +02:00
Nikita Popov
10b1ab9275
Some reflection cleanups
...
Use zend_string and zend_string_tolower in more places, clean up
__invoke handling slightly.
2018-10-02 23:14:13 +02:00
Nikita Popov
784579d99a
Merge branch 'PHP-7.3'
2018-10-02 18:20:30 +02:00
Nikita Popov
a42801abe3
Merge branch 'PHP-7.2' into PHP-7.3
2018-10-02 18:20:25 +02:00
Nikita Popov
f0647edd88
Fixed bug #66430
2018-10-02 18:19:53 +02:00
Nikita Popov
96da1fe8a9
Fixed bug #76737
...
Explicitly prohibit serialization and unserialization of reflection
objects.
2018-09-29 14:47:57 +02:00
Nikita Popov
36a4f58ab9
Remove redundant ce from reflection property_reference
...
The ce is already stored in the main reflection object, no need to
store it twice.
2018-09-28 23:16:10 +02:00
Nikita Popov
570f9f6281
Only store zend_type inside reflection type_reference
...
We don't need the full arg_info and the baggage associated with it.
Storing the type should be safe, as it's part of structures which
are never released during a request (arg_info and in the future
prop_info).
2018-09-28 22:27:14 +02:00
Nikita Popov
74ade095db
Remove unused "dummy" member in reflection_object
2018-09-25 21:47:16 +02:00
Nikita Popov
45bb95c036
Reformat macros in php_reflection.c
2018-09-25 21:47:14 +02:00
Dmitry Stogov
689c6fb188
Replace ZEND_ACC_ANON_BOUND, ZEND_ACC_UNRESOLVED_PARENT and ZEND_ACC_UNRESOLVED_INTERFACES with single ZEND_ACC_LINKED.
2018-09-18 11:41:40 +03:00
Dmitry Stogov
034b7ff091
Get rid of ZEND_ACC_IMPLICIT_PUBLIC
2018-09-11 12:26:26 +03:00
Dmitry Stogov
3a249e769b
Squashed commit of the following:
...
commit 2d3cac9e00
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 11:54:47 2018 +0300
Fixed static property access
commit 31786ee272
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 11:05:29 2018 +0300
Avoid duplicate checks
commit 5ae502b979
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 10:39:17 2018 +0300
Optimization
commit 82c17f0e8a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 09:26:50 2018 +0300
Removed unused zend_duplicate_property_info()
commit ba53d1d0dd
Merge: eacc11b8fd
c4b14370cf
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Sep 11 09:24:13 2018 +0300
Merge branch 'master' into shadow
* master:
7.0.33 next
Sync NEWS [ci skip]
add NEWS for 76582
Enforce ordering of property compare in object comparisons
Fixed wrong assertion
Skip test on unsuitable env
commit eacc11b8fd
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 13:12:39 2018 +0300
Fixed failure of ext/spl/tests/array_017.phpt
commit 62d1871430
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 11:55:07 2018 +0300
Fixed issues
commit 1d37e3a40e
Merge: d6c3f098b6
1e550e6f7e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Sep 10 10:21:20 2018 +0300
Merge branch 'master' into shadow
* master:
Update NEWS
Fix for bug #76582
Fix ssl stream reneg limit test to print only after first renegotiation
Make a copy unconditionally
Fix memory leak in pcre cache
Remove not needed checking for <errno.h>
Remove HAVE_ASSERT_H
Add test for bug #76850
Fixed bug #76850 Exit code mangled by set locale/preg_match
Remove empty PHP tags from test
Fix #75273 : php_zlib_inflate_filter() may not update bytes_consumed
Fix PCRE2 exclusion and remove dead libs in Makefile.gcov
Report mem leaks to stderr if no Win debugger is present
Use combined assignment contanation operator
Fixed bug #76796
Support fixed address mmap without replacement
commit d6c3f098b6
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Sep 7 13:56:30 2018 +0300
Get rid of ZEND_ACC_SHADOW
2018-09-11 11:56:45 +03:00
Christoph M. Becker
f94518dca1
Merge branch 'PHP-7.3'
...
* PHP-7.3:
Fix #74454 : Wrong exception being thrown when using ReflectionMethod
2018-09-05 15:11:09 +02:00
Christoph M. Becker
21cd552e1e
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #74454 : Wrong exception being thrown when using ReflectionMethod
2018-09-05 15:10:27 +02:00
Christoph M. Becker
7a2c9585c4
Merge branch 'PHP-7.1' into PHP-7.2
...
* PHP-7.1:
Fix #74454 : Wrong exception being thrown when using ReflectionMethod
2018-09-05 15:07:59 +02:00
Christoph M. Becker
c0a389a927
Fix #74454 : Wrong exception being thrown when using ReflectionMethod
...
If zend_throw_exception_ex() already threw an exception, we should not
throw again.
2018-09-05 15:05:19 +02:00
Dmitry Stogov
8939c4d96b
Get rid of ZEND_ACC_CTOR, ZEND_ACC_DTOR and ZEND_ACC_IMPLEMENTED_ABSTRACT
2018-09-05 13:16:10 +03:00
Dmitry Stogov
d140df58e6
Keep information about unresolved interfaces in zend_class_entry->interface_names.
...
Move interface implementation code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_INTERFACE and ZEND_VERIFY_ABSTRACT_CLASS opcodes.
2018-08-23 17:16:28 +03:00
Dmitry Stogov
67397970b2
Replace zend_class_entry->traits by persistent zend_class_entry->trait_names.
...
Move trait binding code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_TRIAIT and ZEND_BIND_TRAITS opcodes.
2018-08-23 02:02:26 +03:00
Gabriel Caruso
84b195d9fc
Fix some misspellings
2018-08-12 16:15:45 +02:00
Dmitry Stogov
ab8094c666
Pack zend_constant.flags and zend_constant.module_number into reserved space inside zend_constant.value.
2018-07-26 12:58:07 +03:00
Dmitry Stogov
85ee47eda0
Changed structure of zend_class_entry.trait_aliases and zend_class_entry.trait_precedences to avoid keeping "intermediate" trait references, that are used only during inheritance.
2018-07-11 18:56:10 +03:00
Dmitry Stogov
67b4c3379a
Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY()
2018-07-09 12:46:46 +03:00
Dmitry Stogov
3780b027dd
Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code)
2018-07-05 14:25:17 +03:00
Dmitry Stogov
b6cc4d2009
Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code)
2018-07-05 11:54:26 +03:00
Dmitry Stogov
4a475a4976
Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
...
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Nikita Popov
23ae6ca405
Fix check for invoking abstract method
2018-07-02 21:33:09 +02:00
Nikita Popov
826e403d2c
Add $ before property name in error message
2018-07-02 21:24:38 +02:00
Nikita Popov
04824aa263
Merge branch 'PHP-7.2'
2018-07-02 18:58:01 +02:00
Nikita Popov
9bbb9e537c
Merge branch 'PHP-7.1' into PHP-7.2
2018-07-02 18:57:25 +02:00
Nikita Popov
c97b8bbf82
Fixed bug #75231
...
The behavior is now consistent with ReflectionMethod.
2018-07-02 18:56:27 +02:00
Nikita Popov
1b66ba17ad
Remove unnecessary explicit argc check
...
Instead specify a default value for the argument, which is more
idiomatic.
2018-07-02 18:29:30 +02:00
Nikita Popov
76f1d98a0c
Remove METHOD_NOTSTATIC checks in reflection
...
PHP does not allow static calls to non-static internal methods
anyway, so these checks are redundant.
2018-07-02 18:26:48 +02:00