Skip to content

No longer allow block mode for declare(encoding) #9455

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Aug 31, 2022

As discussed in #9446, this isn't properly supported, and it is
doubtful if it ever can be useful, let alone if it could be properly
supported. Therefore, we disallow the confusing block mode in the
first place.

As discussed in php#9446, this isn't properly supported, and it is
doubtful if it ever can be useful, let alone if it could be properly
supported.  Therefore, we disallow the confusing block mode in the
first place.
@cmb69 cmb69 marked this pull request as ready for review August 31, 2022 15:36
Comment on lines +16 to +17
--EXPECTF--
Fatal error: Encoding declaration pragma must not use block mode in %s on line %d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes no sense to test block mode thrice. Just change the test to not use block mode (or drop it if redundant).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, right! This was just to get CI green quickly. I'll update/fix this soonish.

@@ -6109,6 +6109,11 @@ static void zend_compile_declare(zend_ast *ast) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be "
"the very first statement in the script");
}

if (ast->child[1] != NULL) {
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must not "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must not "
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration must not "

I know that pragma is used in the current wording, but the strict_type one does not use this word, so it might make sense to change the wording to be consistent

@alexdowad
Copy link
Contributor

No objections from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants