-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Show build provider and unify version information printing #14657
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
Show build provider and unify version information printing #14657
Conversation
Vendors such as distributions can set the `PHP_BUILD_PROVIDER` variable, that gets printed in phpinfo. However, I find that users check `php -v` more often than phpinfo to see what PHP they're running. The problem with this is that it does not show that build provider information. This change makes the build provider information printed on an additional line of the version information.
FWIW, the motivation here is because I support users with both a Zend and non-Zend PHP. They try to disambiguate the two, see the "Zend Engine" text in |
Unbreaks build without PHP_BUILD_PROVIDER set.
Looks ok. And possibly useful info. Except that if some parser out there relies on this php -v output. But I'm sure they are aware that this entirety of the info is in possibility to change. Just out of curiosity, how are they building PHP without Zend engine? You mean like some embed-like SAPI that is separate from this code base with some heavy patching? |
No, it's just that they see "Zend Engine" and think they're using Zend's PHP distribution. |
FWIW I also noticed that CLI and CGI SAPIs have diverged in |
better grammatically; many different possibilities here though
I see. Thanks for the info. Ok, yes that makes sense then. |
Sorry for polluting your PR here. What I was also thinking is adding a new command-line option
Yes, unification would be very welcome across all these command-line interfaces. |
I think those make sense along with unifying the version information. New PR or just append it to this one? |
Yes, separate PRs for new command-line options. For the unification, I think it is easier to go into this PR. Whatever you find more comfortable. :D |
This makes it so that all of the SAPIs share the same code for printing version information. This is useful in case of any future changes to the version information, such as i.e. adding build provider to the output.
I'd only add the diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 250c9a0660..52e2fa745d 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -30,6 +30,7 @@
#include "phpdbg_arginfo.h"
#include "zend_vm.h"
#include "php_ini_builder.h"
+#include "php_main.h"
#include "ext/standard/basic_functions.h" The rest looks good to me and I think it's a very nice addition. Does someone else have any thought here perhaps? Unrelated note for the future to be synced: Some SAPIs in CLI mode don't seem to have command-line options much synced yet:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have the opinions about release managers for this, as I don't really have any opinions. @ramsey @adoy @SakiTakamachi @bukka (I'm missing some) but what do you think about this? |
It doesn't seem like there's any particular problem to me either. |
So, we can merge this? Sounds good to everyone? |
php_printf doesn't have same semantics, as phpdbg_out could be on a different output than stdout/err. Also add the phpdbg version (in case it differs from PHP's, to keep similar output before this PR)
we don't use them and CI doesn't like unused variables
Bumping to see if this can be merged. |
Here is now one warning (-Wformat-security) happening and error on the CI since there are errors enabled:
|
I'm just thinking about this a bit. This is the current output here by this PR:
Another option would be to extend the 1st line:
or:
Or if we join these info a bit together:
Basically, the feature freeze is in ~2 weeks, so there's time for all of this also I think. :) |
That's just for RFC to get voted on - features not requiring RFC can land in beta. So you have time till RC1. Just to clarify... :) |
Fixed that warning. I'm not too picky on the format, I just didn't want to get too bogged down in details. If there's consensus on doing it a specific way (or not to do it), I'll go with that, otherwise as-is should be fine. |
Yes, I think the format is just fine. It's also most properly seen that way and understood. I was just thinking out loud. |
Then I think this is ready for merge. |
Sounds good to me; does anyone have last-minute comments? |
@drupol would this impact how reproducible PHP is? |
Thanks for pinging me! I can test this tonight (3 to 4 hours from now) and check. IMO, it should not impact anything since Nix builds are in a controlled environment where macros like |
I don't think it would affect it either, as long as you keep |
I confirm that this does not have impact on reproducibility, if anyone is willing to reproduce (pun intended!) at home:
To add an env. variable in the build process, add it as such:
All good for me then! |
I'll merge this then. |
Vendors can set the
PHP_BUILD_PROVIDER
variable, that gets printed in phpinfo. However, I find that users checkphp -v
more often than phpinfo to see what PHP they're running. The problem with this is that it does not show that build provider information.This change makes the build provider information printed on an additional line of the version information.