Re: [PHP4BETA] ereg_replace update
| From: | George Hartz | Date: | Wed, 18 Aug 1999 02:42:54 +0000 |
| Subject: | Re: [PHP4BETA] ereg_replace update | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3535@lists.php.net to get a copy of this message | ||
Teodor Cimpoesu wrote:
> hmm, I'm not a guru or rx :) but afaik % doesn't have to be escaped.
> So basically it replaces % w/ your number so, do you get
> /something/\134s/ out?
> where \134 (134 is at random) is an escape sequence for a char(so a
> weird one).
> try ereg_replace("%s",$number,"/string/%s/");
> and see what happens
I thought of that, PHP3 and PHP4 both properly handle escaped characters
-- anything with a backslash in front of it is escaped, you'll never get
a backslash coming through on a string assignment without having them
doubled up.
The problem definately seems to be a very non-standard way of casting
integers to strings.
Does anyone actually know if this is a bug, or just the way it works? If
its just the way it works, why is that? It seems very non-standard.
Strangely, the code that stopped working seems to have stopped working
in PHP4 and 3.0.12... the same code in 3.0.6 (the last PHP version I'd
run on the server I first noticed the strange behaviour on before I
upgraded it today to 3.0.12) seemed to cast integers to strings as their
string representation, so unless there was something wierd going on in
my code, its something that changed in both 3 and 4 recently...
- George