Skip to content

Generic.PHP.LowerCaseKeyword complains __HALT_COMPILER is uppercase #2850

Closed
@kwhat

Description

@kwhat

phpcs --standard=PSR1,PSR2,PSR12 pharstub.php

----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] PHP keywords must be lowercase; expected
   |       |     "__halt_compiler" but found "__HALT_COMPILER"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

The problem is that despite what the documentation would suggest, this function must be upper case for include phar:///path/archive.phar/public/index.php to work from the phar stub. Seriously, I cannot make this stuff up:

PHP message: PHP Warning: include(): Failed opening 'public/index.php' for inclusion (include_path='phar:///tmp/archive.phar:.:/usr/share/php7:/usr/share/php') in /tmp/archive.phar on line 6"

Switching __halt_compiler() to __HALT_COMPILER() resolves this issue.

See halt-compiler vs phar.stub

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions