Last modified: 2012-10-21 02:15:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T43248, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41248 - __DIR__ causes error
__DIR__ causes error
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
AntiSpoof (Other open bugs)
master
All All
: Unprioritized major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-20 23:58 UTC by Hazard-SJ
Modified: 2012-10-21 02:15 UTC (History)
2 users (show)

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


Attachments

Description Hazard-SJ 2012-10-20 23:58:23 UTC
I checked out the AntiSpoof extension and afterwards, while running the upgrade script, I got an error similar to the following:

Warning: require(/home/path/w/__DIR__/AntiSpoofHooks.php): failed to open stream: No such file or directory in /home/path/w/includes/AutoLoader.php on line 1007
Fatal error: require(): Failed opening required '/home/path/w/__DIR__/AntiSpoofHooks.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/path/w/includes/AutoLoader.php on line 1007


I had to change the value from __DIR__ to dirname( __FILE__ ) . '/' to get the script to execute.

Afterwards, running batchAntiSpoof.php, I got similar errors, clearly showing __DIR__ in the paths displayed.



In addition, with the SimpleAntiSpam, for an example, with $wgShowExceptionDetails set to true, I saw

Warning: include(__DIR__/SimpleAntiSpam.i18n.php) [function.include]: failed to open stream: No such file or directory in /home/path/w/includes/LocalisationCache.php on line 455

Warning: include(__DIR__/SimpleAntiSpam.i18n.php) [function.include]: failed to open stream: No such file or directory in /home/path/w/includes/LocalisationCache.php on line 455

Warning: include() [function.include]: Failed opening '__DIR__/SimpleAntiSpam.i18n.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/path/w/includes/LocalisationCache.php on line 455


These errors were resolved with the use of "dirname( __FILE__ ) . '/'" instead of "__DIR__". Would it be better to use "dirname( __FILE__ ) . '/'" in place of __DIR__ in all cases then?

(Note: The wiki is on Linux OS and using an Apache server.)
Comment 1 Hazard-SJ 2012-10-21 00:38:03 UTC
PHP version error.
Comment 2 Andre Klapper 2012-10-21 02:14:07 UTC
(In reply to comment #1)
> PHP version error.

Could you elaborate, e.g. which version you initially used and which version was needed?
Comment 3 Alex Monk 2012-10-21 02:15:19 UTC
From IRC:
<Hazard-SJ> MatmaRex: The server in question uses PHP 5.2.17

__DIR__ was added in PHP 5.3.0.

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


Navigation
Links