Re: ereg_replace returns wrong characters
| From: | derick@php.net | Date: | Sun, 05 May 2002 07:14:50 +0000 |
| Subject: | Re: ereg_replace returns wrong characters | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-5322@lists.php.net to get a copy of this message | ||
On Sun, 5 May 2002, Rui Hirokawa wrote:
> I request again because it fix critical imcompatibility problem in PHPlib.
> Could I commit this patch in PHP-4.2.0 branch ?
Yes, as I'll be doing an RC2 today/tomorrow. We have some time to test it
then.
Derick
>
>
> hirokawa Sat May 4 07:20:12 2002 EDT
>
> Modified files:
> /php4/ext/standard reg.c
> Log:
> fixed a problem that ereg_replace() couldn't match with line stand/end marker.
>
> Index: php4/ext/standard/reg.c
> diff -u php4/ext/standard/reg.c:1.61 php4/ext/standard/reg.c:1.62
> --- php4/ext/standard/reg.c:1.61 Mon Apr 8 14:43:35 2002
> +++ php4/ext/standard/reg.c Sat May 4 07:20:12 2002
> @@ -17,7 +17,7 @@
> | Jaakko Hyv$BgU(Bti <jaakko@hyvatti.iki.fi> |
> +----------------------------------------------------------------------+
> */
> -/* $Id: reg.c,v 1.61 2002/04/08 18:43:35 sniper Exp $ */
> +/* $Id: reg.c,v 1.62 2002/05/04 11:20:12 hirokawa Exp $ */
>
> #include <stdio.h>
> #include "php.h"
> @@ -372,7 +372,7 @@
> && subs[walk[1] - '0'].rm_so > -1
> && subs[walk[1] - '0'].rm_eo > -1
> /* this next case shouldn't happen. it does. */
> - && subs[walk[1] - '0'].rm_so < subs[walk[1] - '0'].rm_eo)
> {
> + && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo)
> {
> tmp = subs[walk[1] - '0'].rm_eo
> - subs[walk[1] - '0'].rm_so;
> memcpy (walkbuf,
>
>
>
>
> On Thu, 2 May 2002 09:57:12 +0200 (CEST)
> derick@php.net wrote:
>
> > Hello,
> >
> > as far as I know the current behavior is the right one.
> >
> > Andrei, can you enlighten us?
> >
> > Derick
> >
> > On Thu, 2 May 2002, Rui Hirokawa wrote:
> >
> > >
> > > I think the bug #16969 is critical one because
> > > it affects PHPlib's session id propagation in GET mode.
> > > I made a patch to fix this problem.
> > > Could I apply this fix for PHP 4.2.1RC1/PHP 4.3.0dev ?
> > >
> > > -------------------------------------------------
> > > Bug #16959: ereg_replace returns wrong characters
> > >
> > > This is small script for testing.
> > > <?php
> > > $pat = "(^|&)foo(&|$)";
> > > $string = "foo";
> > > echo ereg_replace($pat, "\\1", $string);
> > > ?>
> > >
> > > In PHP <= 4.1.x, this script returns empty string.
> > > But, PHP 4.2.0 and PHP 4.2.1RC1 return '\1'.
> > > The return value in PHP >= 4.2.0 should be corrected.
> > > ereg_replace() is used for session id propagation in GET mode of PHPlib.
> > > It is not work well because
> > > it is affected by this problem.
> > >
> > >
> > > --
> > > -----------------------------------------------------
> > > Rui Hirokawa <rui_hirokawa@ybb.ne.jp>
> > > <hirokawa@php.net>
> > >
> >
> > -----------------------------------------------------------------------
> > Did I help you? Consider a gift:
> >
> > http://www.amazon.co.uk/exec/obidos/registry/SLCB276UZU8B
> > -----------------------------------------------------------------------
> > PHP: Scripting the Web - derick@php.net
> > All your branches are belong to me!
> > SRM: Script Running Machine - www.vl-srm.net
> > -----------------------------------------------------------------------
>
>
> --
> -----------------------------------------------------
> Rui Hirokawa <rui_hirokawa@ybb.ne.jp>
> <hirokawa@php.net>
>
---------------------------------------------------------------------------
Did I help you? http://www.amazon.co.uk/exec/obidos/registry/SLCB276UZU8B
Frequent ranting: http://www.jdimedia.nl/derick/
---------------------------------------------------------------------------
PHP: Scripting the Web - derick@php.net
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---------------------------------------------------------------------------