1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

13886 Commits

Author SHA1 Message Date
Pierrick Charron 6fd2b39397 Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Tim Düsterhus 13758965b2 Mark parameter in ext/standard as sensitive
No changes to the stubs required, password_hash and password_verify were added
to the initial version of the stub support.
2022-06-13 11:09:12 +02:00
Rowan Tommins d9f3ca705c Add deprecation notices to utf8_encode and utf8_decode
Implements initial stage of accepted RFC to remove them:
https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode

Tests relating to SOAP and htmlspecialchars seem to have been
using this entirely unnecessarily, so have been fixed.

Closes GH-8726.
2022-06-12 13:37:23 +02:00
Max Kellermann c1a06704da Add ZEND_THREEWAY_COMPARE() macro to fix casting underflowed unsigned to signed (#8220)
Casting a huge unsigned value to signed is implementation-defined
behavior in C.  By introducing the ZEND_THREEWAY_COMPARE() macro, we
can sidestep this integer overflow/underflow/casting problem.
2022-06-08 13:24:18 +01:00
Máté Kocsis debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Christoph M. Becker 8e2c08c5c2 Mark Windows mail tests as conflicting
These tests are not (yet) supposed to be run in parallel.
2022-05-31 10:50:59 +02:00
George Peter Banyard 8685a7f03c Remove custom alloca() (#8513)
* Use arena in DCE instead of multiple alloca()
  This requires passing the optimizer context

* Use our do_alloca() instead of alloca()

* Use emalloc in DEBUG builds instead of stack allocations for do_alloca()
  This helps detecting that we correctly free do_alloca()
2022-05-27 09:05:33 +01:00
Arnaud Le Blanc e883407083 Merge branch 'PHP-8.1'
* PHP-8.1:
  Disable zend_rc_debug during dtor of dl()'ed module (#8606)
2022-05-24 19:23:48 +02:00
Arnaud Le Blanc 6cda01a05c Disable zend_rc_debug during dtor of dl()'ed module (#8606)
Newly added dl() tests trigger an assertion in ZEND_RC_DEBUG builds. This change
disables zend_rc_debug to allows these tests to pass until this issue is
resolved.
2022-05-24 19:22:55 +02:00
George Peter Banyard 9f06bb3bb6 Drop remaining usage of u_char in favour of standard C99 uint8_t (#8611)
Plus minor drive-by fixes
2022-05-23 21:57:31 +01:00
George Peter Banyard 59b4fdbb2b Use standard C99 uint8_t type instead of u_char type for crypt_freesec (#8610) 2022-05-23 19:06:41 +01:00
Máté Kocsis 14da1cb909 Add support for class constants in stubs (#7434) 2022-05-22 22:27:23 +02:00
George Peter Banyard 265c88b9e7 Don't initialise pointers to zend_stat_t 2022-05-22 16:13:44 +01:00
George Peter Banyard 2ecd46f48f Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00
Arnaud Le Blanc 33fa80cc97 Merge branch 'PHP-8.1' 2022-05-17 18:47:24 +02:00
Arnaud Le Blanc e9fcb5bd43 Disable zend_rc_debug during dl() (#8552)
Newly added dl() tests trigger an assertion in ZEND_RC_DEBUG builds. This change
disables zend_rc_debug to allows these tests to pass until this issue is
resolved.
2022-05-17 18:46:16 +02:00
Max Kellermann 6beee1a5bb Disable the read buffer in file_get_contents()
The read buffer is useless here, it only hurts performance.

Closes GH-8547.
2022-05-16 16:21:29 +02:00
pandaLIU 72d83709d9 Fix parse_url(): can not recognize port without scheme
Closes GH-7844.
2022-05-16 12:03:35 +02:00
George Peter Banyard 926407f224 Fix some MSAN complaints under Clang (#8553) 2022-05-13 23:30:20 +01:00
Arnaud Le Blanc 298c1ab92e Merge branch 'PHP-8.1' 2022-05-13 12:48:51 +02:00
Arnaud Le Blanc 332bd03782 Do not optimize out ini_get() when the entry does not exist during compilation (#8507)
The entry may exist later if dl is enabled

Fixes GH-8466
2022-05-13 12:35:00 +02:00
Pavel Djundik 12702a2047 Add "N" and "o" format specifiers to idate() 2022-05-13 09:36:43 +01:00
Christoph M. Becker d2bb59cc66 Test standard mail and imap on Windows CI
We setup the currently latest version of hMailServer[1] as mail server,
and configure according to imap_include.inc.  To not require further
configuration, we adapt mail_skipif.inc and mail_include.inc to match
that configuration.  However, we also change the default domain to the
reserved `example.com`.

We also update the standard mail tests to use the `--EXTENSIONS--`
section (instead of skipping the tests if ext/imap is not available).

Finally, we fix bug80751.phpt to expect the configured To and Cc mail
addresses.

[1] <https://www.hmailserver.com/>

Closes GH-8357.
2022-05-12 14:58:22 +02:00
Christoph M. Becker 3cb3ee6c1e Drop useless network/syslog_basic.phpt (#8526)
This test asserts that `syslog()` returns true, but that is the case
anyway[1].  Since there is already misc/syslog_basic.phpt, the test has
no further raison d'être.

[1] <https://github.com/php/php-src/blob/d4e24e72afc269f392eabd74abeb6ea86894740d/ext/standard/basic_functions.stub.php#L697-L698>
2022-05-10 17:23:58 +01:00
Christoph M. Becker c2ca9cd73f Don't unnecessarily skip mb related tests
Apparently, these tests have been overlooked when we switched to using
the `--EXTENSIONS--` section.  That caused to skip these tests on
AppVeyor.

Closes GH-8504.
2022-05-06 15:48:21 +02:00
Arnaud Le Blanc 0a5a761104 Merge branch 'PHP-8.1' 2022-05-06 15:29:21 +02:00
Arnaud Le Blanc f07a08df5c Fix unregistering ini entries of dynamically loaded extension (#8435)
Fixes GH-8185
2022-05-06 15:25:44 +02:00
Ilija Tovilo 9a90bd7054 Deprecate ${} string interpolation
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-05-05 10:14:56 +02:00
Derick Rethans 8a67d7c363 Update related test in ext/standard 2022-04-29 11:25:55 +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
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
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
George Peter Banyard 8649cb8a96 Improve and fix stub return types (#8368) 2022-04-14 18:38:00 +01:00
Christoph M. Becker 30b2398860 Merge branch 'PHP-8.1'
* PHP-8.1:
  Preserve file-position when php://temp switches to temporary file
2022-04-11 12:45:48 +02:00
Christoph M. Becker e3a5e424f6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Preserve file-position when php://temp switches to temporary file
2022-04-11 12:44:56 +02:00
Bernd Holzmüller 84c18f9f04 Preserve file-position when php://temp switches to temporary file
Closes GH-8333.
2022-04-11 12:31:22 +02:00
Christoph M. Becker 53c6619bda Restore memory_reset_peak_usage() declaration
Cf. <https://github.com/php/php-src/pull/8151/files#r819605725>.
2022-04-01 18:13:22 +02:00
George Peter Banyard 083b64efb5 Add missing #endif in stubs
This slipped away during the rebase of 5171cb435a
2022-04-01 16:26:38 +01:00
George Peter Banyard 5171cb435a Fix [-Wundef] warnings in standard extension 2022-04-01 15:48:41 +01:00
Max Kellermann b9e895bca0 Replace memcmp() with zend_string functions (#8216)
* ext/oci8: use zend_string_equals()

Eliminate duplicate code.

* main/php_variables: use zend_string_equals_literal()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_equals_cstr()

Allows eliminating duplicate code.

* Zend, ext/{opcache,standard}, main/output: use zend_string_equals_cstr()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_starts_with()

* ext/{opcache,phar,spl,standard}: use zend_string_starts_with()

This adds missing length checks to several callers, e.g. in
cache_script_in_shared_memory().  This is important when the
zend_string is shorter than the string parameter, when memcmp()
happens to check backwards; this can result in an out-of-bounds memory
access.
2022-03-31 16:27:58 +02:00
George Peter Banyard e948d3c9c8 Use zend_string_to(upper|lower)() API directly 2022-03-23 23:59:41 +00:00
George Peter Banyard 71a110fcaa Remove strnatcmp_ex() wrappers
These APIs always returned SUCCESS.

Closes GH-8195
2022-03-23 23:53:12 +00:00
George Peter Banyard dd62ec065e Refactor php_next_utf8_char() to use zend_result 2022-03-13 13:48:21 +00:00
Christoph M. Becker 2384c236b7 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8048: disk_*_space wrong for some filesystems on macOS
2022-03-04 16:08:48 +01:00
Christoph M. Becker 81048b9f84 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8048: disk_*_space wrong for some filesystems on macOS
2022-03-04 16:07:54 +01:00
risner 57ef16bb5d Fix GH-8048: disk_*_space wrong for some filesystems on macOS
A macOS bug in libc statvfs(3) call truncates 64 bit elements (e.g.
f_blocks) to 32 bits.  Thus, we force macOS to use statfs.

Closes GH-8056.
2022-03-04 16:06:35 +01:00
Patrick Allaert 67440096c5 Added: [zend_]memory_reset_peak_usage() (#8151) 2022-03-04 13:24:08 +01:00
Dmitry Stogov 014c852955 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix infiniry recursion during serialize() of "tricky" object
2022-03-01 00:01:46 +03:00
Dmitry Stogov bb0b4eb996 Fix infiniry recursion during serialize() of "tricky" object
Fixes oss-fuzz #44954
2022-03-01 00:00:22 +03:00