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

898 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
Petr Sumbera
ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
Peter Kokot
f17c5ad83b Windows build: Add new function CHECK_HEADER() (#21191)
The current function `CHECK_HEADER_ADD_INCLUDE()` automatically defines
`HAVE_<HEADER_NAME_H>` preprocessor macros, which makes it difficult to
sync with other build systems. Specially, if some `HAVE_` macro is used
in the code and this function defines this macro but Autotools doesn't.

The new `CHECK_HEADER()` function behaves similar except it doesn't
define the `HAVE_<HEADER_NAME_H>` preprocessor macro.

This removes the following unused compile definitions:

HAVE_ARGON2_H
HAVE_AVIF_H
HAVE_BZLIB_H
HAVE_CAPSTONE_CAPSTONE_H
HAVE_CURL_EASY_H
HAVE_DB_H
HAVE_DECODE_H
HAVE_DEPOT_H
HAVE_EDITLINE_READLINE_H
HAVE_ENCHANT_H
HAVE_ENCODE_H
HAVE_FFI_H
HAVE_FIREBIRD_INTERFACE_H
HAVE_FT2BUILD_H
HAVE_GD_H
HAVE_GLIB_H
HAVE_GMP_H
HAVE_HTTPD_H
HAVE_IBASE_H
HAVE_IR_IR_H
HAVE_KECCAKHASH_H
HAVE_LBER_H
HAVE_LDAP_H
HAVE_LIBEXSLT_EXSLT_H
HAVE_LIBINTL_H
HAVE_LIBPQ_FE_H
HAVE_LIBTIDY_TIDY_H
HAVE_LIBXML_PARSER_H
HAVE_LIBXML_TREE_H
HAVE_LIBXML_XMLWRITER_H
HAVE_LIBXSLT_XSLT_H
HAVE_LMDB_H
HAVE_MBSTRING_H
HAVE_MYSQL_H
HAVE_ONIGURUMA_H
HAVE_OPENSSL_SSL_H
HAVE_PNG_H
HAVE_SNMP_H
HAVE_SODIUM_H
HAVE_SQLITE3_H
HAVE_SQLITE3EXT_H
HAVE_SYBFRONT_H
HAVE_TIDY_H
HAVE_TIDY_TIDY_H
HAVE_TIDYBUFFIO_H
HAVE_TIMELIB_CONFIG_H
HAVE_UNICODE_USPOOF_H
HAVE_UNICODE_UTF_H
HAVE_XPM_H
HAVE_ZIP_H
HAVE_ZIPCONF_H
HAVE_ZLIB_H

The following compile definitions are defined explicitly:

- HAVE_ICONV_H
- HAVE_MSCOREE_H
- HAVE_SQL_H
- HAVE_SQLEXT_H

Additionally, the `SETUP_OPENSSL()` function doesn't accept the 6th
argument anymore.
2026-03-03 20:06:40 +01:00
Tim Düsterhus
a15ba7672c zend_ini: Make ZEND_INI_GET_ADDR() return a void* pointer (#21119)
* zend_ini: Make `ZEND_INI_GET_ADDR()` return a `void*` pointer

Since the actual type of the storage location is not known, a `void*` is more
appropriate and avoids explicit casts that are no more safe than the implicit
cast from `void*`.

* tree-wide: Remove explicit casts of `ZEND_INI_GET_ADDR()`

* UPGRADING.INTERNALS
2026-02-04 11:11:11 +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
ecbdd2b580 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix zlib test for 8.5+
2025-12-28 01:32:27 +01:00
Niels Dossche
6e733a2bd0 Fix zlib test for 8.5+ 2025-12-28 01:32:21 +01:00
Niels Dossche
fd13afd66e Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:22:18 +01:00
Niels Dossche
42f51528da Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:22:12 +01:00
Niels Dossche
dabcd74524 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:21:56 +01:00
Niels Dossche
2709ebc0ce Fix OOB gzseek() causing assertion failure
Closes GH-20785.
2025-12-28 00:21:32 +01:00
David CARLIER
42f994cd05 ext/zlib: minor internal changes. (#20654)
consolidate encoding error exception b/w inflate_init()/deflate_init().
2025-12-21 06:57:10 +00:00
Niels Dossche
a1ed754066 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:42 +01:00
Niels Dossche
6cac6d49ce Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:34 +01:00
Niels Dossche
48d80d2729 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:13 +01:00
Niels Dossche
93ce0500aa Fix assertion failures resulting in crashes with stream filter object parameters
This works for dynamic props but not for non-dynamic props due to the
missing INDIRECT handling.

Closes GH-20500.
2025-11-17 18:23:43 +01:00
Peter Kokot
ca40ec284b ext/zlib: Remove unused ZLIB_EXPORTS (#20400)
This macro was probably once used in zconf.h on Windows in some
custom(ized) zlib versions. Current zlib versions don't use this macro
anywhere - zlib.net, winlibs...
2025-11-05 23:21:34 +01:00
Niels Dossche
2f0a0c598c Merge branch 'PHP-8.5'
* PHP-8.5:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:59 +01:00
Niels Dossche
cda8daaccf Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:54 +01:00
Niels Dossche
981b8c65ed Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:11 +01:00
Niels Dossche
be8c8a9d6b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:04 +01:00
Niels Dossche
df423e4f08 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update zlib test to use separate file for flock()
2025-11-01 09:29:55 +01:00
Niels Dossche
c3d6bf65d5 Update zlib test to use separate file for flock()
This should prevent the nightly failures that fail with permission
denied on platforms with mandatory locks.

Closes GH-20351.
2025-11-01 09:29:45 +01:00
David Carlier
b34ca99c94 Merge branch 'PHP-8.5' 2025-09-29 22:49:12 +01:00
David Carlier
ed9c1b87ee Merge branch 'PHP-8.4' into PHP-8.5 2025-09-29 22:48:55 +01:00
David Carlier
03de7b0b28 Merge branch 'PHP-8.3' into PHP-8.4 2025-09-29 22:48:38 +01:00
David Carlier
93bac8cb1a Fix GH-19922: gzopen() double free
close GH-19924
2025-09-29 22:47:29 +01:00
Tim Düsterhus
8bbd59f064 zlib: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
Tim Düsterhus
4934355b6d zlib: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Gina Peter Banyard
5bd18e3fdc ext/zlib: Refactor tests (#18887)
- Use INI sections
- Use CGI sections
- Move data into a subfolder
- Remove ZPP tests
- Fix various bugs within tests
- Simplify some


Found while working on #18879
2025-06-21 18:03:50 +01:00
Levi Morrison
6406d5f792 zlib: use zend_string_{extend,truncate} over *_realloc (#18462)
These cases seemed obvious enough to me to confidently change as an
outsider to zlib.
2025-04-30 08:18:04 -06:00
David CARLIER
df39586a88 ext/zlib: gzfile() files list as packed array (#18380) 2025-04-21 14:47:52 +01:00
Gina Peter Banyard
556e4d9008 streams: Indicate which argument fails the stream ZPP check 2025-03-24 22:54:34 +00:00
Niels Dossche
c696087e32 Fix error message on Windows 2025-02-15 00:23:38 +01:00
Niels Dossche
b3dd5a4c86 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix zlib support for large files
  Fix memory leak on overflow in _php_stream_scandir()
2025-02-14 23:11:17 +01:00
Niels Dossche
8f8d4be5eb Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix zlib support for large files
  Fix memory leak on overflow in _php_stream_scandir()
2025-02-14 23:10:40 +01:00
Niels Dossche
5aaf7b4937 Fix zlib support for large files
gzread() and gzwrite() have effectively a 4GiB limit at the moment
because the APIs of the zlib library use unsigned ints.
For example, this means that the count argument of gzread() and gzwrite()
& co effectively are modulo 2**32.
Fix this by adding a loop to handle all bytes.

As for automated testing, I didn't find an easy way to write a phpt for
this that wouldn't use a lot of memory or requires a large file.
For instance, the gzread() test that I manually ran requires a 4MiB
input file (and I can't shrink it because zlib has a max window size).

Here are the testing instructions, run on 64-bit:
To test for gzwrite():
```php
$f = gzopen("out.txt.gz", "w");
gzwrite($f, str_repeat('a', 4*1024*1024*1024+64)); // 4GiB + 64 bytes
```
Then use `zcat out.txt.gz|wc -c` to check that all bytes were written
(should be 4294967360).

To test for gzread():
Create a file containing all a's for example that is 4GiB + 64 bytes.
Then compress it into out.txt.gz using the gzip command.
Then run:
```php
$f = gzopen("out.txt.gz", "r");
$str = gzread($f, 4*1024*1024*1024+64);
var_dump(strlen($str)); // 4294967360
var_dump(substr($str, -3)); // string (3) "aaa"
```

Closes GH-17775.
2025-02-14 23:09:57 +01:00
Niels Dossche
78d934ad8e Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when encoding check fails
2025-02-13 19:11:08 +01:00
Niels Dossche
902e01f4f9 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when encoding check fails
2025-02-13 19:10:46 +01:00
ndossche
a54af45a41 Fix memory leak when encoding check fails
zlib_create_dictionary_string() allocates memory, so we can leak memory
if there's an early exit before the assignment to the return value.
Solve this by moving all validation upwards.

Closes GH-17788.
2025-02-13 19:10:17 +01:00
Niels Dossche
4d3d0aeb66 Add test for mandatory zlib locks
Windows has mandatory locks, so we can test the exclusive lock reliably.
2025-02-11 21:56:48 +01:00
Niels Dossche
acb17fb450 Add missing error reporting to reading/writing zlib streams 2025-02-11 21:56:41 +01:00
Niels Dossche
6c706c5714 Implement GH-17668: zlib streams should support locking 2025-02-11 21:56:41 +01:00
Niels Dossche
34e1c590cb Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17747: Exception on reading property in register-based FETCH_OBJ_R breaks JIT
  Fix GH-17745: zlib extension incorrectly handles object arguments
2025-02-11 21:55:51 +01:00
Niels Dossche
0e0d2d21b7 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17745: zlib extension incorrectly handles object arguments
2025-02-11 21:53:52 +01:00
Niels Dossche
4b5c29ef50 Fix GH-17745: zlib extension incorrectly handles object arguments
Because of the "H" modifier in ZPP, there are two bugs:

1) The stub is wrong and will cause a crash in debug mode.
2) Non-dynamic properties are not read correctly because they are not
   DEINDIRECTed.

Closes GH-17750.
2025-02-11 21:52:53 +01:00
Niels Dossche
f926c5ce81 Fix GH-16883: gzopen() does not use the default stream context when opening HTTP URLs
Otherwise it's not possible to control the context; it's also consistent
with how the standard open functions work.

Closes GH-17589.
2025-01-27 19:25:52 +01:00
Christoph M. Becker
b7fd773cc6 Refactor zlib dictionary processing (GH-16407)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-10-16 12:21:50 +02:00
David Carlier
6d1881b42d ext/zlib: gzfile/gzopen/readgzfile converting use_include_path argument to actual boolean.
close GH 16424
2024-10-14 12:40:57 +01:00