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

989 Commits

Author SHA1 Message Date
Máté Kocsis
30b2d77cd3 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix replacement of class signatures when a packagesynopsis element is present
2026-03-20 23:30:35 +01:00
Máté Kocsis
6932260386 Fix replacement of class signatures when a packagesynopsis element is present
So far, the gen_stub.php --replace-classsynopses subcommand didn't take the packagesynopsis element into account, causing some bugs: the wrong element was tried to be replaced (classynopsis instead of packagesynopsis) with the wrong content (the classname without the namespace: e.g. \Exception instead of \FFI\Exception).
2026-03-20 23:30:01 +01:00
Daniel Scherzer
36e1469fe1 gen_stub: use first class callables where possible 2026-03-20 14:44:28 -07:00
Daniel Scherzer
362f5fdb09 gen_stub: use match rather than switch when possible 2026-03-20 14:44:28 -07:00
Daniel Scherzer
ef5771dce2 gen_stub: use real readonly modifier 2026-03-20 14:44:27 -07:00
Daniel Scherzer
b83dd1055b gen_stub: use real mixed type 2026-03-20 14:44:10 -07:00
Daniel Scherzer
25f62cfa1f gen_stub: simplify with early returns 2026-03-16 09:53:51 -07:00
Daniel Scherzer
f1dd3f2f30 gen_stub: move generateArgInfoCode() into FileInfo
Reduce the number of global functions by moving it to instance method
`FileInfo::generateArgInfoCode()`.

In the process, make the following parts of `FileInfo` private:

- `$funcInfos`
- `$generateFunctionEntries`
- `$declarationPrefix`
- `$generateClassEntries`
- `$generateCEnums`
- `::getMinimumPhpVersionIdCompatibility()`
2026-03-16 09:53:51 -07:00
Daniel Scherzer
777fa5d158 gen_stub: fix typo $minPHPCompatability to $minPHPCompatibility 2026-03-16 09:53:51 -07:00
Daniel Scherzer
8ee5a524fa gen_stub: polyfill and use array_any() 2026-03-16 09:53:51 -07:00
Daniel Scherzer
a1d8e525f0 gen_stub: drop unused parameter in ConstInfo::getClassConstDeclaration() 2026-03-16 09:53:34 -07:00
Calvin Buckley
13b83a46cf Bump libtool to serial 63 from 2.5.4 (#21067)
The libtool 1.5.26 is bundled with PHP since the very early days of the
Autotools build system to ease the building process and avoid additional
dependency on the system Libtool. This updates the bundled libtool to
2.5.4 version.

Fixes and implementations:

- Fixed race conditions when building PHP in parallel ("cannot create
  .libs" warnings).
- Implements request https://bugs.php.net/70374 (Update libtool.m4)
- Fixes libtool eating -flto flags.
- Fixes GH-17310 (configure producing errors on macOS)
- Fixes GH-15946 (./configure error when building with NixOS)

Changes:
- Add a script to update autotools files.
- libtool is spread across multiple files; phpize is updated to handle
  this.
- Remove outdated hacks, i.e. for `ar`.
- Remove documentation references to external libtool, as we vendor it.
- `--with-pic` is now `--enable-pic`. Error out on the old flag.
- On macOS linker now uses -undefined dynamic_lookup flag for shared
  extensions and shared embed SAPI (libphp) instead of older
  '-undefined suppress -flat_namespace' combination.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2026-03-11 12:37:56 -03:00
Máté Kocsis
c506142044 Merge branch 'PHP-8.5'
* PHP-8.5:
  Add support for generating the namespace for the manual (#21313)
2026-03-05 13:43:14 +01:00
Máté Kocsis
7e78b0f1d2 Add support for generating the namespace for the manual (#21313)
[skip ci]
2026-03-05 13:42:36 +01:00
Arnaud Le Blanc
d16e6f52a4 Generate C enums from internal enums, introduce Z_PARAM_ENUM() (#20917)
Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).

The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.

Introduce Z_PARAM_ENUM().

* Make ZEND_AST_CONST_ENUM_INIT a 4-children node

* Store enum case id in ZEND_AST_CONST_ENUM_INIT

* Store enum case id in instance

* Expose enum case_id internally

* Generate C enum for internal enums

* Introduce Z_PARAM_ENUM()

* Port extensions
2026-02-03 12:38:04 +01:00
Peter Kokot
c774be97f4 Autotools: Update config.{guess,sub} to 2025-07-10 (#19129)
```
wget -O build/config.guess https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
wget -O build/config.sub https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
```
2026-02-02 10:47:40 +01:00
Tim Düsterhus
149d34d2cc Merge branch 'PHP-8.5'
* PHP-8.5:
  gen_stub: Fix compatibility with php 7.4 (in PHP-8.5+) (#21075)
2026-01-29 12:01:10 +01:00
Giovanni Giacobbi
7ec14e3ca4 gen_stub: Fix compatibility with php 7.4 (in PHP-8.5+) (#21075) 2026-01-29 12:01:01 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Máté Kocsis
eea9a62b1b Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix constant references inside parameter default values when generating the manual
2026-01-08 22:52:32 +01:00
Máté Kocsis
eb1e22b1df Fix constant references inside parameter default values when generating the manual 2026-01-08 22:51:28 +01:00
Máté Kocsis
6dad2060b8 Merge branch 'PHP-8.5'
* PHP-8.5:
  fix: Allow variadic syntax in PHPDoc parameter annotation in `gen_stub.php` (#20342)
2025-12-27 13:01:18 +01:00
Máté Kocsis
324db3a77a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  fix: Allow variadic syntax in PHPDoc parameter annotation in `gen_stub.php` (#20342)
2025-12-27 13:00:29 +01:00
Máté Kocsis
14d8e84236 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  fix: Allow variadic syntax in PHPDoc parameter annotation in `gen_stub.php` (#20342)
2025-12-27 12:54:04 +01:00
Michael Telgmann
09cb5ad442 fix: Allow variadic syntax in PHPDoc parameter annotation in gen_stub.php (#20342)
Closes #20277

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2025-12-27 12:53:15 +01:00
Máté Kocsis
85b681a206 Merge branch 'PHP-8.5'
* PHP-8.5:
  gen_stub: Fix php-parser package download (#20775)
2025-12-25 21:11:15 +01:00
Máté Kocsis
dc5de5d419 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  gen_stub: Fix php-parser package download (#20775)
2025-12-25 21:10:49 +01:00
Giovanni Giacobbi
7d4ba80705 gen_stub: Fix php-parser package download (#20775)
If the system wgetrc has the `content-disposition = on` option, the file is
actually saved as `PHP-Parser-5.0.0.tar.gz`, causing a subsequent failure.

Even with `content-disposition = off`, if for any reason the download file
already exists and is corrupted, it won't be overwritten, and a new file
such as `v5.0.0.tar.gz.1` is saved instead.

We solve both problems by enforcing the name of the downloaded file.

Also, if for any other reason the unpacking should fail, remove the created
directory to allow further attempts.
2025-12-25 21:10:29 +01:00
Peter Kokot
3b67680609 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix cross-compilation for musl C library
2025-10-03 00:59:22 +02:00
DubbleClick
2b8d8ba7c4 Fix cross-compilation for musl C library
This adds a PHP_C_STANDARD_LIBRARY Autoconf macro to detect glibc/musl
more accurately and fixes "cross-compilation" with musl-libc on glibc
systems.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

Closes GH-19352
2025-10-03 00:58:44 +02:00
Niels Dossche
57ce245e1e Reduce code bloat in arginfo by using specialised string releases (#20016)
* Reduce code bloat in arginfo by using specialised string releases

Comparing this patch to master (c7da728574),
with a plain configure command without any options:

```
   text	   data	    bss	    dec	    hex	filename
20683738	1592400	 137712	22413850	156021a	sapi/cli/php
20688522	1592400	 137712	22418634	15614ca	sapi/cli/php_old
```

We see a minor reduction of 0.023% in code size.

* Also use true for the other initialization line

* Also use specialized code for consts
2025-10-02 22:00:20 +02:00
Remi Collet
ad5f31d623 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19681 PHP_EXPAND_PATH broken with bash 5.3.0
2025-09-05 09:10:40 +02:00
Remi Collet
3a88977043 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19681 PHP_EXPAND_PATH broken with bash 5.3.0
2025-09-05 09:10:19 +02:00
Remi Collet
98d2b92324 Fix GH-19681 PHP_EXPAND_PATH broken with bash 5.3.0 2025-09-05 09:08:15 +02:00
Daniel Scherzer
3f3a266a2b gen_stub: Infer constants' types from values (#19568)
Don't require `@var` with a type when the type can be inferred from a literal
value in the stub file.
2025-09-03 18:26:43 -07:00
Timo Tijhof
27a1abc1fa README: Fix non-existent iconv in macOS instruction (#19475)
Follows-up 22e444c5c7 (GH-18670). There is currently no formula called
"iconv". [1][2]

```
$ brew install iconv
Warning: No available formula with the name "iconv". Did you mean icon or cconv?
```

There package is called "libiconv". [3]

Once installed, `./configure` still fails due to a discovery issue.

```
$ ./configure --enable-debug
…
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
```

In 2020, as part of the switch from Intel to ARM, Homebrew adopted /opt
as the standard location instead of /usr/local. [4][5]

Rather than complicating the README with a mandatory `--with-iconv`
path (or --without-iconv) for macOS users, improve the discovery
to support Homebrew's new location.

[1]: https://brew.sh/
[2]: https://github.com/Homebrew/homebrew-core/.
[3]: https://formulae.brew.sh/formula/libiconv
[4]: https://apple.stackexchange.com/a/437622/33762
[5]: https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon
2025-08-25 02:50:40 -07:00
Tim Düsterhus
092127cf25 gen_stub: Update to PHP-Parser 5.6.1 (#19495)
This fixes a PHP 8.5 Deprecation:

> Deprecated: Method SplObjectStorage::attach() is deprecated since 8.5, use
> method SplObjectStorage::offsetSet() instead in
> php-src/build/PHP-Parser-5.6.0/lib/PhpParser/Parser/Php7.php on line 2692
2025-08-16 14:04:56 +02:00
Peter Kokot
f64c6248b5 Autotools: Update ax_check_compile_flag.m4 to serial 11 (#19127)
```sh
wget -O build/ax_check_compile_flag.m4 \
  https://cgit.git.savannah.gnu.org/cgit/autoconf-archive.git/plain/m4/ax_check_compile_flag.m4
```

New version of AX_CHECK_COMPILE_FLAG macro now adds the -Werror flag
automatically, if GNU-compatible compiler is detected.
2025-08-09 02:03:37 +02:00
Ilija Tovilo
0d15bca041 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix filtering of INI directives to respect leading whitespaces
2025-08-04 16:56:59 +02:00
Ilija Tovilo
bd7ffc911d Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix filtering of INI directives to respect leading whitespaces
2025-08-04 16:56:51 +02:00
Arndt Kaiser
9d29283392 Fix filtering of INI directives to respect leading whitespaces
Directives are now correctly filtered out if the line in the php.ini
file begins with whitespace characters.

Closes GH-19348
2025-08-04 16:55:46 +02:00
Daniel Scherzer
54863f4930 gen_stub: Update PHP-Parser to 5.6.0 (#19271)
Includes support for declaring functions named `clone`, so update the stub file
where `clone` is declared to remove the `_clone` workaround.
2025-07-29 07:47:58 -07:00
Daniel Scherzer
ff810d5e36 Arginfo: reuse zend_string objects for initializing attribute values (#19241)
Avoid initializing the same string content multiple times and make use of the
fact that the strings created to initialize attribute values are not freed by
simply making use of an existing zend_string with the same content if one is
available.
2025-07-27 17:27:22 -07:00
Daniel Scherzer
747ecce51f gen_stub: simplify ClassInfo::getRegistration() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
74f7ecbe04 gen_stub: add ConstInfo::getPredefinedConstantElement()
Simplifies the implementation of `::getPredefinedConstantTerm()` and
`::getPredefinedConstantEntry()`, which only differ in the name of the tag
used.
2025-07-25 11:17:34 -07:00
Daniel Scherzer
5ae87ffef4 gen_stub: avoid unneeded regex match 2025-07-25 11:17:34 -07:00
Daniel Scherzer
ecc403a8fa gen_stub: inline computeStubHash() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
2ed5472f06 gen_stub: make some FuncInfo methods private
* `FuncInfo::isFinalMethod()`
* `FuncInfo::getModifierNames()`
* `FuncInfo::equalsApartFromNameAndRefcount()`
2025-07-25 11:17:34 -07:00
Daniel Scherzer
0b01640b58 gen_stub: replace FunctionOrMethodName::isMethod() with instanceof 2025-07-25 11:17:34 -07:00
Daniel Scherzer
49f1685cde gen_stub: simplify FuncInfo::getFramelessDeclaration() 2025-07-25 11:17:34 -07:00