Author: rb
Date: Mon Aug 13 16:58:15 2007
New Revision: 5906
Log:
- Fixed issue #11228: ezcTemplate: cannot supply an absolute Win32-Path to
$t->process().
Modified:
trunk/Template/ChangeLog
trunk/Template/src/template.php
trunk/Template/tests/template_test.php
Modified: trunk/Template/ChangeLog
==============================================================================
--- trunk/Template/ChangeLog [iso-8859-1] (original)
+++ trunk/Template/ChangeLog [iso-8859-1] Mon Aug 13 16:58:15 2007
@@ -1,5 +1,6 @@
- Made the TemplateObject available in CustomBlocks. Thanks to Felix Weis for
the patch.
+- Fixed issue #11228: Cannot supply an absolute Win32-Path to $t->process().
1.2 - Monday 02 July 2007
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modified: trunk/Template/src/template.php
==============================================================================
--- trunk/Template/src/template.php [iso-8859-1] (original)
+++ trunk/Template/src/template.php [iso-8859-1] Mon Aug 13 16:58:15 2007
@@ -272,7 +272,7 @@
$this->properties["stream"] = $location->getPath();
}
- if ( strlen( $this->properties["stream"] ) > 0 &&
$this->properties["stream"][0] != "/" ) // Is it a relative path?
+ if ( strlen( $this->properties["stream"] ) > 0 &&
!ezcBaseFile::isAbsolutepath($this->properties["stream"]) ) // Is it a relative
path?
{
$this->properties["stream"] = $config->templatePath .
DIRECTORY_SEPARATOR . $this->properties["stream"];
}
Modified: trunk/Template/tests/template_test.php
==============================================================================
--- trunk/Template/tests/template_test.php [iso-8859-1] (original)
+++ trunk/Template/tests/template_test.php [iso-8859-1] Mon Aug 13 16:58:15 2007
@@ -205,6 +205,34 @@
}
+ public function testBla()
+ {
+ file_put_contents( $this->templatePath . "/test.ezt", "Hello world" );
+ file_put_contents( $this->templatePath . "/test2.ezt", "Hello world2"
);
+
+ $absPath = $this->templatePath;
+
+ $conf = ezcTemplateConfiguration::getInstance();
+ $conf->templatePath = $absPath;
+
+ $template = new ezcTemplate();
+ self::assertEquals( "Hello world", $template->process( "test.ezt",
$conf ) );
+
+ $conf->templatePath = "/this/is/wrong";
+ self::assertEquals( "Hello world2", $template->process( $absPath .
DIRECTORY_SEPARATOR . "test2.ezt", $conf ) );
+
+
+ try
+ {
+ self::assertEquals( "Hello world2", $template->process(
"test2.ezt", $conf ) );
+ self::fail("Expected an exception");
+ } catch( ezcTemplateException $e)
+ {
+ self::assertEquals("The requested template file
'/this/is/wrong/test2.ezt' does not exist.", $e->getMessage() );
+
+ }
+ }
+
}
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components