https://bugzilla.wikimedia.org/show_bug.cgi?id=41248

       Web browser: ---
             Bug #: 41248
           Summary: $dir in AntiSpoof.php causes error
           Product: MediaWiki extensions
           Version: master
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: AntiSpoof
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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.)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to