[mythtv] Mythweb: init.php - problem with php split function

Dick Middleton dick at lingbrae.com
Mon Nov 22 17:51:37 UTC 2004

I'm having a look at MythWeb as distributed in Debian Sid.  Version 0.16 
I think.  I've found a bug - I'm not too sure what the fix is but I 
thought somebody ought to know assuming they don't already.

mythweb: init.php  line 133   (  Last Updated: 2004.07.06 (xris)  )

// Make sure the image cache path exists
     $path = '';
     foreach (split('/+', image_cache) as $dir) {
         $path .= $path ? "/" . $dir : $dir;
         if(!is_dir($path) && !mkdir($path, 0755))
             trigger_error('Error creating path for '.$path.': Please
check permissions.', FATAL);

Unfortunately if image_cache starts with a '/' this doesn't work.  The
PHP4 split function returns null for first element if pattern match is
found at the beginning of the string.  Odd, but true - see test script:


foreach (split('/+', '/var/local/video') as $dir) {
   print $dir ."\n";


More information about the mythtv-dev mailing list