Commit graph

356 commits

Author SHA1 Message Date
Dmitry Stogov
7793bc8ee6 Improved type inference. Result of opcodes using ZVAL_COPY_DEREF can't be MAY_BE_REF. 2018-06-25 13:07:44 +03:00
Nikita Popov
61d00a6cf3
Use COPY_DEREF instead of COPY_UNREF
This fixes the behavior when the storage location of the fetch is
modified before the operand is dereferenced by the using VM opcode.

Furthermore it elimiates references as a possible return value from
*_R opcodes, which will give us more opportunities for inferences,
in particular in regard to typed properties.
2018-06-25 11:23:59 +02:00
Xinchen Hui
1cc9933130 Fixed bug #76463 (var has array key type but not value type) 2018-06-12 20:55:06 +08: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
9e1e284d48 Merge branch 'PHP-7.2'
* PHP-7.2:
  Revert "More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074)."
2018-03-13 11:04:03 +03:00
Dmitry Stogov
5574562f8f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Revert "More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074)."
2018-03-13 11:03:57 +03:00
Dmitry Stogov
0643c7ab4d Revert "More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074)."
This reverts commit 44ba557de5.
2018-03-13 11:03:45 +03:00
Dmitry Stogov
1c3796b751 Merge branch 'PHP-7.2'
* PHP-7.2:
  More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074).
2018-03-13 10:47:11 +03:00
Dmitry Stogov
575f5002c0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074).
2018-03-13 10:45:53 +03:00
Dmitry Stogov
44ba557de5 More accurate symbolic constraints oferflow/unserflow handling (better fix for bug #76074). 2018-03-13 10:44:53 +03:00
Bob Weinand
827dff310b Merge branch 'PHP-7.2' 2018-03-10 15:29:21 +01:00
Bob Weinand
cfd0979be5 Merge branch 'PHP-7.1' into PHP-7.2 2018-03-10 15:21:16 +01:00
Bob Weinand
9c6df8a238 Fix bug #76074 (opcache corrupts variable in for-loop) 2018-03-10 15:20:45 +01:00
Nikita Popov
df1439241a Simplify code
If operator overloading is ignored tmp will be 0 and we can still
use |=. No need to separate this into two cases.
2018-02-19 21:38:10 +01:00
Dmitry Stogov
a02a126d54 Allow optional ignorance of operator overlaoding. Optimizer takes into account possibility of operator overloading at default optimization level, but ignores this possibility at "unsafe" level (opcache.optimization_level=-1). 2018-02-19 12:21:43 +03:00
Nikita Popov
48c0662876 Merge branch 'PHP-7.2' 2018-02-18 17:43:08 +01:00
Nikita Popov
c0abab5fca Fix ZEND_SL range inference
This is a bit tricker than right shifts because shifting in the
sign bit flips the sign. The computed bounds are not tight.
2018-02-18 17:42:12 +01:00
Nikita Popov
202989edf8 Fix ZEND_SR range inference
Handle out-of-range RHS correctly.
2018-02-18 17:42:12 +01:00
Nikita Popov
85597e2932 Merge branch 'PHP-7.2' 2018-02-18 15:34:04 +01:00
Nikita Popov
ae837db8cf Handle overloaded GMP operators in type inference 2018-02-18 15:33:30 +01:00
Nikita Popov
39974dd65d Disable negative range inference
The negative range inference implementation does not work correctly,
and it's not clear right now how it can be fixed. As such, disable
it entirely for now.
2018-02-18 15:33:28 +01:00
Nikita Popov
2cd40b3aed Merge branch 'PHP-7.2' 2018-02-17 23:21:31 +01:00
Nikita Popov
846e8a3ec9 Fix COUNT range inference
count() on objects may return a negative number :(
2018-02-17 23:18:30 +01:00
Nikita Popov
1a50a50bcf Add RC flags in init_func_return_info 2018-02-17 23:18:29 +01:00
Nikita Popov
d05ac8f610 Merge branch 'PHP-7.2' 2018-02-09 15:11:42 +01:00
Nikita Popov
7aac61ce76 Fixed bug #75938
New modulus range inference implementation has been verified using
https://gist.github.com/nikic/67947ff92cf0e1f7e931f2f0d4cf817f.

The computed bounds are not tight, but it seems to be very hard to
compute tight bounds on modulus operations.
2018-02-09 15:10:23 +01:00
Gabriel Caruso
2d48d734a2 Fix some misspellings 2018-02-06 16:59:00 +01:00
Nikita Popov
39c5857135 Merge branch 'PHP-7.2' 2018-02-05 21:43:50 +01:00
Nikita Popov
1391a0fa0b Fixed bug #75893
It is not sufficient to just add the additional types for aliased
variables at the end of type inference, because types of derived
variables may depend on them. Make sure the additional types are
always added whenever the type of an aliased variable is updated.
2018-02-05 21:41:44 +01:00
Dmitry Stogov
3a794d39f0 Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement). 2018-02-05 19:40:06 +03:00
Dmitry Stogov
f67f455ef7 Changed FETCH_CLASS instruction format (extended_value moved into op1) 2018-01-31 18:14:43 +03:00
Nikita Popov
f208187773 Backport narrowing fix to 7.1
This is a cherry-pick of 8a4532319d.
2018-01-09 18:41:46 +01: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
Xinchen Hui
4deb63dc5a Merge branch 'PHP-7.2'
* PHP-7.2:
  Updated NEWS
2017-12-17 09:42:18 +08:00
Xinchen Hui
a3b5b93ba9 Updated NEWS 2017-12-17 09:42:01 +08:00
Nikita Popov
46da97f7da Merge branch 'PHP-7.2' 2017-12-16 21:12:57 +01:00
Nikita Popov
8a4532319d Improve fix for bug #75687
Adding an (incorrect) UNDEF here may cause subsequent narrowing in
other places.

Instead, let's try to handle this edge-case once for all
instructions...
2017-12-16 21:11:40 +01:00
Xinchen Hui
ef9d2cecc6 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
2017-12-16 23:59:44 +08:00
Xinchen Hui
a20c9bd3fe Fixed bug #75687 (var 8 (TMP) has array key type but not value type) 2017-12-16 23:59:10 +08:00
David Walker
6d4de4cf05 Implement list() reference assignments
Support list() reference assignments of the form:

    list(&$a, list(&$b, $c)) = $d;

RFC: https://wiki.php.net/rfc/list_reference_assignment
2017-12-09 13:39:52 +01:00
Dmitry Stogov
c789dfee04 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75608 ("Narrowing occurred during type inference" error)
2017-12-04 17:23:34 +03:00
Dmitry Stogov
3503dc7482 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75608 ("Narrowing occurred during type inference" error)
2017-12-04 17:22:28 +03:00
Dmitry Stogov
5934bff913 Fixed bug #75608 ("Narrowing occurred during type inference" error) 2017-12-04 17:22:06 +03:00
Dmitry Stogov
88e257c152 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug in type inference
2017-11-27 10:17:07 +03:00
Dmitry Stogov
a4b2ae69e9 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug in type inference
2017-11-27 10:16:46 +03:00
Dmitry Stogov
776bef8447 Fixed bug in type inference 2017-11-27 10:16:16 +03:00
Dmitry Stogov
10d2a5c09d Merge branch 'PHP-7.2'
* PHP-7.2:
  typo
2017-11-22 16:31:23 +03:00