Re: [PHP4BETA] Program received signal SIGSEGV, *walkbuf = '\0';
| From: | Sascha Schumann | Date: | Thu, 13 May 1999 20:43:31 +0000 |
| Subject: | Re: [PHP4BETA] Program received signal SIGSEGV, *walkbuf = '\0'; | ||
| References: | 1 2 3 4 5 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-842@lists.php.net to get a copy of this message | ||
On Wed, May 12, 1999 at 10:56:42PM +0200, Zeev Suraski wrote:
> At 20:24 12/05/99 , Sascha Schumann wrote:
> >On Wed, May 12, 1999 at 09:05:25PM +0200, Zeev Suraski wrote:
> > > Does it use arrays?
> >
> >No, it is only the short snippet of code:
>
> I meant the implementation of ereg_replace()... Arrays are the #1 reason
> for PHP 3.0 internal functions to stop working with PHP 4.0.
>
The whole reg stuff depends on NUL terminated strings, that is why it stopped
working. Running the following script works:
$a = "abc123";
echo ereg_replace("123\0", "asd", $a);
as opposed to
$a = "abc123";
echo ereg_replace("123", "asd", $a);
The unterminated pattern is passed to regcomp which does some weird things
with memory/stack etc. Of course, this is only the first source of problems,
_php3_regreplace makes heavy use of libc's string functions.
--
Regards,
Sascha Schumann
Consultant
--
PHP 4 Beta