Skip to content

Commit

Permalink
[PHP 8.5] Use PHP_BUILD_DATE constant
Browse files Browse the repository at this point in the history
PHP 8.5 has a [new constant named `PHP_BUILD_DATE`](https://php.watch/versions/8.5/PHP_BUILD_DATE)
that contains the same value as the `phpinfo` build date.

We currently use "Build date" field parsed from `phpinfo` output, but
on PHP 8.5, we can simply return the `PHP_BUILD_DATE` value.
  • Loading branch information
Ayesh authored and bkdotcom committed Nov 19, 2024
1 parent a53c9f8 commit 278df1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Debug/Utility/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Php
*/
public function buildDate()
{
if (\defined('PHP_BUILD_DATE')) {
return PHP_BUILD_DATE;
}

\ob_start();
\phpinfo(INFO_GENERAL);
$phpInfo = \ob_get_clean();
Expand Down

0 comments on commit 278df1d

Please sign in to comment.