Page MenuHomePhabricator

Empty PHP Notice in wfShellExec (GlobalFunctions.php)
Closed, ResolvedPublic

Description

From the Support desk Integrating Visual Editor and Parsoid, one user has the following messages in error logs:

[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP Notice: in /var/www/public_html/upload/w/includes/GlobalFunctions.php on line 2874
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP Stack trace:
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 1. {main}() /var/www/public_html/upload/w/load.php:0
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 2. ResourceLoader->respond() /var/www/public_html/upload/w/load.php:47
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 3. ResourceLoader->getCombinedVersion() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:681
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 4. array_map() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:629
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 5. ResourceLoader->{closure:/var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:627-629}() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:6
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 6. ResourceLoaderModule->getVersionHash() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:628
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 7. ResourceLoaderStartUpModule->getDefinitionSummary() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoaderModule.php:470
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 8. ResourceLoaderStartUpModule->getAllModuleHashes() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoaderStartUpModule.php:382
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 9. ResourceLoader->getCombinedVersion() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoaderStartUpModule.php:409
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 10. array_map() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:629
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 11. ResourceLoader->{closure:/var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:627-629}() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:6
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 12. ResourceLoaderModule->getVersionHash() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoader.php:628
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 13. VisualEditorDataModule->getDefinitionSummary() /var/www/public_html/upload/w/includes/resourceloader/ResourceLoaderModule.php:470
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 14. VisualEditorDataModule->getScript() /var/www/public_html/upload/w/extensions/VisualEditor/VisualEditorDataModule.php:161
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 15. GitInfo->getHeadCommitDate() /var/www/public_html/upload/w/extensions/VisualEditor/VisualEditorDataModule.php:46
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 16. wfShellExec() /var/www/public_html/upload/w/includes/GitInfo.php:218
[Tue Jun 09 06:53:02 2015] [error] [client 192.168.200.1] PHP 17. trigger_error() /var/www/public_html/upload/w/includes/GlobalFunctions.php:2874

On that line there's an empty trigger_error:

https://git.wikimedia.org/blob/mediawiki%2Fcore.git/b305d72af57101d580783d639e0cd88f2a049dae/includes%2FGlobalFunctions.php#L2874

// Clear last error
// @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged
@trigger_error( '' );

Is that supposed to be a "good" way to clear PHP errors? Also, why not check first if there was an error?

Apparently, the log displays only the last error, so the trigger_error is masking the real error here. If there was an error before that line, it would be masked by the new empty and not meaningful error.

Event Timeline

Ciencia_Al_Poder raised the priority of this task from to Needs Triage.
Ciencia_Al_Poder updated the task description. (Show Details)
Ciencia_Al_Poder added a subscriber: Ciencia_Al_Poder.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 24 2015, 11:30 AM

Change 436464 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/core@master] Resolve a TODO asking for error_clear_last()

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

Change 436464 merged by jenkins-bot:
[mediawiki/core@master] shell: Resolve a TODO asking for error_clear_last()

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