1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 06:21:12 +02:00
Commit Graph

127432 Commits

Author SHA1 Message Date
Alex Dowad
da58d42d94 Implement fast text conversion interface for CP950 2021-12-26 22:19:51 +02:00
Alex Dowad
eac50a360f Implement fast text conversion interface for Big5 2021-12-26 22:19:51 +02:00
Christoph M. Becker
057737c92f Merge branch 'PHP-8.1'
* PHP-8.1:
  Prevent strict interpretation of tentative definition
2021-12-26 16:43:34 +01:00
Christoph M. Becker
0cd1741004 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Prevent strict interpretation of tentative definition
2021-12-26 16:42:33 +01:00
Christoph M. Becker
e76ddbd2f6 Prevent strict interpretation of tentative definition
This header declaration is never supposed to be interpreted as
definition; otherwise, the handlers are not properly initialized, what
happens, for instance, with ASan instrumented MSVC builds.

Closes GH-7827.
2021-12-26 16:41:25 +01:00
Nikita Popov
e45653c089 Make sure SCCP can evaluate all functions pass1 can
Move evaluation of ini_get() into eval_special_func_call() and
use this helper both in pass1 and sccp.
2021-12-26 15:40:35 +01:00
Nikita Popov
1050edaef8 Extract special function evaluation from pass1
Pass1 handles a number of special functions that can be evaluated
under some circumstances. Move the core logic into a separate
helper, as I believe that SCCP should reuse this.
2021-12-26 15:40:35 +01:00
Christoph M. Becker
77b54248c8 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
2021-12-26 12:59:38 +01:00
Christoph M. Becker
a6ddd1a14d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
2021-12-26 12:59:06 +01:00
Christoph M. Becker
fd3fc5c193 Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
Like `hash_file()`, `hash_hmac_file()` expects a filename, and not some
string data.  Fixing this now, constitutes a (hopefully small) BC break
though.

Closes GH-7828.
2021-12-26 12:55:53 +01:00
Christoph M. Becker
c5c66bd8ec Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix chunk_split_variation*_32bit.phpt for Windows
2021-12-26 12:07:44 +01:00
Christoph M. Becker
9e4437f8c6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix chunk_split_variation*_32bit.phpt for Windows
2021-12-26 12:07:07 +01:00
Christoph M. Becker
b4ba65dd9d Fix chunk_split_variation*_32bit.phpt for Windows
Both tests fail on Windows for slightly different reasons, what appears
to be legit, and as such we fix the test expectations.

Closes GH-7830.
2021-12-26 12:05:52 +01:00
Nikita Popov
c4334fc616 Remove special chr/count handling in sccp function evaluation
These can be handled by the generic code. Worth noting that count
will usually go through ZEND_COUNT, and chr on constants is
evaluated in the compiler, so these are not particularly compile-time
sensitive either.
2021-12-26 09:55:18 +01:00
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