1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00
Commit Graph

649 Commits

Author SHA1 Message Date
Ilija Tovilo
4e12189604 Mark some phar tests as flaky on macOS
Fixes GH-15748
Closes GH-15876
2024-09-13 18:13:10 +02:00
David Carlier
686afc10bf Fix GH-14603: invalid null zip file entry.
close GH-14610
2024-06-21 05:07:46 +01:00
Niels Dossche
5ed5d37f25 Skip test on Windows because of different error output 2024-03-31 16:56:14 +02:00
Niels Dossche
47bb6c1b79 Fix GH-13833: Applying zero offset to null pointer in zend_hash.c
MAPPHAR_FAIL will call the destructor of the manifest, mounted_dirs, and
virtual_dirs tables. When a new phar object is allocated using (p)ecalloc,
the bytes are zeroed, but the flag for an uninitialized table is
non-zero. So we have to manually set the flag in case that we have a
code path that can destroy the tables without first initializing them at
least once.

Closes GH-13847.
2024-03-31 14:25:08 +02:00
Niels Dossche
ed8ed714a8 Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
If the destination already exists, then the `add` function on the
manifest will return NULL, resulting in a NULL entry and therefore a
NULL deref. As `copy()` (not `Phar::copy`) chooses to succeed and
overwrite the destination if it already exists, we should do the same.
Therefore the fix is as simple as changing `add` to `update`.

Closes GH-13840.
2024-03-30 18:03:55 +01:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
Niels Dossche
ba80372a58 Fix GH-13037: PharData incorrectly extracts zip file
The code currently assumes that the extra field length of the central
directory entry and the local entry are the same, but that's not the
case. For example, the "Extended Timestamp extra field" differs in size
for local vs central directory entries. This causes the file contents
offset to be incorrect because it is based on the central directory
length instead of the local entry length. Fix it by reading the local
entry and getting the size from there as well as checking consistency
for the file name length.

Closes GH-13045.
2024-01-25 20:05:45 +01:00
Niels Dossche
5a988d5764 Fix phar/tests/bug77432.phpt
- For Windows we just have to set the right error_reporting value
- Test cannot be used repeatedly on Opcache because the unlink will have
  no effect because of caching.

Closes GH-13129.
2024-01-12 17:23:50 +01:00
Niels Dossche
0d2c83ef9c Skip on Windows 2024-01-01 15:58:47 +01:00
Niels Dossche
7677df4cf1 Fix test not emitting warning because of Windows paths 2024-01-01 15:27:33 +01:00
Niels Dossche
c86f05307e Fix test on Windows 2024-01-01 14:56:49 +01:00
Niels Dossche
1edcfccdca Fix #77432: Segmentation fault on including phar file
phar_get_pharfp() can return NULL. In this case this is because the
stream gets closed by the include code in the engine. However, the phar
entry is still cached, so when the next include happens the engine tries
to read from a closed (and nullified) stream.
Use the same fix as in phar_open_entry_fp(): take into account that the
phar_get_pharfp() can return NULL and in that case reopen the phar
archive.

Closes GH-13056.
2024-01-01 13:45:40 +01:00
Niels Dossche
00ab6bb078 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Mark buildFromIterator test as conflicting
2023-08-04 21:08:57 +02:00
Niels Dossche
dc586b121a Mark buildFromIterator test as conflicting
Commit 0b2e6bc2b0 started caching the directory entry type to improve
performance. Shortly after, we've seen flaky failures of the
buildFromIterator phar test.

When it fails, it's always a value error in the constructor of
RecursiveDirectoryIterator::__construct() with a "no such file or
directory" error. What's happening here is this:
1) A parallel test creates a subdirectory in the current working dir.
2) This test checks hasChildren() on a directory entry, the cached entry
   returns "yes" on the subdirectory.
3) The parallel test finishes and removes the subdirectory.
4) The constructor mentioned above is called, causing an exception
   because the directory is gone.

This race has always been possible, even before said commit. It's just
that it was very hard to hit before: the expensive stat call made the
race window hard to hit. The race is now easier to hit because of the
caching that is fast.

Since there's many tests that modify the current working directory, it
seems best to mark this as an "all" conflict. We cannot avoid every
TOC-TOU race when working with files with these phar tests.

In particular, mounteddir.phpt caused every conflict I saw on CI, but
there's more tests that create subdirectories in the current working
directory.

Closes GH-11869.
2023-08-04 21:08:39 +02:00
Derick Rethans
deddf4692a Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 19:54:44 +01:00
Derick Rethans
0870ebb862 Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 19:53:43 +01:00
Niels Dossche
80316123f3 Fix buffer mismanagement in phar_dir_read()
Fixes GHSA-jqcx-ccgc-xwhv.
2023-07-31 19:47:05 +01:00
Niels Dossche
d8294f2824 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10766: PharData archive created with Phar::Zip format does not keep files metadata (datetime)
2023-03-04 23:57:03 +01:00
Niels Dossche
e633be3e87 Fix GH-10766: PharData archive created with Phar::Zip format does not keep files metadata (datetime)
Due to an incorrect check, the datetime was never actually set.
To test this we need to write the file using phar, but read the file
using a different method to not get a cached, or a value that's been
transformed twice and is therefore accidentally correct.

Closes GH-10769
2023-03-04 23:43:48 +01:00
Christoph M. Becker
d981def074 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix new bug81726.phpt for PHP 8.0
2022-09-27 18:45:54 +02:00
Christoph M. Becker
809176dab0 Fix new bug81726.phpt for PHP 8.0
The error message has slightly changed, so we adapt our expectations.
2022-09-27 18:40:02 +02:00
Christoph M. Becker
bb34bc445e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix new bug81726.phpt for PHP 8.0
2022-09-27 18:32:09 +02:00
Christoph M. Becker
4f79dbd745 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix new bug81726.phpt for PHP 8.0
2022-09-27 18:31:44 +02:00
Christoph M. Becker
1a3c9b0542 Fix new bug81726.phpt for PHP 8.0
The error message has slightly changed, so we adapt our expectations.

Closes GH-9621.
2022-09-27 18:30:04 +02:00
Derick Rethans
25290cd25c Merge branch 'PHP-8.1' into PHP-8.2 2022-09-27 14:11:40 +01:00
Derick Rethans
cfee252a95 Merge branch 'PHP-8.0' into PHP-8.1 2022-09-27 14:11:31 +01:00
Derick Rethans
def8c8d174 Merge branch 'PHP-7.4' into PHP-8.0 2022-09-27 14:11:14 +01:00
Christoph M. Becker
404e8bdb68 Fix #81726: phar wrapper: DOS when using quine gzip file
The phar wrapper needs to uncompress the file; the uncompressed file
might be compressed, so the wrapper implementation loops. This raises
potential DOS issues regarding too deep or even infinite recursion (the
latter are called compressed file quines[1]). We avoid that by
introducing a recursion limit; we choose the somewhat arbitrary limit
`3`.

This issue has been reported by real_as3617 and gPayl0ad.

[1] <https://honno.dev/gzip-quine/>
2022-09-09 17:10:04 +01:00
Ayesh Karunaratne
5c2c688c17 phpinfo HTML Output: Make module title names clickable and link to the URL fragment
Each section of `phpinfo` is titled with an `<h2><a name="module_NAME">NAME</a></h2>` tag. While the `name=module_NAME` attribute allows linking to that section using a URL fragment (e.g `info.php#module_NAME`), it lacks discoverability because the `<a>` tag does not contain an `href` attribute. This is also highlighted in accessibility scans (in Firefox for instance).

This adds a link to the `<a>` tag that links to the URL fragment, fixing the accessibility remark and improving the discoverability of the clickable section titles. Also contains minor CSS changes to account for the dark theme CSS.

Closes GH-9054.
2022-07-20 17:18:34 +02:00
Christoph M. Becker
af40f06d5b Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix test XFAIL, update phar to use spl_autoload_register
2022-05-02 14:02:46 +02:00
Christoph M. Becker
c9fba10242 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix test XFAIL, update phar to use spl_autoload_register
2022-05-02 14:00:19 +02:00
Michael Voříšek
60487621c1 Fix test XFAIL, update phar to use spl_autoload_register
Closes GH-8449.
2022-05-02 13:58:25 +02:00
Nikita Popov
cd3fbb1b15 Fix file name clash in phar test 2021-11-09 15:52:10 +01:00
Nikita Popov
4087aba60d Fix file name clashes in phar buildfromiterator tests 2021-09-17 10:11:06 +02:00
Nikita Popov
768265cd22 Fix some more CLEAN sections 2021-09-06 17:03:35 +02:00
Nikita Popov
98d004c9bc Fix CLEAN sections 2021-09-03 12:36:02 +02:00
Nikita Popov
7a411564f0 Fix some more CLEAN sections 2021-09-03 11:18:19 +02:00
Stanislav Malyshev
1fefd482f4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix test
2021-08-23 23:44:06 -07:00
Stanislav Malyshev
ffcf5ba4ae Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix test
2021-08-23 23:43:58 -07:00
Stanislav Malyshev
c1f427b506 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test
2021-08-23 23:43:51 -07:00
Stanislav Malyshev
b815645aac Fix test 2021-08-23 23:43:32 -07:00
Stanislav Malyshev
18ebe1588d Merge branch 'PHP-8.0'
* PHP-8.0:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:31:00 -07:00
Stanislav Malyshev
33e4174d1c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:30:34 -07:00
Stanislav Malyshev
40db8947e2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix #81211: Symlinks are followed when creating PHAR archive
2021-08-23 23:29:01 -07:00
Christoph M. Becker
2ff853aa11 Fix #81211: Symlinks are followed when creating PHAR archive
It is insufficient to check whether the `base` is contained in `fname`;
we also need to ensure that `fname` is properly separated.  And of
course, `fname` has to start with `base`.
2021-08-23 23:25:16 -07:00
Nikita Popov
ddc21b0902 Fix phar test
As the REPORT_ERRORS flag is now respected, this no longer
throws a warning (in addition to the exception).
2021-08-17 14:57:17 +02:00
Remi Collet
c51af22fef implement openssl_256 and openssl_512 for phar singatures 2021-08-11 14:13:57 +02:00
Remi Collet
8bb0c74e24 switch phar to use sha256 signature by default 2021-08-11 14:13:54 +02:00
Nikita Popov
1a370d3321 Skip some tests under --preload
A genuine problem here is that we sometime get different class
casing due interaction with the ZSTR CE cache. Ignore these for
now.
2021-07-30 17:26:39 +02:00
Máté Kocsis
75a678a7e3 Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00