Commit graph

865 commits

Author SHA1 Message Date
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
Nikita Popov
7ac06d66d4 Add zend_update_static_property_ex API
And cleanup the implementation to perform a normal by-value
assignment.
2018-06-29 22:56:59 +02:00
Nikita Popov
813b6fc950 Add zend_read_static_property_ex API
For symmetry with zend_read_property_ex.
2018-06-29 22:49:15 +02:00
Nikita Popov
db7ead0768 Fix ReflectionProperty::get/setValue() on internal static property
This was broken by 6dc0cd868d, which
moved static property initialization outside of constant updating.

Instead of replicating logic, use zend_get_static_property() API
in the reflection implementation, just like we're using
read_property for non-static proprety access.
2018-06-28 22:45:26 +02:00
Xinchen Hui
8e940654e1 Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence)
2018-06-28 12:38:26 +08:00
Xinchen Hui
5d7f9dcca7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence)
2018-06-28 12:37:58 +08:00
Xinchen Hui
1f6b842af4 Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence) 2018-06-28 12:37:33 +08:00
Nikita Popov
bddb085a68 Store unmangled name in ReflectionProperty
Avoid redundant unmangles and string copies, where possible.
2018-06-27 23:52:21 +02:00
Nikita Popov
78f2a1b81d Optimize ReflectionProperty constructor
Perform HT lookups using a zend_string. Don't copy the name for
the "name" property. We can always use the original name directly,
as properties case case-sensitive, so the original name should
always match the unmangled name of the fetched property info.
2018-06-27 23:21:06 +02:00
Dmitry Stogov
7f67513ca3 Lazy function copying from op_cache SHM into process memory 2018-06-25 19:53:58 +03:00
Dmitry Stogov
c8f355b12c Micro-optimization 2018-06-25 17:32:13 +03:00
Nikita Popov
2543e61aed Fixed bug #76509
In PHP static properties are shared between inheriting classes,
unless they are explicitly overwritten. However, because this
functionality was implemented using reference, it was possible
to break the implementation by reassigning the static property
reference.

This is fixed by switching the implementation from using references
to using INDIRECTs, which cannot be affected by userland code.
2018-06-25 15:04:09 +02:00
Dmitry Stogov
4418d61ca3 Avoid reusing zend_function.common.prototype for magic things (use reserved fields instead). 2018-06-21 13:09:25 +03:00
Peter Kokot
ede39739fd Normalize Reflection phpinfo() output
This patch normalizes the Reflection extension version in the phpinfo
output. It removes the Git attributes ident blob object name from Git
repository as an extension version.

Also the table output is synced with other extensions (i.e. enabled
in a row instead of table header).
2018-06-04 16:28:16 +02:00
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +03:00
Dmitry Stogov
d90c6f2443 Removed useless zval_ptr_dtor() 2018-05-29 17:58:06 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Dmitry Stogov
eafa92ba9d zend_fcall_info_cache.calling_scope is not used by zend_call_function() and doesn't have to be initialized.
It's used only as a result of zend_is_callable() in forward_static_call and spl_autoload.
2018-05-03 19:27:04 +03:00
Dmitry Stogov
1af60a2a71 Keep initialized object_handlers structures in read-only memory. 2018-03-14 14:01:45 +03:00
Anatol Belski
70a1b23c2c Remove unused assignment 2018-03-07 18:09:58 +01:00
Gabriel Caruso
0f2be28b43
Fix typo 2018-02-13 08:05:05 +01:00
Nikita Popov
b4dff68379 Remove no longer necessary type-name special cases
zend_get_type_by_name() now produces the correct value by itself,
so we no longer need these workarounds.
2018-02-04 23:20:44 +01:00
Dmitry Stogov
12c386f5b9 Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573af, now it should be OK). 2018-01-11 22:15:45 +03:00
Dmitry Stogov
6ba10a03e7 Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
This reverts commit 781e1573af.
2018-01-11 17:27:26 +03:00
Dmitry Stogov
781e1573af Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. 2018-01-11 16:25:28 +03:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
d9f5ea691f zend_fcall_info_cache.initialized is removed (zend_fcall_info_cache is initialized if zend_fcall_info_cache.function_handler is set). 2017-12-27 15:15:03 +03:00
Xinchen Hui
4dfbfe93aa Use cheaper API 2017-12-18 11:55:14 +08:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Dmitry Stogov
084c17fe0b Use zend_string_tolower() where it's possible (to avoid reallocations).
Allow zend_string_tolower_ex() to create parsistent strings
2017-11-30 01:13:39 +03:00
Nikita Popov
b72b1a4e4d Add zend_object_alloc() API
Using ecalloc() to create objects is expensive, because the
dynamic-size memset() is unreasonably slow. Make sure we only
zero the main object structure with known size, as the properties
are intialized separately anyway.

Technically we do not need to zero the embedded zend_object
structure either, but as long as the memset argument is constant,
a couple more bytes don't really matter.
2017-11-25 17:12:37 +01:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Sara Golemon
c33008339e Merge branch 'PHP-7.2'
* PHP-7.2:
  Revert BC break caused by fixing bug #74035
2017-11-06 17:52:35 -05:00
Michael Moravec
f70ca770b6 Revert BC break caused by fixing bug #74035
This reverts commit 9ffc6ca62f.
2017-11-06 17:52:17 -05:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Dmitry Stogov
fcb13fab6e Avoid reference counting (the value may be a persistent string) 2017-11-01 01:31:47 +03:00
Nikita Popov
5b044aacbe Use known strings for reflection properties 2017-10-31 15:46:55 +01:00
Nikita Popov
7b16205f8b Remove some unnecessary duplications 2017-10-30 22:48:20 +01:00