Skip to content

Conversation

@petk
Copy link
Member

@petk petk commented Jan 14, 2026

At the time of writing, PHP found on host system must be at least 8.0 for build/gen_stub.php and Zend/zend_vm_gen.php scripts to work.

@DanielEScherzer
Copy link
Member

What was the issue with 7.4 for gen_stub? I had intentionally avoided using things that would require 8.0+ in my cleanups
CC @kocsismate - this will allow using 8.0 features in gen_stub if merged

@petk
Copy link
Member Author

petk commented Jan 14, 2026

What was the issue with 7.4 for gen_stub?

In PHP 8.4:
Fatal error: Uncaught Error: Call to undefined function str_ends_with() in /opt/php-src/build/gen_stub.php:87

and in PHP-8.5 and master:

Fatal error: Uncaught TypeError: Typed property EvaluatedValue::$value must be an instance of mixed, string used in /opt/php-src/build/gen_stub.php:2357

@kocsismate
Copy link
Member

@DanielEScherzer Yes, basically Nikita's request was not to increase the minimum required PHP version to a too recent version, but he told this a few ago already when PHP 8.0 was only a couple of years old.

Now I think it's OK to make this change, especially because proper support for PHP 7.4 is broken for a while ^^ So at least the fact that no one complained confirms that we won't break too many workflows :)

And then the next question: is it ok to increase the minimum version to PHP 8.1 so that readonly properties can be used? IMO it's also a viable option besides PHP 8.0.

@petk
Copy link
Member Author

petk commented Jan 26, 2026

And then the next question: is it ok to increase the minimum version to PHP 8.1 so that readonly properties can be used?

I think so, yes. Probably this version might be limited in cases when building PHP from source on systems that have some old PHP installed. And I don't see any reason why this would cause any issues out there.

Edit: Another possible reason for very very old PHP version used here was that once this version was hardcoded in build/php.m4 file directly (in the PHP_PROG_PHP macro) if some extensions were using the old macro signature without the version argument. This PHP_PROG_PHP macro was then refactored so the minimum required version is only applicable here when using it during php-src building. Extensions out there also shouldn't have this issue because PHP installed on some system is the one being targeted when extension is built.

At the time of writing, PHP found on host system must be at least 8.0
for build/gen_stub.php and Zend/zend_vm_gen.php scripts to work.

Minimum required version is updated to 8.1 to still support building PHP
from source on any possible old systems, and enabling new features in
build/gen_stub.php, such as readonly properties.
@petk petk force-pushed the patch-min-php-version branch from a5838c0 to 69ec11f Compare January 26, 2026 20:44
@kocsismate
Copy link
Member

LGTM on my part, but I don't know if this needs more discussion (at least among main contributors) 🤷

@thg2k
Copy link
Contributor

thg2k commented Jan 27, 2026

Please don't raise requirements for gen stub. In fact it should be fixed to actually work with all versions since 7.4.

The reason is that it is an essential tool for building php itself, and 7.4 is the last version that does not require php to build itself.

So you can build 7.4 to then build 8.x.

Otherwise it forces to use binary 3rd party or distro packages, increasing the supply chain attack surface.

@petk
Copy link
Member Author

petk commented Jan 27, 2026

Please don't raise requirements for gen stub.

Which version would be then suitable to update this requirement? PHP 9? PHP 10?

The reason is that it is an essential tool for building php itself

PHP isn't required to build PHP itself. This is only for development of php-src, when some stub.php file changes to regenerate its arginfo.h file.

@thg2k
Copy link
Contributor

thg2k commented Jan 28, 2026

Please don't raise requirements for gen stub.

Which version would be then suitable to update this requirement? PHP 9? PHP 10?

I would raise the requirement when needed. Do you need to raise the requirement? Like for enums or some kind of very important feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants