Ticket #182 (closed defect: fixed)
GLOB_BRACE not supported in some systems
| Reported by: | miklb | Owned by: | moeffju |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.5 |
| Component: | Habari Core Software | Version: | SVN |
| Keywords: | has_patch | Cc: |
Description
Preface: issue reported by user sparkx on IRC, using Solaris, via Joyent hosting
Perhaps a fringe issue, but " The GLOB_BRACE flag is not available on some non GNU systems, like Solaris " http://us.php.net/glob
The only place this is used is in checking for screenshots on admin/themes. The error thrown is "Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' ../system/classes/adminhandler.php : Line 398", which relates to the get_all_data function in system/classes/themes.php starting on line 38.
I thought I had found a solution, but
//if GLOB_BRACE not available
if ( !defined("GLOB_BRACE") )
{
if ( $screenshot = glob("$theme_path/*.jpg") );
elseif ( $screenshot = glob("$theme_path/*.jpeg") );
elseif ( $screenshot = glob("$theme_path/*.png") );
elseif ( $screenshot = glob("$theme_path/*.gif") );
}
else {
if ( $screenshot= Utils::glob( $theme_path . '/screenshot.{png,jpg,gif}' , GLOB_BRACE) ) {
$themedata['screenshot'] = Site::get_url( 'habari' ) . "/" . dirname(str_replace( HABARI_PATH, '', $theme_path )) . '/' . basename( $theme_path ) . "/" . basename(reset($screenshot));
}
else {
$themedata['screenshot'] = Site::get_url( 'habari' ) . "/system/admin/images/screenshot_default.png";
}
}
self::$all_data[$theme_dir] = $themedata;
}
}
return self::$all_data;
}
didn't work in the users environment (via IRC, said blanked entire site), but did work in my test environment.
I suggest we find an alternate solution for this single use of the function, or figure out what I did wrong, as this would seem to open up more platforms.
