#28119 [NEW]: ereg_replace require string casting?
| From: | vb_user at yahoo dot com | Date: | Fri, 23 Apr 2004 07:33:12 +0000 |
| Subject: | #28119 [NEW]: ereg_replace require string casting? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-58624@lists.php.net to get a copy of this message | ||
From: vb_user at yahoo dot com
Operating system: Windows 2003
PHP version: 4.3.5
PHP Bug Type: Strings related
Bug description: ereg_replace require string casting?
Description:
------------
When i pass in ereg_replace a variable like this:
ereg_replace($pattern, $variable, $string);
and $variable is holding an integer value, then $string will be replace
with blank, not the value hold in $variable. This only happen in Windows
installation not Linux as i have used this many times.
Doing the following will fix the problem:
ereg_replace($pattern, (string)$variable, $string);
But does that mean PHP is now no long type tolerant?
Reproduce code:
---------------
$variable = 13;
$pattern = 'test';
$string = 'this is a test';
ereg_replace($pattern, $variable, $string);
Expected result:
----------------
this is 13
Actual result:
--------------
this is
--
Edit bug report at http://bugs.php.net/?id=28119&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28119&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28119&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28119&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28119&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28119&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28119&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28119&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28119&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28119&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28119&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28119&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28119&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28119&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28119&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28119&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28119&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28119&r=float