Fix for examples directory iterator in PHP 5.2. Future-proof things a bit by actually checking for file extension before accessing that index.
This commit is contained in:
+14
-12
@@ -262,22 +262,24 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
foreach ($children as $file) {
|
||||
if (!$file->isFile()) continue;
|
||||
|
||||
$filename = $file->getPathInfo();
|
||||
$filename = $file->getPathname();
|
||||
$info = pathinfo($filename);
|
||||
|
||||
switch($info['extension']) {
|
||||
case 'php':
|
||||
$class = $info['filename'];
|
||||
include_once($filename);
|
||||
break;
|
||||
if (isset($info['extension'])) {
|
||||
switch($info['extension']) {
|
||||
case 'php':
|
||||
$class = $info['filename'];
|
||||
include_once($filename);
|
||||
break;
|
||||
|
||||
case 'mustache':
|
||||
$template = file_get_contents($filename);
|
||||
break;
|
||||
case 'mustache':
|
||||
$template = file_get_contents($filename);
|
||||
break;
|
||||
|
||||
case 'txt':
|
||||
$output = file_get_contents($filename);
|
||||
break;
|
||||
case 'txt':
|
||||
$output = file_get_contents($filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user