Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 27, 2016

We allow negative numeric offsets for the simple syntax inside
double-quoted and heredoc strings.

We allow negative numeric offsets for the simple syntax inside
double-quoted and heredoc strings.
@cmb69
Copy link
Member Author

cmb69 commented Sep 27, 2016

I'm not sure whether https://bugs.php.net/72918 qualifies as bug, or should be regarded as feature request. The documentation states:

Similarly, an array index or an object property can be parsed. With array indices, the closing square bracket (]) marks the end of the index.

According to this, negative offsets would have to be supported.

Anyhow, supporting negative offsets seems to be particularly appealing since negative offsets are supported for strings as of PHP-7.1, so even if we don't consider this issue to be a bug, the patch might be considered to be applied to PHP-7.1, too.

@cmb69
Copy link
Member Author

cmb69 commented Oct 7, 2016

@flaupretre As you've authored the Generalize support of negative string offsets RFC, what do you think about this PR?

@hikari-no-yume
Copy link
Contributor

Not supporting this on arrays seems like an oversight, given array keys can be negative numbers, and it's additionally useful now given PHP 7.1's negative string offset support. Targeting 7.1 makes sense to me.

@nikic
Copy link
Member

nikic commented Oct 13, 2016

Yeah, agree. I'd like to see this land in PHP 7.1.

Please fix the indent in zend_language_parser.y and adjust the comment in https://github.com/cmb69/php-src/blob/8d2ef27608a69817ad3ad282cea9d925913ff4e5/Zend/zend_language_scanner.l#L1878 to say '[' or '-'.

@cmb69
Copy link
Member Author

cmb69 commented Oct 13, 2016

@nikic Thanks!

@dshafik Okay to target PHP 7.1?

@dshafik
Copy link
Contributor

dshafik commented Oct 13, 2016

@cmb69 yes

@cmb69
Copy link
Member Author

cmb69 commented Oct 14, 2016

Thanks! Applied with commit 2cc3aeb.

@cmb69 cmb69 closed this Oct 14, 2016
@cmb69 cmb69 deleted the bug72918 branch October 14, 2016 12:20
salathe pushed a commit to salathe/phpdoc-en that referenced this pull request Oct 14, 2016
LawnGnome pushed a commit to LawnGnome/phpdoc-en that referenced this pull request Oct 14, 2016
svn2github pushed a commit to svn2github/phpdoc_en that referenced this pull request Oct 14, 2016
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.

4 participants