1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

945 Commits

Author SHA1 Message Date
Petr Sumbera
ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Niels Dossche
971728fe10 Fix GH-20679: finfo_file() doesn't work on remote resources (#20700)
The remote resources don't work because remote streams don't have a stat
method.
Since the check is only here for a best-effort check to return
"directory" instead of "empty", we can try the stat and still execute
the magic_stream() code even if it failed. Unfortunately we can't
distinguish between a failed stat and an unimplemented stat. If we
could, then this code could be even more robust.
2026-01-02 17:57:30 +01:00
Weilin Du
4f793ba1c3 [skip ci] Fix duplicate words typos (GH-20800) 2025-12-31 02:22:09 +01:00
Peter Kokot
1cf63a9380 ext/fileinfo: Remove duplicate HAVE_STDINT_H definition (#20392) 2025-11-05 00:36:24 +01:00
Gina Peter Banyard
ba21ab4ea0 ext/finfo: Deprecate the parameter for finfo_buffer() (#19378)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_context_parameter_for_finfo_buffer
2025-08-09 17:42:19 +01:00
Tim Düsterhus
ccb716dcad fileinfo: Deprecate finfo_close() (#18396)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_finfo_close
2025-08-08 21:25:13 +01:00
Niels Dossche
8629256dc7 Deduplicate error-handling code in finfo_open (#19149) 2025-07-17 20:45:09 +02:00
Niels Dossche
399cb4ca85 Fix misplaced endif in apprentice_sort() (#18686) 2025-05-29 12:04:07 +02:00
Niels Dossche
3d51ba3479 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ZEND_NONSTRING attribute for data_file.c
2025-05-28 19:50:06 +02:00
Niels Dossche
b8e734a24e Fix ZEND_NONSTRING attribute for data_file.c
This broke in CI but not on my local machine because of the different
compiler version. This is because there was an issue in GCC [1] that
caused the attribute to not properly work on multidimensional arrays.
This has since been fixed in GCC 15.
Therefore, we guard the attribute with a version check.

[1] https://gcc.gnu.org/cgit/gcc/commit/?id=afb46540d3921e96c4cd7ba8fa2c8b0901759455
2025-05-28 19:48:59 +02:00
Niels Dossche
cbe0cf6315 Merge branch 'PHP-8.4'
* PHP-8.4:
  Temporarily drop attribute for fileinfo
2025-05-27 21:08:11 +02:00
Niels Dossche
877663178c Temporarily drop attribute for fileinfo
The error in CI doesn't reproduce on my system with GCC 15.1.1...
2025-05-27 21:07:15 +02:00
Niels Dossche
c2749e0a80 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compile error for attribute
2025-05-27 21:01:39 +02:00
Niels Dossche
e4d2cd47c2 Fix compile error for attribute 2025-05-27 21:00:41 +02:00
Niels Dossche
d5515577d5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix for GH-17687
2025-05-27 20:42:12 +02:00
Niels Dossche
fab0a6d75c Backport fix for GH-17687
Introducing a new attribute macro in lower branches is an ABI break and
not allowed. However, we still need to fix the warnings such that
-Werror builds don't break. So we copy the macro from the master branch
to the C files in the appropriate places.
2025-05-27 20:40:35 +02:00
Niels Dossche
ea69276fd5 Fix GH-17687: initializer-string for array of ... warnings
Starting with gcc 15 the warning `-Wunterminated-string-initialization`
is enabled by default. We make now use of the `nonstring` attribute to
silence the warning for the cases where this is intended.

Closes GH-18603.
2025-05-27 20:28:29 +02:00
Ilija Tovilo
9306c9584b Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:28:47 +02:00
Ilija Tovilo
303610154b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:32 +02:00
Ilija Tovilo
438f07c9f7 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:25 +02:00
Ilija Tovilo
86ac21c3cd Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:16 +02:00
Ilija Tovilo
b5081339e9 [skip ci] Increase tolerance for cve-2014-3538 tests
These regularly fail with "Failed, time=1.5x".
2025-04-24 11:26:17 +02:00
Tim Düsterhus
7831f65f83 fileinfo: Stop calling finfo_close() in tests (#18405)
This function is a noop and will be proposed for deprecation. This patch
removes the useless calls.
2025-04-23 18:57:32 +02:00
Tim Düsterhus
00affe43aa fileinfo: Show libmagic version with . in PHPInfo output (#18399)
This makes the output in PHPInfo a little more readable.
2025-04-23 16:21:13 +02:00
Tim Düsterhus
7e15a07fea fileinfo: Remove php_fileinfo struct (#18398)
* fileinfo: Remove `php_fileinfo` struct

This is just a needless layer of indirection and requires an additional
allocation.

* fileinfo: Remove options field from `finfo_object`

This was only required to restore the original options when options are given
for `finfo_file()` or `finfo_buffer()`. This can more reliably be achieved
using `magic_getflags()` and is therefore redundant.

* fileinfo: Preserve error for uninitialized `finfo` objects
2025-04-23 12:04:10 +02:00
Tim Düsterhus
6adbe84120 Merge branch 'PHP-8.4'
* PHP-8.4:
  fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (#18397)
2025-04-22 22:25:43 +02:00
Tim Düsterhus
d5717d25cd Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (#18397)
2025-04-22 22:25:04 +02:00
Tim Düsterhus
92cec8add5 fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (#18397)
This also removes an accidentally committed file.
2025-04-22 22:24:49 +02:00
Tim Düsterhus
54a0a7924a fileinfo: Change return type of finfo_close() to true (#18395)
This function is a noop and always returns `true`.
2025-04-22 20:18:08 +02:00
David CARLIER
2d39c7855a Fixed GH-18267 finfo_file() crashing on invalid URL protocol. (#18269)
Close GH-18267
2025-04-08 22:43:11 +01:00
Gina Peter Banyard
fabee4e244 ext/fileinfo: Separate implementations of functions
Instead of relying on a "god" function
2025-04-03 19:06:47 +01:00
Gina Peter Banyard
3d41cb012a ext/fileinfo: Use magic_setflags() directly
The only way this function returns -1 is if:
> magic_setflags() returns -1 on systems that don't support utime(3), or utimes(2) when MAGIC_PRESERVE_ATIME is set.

This is extremely unlikely and if this would happen we currently have a return type violation.
2025-04-03 19:06:47 +01:00
Niels Dossche
a570ce8f40 Remove custom patches that are no longer in upstream
These were introduced in 6747068c, but they don't seem to be in upstream
(anymore). For the entry in rpm it may have even been a mixup with the
two sections in the rpm file: there's a "10 string" entry but only in
the delta part.
2025-02-15 12:53:07 +01:00
Niels Dossche
37dbad8fcd Upgrade to file 5.46 2025-02-15 12:53:07 +01:00
Ilija Tovilo
c1b151020a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix cve-2014-3538 test
2025-01-27 21:49:10 +01:00
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
Niels Dossche
f1b24da6b5 Fix GH-17039: PHP 8.4: Incorrect MIME content type
Backports file/file@ad925d3

Closes GH-17044.
2024-12-08 22:47:03 +01:00
Hans Krentel (hakre)
329890c149 Fail early in *nix build script
Adding one more [1] exit early safeguard in *nix build scripts:

Given the initial cd into the build tree fails (the project root),
   the `buildconf` script exits with non-zero status (failure).

Additionally quoting the pathname to cd into and the empty CD_PATH
parameter for portability, also for systems that are using a
non-portable pathname [2] for the build tree.

[1]: https://github.com/php/php-src/pull/16717
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271

Closes GH-16724.
2024-11-09 14:09:58 +01:00
Daniel Scherzer
29f9f903b1 backporting GH-15755 fix. 2024-09-05 02:02:36 +01:00
David Carlier
1e62d203a6 Merge branch 'PHP-8.3' 2024-09-05 01:55:58 +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
Máté Kocsis
8d12f666ae Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Peter Kokot
634708a14f Add pcre as a configure step dependency to fileinfo (#15349)
The pcre is a required dependency in fileinfo extenstion. This marks it
as a configure step dependency for consistency with other extensions
and to have extensions properly sorted in the generated
internal_functions* files.
2024-08-12 00:17:29 +02:00
Peter Kokot
ce8ffedccf Autotools: Normalize ext/fileinfo sources (#15082) 2024-07-24 19:55:37 +02:00