Re: Possible BUG?

From: Date: Mon, 06 Dec 2021 15:44:18 +0000
Subject: Re: Possible BUG?
References: 1 2  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19363@lists.php.net to get a copy of this message
On Mon, Dec 6, 2021 at 9:42 AM Tiffany Taylor <tiffany.k.taylor@gmail.com>
wrote:

> On Mon, Dec 6, 2021 at 9:31 AM zerof <zerof.one@gmail.com> 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
>

I should clarify, the support for barewords altogether was deprecated in
7.2, then removed in 8.0. It wasn't limited to the define keyword.


Thread (3 messages)

« previous php.doc.bugs (#19363) next »