Last modified: 2013-08-25 17:34:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 37957 - replace php_sapi_name() with PHP_SAPI
replace php_sapi_name() with PHP_SAPI
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Low enhancement (vote)
: 1.21.0 release
Assigned To: Nobody - You can work on this!
: platformeng
Depends on:
Blocks: code_quality
  Show dependency treegraph
Reported: 2012-06-26 09:13 UTC by Antoine "hashar" Musso (WMF)
Modified: 2013-08-25 17:34 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Antoine "hashar" Musso (WMF) 2012-06-26 09:13:49 UTC
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 ) { }
Comment 1 Antoine "hashar" Musso (WMF) 2012-06-26 09:14:45 UTC
CCing Sam and Chad for input.
Comment 2 Tim Starling 2013-02-04 02:05:37 UTC
PHP_SAPI is also faster.
Comment 3 Ori Livneh 2013-02-04 03:14:01 UTC
Patch in Gerrit:

(In reply to comment #2)
> PHP_SAPI is also faster.

I will now add "MediaWiki performance engineering" to my résumé.
Comment 4 Antoine "hashar" Musso (WMF) 2013-02-04 08:18:26 UTC
Bug 44633 track the addition of a rule in PHP CodeSniffer
Comment 5 Alex Monk 2013-02-04 21:04:09 UTC
We could probably do the same for some extensions.
Comment 6 Ori Livneh 2013-02-05 04:36:51 UTC

That covers all extensions currently deployed, I think.
Comment 7 Gerrit Notification Bot 2013-08-25 16:29:42 UTC
Change 80866 had a related patch set uploaded by Yuvipanda:
Use PHP_SAPI instead of php_sapi_name()
Comment 8 Yuvi Panda 2013-08-25 16:34:40 UTC if people want to knock off some more extensions :)
Comment 9 Gerrit Notification Bot 2013-08-25 17:34:50 UTC
Change 80866 merged by jenkins-bot:
Use PHP_SAPI instead of php_sapi_name()

Note You need to log in before you can comment on or make changes to this bug.