ID:               21287
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         *General Issues
 Operating System: linux debian
 PHP Version:      4.2.3
 New Comment:

behaviour confirmed also on 4.3

http://sunshine.krneki.org/phpinfo.php

i've tried the script with and without the phpA zend_extension, and if
it was active then i tried it in disabled mode (php_value phpa off -
inside .htaccess)

currentlly the php.ini file is the same as php.ini-recommended inside
the 4.3.0 distribution

i now definetly check if i str_replace that key inside the first loop
and the logging is as follows (same as before):

(1.228) 0.0028 replace block_spacing_height => <img
src="modules/themes/base/images/pixel.gif" align="middle" border="0"
alt="" height="10">
(1.232) 0.0040 block_spacing_height exists in parsevals?!?!?
(1.233) 0.0017 Undefined variables exist in root (site_footer.tpl):
Array
(
    [0] => Array
        (
            [0] => {block_spacing_height}
        )

)

ofcourse after the repeated str_replace the key is accurately replaced
so i dont know where the problem could live (if its on my side)...

is there any way i can track this more accuratelly than with my own
functions? debug_backtrace() perhaps?


Previous Comments:
------------------------------------------------------------------------

[2002-12-30 06:00:42] [EMAIL PROTECTED]

i have a template engine running, in it a string (content hereon) with
keys and an array (parsevals hereon) with key/values that need to be
replaced in the content

this is what i do:

foreach ($this->_parsevals as $key=>$val) {
        $retval = str_replace('{'.$key.'}',$val,$retval);
}

after that i do a preg_match_all to find all the remaining keys in the
content with this regexp: '/\{[A-Za-z][-_A-Za-z0-9]*\}/', and find
existing keys, which also exist in $this->_parsevals..


if (preg_match_all($this->regex_var,$retval,$result)) {
        foreach ($result[0] as $val) {
                $key = substr($val,1,-1);
                if (isset($this->_parsevals[$key])) {
                        condor_assert($key." exists in
parsevals?!?!?");
                        $retval = str_replace($val,
$this->_parsevals[$key],$retval);
                }
        }
}

condor_assert is a basic log function, and its activated with that
error message in there... another str_replace seems to solve the
problem of the "undefined variable" case..

i tried to reproduce this in a short-self-contained script but failed,
i will test it on 4.3 asap

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21287&edit=1

Reply via email to