Page MenuHomePhabricator

scap's check_php_syntax() should check for text before '<?php' in PHP files
Closed, ResolvedPublic

Description

https://gerrit.wikimedia.org/r/#/c/196279/ broke the site because it introduced whitespace before the opening <?php marker in a configuration file that is loaded on every request. scap should check for that.

Event Timeline

ori raised the priority of this task from to Needs Triage.
ori updated the task description. (Show Details)
ori added a project: Deployments.
ori added subscribers: ori, bd808.

Things with stuff before <?php in core+extensions+skins:

1/home/km/projects/vagrant/mediawiki/maintenance/update.php
2/home/km/projects/vagrant/mediawiki/extensions/WikidataEntitySuggester/php-client/wesTest.php
3/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/sample_posteddata.php
4/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/php/advanced.php
5/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/php/replace.php
6/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/php/standalone.php
7/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/php/events.php
8/home/km/projects/vagrant/mediawiki/extensions/SemanticPageMaker/scripts/wysiwyg/ckeditor/_samples/php/replaceall.php
9/home/km/projects/vagrant/mediawiki/extensions/TweetANew/TweetANew.body.php
10/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/assets/_posteddata.php
11/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/php/advanced.php
12/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/php/replace.php
13/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/php/standalone.php
14/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/php/events.php
15/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/ckeditor/_samples/php/replaceall.php
16/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/tests_selenium/LocalSettings.php
17/home/km/projects/vagrant/mediawiki/extensions/WYSIWYG/WYSIWYG/tests_selenium_ext_img/LocalSettings.php
18/home/km/projects/vagrant/mediawiki/extensions/WikiLexicalData/util/voctrain/exercise.php
19/home/km/projects/vagrant/mediawiki/extensions/Convert2Wiki/src/main/special/Convert2WikiSpecial.php
20/home/km/projects/vagrant/mediawiki/extensions/LinkedWiki/lib/SPARQL/ParserCSV.php
21/home/km/projects/vagrant/mediawiki/extensions/LinkedWiki/lib/SPARQL/ParserTurtle.php
22/home/km/projects/vagrant/mediawiki/extensions/Scribunto/engines/LuaCommon/lualib/ustring/make-tables.php
23/home/km/projects/vagrant/mediawiki/extensions/Scribunto/engines/LuaCommon/lualib/ustring/make-normalization-table.php
24/home/km/projects/vagrant/mediawiki/extensions/ThemeDesigner/frame/layout.php
25/home/km/projects/vagrant/mediawiki/extensions/ConventionExtension/ui/admin/SpecialDashboard.php
26/home/km/projects/vagrant/mediawiki/extensions/SecureSessions/php-geoip/benchmark.php
27/home/km/projects/vagrant/mediawiki/extensions/SecureSessions/php-geoip/timezone/test_timezone.php
28/home/km/projects/vagrant/mediawiki/extensions/SecureSessions/php-geoip/admin/generate_geoipregionvars.php
29/home/km/projects/vagrant/mediawiki/extensions/Math/tests/MathMathMLTest.php
30/home/km/projects/vagrant/mediawiki/extensions/SemanticWebBrowser/lib/EasyRdf/._Isomorphic.php
31/home/km/projects/vagrant/mediawiki/extensions/SemanticWebBrowser/lib/EasyRdf/Serialiser/._RdfPhp.php
32/home/km/projects/vagrant/mediawiki/extensions/SemanticWebBrowser/lib/EasyRdf/Serialiser/._Json.php
33/home/km/projects/vagrant/mediawiki/extensions/Mpdf/mpdf/utils/index.php
34/home/km/projects/vagrant/mediawiki/includes/libs/normal/UtfNormalTest2.php
35/home/km/projects/vagrant/mediawiki/tests/phpunit/phpunit.php

Some are shebangs, other look like legit errors (MathMLTest).

greg triaged this task as High priority.Mar 12 2015, 6:50 PM

Change 196306 had a related patch set uploaded (by Legoktm):
check_php_syntax: Check for any content before opening <?php tag

https://gerrit.wikimedia.org/r/196306

Math was fixed in 5a50bb312c4bd7355835e6939508687b5a7f796b, and that looked like the only issue with WMF-deployed code.

Change 196306 merged by jenkins-bot:
Check for any content before opening <?php tag prior to syncing

https://gerrit.wikimedia.org/r/196306

Legoktm moved this task from Needs Review/Feedback to Done on the MediaWiki-Core-Team board.