ereg_replace broken?
| From: | George Hartz | Date: | Tue, 17 Aug 1999 21:04:56 +0000 |
| Subject: | ereg_replace broken? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-3523@lists.php.net to get a copy of this message | ||
Is ereg_replace broken in the CVS PHP 4.0?
I get a core dump from Apache whenever it gets called.
The following code is a simplification of the problem:
----- begin tmp.php3 -----
Blah
<?php
$number = 10;
$string = "/something/%s/";
//$string = ereg_replace("\%s", $number, $string);
print "<H1>$string</H1>\n";
?>
----- end tmp.php3 -----
With the ereg_replace string commented out, I get what you'd expect:
Blah
/something/%s/
With it uncommented, that apache child coredumps.
On a somewhat related note (I spotted this when trying to verify a bug
in PHP3), what's the deal with PHP converting an integer to a string?
The above code under PHP 3.0.12 gives the following HTML:
Blah
<H1>/something/
/</H1>
The "10" is getting converted to the ascii charater for decimal 10. If I
give it a number over 256, I get the number itself. Ie, if $number =
1000 I get:
Blah
/something/1000/
Is this a bug, or just some wierd type conversion thing with PHP? I was
trying to see if the same effects happen with 4.0, but for the above
reason, I can't check it.
- George
--
email:dotorg@bangsplat.org;url:www.bangsplat.org;uin:153182;aim:tgd98
GCS/GP/GS/GFA d- s+: a- C++++$ UL++++$ P+++$ L+++$ E- W++>$ N+@ !o
K+++ w--- !O M-@ V PS+ PE Y+ PGP t-(+) 5- X++ R-(--) tv+ b+++ DI++ D++
G+ e* h r y++