Commit graph

2175 commits

Author SHA1 Message Date
Dmitry Stogov
cf4c4ee900 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78531 (Crash when using undefined variable as object
2019-09-13 01:43:40 +03:00
Dmitry Stogov
51d9f32dbe Fixed bug #78531 (Crash when using undefined variable as object 2019-09-13 01:42:02 +03:00
Dmitry Stogov
86a56f89a3 Use zval_try_get_tmp_string() instead of zval_get_tmp_string() for cheaper EG(exception) check 2019-09-13 00:20:06 +03:00
Dmitry Stogov
0a7233f2aa Avoid reloading 2019-09-12 20:13:31 +03:00
Dmitry Stogov
8b10fcd3e7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Load string once
2019-09-12 18:53:26 +03:00
Dmitry Stogov
5a616191f3 Load string once 2019-09-12 18:46:13 +03:00
Nikita Popov
f61f122b9a Merge branch 'PHP-7.4' 2019-09-12 16:41:45 +02:00
Nikita Popov
4b9ebd837b Allow throwing exception while loading parent class
This is a fix for symfony/symfony#32995.

The behavior is:

* Throwing exception when loading parent/interface is allowed
  (and we will also throw one if the class is simply not found).
* If this happens, the bucket key for the class is reset, so
  it's possibly to try registering the same class again.
* However, if the class has already been used due to a variance
  obligation, the exception is upgraded to a fatal error, as we
  cannot safely unregister the class stub anymore.
2019-09-12 16:41:18 +02:00
Dmitry Stogov
02c83b809a ceanup 2019-09-10 15:12:42 +03:00
Nikita Popov
ee4b11c668 Detect calls to abstract methods in get_method() already
Instead of checking for this during DO_FCALL, already detect this
case during get_method()/get_static_method(), similar to visibility
checks.

This causes a minor difference in behavior, in that arguments will
no longer be evaluated. I think this is correct though (and consistent
with visibility errors).
2019-09-06 15:05:24 +02:00
Dmitry Stogov
9513b20738 Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Microoptimization (avoid code duplication)"
2019-09-05 15:35:42 +03:00
Dmitry Stogov
4ecdff2da8 Revert "Microoptimization (avoid code duplication)"
This reverts commit 25d97f5eee.
2019-09-05 15:35:19 +03:00
Dmitry Stogov
1b5d41751f Merge branch 'PHP-7.4'
* PHP-7.4:
  Microoptimization (avoid code duplication)
2019-09-05 13:45:25 +03:00
Dmitry Stogov
25d97f5eee Microoptimization (avoid code duplication) 2019-09-05 13:44:46 +03:00
Dmitry Stogov
0f8bb9e37d Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HOT attribute from some VM handlers. Comparisons almost always followed by JMPZ/JMPNZ; JMPZNZ is rare used.
  Remove --with-zlib-dir option from mysqlnd config
2019-09-05 11:43:13 +03:00
Dmitry Stogov
7237da27fe Remove HOT attribute from some VM handlers. Comparisons almost always followed by JMPZ/JMPNZ; JMPZNZ is rare used. 2019-09-05 11:40:15 +03:00
Nikita Popov
395e87d497 Merge branch 'PHP-7.4' 2019-09-04 15:33:16 +02:00
Nikita Popov
b6f76aca54 Improve exception handling for abstract/deprecated calls
Reuse existing arg freeing loop instead of duplicating it.

Additionally also handle deprecated in DO_FCALL_BY_NAME.
2019-09-04 15:19:21 +02:00
Nikita Popov
b02f425b6c Merge branch 'PHP-7.4' 2019-09-04 12:47:21 +02:00
Nikita Popov
4bb7282742 Fix handling of abstract/deprecated exception
The exception mechanism assumes that exceptions from DO_FCALL are
already happening after the function call. This means that we are
currently leaking the passed arguments, and I think we can also
corrupt the VM stack due to incorrect frame linking in some cases
(there are assertion failures if the VM stack page size is reduced).

Instead handle the stack frame freeing manually for this special
case.
2019-09-04 12:46:00 +02:00
Nikita Popov
603b9c43cb Add arg type assertions to DO_ICALL
Now that DO_ICALL is also used for functions with type hints, we
should include the arginfo sanity check assertions in there as
well.
2019-09-02 14:30:51 +02:00
Nikita Popov
d00036e625 Merge branch 'PHP-7.4' 2019-08-29 12:34:31 +02:00
Nikita Popov
a12fe30590 Merge branch 'PHP-7.3' into PHP-7.4 2019-08-29 12:34:07 +02:00
Nikita Popov
34edd4aa2a Merge branch 'PHP-7.2' into PHP-7.3 2019-08-29 12:33:04 +02:00
Nikita Popov
ed749edd47 Fix use-after-free of immediately invoked closure with extra args 2019-08-29 12:32:03 +02:00
Nikita Popov
d93b094584 Throw TypeError from VM implementation of get_class()
The normal function already throws TypeError through the usual zpp
mechanism, but the VM implementation handles this manually and has
not been updated.
2019-08-27 09:37:48 +02:00
Dmitry Stogov
b912335315 Merge branch 'PHP-7.4'
* PHP-7.4:
  Inline zend_zval_ptr() in executor explicitely (only on hot paths)
2019-08-06 16:33:27 +03:00
Dmitry Stogov
d1fd4607d0 Inline zend_zval_ptr() in executor explicitely (only on hot paths) 2019-08-06 16:28:42 +03:00
Nikita Popov
e63093e547 Merge branch 'PHP-7.4' 2019-08-01 10:11:02 +02:00
Nikita Popov
afd96392a3 Revert "Use RW fetch for argument unpacking"
This reverts commit 6913ec3282.
This reverts commit a9e332e027.

Causes https://bugs.php.net/bug.php?id=78356, which I don't have
a good solution for.
2019-08-01 10:06:53 +02:00
Nikita Popov
14f99ede42 Merge branch 'PHP-7.4' 2019-07-30 10:07:25 +02:00
Nikita Popov
6913ec3282 Use RW fetch for argument unpacking
Argument unpacking may need to create references inside the array
that is being unpacked. However, it currently can only do this
if a plain variable is unpacked, not for any nested accesses,
because the value is fetched for read. Resolve this by fetching
the operands for RW.
2019-07-30 10:07:08 +02:00
Dmitry Stogov
96dab0a657 Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid over-specialization
2019-07-24 20:00:55 +03:00
Dmitry Stogov
853b426ecf Avoid over-specialization 2019-07-24 19:51:56 +03:00
Dmitry Stogov
30886007c1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Reordering
2019-07-24 18:52:55 +03:00
Dmitry Stogov
d7e8abb4aa Reordering 2019-07-24 18:49:46 +03:00
Dmitry Stogov
a106e52b10 Merge branch 'PHP-7.4'
* PHP-7.4:
  Delay dereference
2019-07-24 18:40:03 +03:00
Dmitry Stogov
22e7ee3bb3 Delay dereference 2019-07-24 18:36:50 +03:00
Dmitry Stogov
1f38adb501 Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid reloading
2019-07-24 17:38:42 +03:00
Dmitry Stogov
6191df7553 Avoid reloading 2019-07-24 17:30:38 +03:00
Dmitry Stogov
57d9b94dea Simplify TMP/VAR operand releasing 2019-07-24 14:13:40 +03:00
Nikita Popov
dc6341eb78 Merge branch 'PHP-7.4' 2019-07-24 10:07:51 +02:00
Nikita Popov
1eb706179f Avoid references in TMP var
Make sure we deref the OBJ_IS result, because we store it in a TMP
var, which is not allowed to contain references and will cause
assertion failures in the unspecialized VM.

This also partially reverts fd463a9a60,
which merged the TMP and VAR specializations of COALESCE to work
around this bug.

An alternative would be to change the result type of OBJ_IS back
to VAR.
2019-07-24 10:07:26 +02:00
Nikita Popov
80681e8d40 Merge branch 'PHP-7.4' 2019-07-24 09:55:09 +02:00
Nikita Popov
9e4603f772 Try to fix macos build
By avoiding unused variable opline warnings. Also clean up the
replacement of ZEND_VM_SPEC -- we were sometimes treating it as
an always-defined constant with a value (what it actually is) and
sometimes as a conditionally defined constant (which it isn't, but
which still worked thanks to the specializer). Switch to only
treating it as a constant with a value.
2019-07-24 09:44:55 +02:00
Dmitry Stogov
43c4e4cd22 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed unspecialized executor
2019-07-24 01:43:20 +03:00
Dmitry Stogov
eaa9048973 Fixed unspecialized executor 2019-07-24 01:43:01 +03:00
Dmitry Stogov
97912023bb Merge branch 'PHP-7.4'
* PHP-7.4:
  Use run-time cache to avoid repeatable hash lookups in ZEND_DECLARE_CLASS_DELAYED
2019-07-19 11:46:35 +03:00
Dmitry Stogov
445d51347d Use run-time cache to avoid repeatable hash lookups in ZEND_DECLARE_CLASS_DELAYED 2019-07-19 11:46:03 +03:00
Dmitry Stogov
a837b80a48 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use run-time cache to avoid repeatable hash lookups when creating anonymous functions and classes
2019-07-19 10:45:00 +03:00