-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add PHP_BUILD_DATE constant #16747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PHP_BUILD_DATE constant #16747
Conversation
This information can be occasionally useful, and would otherwise need to be parsed from `phpinfo()` output. However, maybe more importantly we unify the build date between what is given by `php -v` and `php -i`, since these compilation units are not necessarily preprocessed within the same second.
Isn’t this going to be problematic for reproducible builds? |
Well, we have this anyway (not the constant, but using |
So I have done a little bit checking and it's actually fine as both clang (16+) and gcc (7+) will set |
The reason why I mentioned it before is that if DATE and TIME were not safe for repro builds, then it wouldn't be a good idea to expose it as user space constant. But that's not the case so all good. :) |
See <#16747 (review)>. Co-authored-by: Ayesh Karunaratne <[email protected]>
Is there any good reason why it's a string in such inconvenient format instead of a unix timestamp that you could directly use with date()? |
It's what compilers give us. You can use |
This information can be occasionally useful, and would otherwise need to be parsed from
phpinfo()
output.However, maybe more importantly we unify the build date between what is given by
php -v
andphp -i
, since these compilation units are not necessarily preprocessed within the same second.This came up in #16560. While I don't mind a new
PHP_BUILD_DATE
constant, for me it's more important to unify the dates.Note that I'm not sure if the format is standardized; I believe so, though. The test will show.