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

128120 Commits

Author SHA1 Message Date
George Peter Banyard
cf51d8ffe7 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8273: SplFileObject: key() returns wrong value
2022-04-23 14:02:01 +01:00
George Peter Banyard
660ef91fbc Fix GH-8273: SplFileObject: key() returns wrong value 2022-04-23 14:00:11 +01:00
Max Kellermann
fa6d97db5d main/streams/streams: use copy_file_range() on Linux (#8413)
copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating the need
to transfer data from the kernel to userspace and back.  For
networking file systems like NFS and Ceph, it even eliminates copying
data to the client, and local filesystems like Btrfs and XFS can
create shared extents.
2022-04-23 13:32:05 +01:00
Jakub Zelenka
4ec92c6253 Update NEWS and www.conf with listen.backlog default change 2022-04-23 13:25:08 +01:00
Cristian Rodríguez
1e562683cb fpm: listen backlog should default to -1 also on Linux
On linux -1 means system administrator choosen default or kernel
default, this varies between kernel versions or distributions
it used to be 128 now it is 4096.
2022-04-23 13:20:42 +01:00
George Peter Banyard
ef287bfceb Minor refactoring of std string extension (#8196)
Mainly using more appropriate types, early returns, and moving the happy path to the primary scope (failure path is guarded by ``UNEXPECTED`` macros.
2022-04-23 12:15:13 +01:00
divinity76
820f695b05 Use bit shift to set bitflags in standard/file.h (#8428)
Nitpicking, this makes it practically impossible to accidentally use a number with 2 bits set in the future, 
it's also my personal preference, its trivial to see "PHP_FILE_NO_DEFAULT_CONTEXT use bit 4" and that "the next unused bit is bit 5"
2022-04-23 12:11:26 +01:00
Ilija Tovilo
f06410a822 Merge branch 'PHP-8.1'
* PHP-8.1:
  Add missing news entry for GH-8421
2022-04-23 11:22:42 +02:00
Ilija Tovilo
bfad99f8a1 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Add missing news entry for GH-8421
2022-04-23 11:22:29 +02:00
Ilija Tovilo
4d6965dcec Add missing news entry for GH-8421 2022-04-23 11:21:51 +02:00
Ilija Tovilo
91fe8075ab Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8421: Attributes that target functions are not valid for anonymous functions defined within a method
2022-04-23 11:19:34 +02:00
Ilija Tovilo
82d3a831d2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8421: Attributes that target functions are not valid for anonymous functions defined within a method
2022-04-23 11:19:20 +02:00
Ollie Read
d0f1b987a5 Fix GH-8421: Attributes that target functions are not valid for anonymous functions defined within a method
Closes GH-8424
2022-04-23 11:16:28 +02:00
Marco Pivetta
25cb9cdb79 Fix GH-8232 - always reference classes in var_export() via their FQCN
Closes GH-8233

This fix corrects a behavior of `var_export()` that was mostly "hidden" until PHP 8.1 introduced:

* properties with object initializers
* constants containing object references
* default values of class properties containing `enum`s

Since `var_export(..., true)` is mostly used in conjunction with code generation,
and we cannot make assumptions about the generated code being placed in the root
namespace, we must always provide the FQCN of a class in exported code.

For example:

```php
<?php

namespace MyNamespace { class Foo {} }

namespace { echo "<?php\n\nnamespace Example;\n\n" . var_export(new \MyNamespace\Foo(), true) . ';'; }
```

produces:

```php
<?php

namespace Example;

MyNamespace\Foo::__set_state(array(
));
```

This code snippet is invalid, because `Example\MyNamespace\Foo::__set_state()` (which
does not exist) is called.

With this patch applied, the code looks like following (valid):

```php
<?php

namespace Example;

\MyNamespace\Foo::__set_state(array(
));
```

Ref: https://github.com/php/php-src/issues/8232
Ref: https://github.com/Ocramius/ProxyManager/issues/754
Ref: https://externals.io/message/117466
2022-04-23 11:06:21 +02:00
Jakub Zelenka
436cffc971 Merge branch 'PHP-8.1' 2022-04-22 23:08:23 +01:00
Jakub Zelenka
abd56aeb9a Merge branch 'PHP-8.0' into PHP-8.1 2022-04-22 23:07:01 +01:00
Jakub Zelenka
d8612fb6b7 Fix bug #77023: FPM cannot shutdown processes
This change introduces subsequent kill of the process when idle process quit
(SIGQUIT) does not succeed. It can happen in some situations and means that FPM
is not able to scale down in dynamic pm. Using SIGKILL fixes the issue.
2022-04-22 20:51:02 +01:00
Arnaud Le Blanc
f20e11cbe1 Clear recorded errors before executing shutdown functions
Recorded errors may be attached to the wrong cached script when a fatal error
occurs during recording. This happens because the fatal error will cause a
bailout, which may prevent the recorded errors from being freed. If an other
script is compiled after bailout, or if a class is linked after bailout, the
recorded errors will be attached to it.

This change fixes this by freeing recorded errors before executing shutdown
functions.

Fixes GH-8063
2022-04-22 18:14:08 +02:00
David Carlier
7a45dcfe2e Introduce CURLOPT_XFERINFOFUNCTION
`CURLOPT_XFERINFOFUNCTION` is available as of cURL 7.32.0, and
supersedes `CURLOPT_PROGRESSFUNCTION` which is still supported by
latest cURL, though.

Closes GH-7823.
2022-04-22 18:09:06 +02:00
Derick Rethans
a690a56a86 Merge branch 'PHP-8.1' 2022-04-22 10:31:22 +01:00
Derick Rethans
15ee285f83 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-22 10:31:14 +01:00
Derick Rethans
c854bb2472 Fixed GH-8400: bug73837.phpt makes no sense
Replaces the indeed silly test with something that actually does the job,
albeit much slower.
2022-04-22 10:29:37 +01:00
Ilija Tovilo
bf6c96a27b Merge branch 'PHP-8.1'
* PHP-8.1:
  Only check tracked files in verify-generated-files
2022-04-22 00:29:56 +02:00
Ilija Tovilo
79eba0231b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Only check tracked files in verify-generated-files
2022-04-22 00:29:40 +02:00
Ilija Tovilo
1dc6dba014 Only check tracked files in verify-generated-files 2022-04-22 00:28:32 +02:00
Ilija Tovilo
4dec645029 Merge branch 'PHP-8.1'
* PHP-8.1:
  Verify generated files are up to date in CI
2022-04-21 23:27:46 +02:00
Ilija Tovilo
cf70047351 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Verify generated files are up to date in CI
2022-04-21 23:27:29 +02:00
Michael Voříšek
36de002cc6 Verify generated files are up to date in CI
Closes GH-8295
2022-04-21 23:25:47 +02:00
Ilija Tovilo
3b4eaf67ec Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix preloading of constants containing enums
2022-04-21 11:59:15 +02:00
Ilija Tovilo
4397811db2 Fix preloading of constants containing enums
Fixes GH-8133
2022-04-21 11:57:12 +02:00
George Peter Banyard
7061c40f43 [skip-ci] update UPGRADING 2022-04-20 17:43:10 +01:00
George Peter Banyard
c2547ab7dc Add some const qualifiers in zend_string/hash (#8304)
Co-authored-by: Levi Morrison <morrison.levi@gmail.com>
2022-04-20 15:56:51 +01:00
Christoph M. Becker
37f91e41e0 [ci skip] Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8408: bug68547.phpt fails without multibyte support
2022-04-20 16:48:53 +02:00
Christoph M. Becker
e9b9fec2b2 [ci skip] Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8408: bug68547.phpt fails without multibyte support
2022-04-20 16:44:11 +02:00
Christoph M. Becker
dad5cb442d Fix GH-8408: bug68547.phpt fails without multibyte support 2022-04-20 16:42:09 +02:00
Nikita Popov
8f02d7b7e4 Remove unnecessary bailout in fcall optimization
Even if we can't optimize the SEND_VAL_EX, there is no reason to
skip the INIT_FCALL/DO_FCALL optimizations, those should be entirely
orthogonal.
2022-04-18 18:30:36 +02:00
Nikita Popov
a8b6aea5a2 Remove unused macros 2022-04-18 18:24:52 +02:00
Nikita Popov
2aba4f8235 Merge branch 'PHP-8.1'
* PHP-8.1:
  Move check for named params in fcall optimization earlier
2022-04-18 18:22:04 +02:00
Nikita Popov
18b4e36df1 Move check for named params in fcall optimization earlier
I don't think this is strictly necessary, but I think it makes
sense to check this before interpreting opline->op2.num as an
argument number.

This also adds one more has_known_send_mode() check that I had
missed before.
2022-04-18 18:21:24 +02:00
Nikita Popov
4dc669a74d Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't optimize trailing args for prototype fbc
2022-04-18 17:57:59 +02:00
Nikita Popov
11f950e77e Don't optimize trailing args for prototype fbc 2022-04-18 17:57:16 +02:00
Max Kellermann
d87ba95acd sapi/*: move duplicate "--define" code to library 2022-04-18 16:52:08 +02:00
Nikita Popov
462dc9da6a Don't specify ce for MAY_BE_REF STATIC_PROP_FETCH
This is unlikely to matter in practice (due to the short lifetime),
but we should not specify a CE for a potential ref result.

Fixes oss-fuzz #46810.
2022-04-18 10:45:57 +02:00
Dmitry Stogov
dc374a0b22 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed incorrect guard
2022-04-18 11:35:08 +03:00
Dmitry Stogov
c3a30544ad JIT: Fixed incorrect guard
Fixes oss-fuzz #46704
2022-04-18 11:34:18 +03:00
Dmitry Stogov
6ed3b57e67 Fix incorrect constant propagation for VERIFY_RETURN_TYPE
Fixes oss-fuzz #46616
2022-04-18 10:33:52 +03:00
Nikita Popov
fbb7393997 Handle other DO_FCALL opcodes in NEW live range calculation
Make this robust against the case where NEW is terminated by
something other than DO_FCALL, e.g. DO_UCALL. This can't currently
happen.
2022-04-17 22:56:23 +02:00
Nikita Popov
74c0edefe7 Remove unnecessary abstract function check in zend_get_call_op()
Abstract functions are now handled in the INIT stage, they do not
affect DO opcodes anymore.

Also add a check for another precondition, namely that the function
is not a trampoline.
2022-04-17 18:07:52 +02:00
Nikita Popov
df4c27642e Check opcode rather than result_type for R/IS type inference
We may sometimes create FETCH_*_R opcodes with VAR type (e.g. if a
FUNC_ARG opcode is converted to BP_VAR_R fetch kind). Make sure we
don't infer overly conservative types in that case.
2022-04-16 22:42:20 +02:00
Alex Dowad
3f12d26e3a Merge branch 'PHP-8.1'
* PHP-8.1:
  Error handling for UTF-8 complies with WHATWG specification
2022-04-16 20:32:12 +02:00