1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Commit Graph

1161 Commits

Author SHA1 Message Date
Dmitry Stogov
759f4ecd8b Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time 2019-06-25 11:30:58 +03:00
Nikita Popov
8227e0f747 Avoid ub in shift overflow check
Also fix an off-by-one error. While 1 << 63 overflows, -1 << 63 does
not.
2019-06-21 10:24:27 +02:00
Nikita Popov
e162a1c02e Fix maybe uninit warning 2019-06-20 10:35:22 +02:00
Nikita Popov
117c7b3f65 Avoid overflow in mul range calculation
By using ZEND_SIGNED_MULTIPLY_LONG, which already implemented
efficient overflow checking logic.
2019-06-20 09:57:55 +02:00
Nikita Popov
3a97b8b4f9 Backport "Avoid UB in overflow checks"
Cherry-pick of bb940d9969 without
the JIT parts.
2019-06-20 09:51:05 +02:00
Nikita Popov
ccfe6c862a Avoid memset/memcpy null ub in block pass
The arena allocator has no problem with zero-size allocations (and
will just return the same pointer for each in this case), so just
do that to avoid null pointers.
2019-06-20 09:49:07 +02:00
Nikita Popov
83e0bfb50c Merge branch 'PHP-7.3' into PHP-7.4 2019-06-11 15:41:05 +02:00
Tyson Andre
5d3e3a62a2 Be more precise about possible types for mysqli methods
mysqli has an uncommon approach to 64-bit compatibility:
it will convert numbers that can't be represented on 32-bit
platforms to a string.
This is documented at
https://www.php.net/manual/en/mysqli-stmt.affected-rows.php#refsect1-mysqli-stmt.affected-rows-returnvalues

So if there's a query to a remote mysqli server that affects
more than 2.2 billion rows, then the opcache inference might be
incorrect.

(It's possible to add a MAY_BE_STRING_ON_32_BIT_PLATFORM bitflag macro to
account for this, but I don't think there's a need or want to?)

Patches 3162285b86

This is based on the list of php 7.4 functions using
MYSQLI_RETURN_LONG_INT in mysqli_api.c
2019-06-11 15:40:33 +02:00
Tyson Andre
07c63c6fdf Fix opcache signatures for mysqli_stat
See mysqli_api.c and https://www.php.net/manual/en/mysqli.stat.php
2019-06-11 15:39:59 +02:00
Tyson Andre
7350e808c5 Fix bug in opcache flags for mysqli_get_charset
https://www.php.net/manual/en/mysqli.get-charset.php
tests/mysqli_field_seek.phpt has a test of this returning an object.

Looking at the source in ext/mysqli/mysqli_nonapi.c,
this should be object|null, not array|null

This might actually cause bugs in opcache's inferences,
(no proof of this)
so it might make sense to pull this patch into an earlier minor version.
2019-06-11 15:39:59 +02:00
Nikita Popov
89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Nikita Popov
eecd8961d9 Add get_mangled_object_vars() function 2019-06-11 10:28:29 +02:00
Tyson Andre
5c8b702e77 Fix typo in opcache function flag info (mage->image)
ext/gd/gd.c seems to return null for wrong parameter count, false for
error, and long otherwise. See https://php.net/imagecolorallocate

In php 8.0, the MAY_BE_NULL can probably be removed.
2019-06-11 09:08:23 +02:00
Tyson Andre
b921564a35 Clean up opcache func flags for set_socket_blocking
It was removed in php 7.0. See https://php.net/set_socket_blocking
2019-06-11 09:05:57 +02:00
Tyson Andre
98b487e244 Fix a typo in opcache func info for "get_parrent_class"
This should only have one r.
http://php.net/get_parent_class mentions that it returns string|false

Also, I'm not 100% sure if this is right - should this include
MAY_BE_NULL to handle the case of too many parameters?
(then again, get_called_class() also returns null in the global scope)

```
php > var_export(get_parent_class(2,3));
Warning: get_parent_class() expects at most 1 parameter, 2 given in php
shell code on line 1
NULL
```
2019-06-11 08:59:12 +02:00
Nikita Popov
029b735a6e Merge branch 'PHP-7.3' into PHP-7.4 2019-05-29 16:48:28 +02:00
Nikita Popov
61a38bb274 SCCP: Fix leak when determining TYPE_CHECK from type info
As TYPE_CHECK is the only opcode where we do something like this,
I'm adding this hack.
2019-05-29 16:47:19 +02:00
Nikita Popov
071b389bc6 Merge branch 'PHP-7.3' into PHP-7.4 2019-05-28 16:41:17 +02:00
Nikita Popov
817b50826e Merge branch 'PHP-7.2' into PHP-7.3 2019-05-28 16:41:08 +02:00
Nikita Popov
59dfaa3f99 Fix type inference of SEND_UNPACK with empty array
An empty array will not be turned into an array of references.
This violated the invariant than an array has values iff it has
keys.
2019-05-28 16:40:56 +02:00
Nikita Popov
f19dd674e0 SCCP: Fix handling of ASSIGN_OBJ_REF
The generic BOT handling is not away of OP_DATA, so need to handle
this opcode before we get to that.
2019-05-28 16:15:37 +02:00
Nikita Popov
6893f1f98e SCCP: Don't perform partial object propagation for typed props 2019-05-28 15:46:03 +02:00
Nikita Popov
fd23f9104a BIND_STATIC of implicit binding may be undef
Even though we don't need it at runtime, add the BIND_IMPLICIT
flag to BIND_STATIC as well, so we can distinguish this case in
type inference.

This fixes a JIT miscompile in arrow_functions/002.phpt.
2019-05-27 17:12:20 +02:00
Nikita Popov
31ce1cbbb9 Func info: Fix calls to zero-arg varargs
The num_args does not include variadics, so a "zero-arg" function
may accept additional arguments through that. No functions seem
to be affected right now, but they will be after #4175.
2019-05-27 16:14:51 +02:00
Nikita Popov
7cc17c4aac Merge branch 'PHP-7.3' into PHP-7.4 2019-05-27 16:14:16 +02:00
Nikita Popov
62f339c8d5 Func info: Fix calls to zero-arg varargs
The num_args does not include variadics, so a "zero-arg" function
may accept additional arguments through that. No functions seem
to be affected right now, but they will be after #4175.
2019-05-27 16:12:42 +02:00
Nikita Popov
dcccdc471d Don't require NO_ESCAPE for partial arrays in SCCP 2019-05-23 09:59:25 +02:00
Dmitry Stogov
fe1db0c3d7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed dump of constant flags
2019-05-22 23:00:26 +03:00
Dmitry Stogov
aa9c76d027 Fixed dump of constant flags 2019-05-22 22:59:40 +03:00
Nikita Popov
ff4b0ce0e8 Fix bug #78034
Don't def non-cv variables in assign_obj_ref data operand.
2019-05-22 09:35:38 +02:00
Nikita Popov
f260c0918f Merge branch 'PHP-7.3' into PHP-7.4 2019-05-21 17:35:28 +02:00
Nikita Popov
97ba6b0d8b Don't evaluate functions with partial array arguments 2019-05-21 17:35:03 +02:00
Nikita Popov
436a47428b Merge branch 'PHP-7.3' into PHP-7.4 2019-05-21 17:17:45 +02:00
Nikita Popov
30f1b17262 Fix null check in sccp add_array_elem chain handling
We need to check result_use rather than result_def for a null zval.
Previously we were later assuming that the null zval is really a
partial array, which does not go well.
2019-05-21 17:15:07 +02:00
Nikita Popov
a87448bb55 Merge branch 'PHP-7.3' into PHP-7.4 2019-05-21 17:03:52 +02:00
Nikita Popov
fc4836b193 Fix partial array handling in FE_RESET edge feasibility 2019-05-21 16:59:27 +02:00
Nikita Popov
cd188d0398 Handle partial arrays in zend_is_true() checks 2019-05-21 16:53:34 +02:00
Nikita Popov
bdce5849b7 Extract ct_eval_binary_op()
And use it in more places, though some of them are currently not
reachable by partial arrays to the best of my knowledge.
2019-05-21 16:43:41 +02:00
Nikita Popov
367788cbc3 Improve SCCP debug code
In particular properly dump partial arrays when tracing execution.
2019-05-21 16:42:13 +02:00
Nikita Popov
806db1a793 Merge branch 'PHP-7.3' into PHP-7.4 2019-05-15 14:36:45 +02:00
Nikita Popov
9d76fbd0c4 Fixed bug #78015
Don't try to evaluate various operations with partial array operands.
We could evaluate some of these, but let's be conservative for now...
2019-05-15 14:35:31 +02:00
CHU Zhaowei
e829d08729 Implement spread operator in arrays
RFC: https://wiki.php.net/rfc/spread_operator_for_array

Closes GH-3640.
2019-05-13 14:42:43 +02:00
蝦米
e4ed2bf922 fix typo 2019-04-30 09:18:17 +02:00
Dmitry Stogov
db2ffcf157 Optimize constant SWITCH_LONG and SWITCH_STRING 2019-04-24 00:08:17 +03:00
Dmitry Stogov
4d0d7ce349 Don't eliminate BIND_STATIC if it may cause undefined constant warning 2019-04-23 22:39:14 +03:00
Dmitry Stogov
1827d784b5 Remove unused BIND_STATIC insructions 2019-04-23 02:21:08 +03:00
Dmitry Stogov
abacb5e8ea Fixed wrong opline 2019-04-22 11:05:56 +03:00
Fabien Villepinte
baa9669392 Fix typo in comments 2019-04-19 13:11:50 -03:00
Dmitry Stogov
3ccd3aba90 Eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM 2019-04-17 11:52:56 +03:00
Rodrigo Prado
f1dbe6160c Remove functions from func_info that were removed in PHP 7 2019-04-15 10:04:41 +02:00