Page MenuHomePhabricator

replace php_sapi_name() with PHP_SAPI
Closed, ResolvedPublic


This bug is about replacing our calls to php_sapi_name() by the PHP building constant PHP_SAPI.

PHP_SAPI has been available since PHP 4.2 and provide the same string that php_sapi_name() provides. I find it shorter and cleaner to read. Consider:

if( php_sapi_name() !== 'cli ) { }

if( PHP_SAPI !== 'cli ) { }

Version: 1.20.x
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:28 AM
bzimport set Reference to bz37957.
bzimport added a subscriber: Unknown Object (MLST).

CCing Sam and Chad for input.

Patch in Gerrit:

(In reply to comment #2)

PHP_SAPI is also faster.

I will now add "MediaWiki performance engineering" to my résumé.

Bug 44633 track the addition of a rule in PHP CodeSniffer

We could probably do the same for some extensions.

Change 80866 had a related patch set uploaded by Yuvipanda:
Use PHP_SAPI instead of php_sapi_name()

Change 80866 merged by jenkins-bot:
Use PHP_SAPI instead of php_sapi_name()