Re: [DOC-BUGS] Possible BUG?
[email protected] (Tiffany Taylor) Mon, 6 Dec 2021 09:42:20 -0600
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <CAHSBg453f7P1VKXSBasB6Y-WoX1nWjEEtL_QZ2by0rJtyLRcZw@mail.gmail.com> |
On Mon, Dec 6, 2021 at 9:31 AM zerof <[email protected]> wrote: > Why is it that whenever I run this code and different versions of PHP, > in versions 7.4.26 and 8.0.13 it gives a Parse error, but in version > 8.1.0 it doesn't give any error? > > <?php > > if(PHP_MAJOR_VERSION == 8) > { > echo 'PHP '. PHP_VERSION . '<br>'; > define("k16a", 0o1023); > echo 'k16a = ' . k16a; > } > else > { > echo 'PHP '. PHP_VERSION . '<br>'; > define("k16a", 01023); > echo 'k16a = ' . k16a; > } > > // PHP 8.1.0 > // k16a = 531 > > // PHP 8.0.13 > > // Parse error: syntax error, unexpected identifier "o1023", expecting ")" in ...echo16.php on line 6 > > > // PHP 7.4.26 > > // Parse error: syntax error, unexpected 'o1023' (T_STRING), expecting ')' in ...echo16.php on line 6 > > ?> > > -- > prof José Roberto Fernandes ( ZEROF ) > São Paulo, SP, Brasil > Not a bug. :) In 8.0, the `define` keyword removed support for barewords in values[1]. In 8.1, support for explicit octal integer literal notation[2] came. I'm unsure if this is documented appropriately, but I knew what the RFCs were off-hand. Docs for 8.1 are still in the process of completion. [1] https://wiki.php.net/rfc/deprecate-bareword-strings (deprecated in 7.2, throws error in 8.0) [2] https://wiki.php.net/rfc/explicit_octal_notation