ID:               36198
 User updated by:  thomas at pixtur dot de
 Reported By:      thomas at pixtur dot de
-Status:           Bogus
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Debian Server
 PHP Version:      5.1.2
 New Comment:

Thanks [EMAIL PROTECTED] Good hint.

After trying a little bit I discoverd, that writing the regex as...

 ereg("\{\?([a-z_]*)\}(.*)",$rest, $matches)

... escapting the {} brackets fixes the problem. 

This also clarifies my problem: {} is the length parameter for the
"preceding" match, which does not exists. So this was my fault. 
It's still strange that different PHP-installations behave
differently...

  thanks for your help


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

[2006-01-30 15:42:10] [EMAIL PROTECTED]

\ is special character in PHP strings. If you want to match ?, write it
as "\\?'.

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

[2006-01-29 13:08:49] thomas at pixtur dot de

As state in the report, I cannot personally reproduce the code. It was
reported by a user
(http://www.streber-pm.org/phpBB2/viewtopic.php?p=234#234). 

Since googling this message gives a lot of broken php-pages but not
explanation what so ever, I posted this bug to "Documantation Problem".
I need a explanation of what the error-message is trying to tell me, so
I can adjust my code.

  tom

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

[2006-01-29 12:39:49] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

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

[2006-01-29 12:37:42] thomas at pixtur dot de

Description:
------------
The warning only occurs on very few plattforms. I probably could fix it
in my code, if I could only understand it's meaning. If you google for
the error-message you will find tons of broken pages with the same
error but no explanation.




Reproduce code:
---------------
/* NOT reproducable */
class ListBlockColHtml extends ListBlockCol
{
        function render_tr(&$obj, $style="") {
                if(!isset($obj) || !is_object($obj)) {
                        trigger_error("ListBlockColHtml->render_tr() called 
without valid
object",E_USER_WARNING);
                        return;
                }
                $key= $this->key;
                $format= $this->format;
                $rest=$this->format;
                $style= $this->style
                      ? "class='$this->style'"
                      : '';

                while(  ereg("{\?([a-z_]*)}(.*)",$rest, $matches) ) { ### causes
error
                        $key=$matches[1];
                        $rest=$matches[2];
                        $value= isset($obj->$key) ? $obj->$key : "??$key";
                        $format=ereg_replace("{\?$key}",$value,$format);
                }
                print "<td $style>$format</td>";
        }
}



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


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

Reply via email to