llaville / php-compatinfo

Library that find out the minimum version and the extensions required for a piece of code to run
https://llaville.github.io/php-compatinfo/7.1/
Other
373 stars 20 forks source link

`const FOO = null;` does not require PHP 5.6.0 #228

Closed cmb69 closed 7 years ago

cmb69 commented 7 years ago

Consider the following PHP file:

<?php

const FOO = null;

Running php phpcompatinfo-5.0.4.phar analyser:run . yields:

Data Source Analysed

Directories                                          1
Files                                                1

Extensions Analysis

    Extension Matches REF  EXT min/Max PHP min/Max PHP all
    Core              Core 4.0.0       4.0.0
    Total [1]                          4.0.0

Namespaces Analysis

    Namespace Matches REF  EXT min/Max PHP min/Max PHP all
    +global           Core             5.6.0
    Total [1]                          5.6.0

No interface found

No trait found

No class found

No function found

Constants Analysis

    Constant  Matches REF  EXT min/Max PHP min/Max
    FOO       1       user             5.6.0
    null      1       Core 4.0.0       4.0.0
    Total [2]                          5.6.0

No condition found

Requires PHP 5.6.0 (min), PHP 5.6.0 (all)

However, this syntax is valid as of PHP 5.3.0.

Note that const FOO = false; and const FOO = true; are also erroneously reported to require at least PHP 5.6.0.

llaville commented 7 years ago

Just been released new version 5.0.5. Thanks Christoph for bug reporting !

cmb69 commented 7 years ago

Thanks, Laurent, for fixing this so fast! :)