1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 07:58:20 +02:00
Commit Graph

127418 Commits

Author SHA1 Message Date
Nikita Popov 924e875651 Minor code cleanup in pass1
Move literal destruction into helper and use a common result
variable to make code more compact.
2021-12-26 09:48:06 +01:00
Nikita Popov 206d80e11a Reuse get_class_entry_from_op1() helper
Export and reuse this helper in places that fetch a class entry
from op1.
2021-12-25 22:18:50 +01:00
Nikita Popov 2cf93032ee Sink op_array scope case into get_class_entry()
This handles references to the current class through its name
rather than self (and for cases where is is not linked yet and
thus not covered by the context lookup). Rather than handling this
only for FETCH_CLASS_CONSTANT optimization, integrate this into
the generic get_class_entry() utility.
2021-12-25 21:51:29 +01:00
Nikita Popov 046096f265 Remove outdated FETCH_CLASS handling in FETCH_CLASS_CONSTANT optimization
Nowadays self::X is represented using an UNUSED operand with
FETCH_CLASS_SELF flag rather than a separate FETCH_CLASS instruction.
The code already handles the new pattern.
2021-12-25 21:00:07 +01:00
Nikita Popov f6dce4a8ca Extract common replacement login in pass1
The replace const or replace with QM_ASSIGN pattern is common to
all constant folding, extract it into a function.
2021-12-25 20:56:25 +01:00
Anatol Belski 28287572a1 hash: Upgrade xxHash to 0.8.1
Signed-off-by: Anatol Belski <ab@php.net>
2021-12-25 19:00:09 +01:00
Nikita Popov 52676f2b7e Remove unnecessary wrapper function
This seems to date back to a time where zval_ptr_dtor was a macro
implicitly passing additional parameters.
2021-12-25 17:39:05 +01:00
Nikita Popov 0884048401 Don't exclude arrays from constant collection
These are supported as constants nowadays, so we can drop the
string check.

Also fix a potential leak, though I believe this doesn't matter in
current usage, as it will effectively be suppressed during persist.
2021-12-25 17:32:18 +01:00
Nikita Popov 7eae7e5e54 Remove FETCH_CLASS+INSTANCEOF special case
Instead propagate the FETCH_CLASS return value, so it can be
directly replaced if possible, which will also eliminate the
FETCH_CLASS subsequently.
2021-12-25 16:45:38 +01:00
Nikita Popov 92e7cf5962 Move FETCH_CLASS+INSTANCEOF special case out of update_op1_const()
The generic code was rejecting this to go into a special code path
in SCCP. We should directly do that in SCCP instead, to still allow
the generic (and valid) replacement.
2021-12-25 16:32:02 +01:00
Nikita Popov 98dfde2c14 Remove unnecessary INSTANCEOF special case in sccp
While we can't replace the instanceof operand, we will evaluate
the instanceof to false and replace its result anyway. Even in
cases where the instanceof user cannot be replaced, we already
have generic code to convert the opcode to QM_ASSIGN in that
case.
2021-12-25 13:02:10 +01:00
Nikita Popov 36dafade51 Remove unnecessary try_replace_op1() special cases
update_op1_const() can handle these nowadays.
2021-12-25 12:39:52 +01:00
Nikita Popov 4ad9dbbac9 Don't replace SEND opcodes with different by-ref behavior
update_op1_const() implements the right logic here -- these cannot
be replaced by different opcodes, as the by-ref passing behavior
is not the same.
2021-12-25 12:34:02 +01:00
Nikita Popov 46d1e503dd Remove redundant code in zend_optimizer_replace_by_const()
zend_optimizer_update_op1_const() already handles these cases.
2021-12-25 12:18:12 +01:00
Dmitry Stogov eee3b1d917 Bucket->key must be removed before destructor call, because destructor may update the same HashTable.
Fixes oss-fuzz #42894
2021-12-24 15:36:52 +03:00
Dmitry Stogov 8b23538034 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak in SCCP
2021-12-24 13:11:09 +03:00
Dmitry Stogov b2939b636d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak in SCCP
2021-12-24 13:10:58 +03:00
Dmitry Stogov 2b81156f2a Fix memory leak in SCCP
Fixes oss-fuzz #42878
2021-12-24 13:10:22 +03:00
Christoph M. Becker 8683d17619 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7809: Cloning a faked SplFileInfo object may segfault
2021-12-23 23:15:02 +01:00
Christoph M. Becker 0ed39ed809 Fix GH-7809: Cloning a faked SplFileInfo object may segfault
While the `path` is not supposed to be `NULL` for normal operation, it
is possible to create `SplFileInfo` objects where that is the case, and
we must not follow the null pointer.

Closes GH-7814.
2021-12-23 23:10:51 +01:00
Dmitry Stogov aab52968a3 micro-optimization 2021-12-23 18:31:45 +03:00
Christoph M. Becker 3c3257b0d3 Merge branch 'PHP-8.1'
* PHP-8.1:
  Avoid void* arithmetic in sockets/multicast.c on NetBSD
2021-12-23 16:22:11 +01:00
Christoph M. Becker 9d2dc1e9a9 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Avoid void* arithmetic in sockets/multicast.c on NetBSD
2021-12-23 16:21:28 +01:00
David Carlier 3f0bb67361 Avoid void* arithmetic in sockets/multicast.c on NetBSD
On NetBSD, ifconf.ifc_buf member, unlike most of platforms, is a void
pointer.

We also fix the cpuinfo declarations with empty parameter lists.

Closes GH-7819.
2021-12-23 16:17:30 +01:00
C. Scott Ananian eebe91085d Don't test hidden files that happen to end in .phpt
This is a tiny improvement to run-tests.php which helps keep it from
tripping over hidden files, including autosave files from various
editors, metadata on certain platforms, etc.

Closes GH-7783.
2021-12-23 16:02:22 +01:00
hassan e72b2f32d4 Azure CI: remove duplicates and add required libs
Closes GH-7727.
2021-12-23 14:26:52 +01:00
Christoph M. Becker 9534673686 [ci skip] Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] Update the min curl version in the sync-constants.php script
2021-12-23 13:44:49 +01:00
Christoph M. Becker d37c496735 [ci skip] Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] Update the min curl version in the sync-constants.php script
2021-12-23 13:44:23 +01:00
Christophe Coevoet 096a01c905 [ci skip] Update the min curl version in the sync-constants.php script
PHP 8.0 bumped the min curl version to 7.29.0

Closes GH-7805.
2021-12-23 13:43:32 +01:00
Christoph M. Becker 5ddf191da2 Merge branch 'PHP-8.1'
* PHP-8.1:
  $context parameter of get_headers() is nullable
2021-12-23 11:50:53 +01:00
Christoph M. Becker ccd7d410f1 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  $context parameter of get_headers() is nullable
2021-12-23 11:49:33 +01:00
Christoph M. Becker c5f4ee50ab $context parameter of get_headers() is nullable
Closes GH-7813.
2021-12-23 11:47:20 +01:00
Máté Kocsis 97cdf62a6a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix the value param of SimpleXMLElement::addAttribute()
2021-12-22 12:36:53 +01:00
Máté Kocsis 713dcb2818 Fix the value param of SimpleXMLElement::addAttribute()
Closes GH-7811
2021-12-22 12:35:59 +01:00
Dmitry Stogov 5d6bc25063 Reset Bucket->key of deleted HastTable elemets to NULL.
This allows elimination of some Z_ISUNDEF(Bucket->val) checks.
2021-12-22 12:54:32 +03:00
Alex Dowad 3c73225125 New internal interface for fast text conversion in mbstring
When converting text to/from wchars, mbstring makes one function call
for each and every byte or wchar to be converted. Typically, each of
these conversion functions contains a state machine, and its state has
to be restored and then saved for every single one of these calls.
It doesn't take much to see that this is grossly inefficient.

Instead of converting one byte or wchar on each call, the new
conversion functions will either fill up or drain a whole buffer of
wchars on each call. In benchmarks, this is about 3-10× faster.

Adding the new, faster conversion functions for all supported legacy
text encodings still needs some work. Also, all the code which uses
the old-style conversion functions needs to be converted to use the
new ones. After that, the old code can be dropped. (The mailparse
extension will also have to be fixed up so it will still compile.)
2021-12-21 08:33:11 +02:00
Joe Watkins 0b5d371a9c Merge branch 'PHP-8.1'
* PHP-8.1:
  socket cmsg credential test fixes, "backporting" from the FreeBSD PR.
2021-12-21 07:28:19 +01:00
Joe Watkins 938a81cf01 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  socket cmsg credential test fixes, "backporting" from the FreeBSD PR.
2021-12-21 07:28:09 +01:00
David Carlier 80b02275bb socket cmsg credential test fixes, "backporting" from the FreeBSD PR. 2021-12-21 07:27:59 +01:00
Joe Watkins fae4344ee0 Merge branch 'PHP-8.1'
* PHP-8.1:
  socket: ancillary credentials build fix for non linux systems.
2021-12-21 07:26:46 +01:00
Joe Watkins 00113b95b2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  socket: ancillary credentials build fix for non linux systems.
2021-12-21 07:25:55 +01:00
David Carlier 51647eb23e socket: ancillary credentials build fix for non linux systems.
for systems using SO_PASSCRED sockopt flag but not using ucred struct.
2021-12-21 07:25:43 +01:00
David CARLIER ebace1d7d0 pcntl add ECAPMODE from FreeBSD (#7716) 2021-12-21 07:23:22 +01:00
Joe Watkins 898da7bee1 Merge branch 'PHP-8.1'
* PHP-8.1:
  zend gdb detection fix on FreeBSD.
2021-12-21 07:21:59 +01:00
Joe Watkins 3ee2422cbb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  zend gdb detection fix on FreeBSD.
2021-12-21 07:19:58 +01:00
David CARLIER 62bcb31706 zend gdb detection fix on FreeBSD. 2021-12-21 07:19:33 +01:00
David CARLIER 1a4d2dd962 zend alloc USE_ZEND_ALLOC_HUGE_PAGES option support on solaris based systems (#7789) 2021-12-21 07:18:11 +01:00
Arnaud Le Blanc aa35499b1c Use new param API in ext/pcntl (#7751) 2021-12-21 07:17:12 +01:00
Dmitry Stogov 9b968ffe10 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed compilation warning
2021-12-21 00:03:29 +03:00
Dmitry Stogov 01dc872b26 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed compilation warning
2021-12-21 00:03:09 +03:00