PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Template_IT » Bug #9853

problems with dot in blockname

Details

Submitted2007-01-17 13:57 UTC
Fromtles dot kin201_pear at gadzarts dot org
Assigneddsp
StatusClosed
PackageHTML_Template_IT
PHP VersionIrrelevant
OSAll
Roadmaps1.3.0a1

Comments

[2007-01-17 13:57 UTC] tles dot kin201_pear at gadzarts dot org

Description:
------------
The patch provided with the bug #7651 is buggy :)

By closing this bug, it allow blocks like <!-- BEGIN foo.bar --> or variables like {foo.bar}

But the dot is a "regex modifier", so a new bug appear.

You may not use foo. and foo2 as blockname in the same template

It's may be the same things with blockname

Just my 2 cents

Christophe Colombier
A french guy

Test script:
---------------
<?php

require("HTML/Template/ITX.php");

$tpl = new HTML_Template_IT();

$tplContenu = <<<HTML
############ TEST ################

before foo1 bloc
<!-- BEGIN foo1 -->
In foo1
{VAR}
<!-- END foo1 -->
after foo1 bloc

before foo2 bloc
<!-- BEGIN foo2 -->
In foo2
{VAR}
<!-- END foo2 -->
after foo2 bloc

before bar bloc
<!-- BEGIN bar -->
In bar
{VAR}
<!-- END bar -->
after bar bloc

HTML;

$tpl->setTemplate($tplContenu);

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("foo1");

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("foo2");

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("bar");

$tpl->parse();
$tpl->show();

$tpl = new HTML_Template_IT();

$tplContenu = <<<HTML
############ TEST WITH DOT ################

before foo. bloc
<!-- BEGIN foo. -->
In foo.
{VAR}
<!-- END foo. -->
after foo. bloc

before foo1 bloc
<!-- BEGIN foo2 -->
In foo1
{VAR}
<!-- END foo2 -->
after foo2 bloc

before bar bloc
<!-- BEGIN bar -->
In bar
{VAR}
<!-- END bar -->
after bar bloc
HTML;

$tpl->setTemplate($tplContenu);

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("foo.");

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("foo2");

$tpl->setVariable("VAR" , "Ok !");
$tpl->parse("bar");

$tpl->parse();
$tpl->show();

?>

Expected result:
----------------
############ TEST ################

before foo1 bloc

In foo1
Ok !

after foo1 bloc

before foo2 bloc

In foo2
Ok !

after foo2 bloc

before bar bloc

In bar
Ok !

after bar bloc
############ TEST WITH DOT ################

before foo. bloc

In foo.
Ok !

after foo. bloc

before foo2 bloc

In foo2
Ok !

after foo2 bloc

before bar bloc

In bar
Ok !

after bar bloc

Actual result:
--------------
############ TEST ################

before foo1 bloc

In foo1
Ok !

after foo1 bloc

before foo2 bloc

In foo2
Ok !

after foo2 bloc

before bar bloc

In bar
Ok !

after bar bloc
############ TEST WITH DOT ################

before foo. bloc

In foo.
Ok !

after foo2 bloc

before bar bloc

In bar
Ok !

after bar bloc

[2007-02-12 19:57 UTC] dsp at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.