Skip to content

Commit df10f36

Browse files
committed
use PHP_BUILD_PROVIDER with PHP 8.5+
1 parent 7461436 commit df10f36

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Platform/TargetPhp/PhpBinaryPath.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use function array_keys;
2626
use function array_map;
2727
use function assert;
28+
use function defined;
2829
use function dirname;
2930
use function explode;
3031
use function file_exists;
@@ -42,6 +43,7 @@
4243
use function trim;
4344

4445
use const DIRECTORY_SEPARATOR;
46+
use const PHP_BUILD_PROVIDER;
4547

4648
/**
4749
* @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks
@@ -210,9 +212,12 @@ public function loadedIniConfigurationFile(): string|null
210212
public function buildProvider(): string|null
211213
{
212214
/**
213-
* Newer versions of PHP will have a `PHP_BUILD_PROVIDER` constant
214-
* defined - {@link https://github.com/php/php-src/pull/19157}
215+
* PHP 8.5+ have a `PHP_BUILD_PROVIDER` constant defined
215216
*/
217+
if (defined('PHP_BUILD_PROVIDER')) {
218+
return PHP_BUILD_PROVIDER;
219+
}
220+
216221
if (
217222
preg_match('/Build Provider([ =>\t]*)(.*)/', $this->phpinfo(), $m)
218223
&& array_key_exists(2, $m)

0 commit comments

Comments
 (0)