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

129157 Commits

Author SHA1 Message Date
David Carlier
9090e2602e sockets ext for solaris update.
socket filter support, system can support up to 32 filters giving the possibility to retrive the full list.
Closes #8191.
2022-07-25 19:28:25 +01:00
Christoph M. Becker
baebb730b4 Merge branch 'PHP-8.1'
* PHP-8.1:
  Initialize blacklist_path_length
2022-07-25 19:12:12 +02:00
Christoph M. Becker
7d36703a8f Initialize blacklist_path_length
For some reason, GCC warns[1]:

| ‘blacklist_path_length’ may be used uninitialized in this function
| [-Werror=maybe-uninitialized]

This looks like a false positive to me, but it doesn't hurt to
explicitly initialize the variable.

[1] <https://github.com/php/php-src/runs/7502212969?check_suite_focus=true>

Closes GH-9129.
2022-07-25 19:10:42 +02:00
Máté Kocsis
a05a6c555d Declare ext/soap constants in stubs (#9124) 2022-07-25 16:40:41 +02:00
Christoph M. Becker
f78ae8d114 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-9033: Loading blacklist file can fail due to negative length
2022-07-25 16:33:15 +02:00
Christoph M. Becker
4834cfea1a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9033: Loading blacklist file can fail due to negative length
2022-07-25 16:32:18 +02:00
Christoph M. Becker
35fd97c3c9 Fix GH-9033: Loading blacklist file can fail due to negative length
If the blacklist file contains a line with a single double-quote, we
called `zend_strndup(pbuf, -1)` what causes an unnecessary bail out;
instead we just ignore that line.

If the blacklist file contains an empty line, we may have caused an OOB
read; instead we just ignore that line.

Closes GH-9036.
2022-07-25 16:30:19 +02:00
Máté Kocsis
4ad7e7251d Declare ext/sysvmsg constants in stubs (#9125)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2022-07-25 16:21:01 +02:00
Dmitry Stogov
87cf05e8be Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-25 15:55:15 +03:00
Dmitry Stogov
d50875c822 Fix type inference
Fixes oss-fuzz #49423 and #49474
2022-07-25 15:53:06 +03:00
David Carlier
53ae24e435 zend defines attribute malloc for Win32 as returned pointer are not aliased
Closes #9118.
2022-07-25 13:43:41 +01:00
Dmitry Stogov
9d52081741 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix missing type stote
2022-07-25 15:25:08 +03:00
Dmitry Stogov
e70d282077 JIT: Fix missing type stote
Fixes oss-fuzz #49402
2022-07-25 15:24:26 +03:00
Martin Herndl
229b189293 [ci skip] Fix str_split NEWS and UPGRADE note
Closes GH-9123.
2022-07-25 13:45:01 +02:00
Dmitry Stogov
4227fddf4d Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-07-25 12:08:09 +03:00
Dmitry Stogov
cc465ba0bb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-07-25 12:08:00 +03:00
Dmitry Stogov
44b86aee31 Fix memory leak
Fixes oss-fuzz #49272
2022-07-25 12:04:46 +03:00
Tim Düsterhus
60f149f7ad Improve error reporting in random extension (#9071)
* Use `php_random_bytes_throw()` in Secure engine's generate()

This exposes the underlying exception, improving debugging:

    Fatal error: Uncaught Exception: Cannot open source device in php-src/test.php:5
    Stack trace:
    #0 php-src/test.php(5): Random\Engine\Secure->generate()
    #1 {main}

    Next RuntimeException: Random number generation failed in php-src/test.php:5
    Stack trace:
    #0 php-src/test.php(5): Random\Engine\Secure->generate()
    #1 {main}
      thrown in php-src/test.php on line 5

* Use `php_random_int_throw()` in Secure engine's range()

This exposes the underlying exception, improving debugging:

    Exception: Cannot open source device in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getInt(1, 3)
    #1 {main}

    Next RuntimeException: Random number generation failed in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getInt(1, 3)
    #1 {main}

* Throw exception when a user engine returns an empty string

This improves debugging, because the actual reason for the failure is available
as a previous Exception:

    DomainException: The returned string must not be empty in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getBytes(123)
    #1 {main}

    Next RuntimeException: Random number generation failed in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getBytes(123)
    #1 {main}

* Throw exception when the range selector fails to get acceptable numbers in 50 attempts

This improves debugging, because the actual reason for the failure is available
as a previous Exception:

    RuntimeException: Failed to generate an acceptable random number in 50 attempts in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getInt(1, 3)
    #1 {main}

    Next RuntimeException: Random number generation failed in php-src/test.php:17
    Stack trace:
    #0 php-src/test.php(17): Random\Randomizer->getInt(1, 3)
    #1 {main}

* Improve user_unsafe test

Select parameters for ->getInt() that will actually lead to unsafe behavior.

* Fix user_unsafe test

If an engine fails once it will be permanently poisoned by setting
`->last_unsafe`. This is undesirable for the test, because it skews the
results.

Fix this by creating a fresh engine for each "assertion".

* Remove duplication in user_unsafe.phpt

* Catch `Throwable` in user_unsafe.phpt

As we print the full stringified exception we implicitly assert the type of the
exception. No need to be overly specific in the catch block.

* Throw an error if an engine returns an empty string

* Throw an Error if range fails to find an acceptable number in 50 attempts
2022-07-25 09:00:49 +02:00
Go Kudo
34b352d121 Fix memory leak on Randomizer::__construct() call twice (#9091)
When Radomizer::__construct() was called with no arguments, Randomizer\Engine\Secure was implicitly instantiate and memory was leaking.
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2022-07-24 03:09:14 +09:00
George Peter Banyard
3c372901bd Add support to pass driver flags to DBA handlers
Currently only LMDB with DBA_LMDB_USE_SUB_DIR/DBA_LMDB_NO_SUB_DIR are supported
2022-07-23 18:38:27 +01:00
George Peter Banyard
79d831ff9f Pass MDB_RDONLY to the LMDB environment for readonly DBs 2022-07-23 18:38:27 +01:00
George Peter Banyard
0887a1d7ab Remove personalisation from write on readonly db DBA error message 2022-07-23 18:38:27 +01:00
George Peter Banyard
c8ba00f627 Add comment in GDBM informing to what param the 0 org corresponds to 2022-07-23 18:38:27 +01:00
Tim Düsterhus
395b6a9674 Remove dead code in ext/random/random.c (#9114)
see GH-9070
2022-07-23 13:14:31 +02:00
Máté Kocsis
e4d79ce24c Declare ext/reflection constants in stubs (#9111) 2022-07-23 12:59:30 +02:00
Máté Kocsis
c854816b65 Declare ext/readline constants in stubs (#9110) 2022-07-23 12:33:44 +02:00
Máté Kocsis
a98560ad3f Declare ext/session constants in stubs (#9112) 2022-07-23 12:32:21 +02:00
Máté Kocsis
98be397776 Declare ext/random constants in stubs (#9109) 2022-07-23 12:32:01 +02:00
Michael Voříšek
b0c0a2cfb4 Use -1 "precision" in gen_stub.php
Closes GH-8734.
2022-07-23 12:09:37 +02:00
Tim Düsterhus
eff9aed159 [ci skip] Update NEWS for byte expansion in rand_rangeXX()
see GH-9083
see GH-9088
see GH-9056
2022-07-22 18:52:47 +02:00
Michael Voříšek
fc42098c23 Fix typo in lob_prefetch_ini.phpt test (#9099) 2022-07-22 17:17:03 +01:00
Martin Schröder
0adbf9c2d4 Fix memory leak in fiber constructor by throwing an error (#9098) 2022-07-22 10:47:47 -05:00
Derick Rethans
9dcb0bd1dc Merge remote-tracking branch 'derickr/bug75035-big-year-serialisation' 2022-07-22 15:36:04 +01:00
Derick Rethans
1d0e5eddd5 Add test case for bug #80483/#75035 2022-07-22 15:34:57 +01:00
Derick Rethans
6ae86c2358 Fixed bug #80022: Support ISO 8601 years outside 0000-9999 range better 2022-07-22 15:34:57 +01:00
Derick Rethans
8ea587a305 Import timelib 2022.01 2022-07-22 15:34:57 +01:00
Derick Rethans
b1575f996c Merge branch 'PHP-8.1' 2022-07-22 13:08:11 +01:00
Derick Rethans
0ae9942801 Merge remote-tracking branch 'derickr/timelib-2021-15-sync' into PHP-8.1 2022-07-22 13:07:28 +01:00
Derick Rethans
7831a1cae6 Add test case for GH-8964 2022-07-22 13:06:32 +01:00
Derick Rethans
0d3061d225 Import timelib 2021.15 2022-07-22 13:06:32 +01:00
George Peter Banyard
4457dba1fb Add support for stubs to declare intersection type class properties (#8751) 2022-07-22 13:04:49 +01:00
David CARLIER
77bd39a116 crc32 Aarch64 add crc feature to crc32_aarch64 from clang
Closes #8916.
2022-07-22 12:46:11 +01:00
Máté Kocsis
6ab897c8d3 Declare ext/phar constants in stubs (#9094) 2022-07-22 13:09:23 +02:00
Máté Kocsis
17f3631d95 Declare ext/posix constants in stubs (#9095) 2022-07-22 13:08:58 +02:00
Máté Kocsis
f72d264560 Declare ext/pspell constants in stubs (#9096) 2022-07-22 13:08:44 +02:00
George Peter Banyard
0490f082e9 [run-tests.php] echo call performance optimization 2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
3483a1f170 [run-tests.php] Combine multiple str_replace calls to a single strtr call
Makes the replacement easier to see, neatly aligned, and only takes one function call.
This is safe because none of the combined replacement values contain tokens that would be recursively replaced.

This also improves the readability on how the regular expressions in `EXPECTF` matcher is constructed.

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
c83a10d8db [run-tests.php] Replace backtick operator string literals with shell_exec() calls
The rationale is that `shell_exec()` is identical to the backtick operator (both of which are disabled when `shell_exec` function is disabled) makes it very clear that it is a shell execution, and eases security audits too.
2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
f958701dad [run-tests.php] Merge multiple unset() calls to a single call 2022-07-22 11:53:46 +01:00
Ayesh Karunaratne
056afc8daf [run-tests.php] Minor optimizations in if blocks by placing simple expressions first 2022-07-22 11:53:46 +01:00