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

62255 Commits

Author SHA1 Message Date
Arnaud Le Blanc
77f73de5bb XFAIL test 2022-07-10 14:49:42 +02:00
Dennis Snell
492af9f88e Add ini_parse_quantity function to convert ini quantities shorthand notation to int (#8454) 2022-07-10 14:48:52 +02:00
Michael Voříšek
e80925445c Fix GH-8924 str_split of empty string must return empty array
Closes #8945.
2022-07-08 15:49:45 +01:00
Arnaud Le Blanc
4df3dd7679 Reduce memory allocated by var_export, json_encode, serialize, and other (#8902)
smart_str uses an over-allocated string to optimize for append operations. Functions that use smart_str tend to return the over-allocated string directly. This results in unnecessary memory usage, especially for small strings.

The overhead can be up to 231 bytes for strings smaller than that, and 4095 for other strings. This can be avoided for strings smaller than `4096 - zend_string header size - 1` by reallocating the string.

This change introduces `smart_str_trim_to_size()`, and calls it in `smart_str_extract()`. Functions that use `smart_str` are updated to use `smart_str_extract()`.

Fixes GH-8896
2022-07-08 14:47:46 +02:00
George Peter Banyard
4ccf0b0181 Make php_fgetcsv() return a HashTale instead of in-out zval param (#8936)
Also refactor what happens on an empty line to return NULL instead of setting the array to [NULL] which makes no design sense at all.
However, as this is the current behaviour create a BC Shim inline function to recreate this weird HashTable in the functions which currently use this API
2022-07-08 12:11:05 +01:00
George Peter Banyard
247de8a4de Use true/false and comment when arg correspond to silent arg 2022-07-08 11:36:59 +01:00
George Peter Banyard
bb3d0933af Remove silent argument to spl_filesystem_file_read_line_ex()
true was always passed to it
2022-07-08 11:36:59 +01:00
George Peter Banyard
a055c54801 Remove silent argument to spl_filesystem_file_read_line()
true was always passed to it
2022-07-08 11:36:59 +01:00
George Peter Banyard
f905590764 Add support for Disjoint Normal Form (DNF) types (#8725)
RFC: https://wiki.php.net/rfc/dnf_types

This allows to combine union and intersection types together in the following form (A&B)|(X&Y)|T but not of the form (X|A)&(Y|B) or (X|A)&(Y|B)|T.

* Improve union type parsing

Co-authored-by: Sara Golemon <pollita@php.net>
2022-07-08 11:30:23 +01:00
Pierrick Charron
4dd66b8ce0 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug GH-8943 Reflection::getModifiersNames() with readonly modifier
2022-07-07 17:03:25 -04:00
Pierrick Charron
c650e67c90 Fixed bug GH-8943 Reflection::getModifiersNames() with readonly modifier 2022-07-07 16:59:54 -04:00
Levi Morrison
d9c49ae1c1 Improve contrast for dark mode phpinfo (#8893)
Also use CSS variable names; all browsers I can find that support
the prefers-color-scheme media query also support CSS variables.

Someone voiced they didn't want the background texture that php.net
has, so I did not include that.
2022-07-06 14:19:21 -06:00
David Carlier
b22d2bf589 intl extension, build fix for icu >= 71.x release.
ubrk/ucnv_safeClone had been deprecated in favor
of ubrk/ucnv_clone which does not use user provided stacks
but remain thread safe.
Closes #8930.
2022-07-06 18:12:19 +01:00
Kamil Tekiela
1dc51c7b90 Implement mysqli_execute_query() (#8660) 2022-07-06 12:23:46 +01:00
George Peter Banyard
6f26102bbf Merge branch 'PHP-8.1'
* PHP-8.1:
  Revert "Fix GH-8563  Different results for seek() on SplFileObject and SplTempFileObject"
  Revert "Update FreeBSD CI image."
2022-07-05 21:45:13 +01:00
George Peter Banyard
e67336f46a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Fix GH-8563  Different results for seek() on SplFileObject and SplTempFileObject"
2022-07-05 21:33:47 +01:00
George Peter Banyard
79a283240e Revert "Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject"
Although the fix is partially correct it also breaks long standing behaviour which has been produced since PHP 5.3.

This reverts commit 6f87a5c633.
2022-07-05 21:28:59 +01:00
Bob Weinand
9f29e2d7e9 Allow for arbitrary (class) attributes in stubs
This can be easily extended to other types of attributes.

Closes #8839.
2022-07-05 18:23:05 +02:00
Stanislav Malyshev
b2f692a9f8 Merge branch 'PHP-8.1' 2022-07-05 00:59:43 -06:00
Christoph M. Becker
ca6d511fa5 Fix #81723: Memory corruption in finfo_buffer()
We need to use the same memory allocator throughout.
2022-07-05 00:44:00 -06:00
David Carlier
dfbb425295 Use safe_*erealloc* flavor in few places to mitigate possible overflows. 2022-07-04 14:41:04 +01:00
David Carlier
0ad8b64b70 Follow up on #8897 but on master which instead does not use the old custom alloca.
Closes #8905.
2022-07-04 12:56:01 +01:00
Derick Rethans
d8ebfdc506 Merge branch 'PHP-8.0' into PHP-8.1 2022-07-04 10:50:32 +01:00
George Peter Banyard
1d0c287b90 Abort LMDB transaction whe trying to delete non-existing key 2022-07-01 17:28:36 +01:00
George Peter Banyard
8fce70ae7b Abort LMDB transaction whe trying to delete non-existing key 2022-07-01 17:26:27 +01:00
Ilija Tovilo
40908b10fc Merge branch 'PHP-8.1'
* PHP-8.1:
  Disallow assigning reference to  unset readonly property
2022-07-01 12:20:32 +02:00
Ilija Tovilo
110573726b Disallow assigning reference to unset readonly property
Closes GH-7942
Closes GH-8188
2022-07-01 12:16:32 +02:00
David CARLIER
1a5414cd98 Revert "Merge branch 'PHP-8.1'"
This reverts commit 6876c202ea, reversing
changes made to a193427333.
2022-07-01 06:31:55 +01:00
David Carlier
6876c202ea Merge branch 'PHP-8.1' 2022-07-01 05:43:21 +01:00
David Carlier
26d63c74be Merge branch 'PHP-8.0' into PHP-8.1 2022-07-01 05:34:05 +01:00
David Carlier
b3569865b3 Fix the crypt sha apis build (with recent clang versions).
Removing the said subtraction by casting instead.
While at it fixing werror level on phpdbg too.

Closes #8897.
2022-07-01 05:33:12 +01:00
David Carlier
a193427333 Adds TCP_CONGESTION socket option for Linux/FreeBSD.
Closes #8824.
2022-06-30 19:43:09 +01:00
Javier Eguiluz
14ced88c17 [ci skip] Fix typo (anough → enough)
Closes GH-8901.
2022-06-30 17:27:39 +02:00
Dmitry Stogov
17aa81a5e2 Allocate JIT bufer close to PHP .text segment to allow using direct IP-relative calls and jumps (#8890)
This implementation is based on https://github.com/php/php-src/pull/8618 developed by Su Tao, Wang Xue, Chen Hu and Lizhen Lizhen.
2022-06-30 10:49:24 +03:00
David Carlier
7ceae66182 streams/xp_socket: fix clang build error with enum usage on bool condition.
Fix targeted for oses defining those flags as enums (like Linux/glibc).

`error: converting the enum constant to a boolean [-Werror,-Wint-in-bool-context]
                                } else if ((!sslsock->ssl_active && value == 0 && (MSG_DONTWAIT || !sslsock->s.is_blocked)) ||`

Closes #8895.
2022-06-30 05:45:33 +01:00
Michael Voříšek
c756e978c4 Improve tests on 32bit
The watch_*.phpt test apparently no longer fail on 32bit, so we remove
the XFAIL conditions.  bug77269.phpt is practically identical to
bug77272.phpt, and there seems no particular reason to have an
additional test for libgd ≤ 2.2.5.

Closes GH-8448.
2022-06-29 14:04:40 +02:00
Dmitry Stogov
e01586ac4f Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:09:22 +03:00
Dmitry Stogov
af75eab0ef Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:09:14 +03:00
Dmitry Stogov
d66d477d6f Fix incorrect condition introdused in 7cf6f17383 2022-06-29 13:08:18 +03:00
Dmitry Stogov
7e32033331 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:16:20 +03:00
Dmitry Stogov
b7693360cb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:13:03 +03:00
Dmitry Stogov
7cf6f17383 Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file) 2022-06-29 12:10:46 +03:00
George Peter Banyard
9bae9ab3a4 Fix GH-8861: correctly handle string lengths in SplFileinfo methods (#8869)
* Fix GH-8861: correctly handle string lengths in \SplFileinfo::getBasename

Co-authored-by: M. Vondano <m-vo@users.noreply.github.com>
2022-06-28 15:42:59 +01:00
Remi Collet
2223853c58 implement fseek for zip stream when possible with libzip 1.9.1 2022-06-28 15:17:27 +02:00
Chen, Hu
d8de067b0f JIT: Add IBT support (#8774)
Indirect Branch Tracking (IBT) is part of Intel's Control-Flow
Enforcement Technology (CET). IBT is hardware based, forward edge
Control-Flow-Integrity mechanism where any indirect CALL/JMP must target
an ENDBR instruction or suffer #CP.

This commit adds IBT support for JIT:
1. Add endbr32/64 instruction in Dynasm.
2. Insert endbr32/64 in indirect branch target for jitted code.

gcc support CET since v8.1 and set it to default since gcc 11. With this
commit, endbr is inserted in jitted code if PHP is compiled with "gcc
-fcf-protection=full/branch".

Signed-off-by: Chen, Hu <hu1.chen@intel.com>
2022-06-28 08:42:19 +03:00
Christoph M. Becker
84c160dd90 Increase test portability
The test as is can only work if com_dotnet is built dynamically, and
not already loaded via the php.ini file.  While this is given on
AppVeyor, it may not be given in other environments.

Closes GH-8879.
2022-06-27 17:12:42 +02:00
Dmitry Stogov
7e23c838e2 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 16:41:53 +03:00
Dmitry Stogov
ad40fffd36 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 14:25:30 +03:00
Ilija Tovilo
3b92a96610 Convert return type of various object handlers from int to zend_result (#8755) 2022-06-26 01:00:19 +02:00
Derick Rethans
30cc0c1742 Merge branch 'PHP-8.1' 2022-06-25 17:53:33 +01:00