1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 01:53:36 +02:00
Commit Graph

793 Commits

Author SHA1 Message Date
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
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
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
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
3c40d9bf77 libmagic: Update patch
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 22:04:32 +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
Nikita Popov
5dc31e0cb6 Fixed bug #80197
Use "libmagic/magic.h" rather than <magic.h> to make sure that we
use the bundled libmagic, even if there is a system libmagic on the
include path.
2021-06-14 10:59:13 +02:00
Nikita Popov
fd5ff37db7 Make finfo_open() $magic_database nullable
Empty string was interpreted as a special value here, which indicates
that the default magic database should be used. It makes more sense
to use null for this purpose.

The documentation also explicitly mentions that null can be used.
2021-02-10 12:18:42 +01:00
Christoph M. Becker
e589609b4c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77961: finfo_open crafted magic parsing SIGABRT
2020-11-24 14:06:53 +01:00
Christoph M. Becker
39f95f5614 Fix #77961: finfo_open crafted magic parsing SIGABRT
libmagic may abort the running process, which is not desirable for PHP;
we raise a fatal error instead.

Closes GH-6437.
2020-11-24 14:01:15 +01:00
Christoph M. Becker
337031abbd [ci skip] Update generate_patch.sh
This has apparently been forgotten when updating to libmagic 5.39.
2020-11-24 13:38:31 +01:00
Nikita Popov
6d3695a217 Deny serialization of finfo objects
The resulting objects were already unusable, make it error out
earlier.
2020-10-26 16:54:30 +01:00
Nikita Popov
70388cc0ed Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Deny cloning of fileinfo objects
2020-10-26 16:52:14 +01:00
Nikita Popov
9353f11bd2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Deny cloning of fileinfo objects
2020-10-26 16:50:48 +01:00
Nikita Popov
7817fc07e1 Deny cloning of fileinfo objects
Using a cloned finfo object will crash.
2020-10-26 16:50:20 +01:00
Dik Takken
f3c58a5ed6 Make handling of NULL bytes in file paths more consistent (WIP)
Not all extensions consistently throw exceptions when the user passes
a path name containing null bytes. Also, some extensions would throw
a ValueError while others would throw a TypeError. Error messages
also varied.

Now a ValueError is thrown after all failed path checks, at least for
as far as these occur in functions that are exposed to userland.

Closes GH-6216.
2020-09-29 14:55:10 +02:00
Máté Kocsis
41b096b392 Promote a few forgotten warnings to exceptions
Closes GH-6211
2020-09-25 12:08:15 +02:00
Nikita Popov
25b9ba87b2 Update fileinfo parameter names
Closes GH-6206.
2020-09-24 18:36:36 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
9975986b7e Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Nikita Popov
7e339a335e Make null byte error a ValueError
Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.

This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.

Closes GH-6094.
2020-09-08 15:23:23 +02:00
Anatol Belski
e64c386b62 libmagic: Update patch
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2020-09-02 21:25:24 +02:00
Anatol Belski
f2b40775af Revert "libmagic: Move the allocation on the stack"
This reverts commit 1d84a58736.

Signed-off-by: Anatol Belski <ab@php.net>
2020-09-02 20:04:00 +02:00
Anatol Belski
8c31001bf1 libmagic: Constify arg 2020-09-02 17:35:51 +02:00
Anatol Belski
1d84a58736 libmagic: Move the allocation on the stack 2020-09-02 17:35:51 +02:00
Anatol Belski
486866c1b9 libmagic: Update patch [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 21:27:01 +02:00
Anatol Belski
c676e8f356 libmagic: Fix VS compat 2020-08-29 19:58:26 +02:00
Anatol Belski
f8f288145b libmagic: Remove unneeded includes
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 19:41:53 +02:00
Anatol Belski
bf93f1d824 fileinfo: Followup fixes
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 19:03:41 +02:00
Anatol Belski
c3eeab01ba fileinfo: Upgrade to libmagic 5.39
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 02:05:56 +02:00
George Peter Banyard
1b2ec73c1d Drop various unused macros/APIs
Also convert_libmagic_pattern() to return a zend_string*

Closes GH-6029
2020-08-26 12:59:43 +02:00
David Carlier
f32653accc fileinfo build fix proposal for haiku.
Haiku already defines a unichar type and different than the fileinfo's anyway.

Closed GH-5983
2020-08-21 16:13:09 +02:00
Máté Kocsis
7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
George Peter Banyard
196f8fdfc3 Promote warnings to Error in FileInfo extension
Closes GH-5914
2020-08-06 13:37:36 +02:00
George Peter Banyard
3f286fa89a Promote Notice to Warning in libmagic
The current behaviour makes little to no sense, having a notice which starts with 'Warning:' should just be a warning

Closes GH-5824
2020-07-10 14:43:43 +02:00
Max Semenik
2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Fabien Villepinte
3190282f09 Fix typos in comments 2020-07-01 09:08:28 +02:00
Christoph M. Becker
43b5d58341 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79756: finfo_file crash (FILEINFO_MIME)
2020-06-29 17:47:21 +02:00
Christoph M. Becker
dfac28f8d8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79756: finfo_file crash (FILEINFO_MIME)
2020-06-29 17:46:46 +02:00
Christoph M. Becker
816b4c1235 Fix #79756: finfo_file crash (FILEINFO_MIME)
If `ctime` or `asctime` return `NULL`, we must not attempt to copy the
buffer, but rather return `NULL` as well.
2020-06-29 17:45:28 +02:00
Máté Kocsis
b5c7a83dca Remove unnecessary PHPDoc-alike blocks from tests
Closes GH-5759
2020-06-24 13:13:44 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Alex Dowad
d1ebc3ab21 Increase failure threshold for 'extensive backtracking' fileinfo test
A spurious failure for this test was seen on Travis CI (S390X):

https://travis-ci.org/github/alexdowad/php-src/jobs/701533828

(The test is expected to finish within 1 second, but it took 1.06 seconds.)
Therefore, increase the threshold a bit.
2020-06-24 08:46:19 +02:00
Christoph M. Becker
0eaecb9c87 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79681: mime_content_type/finfo returning incorrect mimetype
2020-06-10 16:40:39 +02:00
Christoph M. Becker
6747068ce7 Fix #79681: mime_content_type/finfo returning incorrect mimetype
We backport the respective fix for MP3s[1].

[1] <5a55569a35>
2020-06-10 16:36:40 +02:00