php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25742 smth bad with pear or php
Submitted: 2003-10-03 05:42 UTC Modified: 2004-09-01 16:20 UTC
From: creator at sacura dot net Assigned:
Status: Not a bug Package: PEAR related
PHP Version: 4.3.3 OS: windows 2000
Private report: No CVE-ID: None
 [2003-10-03 05:42 UTC] creator at sacura dot net
Description:
------------
Problem with some names of variables in templates files (PEAR/IT).

Reproduce code:
---------------
<?php

  require('HTML/Template/IT.php');

  $tsql = new HTML_Template_IT();   

  $tsql->loadTemplateFile("test.sql");
  $tsql->setVariable('C2','1');  
 
  print "test=". $tsql->get();

?>
and template (test.sql)
{DUMMY}
'{C2}/'
{DUMMY}       


Expected result:
----------------
Warning: Compilation failed: nothing to repeat at offset 3 in c:\php\pear\HTML\Template\IT.php on line 575
test= '/'

Actual result:
--------------
it should be this:
'1/'
I think so.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-06 04:05 UTC] creator at sacura dot net
it seems this is preg_replace bug
 [2003-10-06 04:07 UTC] creator at sacura dot net
In submission "expected result" and "actual result" must be swaped.
 [2003-10-08 07:14 UTC] cynic@php.net
what does $regs contain when you get this error?

 [2003-10-08 07:15 UTC] cynic@php.net
updating status...

 [2003-10-10 07:25 UTC] creator at sacura dot net
variable $regs is clean
 [2003-10-10 07:47 UTC] cynic@php.net
does this patch (warning, will be crippled by the textarea) solve your problem?

Index: HTML_Template_IT/IT.php
===================================================================
RCS file: /repository/pear/HTML_Template_IT/IT.php,v
retrieving revision 1.6
diff -u -u -r1.6 IT.php
--- HTML_Template_IT/IT.php	12 Mar 2003 02:25:16 -0000	1.6
+++ HTML_Template_IT/IT.php	10 Oct 2003 11:48:59 -0000
@@ -555,7 +555,7 @@
 
         }
 
-        if (!$flag_recursion && 0 != count($values)) {
+        if (!$flag_recursion && 0 != count($values) && 0 != count($regs)) {
             if ($this->_options['use_preg']) {
                 $regs        = array_map(array(
                                     &$this, '_addPregDelimiters'),
 [2003-10-10 07:50 UTC] cynic@php.net
disregard the last followup, please. I'm looking into the problem.
 [2004-09-01 16:20 UTC] alan_k@php.net
can you move this on pear.php.net - none of the pear maintainers read bugs.php.net and it more likely the package maintainer will be able to help.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 26 14:01:28 2020 UTC