Last modified: 2010-05-15 15:59:45 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 T13355, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11355 - safe_mode check broken (fix inside)
safe_mode check broken (fix inside)
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.11.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-15 22:37 UTC by Philipp Gruber
Modified: 2010-05-15 15:59 UTC (History)
0 users

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


Attachments

Description Philipp Gruber 2007-09-15 22:37:37 UTC
In my wiki, when generating thumbnails, I got an error which said, that it can't generate thumbnails because safe_mode was on, although I disabled safe_mode.

After searching in the code, I found the followig:

    if( ini_get( 'safe_mode' )) {
        wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" );
        $retval = 1;
        return "Unable to run external programs in safe mode.";
    }

The problem here is, that the if only checks wether the variable safe_mode is set. In my case, it was actually set, but the value is 'Off'. 

Then I changed it to 
    if( ini_get( 'safe_mode' ) && ini_get('safe_mode') != 'Off') {
And now it works fine. It's not a nice solution, but it works for me. Not sure wether it is neccessary to check also for 'off', '0', 'false', etc.

HTH

Philipp
Comment 1 Brion Vibber 2007-09-17 19:54:58 UTC
Fixed in r25896.

The problem seems to be that PHP is a bit inconsistent about what it returns for these settings; when they're set via php_value or php_admin_value in the Apache configuration, it returns the original string instead of the boolean value, while normally they're normalized to '0' or '1' based on the interpretation of the php.ini or php_flag / php_admin_flag setting.

This gets confusing because the way it interprets the strings is different from how PHP coerces strings into boolean values. I've attempted to replicate this in a new wfIniGetBool() wrapper, which in my quick testing seems to match.

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


Navigation
Links