-
Notifications
You must be signed in to change notification settings - Fork 806
Add missing ZEND constants and descriptions of their PHP aliases #3054
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this really an int? And is this is an alias for the ZEND constant? If so maybe saying that it is an alias of
&Alias; <constant>NAME</constant>
?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.
Yes, the PHP constants are int and represent the same value as the bool ZEND constants (see below for more details). If based on the below you think that I should mark either constant as an alias, just let me know.
The ZEND constants:
Zend/zend_constants_arginfo.h#L26-L27
And the PHP constants:
main/main_arginfo.h#L14-L15
PHP_DEBUG is simply:
main/php.h#L56
ZEND_DEBUG is defined during PHP compilation.
And ZEND_THREAD_SAFE (ZTS_V) and PHP_ZTS (PHP_ZTS):
main/php_main.h#L61-L69
Zend/zend_portability.h#L431-L435
ZTS is defined during PHP compilation.
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.
Okay, could you mark the
ZEND
constants as aliases for the PHP ones and mark them all as bool?I'm wondering if maybe we shouldn't deprecate the Zend ones and only keep the PHP ones, but that is out of scope for this PR (and is not a doc change anyway)
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.
Mark the int constants as bool too? I'm not sure how much those are used with strict comparison but if you're sure, I'll mark them as bool.
Of course this doesn't look good either if the docs show all four to be bool: :-)
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.
wtf is this... can you file an issue (or PR) on php-src to mention this, as those should be consistent.
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.
Sure, I'll open a PR.
I've searched on GitHub and some popular Composer packages and there doesn't seem to be too many uses of == or === with the PHP_(DEBUG|ZTS) constants.
There is only one of these in php-src:
ext/zip/tests/bug72660.phpt#L7
It's not an issue but I could change it to the below to be consistent with all the other uses of PHP_ZTS.
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.
Changing it to just be
if (PHP_ZTS)
makes senseThere 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 just opened php/php-src#13079 .
Also, I of course meant
if (!PHP_ZTS)
in my previous message.