Re: PHP 4.0 Bug #5676: preg_replace and 'e' modifyer eval problem
| From: | Wico de Leeuw | Date: | Thu, 20 Jul 2000 15:19:30 +0000 |
| Subject: | Re: PHP 4.0 Bug #5676: preg_replace and 'e' modifyer eval problem | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-25228@lists.php.net to get a copy of this message | ||
At 12:36 19-7-00 +0000, wico@cnh.nl wrote:
Ok i think it isn't the sollution to put the match into a var ($1) but trowing a addslashes at the found match will be a good start: to make it easy for you :) i think it should be change somewhere in function preg_do_eval (etx/pcre/php_pcre.c) 558 + 559:From: wico@cnh.nlOperating system: linuxPHP version: 4.0 Latest CVS (19/07/2000) PHP Bug Type: Scripting Engine problemBug description: preg_replace and 'e' modifyer eval problem <?echo preg_replace("'<(.*?)>'ime", "Wico('\\1');", "try <'to' match \"this\"> in php");function Wico ($plop) { return("plop"); }?> // this will work better I think (if you guys are so nice want to build into php for us // i can't replace all ' with " or visaversa
match = subject + offsets[backref<<1];
match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
someone said to me to add this after thos statements:
match = php_addslashes(match,0, &match_len,0); match_len--;the problem of the eval is fixed then but the founded match is to long when you get it in the function. I'm not a c programmer, so if someone could fix this please and send me a diff or even better puts it in the cvs my day will be good (and i can continue to work, boss also happy :) Greetz, Wico
<?echo preg_replace("'<(.*?)>'ime", "Wico($1);", "try <'to' match \"this\"> in php");function Wico ($plop) { return("plop"); }?> -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net