Skip to content

Fixed bug #44889 - #441

Closed
bwoebi wants to merge 1 commit into
php:masterfrom
bwoebi:bug_44889
Closed

bwoebi wants to merge 1 commit into
php:masterfrom
bwoebi:bug_44889

Conversation

@bwoebi

@bwoebi bwoebi commented Sep 12, 2013

Copy link
Copy Markdown
Member

This PR fixes https://bugs.php.net/bug.php?id=44889

It's a simple check if it's the end of the input string and if the string is <?php. And when yes, it extends the yyleng to include the whole <?php string and moves YYCURSOR by sizeof("php").

@nikic

nikic commented Sep 12, 2013

Copy link
Copy Markdown
Member

Why is this only done with short tags enabled? Furthermore, it looks to me like this may dereference the string pasts its end.

@bwoebi

bwoebi commented Sep 12, 2013

Copy link
Copy Markdown
Member Author

@nikic There is some padding in yytext. So ./sapi/cli/php -dshort_open_tag=1 -r "print_r(token_get_all('<?a'));" doesn't segfault.

Hmm, I just see, that without short_open_tags the token is wrong without short_open_tags. Will fix.

@bwoebi

bwoebi commented Sep 12, 2013

Copy link
Copy Markdown
Member Author

@nikic Used YYFILL to ensure that the buffer is always filled (= no segfault triggering dereference). Also with short_open_tag=Off it works now.

Comment thread Zend/zend_language_scanner.l Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

char should be zend_bool here. The YYFILL has to come after the declaration to be C89 compatible.

(T_OPEN_TAG doesn't match <?php without any trailing characters with short_open_tags=On)
@jpauli

jpauli commented Feb 23, 2015

Copy link
Copy Markdown
Member

Not reproductible on latest 5.5 nor 5.6.
Closing

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants