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

246 Commits

Author SHA1 Message Date
Ilija Tovilo
cee3687180 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix cve-2014-3538 test
2025-01-27 21:49:03 +01:00
Ilija Tovilo
7bda7ad31d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cve-2014-3538 test
2025-01-27 21:48:47 +01:00
Ilija Tovilo
d17d58a982 Fix cve-2014-3538 test
Make sure we have a unique test file to work with, and increase the time
for the nojit version to match the default version.

Closes GH-17600
2025-01-27 20:01:13 +01:00
David Carlier
ea83eba590 Merge branch 'PHP-8.2' into PHP-8.3 2024-09-05 01:41:55 +01:00
Daniel Scherzer
c5e0a6aaab Fix GH-15752: finfo_file() - parameter validation error messages
Show the correct parameter names and numbers - the errors are caused by the
second parameter being empty or having null bytes, not the first.

close GH-15755
2024-09-05 01:41:15 +01:00
Michael Orlitzky
4ded247675 ext/fileinfo/tests/bug78987.phpt: increase a memory limit
This test performs a few checks to ensure that "not too much" memory
is used while fileinfo is detecting encodings. It is however platform
specific, and memory usage varies across hosts and as libmagic changes.

Recently a Gentoo user reported a failure in this test at,

  https://bugs.gentoo.org/927461

on a big-endian PPC64 machine with output,

  ---- EXPECTED OUTPUT
  131072   => ok
  262144   => ok
  524288   => ok
  1048576  => ok
  2097152  => ok
  4194304  => ok
  8388608  => ok
  16777216 => ok
  ---- ACTUAL OUTPUT
  131072   => 10092544
  262144   => 10092544
  524288   => 12189696
  1048576  => 12189696
  2097152  => 14352384
  4194304  => 18612224
  8388608  => 24903680
  16777216 => 37486592
  ---- FAILED

Those numbers are with 8.3.4 and therefore missing commit b7c5813c
which also raises the limits. Checking the "actual" numbers above
against the current values, we see that the limit for 524288 would
need to be bumped to 12189696 to allow this test to pass. Since that
seems reasonable, that's what this commit does.

Closes GH-13795
Closes GH-13940
2024-04-11 15:58:06 +02:00
Niels Dossche
e71b597f4d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
2024-02-13 21:15:37 +01:00
Niels Dossche
c2b671cb1b Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
Credits to ranvis for finding the upstream commit that fixes the issue.

This backports 029b82459e

Closes GH-13370.
2024-02-13 21:13:43 +01:00
Anatol Belski
bd24c56207 fileinfo: Backport svg detection patch
This patch is a port of 1f5bea34 and adds a port for 5.43 based
branches. The related test is unchanged.

Signed-off-by: Anatol Belski <ab@php.net>
2023-09-30 18:22:14 +02:00
Anatol Belski
4b22cb213a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fileinfo: Backport svg detection patch
2023-09-30 16:26:24 +02:00
usarise
1f5bea3452 fileinfo: Backport svg detection patch 2023-09-30 16:17:03 +02:00
Anatol Belski
292e10b14b fileinfo: Add test for xz type
Ref: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 18:37:53 +02:00
Anatol Belski
97f0d97d2a fileinfo: Backport xz detection patch
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 18:02:46 +02:00
Anatol Belski
86f79b299e fileinfo: Backport xz detection fix
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 17:58:38 +02:00
Anatol Belski
962c082a5b fileinfo: Fix expected values for test on s390x
The peak memory usage increased by the blanket 1mb on s390 only.
This is good to note but otherwise seems acceptable, so just
adjusting the test is fine.

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 19:57:41 +02:00
Anatol Belski
bb6b41c3b1 Revert "fileinfo: tests: Disable times sensitive tests on debug build"
This reverts commit cab2f05f5a.
2022-10-02 18:39:54 +02:00
Anatol Belski
a4280d23dd fileinfo: tests: Sync more upstream tests and fix phpt
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:47 +02:00
Anatol Belski
a24727a5ca fileinfo: libmagic: Apply libmagic.patch
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:46 +02:00
Anatol Belski
6219d7fbc6 fileinfo: libmagic: Check in unpatched 5.43
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:46 +02:00
Anatol Belski
50fc9970f3 Merge branch 'PHP-8.1' into PHP-8.2 2022-09-25 20:44:16 +02:00
Anatol Belski
cab2f05f5a fileinfo: tests: Disable times sensitive tests on debug build
Signed-off-by: Anatol Belski <ab@php.net>
2022-09-25 20:43:31 +02:00
Anatol Belski
796fdb4bcc Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fileinfo: magic: Backport mime type support for woff/woff2 fonts
2022-09-18 14:44:00 +02:00
Anatol Belski
34fa65a6c2 fileinfo: magic: Backport mime type support for woff/woff2 fonts
Upstream patch: 7a821aedc1

Fixes GH-8805.

Signed-off-by: Anatol Belski <ab@php.net>
(cherry picked from commit 8a2ebe069148909a00739c83e9bcc031734bf826)
2022-09-18 14:39:12 +02:00
Ilija Tovilo
52850a4c0f Fix cleaup of fileinfo test 2022-09-14 22:18:59 +02:00
Michael Voříšek
60189aa96a Skip locale tests /w musl libc (#9141) 2022-07-25 23:56:14 +01: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
Anatol Belski
8de75fa754 fileinfo: Re-add Apple flag
It is not supported for all kinds of data, but it is definitely usable.

Signed-off-by: Anatol Belski <ab@php.net>
2022-04-15 14:44:50 +02:00
George Peter Banyard
16c98d481f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix Bug #81462 mime_content_type() indicates wrong arg num on TypeError
2021-09-20 22:48:46 +01:00
George Peter Banyard
0ea38b9509 Fix Bug #81462 mime_content_type() indicates wrong arg num on TypeError 2021-09-20 22:48:00 +01:00
Anatol Belski
1399e08ab9 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  fileinfo: Fix test value for s390x on travis-ci
2021-09-19 16:04:47 +02:00
Anatol Belski
fafdf744fa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Fix test value for s390x on travis-ci
2021-09-19 16:04:35 +02:00
Anatol Belski
8f75ab0dfc fileinfo: Fix test value for s390x on travis-ci
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-19 16:02:30 +02:00
Anatol Belski
62bfadc3b8 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  fileinfo: Capture more sizes for test as delivered by travis-ci
  fileinfo: Capture more sizes for test as delivered by AppVeyor
2021-09-18 23:18:11 +02:00
Anatol Belski
d225770e9e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Capture more sizes for test as delivered by travis-ci
  fileinfo: Capture more sizes for test as delivered by AppVeyor
2021-09-18 23:17:41 +02:00
Anatol Belski
6e0acece68 fileinfo: Capture more sizes for test as delivered by travis-ci
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 23:16:38 +02:00
Anatol Belski
e56435c86d fileinfo: Capture more sizes for test as delivered by AppVeyor
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 23:06:57 +02:00
Anatol Belski
f88fb1af5f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  fileinfo: Adjust value in test
2021-09-18 22:52:52 +02:00
Anatol Belski
a4f85a5796 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Adjust value in test
2021-09-18 22:52:30 +02:00
Anatol Belski
0208374ad4 fileinfo: Adjust value in test
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 22:51:08 +02:00
Anatol Belski
df5d7ec482 fileinfo: Fix test skip condition
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 22:36:04 +02:00
Anatol Belski
31c908af8e Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  libmagic: Update patch
  fileinfo: Fixed bug #78987 High memory usage during encoding detection
2021-09-18 22:11:06 +02:00
Anatol Belski
2a9a521d71 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Fixed bug #78987 High memory usage during encoding detection
2021-09-18 22:02:56 +02:00
Anatol Belski
fa96c7e000 fileinfo: Fixed bug #78987 High memory usage during encoding detection
The default buffer size for the encoding detection is set to 64K.

Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 21:00:30 +02:00
Anatol Belski
9b78000432 Revert "fileinfo: Obey POSIX in pattern conversion"
This reverts commit 343d1c2b1f.

Also remove the incompatible test data for time being. The new line
handling will need an extra fix.

Signed-off-by: Anatol Belski <ab@php.net>
2021-04-24 14:59:53 +02:00
Anatol Belski
34bdab538b fileinfo: Pull upstream tests
Integrating the upstream tests is important to ensure the quality of the
patch and to ensure the parity in the function.

Signed-off-by: Anatol Belski <ab@php.net>
2021-04-23 22:01:34 +02:00
Anatol Belski
3b9173dc8f fileinfo: Port libmagic 5.40
Signed-off-by: Anatol Belski <ab@php.net>
2021-04-05 20:19:07 +02:00
Max Semenik
bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Christoph M. Becker
b85f0d1cd0 Convert file_info resources to objects
Besides our general desire to get rid of the legacy resource types,
this is particularly appealing for fileinfo, because there are already
respective objects.

Closes GH-5987.
2020-12-20 18:19:22 +01:00