Re: addslashes/mysql_real_escape_string

Re: addslashes/mysql_real_escape_string

am 30.03.2008 20:37:47 von Gabest

> I have never had a memoryleakfrom mysql_real_escape_string(). =A0What
> version are you running?

5.2.5, but I'm not sure where to report this, mysql, php or pear :) I
managed to narrow it down to a simple repro, it only happens if I pass
a simplexml node to this function, which is actually an object. If I
cast it to string or something then it's working fine.

Re: addslashes/mysql_real_escape_string

am 31.03.2008 00:07:45 von Jerry Stuckle

Gabest wrote:
>> I have never had a memoryleakfrom mysql_real_escape_string(). What
>> version are you running?
>
> 5.2.5, but I'm not sure where to report this, mysql, php or pear :) I
> managed to narrow it down to a simple repro, it only happens if I pass
> a simplexml node to this function, which is actually an object. If I
> cast it to string or something then it's working fine.
>

mysql_real_escape_string() is not meant to be taking objects. It
requires a string. If you want to do this, you need a __tostring()
method in your class to convert to a string.

Or, if you want to bring it back out into a string later, you should
first serialize() the object, then after retrieval, unserialize() it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================