Commit graph

637 commits

Author SHA1 Message Date
Dmitry Stogov
7f67513ca3 Lazy function copying from op_cache SHM into process memory 2018-06-25 19:53:58 +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
34e58a6447 Reduced overhead of magic method calls (__get/__set/__unset/__isset/__dectructor/__clone). 2018-06-22 14:29:54 +03: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
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +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
a795bd8265 Optimize zend_hash_real_init() 2018-03-23 00:13:45 +03:00
Dmitry Stogov
d7f2dc4ec6 Improve HashTable iterators handling:
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
2018-03-22 02:41:49 +03:00
Dmitry Stogov
1af60a2a71 Keep initialized object_handlers structures in read-only memory. 2018-03-14 14:01:45 +03:00
Dmitry Stogov
58880e3fc1 Get rid of IS_OBJ_USE_GUARDS and IS_OBJ_HAS_GUARDS flags 2018-02-27 17:38:56 +03:00
Dmitry Stogov
5e8aa036f2 Access extra data stored in zval through macros 2018-01-23 12:56:22 +03:00
Dmitry Stogov
b3e22da745 Use OBJ_FLAGS() macro to access object flags (even if they are currently stored together with GC_FLAGS) 2018-01-22 15:57:00 +03:00
Dmitry Stogov
6634d5e313 Use HT_FLAGS() macro 2018-01-22 14:58:16 +03:00
Dmitry Stogov
c4fa7345dc Removed useless separation 2018-01-17 03:00:11 +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
Nikita Popov
b2b2b437af Add _IS_NUMBER as cast_object() target type
convert_scalar_to_number() will now call cast_object() with an
_IS_NUMBER argument, in which case the cast handler should return
either an integer or floating point number, whichever is more
appropriate.

Previously convert_scalar_to_number() unconditionally converted
objects to integers instead.

Fixes bug #53033.
Fixes bug #54973.
Fixes bug #73108.
2017-12-26 12:39:06 +01:00
Nikita Popov
182317f6b6 Remove unnecessary type check 2017-12-25 21:21:05 +01:00
Nikita Popov
2667ddc46d Remove unnecessary readobj==writeobj checks
This can no longer be the case since PHP 7. The writeobj must
always point to a different zval.
2017-12-25 21:19:45 +01:00
Xinchen Hui
4dfbfe93aa Use cheaper API 2017-12-18 11:55:14 +08:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Xinchen Hui
60c742979d Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Fixed bug #75573 (Segmentation fault in 7.1.12 and 7.0.26)
  Revert "ext/sodium: pwhash: do not warn on low parameters"

Conflicts:
	Zend/zend_object_handlers.c
2017-11-29 14:54:05 +08:00
Xinchen Hui
bedf6093ad Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75573 (Segmentation fault in 7.1.12 and 7.0.26)
2017-11-29 14:46:44 +08:00
Xinchen Hui
3b9ba7b6bd Fixed bug #75573 (Segmentation fault in 7.1.12 and 7.0.26) 2017-11-29 14:46:21 +08:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
aeca761856 Removed useless reallocations 2017-10-26 19:13:53 +03:00
Dmitry Stogov
0366684ce3 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed indirect modification of magic ArrayAccess method arguments
2017-10-26 16:17:49 +03:00
Dmitry Stogov
1d846fdfb2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed indirect modification of magic ArrayAccess method arguments
2017-10-26 16:07:49 +03:00
Dmitry Stogov
503df277ab Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed indirect modification of magic ArrayAccess method arguments
2017-10-26 16:04:20 +03:00
Dmitry Stogov
98eee90734 Fixed indirect modification of magic ArrayAccess method arguments 2017-10-26 16:03:42 +03:00
Dmitry Stogov
0772b32ef6 Restore object copying on magic method calls (It was removed in master only). 2017-10-26 14:04:42 +03:00
Dmitry Stogov
b09e398304 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed indirect modification of magic method arguments.
2017-10-26 13:35:39 +03:00
Dmitry Stogov
e3997b2c82 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed indirect modification of magic method arguments.
2017-10-26 13:12:52 +03:00
Dmitry Stogov
177cdcf313 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed indirect modification of magic method arguments.
2017-10-26 13:11:59 +03:00
Dmitry Stogov
bc59289b7a Fixed indirect modification of magic method arguments. 2017-10-26 13:05:23 +03:00
Xinchen Hui
5cb5b27c40 Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Update NEWS
  Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)

Conflicts:
	Zend/zend_object_handlers.c
2017-10-26 10:16:55 +08:00
Xinchen Hui
11a4b57e61 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)
2017-10-26 10:09:57 +08:00
Xinchen Hui
3c4c9a23bc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)

Conflicts:
	Zend/zend_object_handlers.c
2017-10-26 10:08:39 +08:00
Xinchen Hui
d2047503cb Fixed bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS) 2017-10-26 10:07:08 +08:00
Dmitry Stogov
6a034be2c6 Fixed signed/unsigned comparisons 2017-10-25 11:45:17 +03:00
Dmitry Stogov
59a7944bc6 Made run_time_cache to keep "offset" to dynamic properties Buckets (instead of index). 2017-10-24 10:28:19 +03:00
Dmitry Stogov
917dfe646e Removed useless reference-counting and copying 2017-10-23 21:07:49 +03:00
Dmitry Stogov
193adbdf30 Use run-time cache to keep position of dynamic properties in HashTable to access them without hash lookup. 2017-10-23 18:29:13 +03:00
Dmitry Stogov
f18638ca2d Fixed incorrect recursion detection 2017-10-06 11:47:11 +03:00
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Dmitry Stogov
44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00
Dmitry Stogov
0fb05f1487 Property access micro-optimization. (ZEND_WRONG_PROPERTY_OFFSET and ZEND_DYNAMIC_PROPERTY_OFFSET are hidden, use one comparison instead of two on fast paths. "Negative" offsets are reserved for future optimizations). 2017-09-18 13:13:24 +03:00