Bug #53109 [Fbk->Opn]: htmlentities and htmlspecialchars problems with __toString

2010-10-20 Thread ibber_of_crew42 at hotmail dot com
Edit report at http://bugs.php.net/bug.php?id=53109&edit=1

 ID: 53109
 User updated by:ibber_of_crew42 at hotmail dot com
 Reported by:ibber_of_crew42 at hotmail dot com
 Summary:htmlentities and htmlspecialchars problems with
 __toString
-Status: Feedback
+Status: Open
 Type:   Bug
 Package:Strings related
 Operating System:   Irrelevant
 PHP Version:5.2.14
 Block user comment: N

 New Comment:

Sadly, I cannot reproduce this. The circumstances under which I was able
to 

produce it were very complicated.



As you mentioned it may have been provoked by some memory corruption
occuring 

before the call. I repeatedly ran into the well known Segmentation Fault
that 

the preg_-functions can produce, around the time this was occuring. It
may be 

that the preg_-functions operating around the edge of seg faulting may
actually 

corrupt their output?



Regarding the warning you are able to produce, by passing object as
argument 

number 2: "htmlentities() expects parameter 2 to be long, object given".
This 

must come from the underlying C function. PHP has no data type called
long, as 

far as I know? That's a bug, right?



Either way, I'm fine with you closing this bug report. It should be a
very rare 

case.


Previous Comments:

[2010-10-20 22:27:02] cataphr...@php.net

By the way, your report sounds like there's some kind of memory
corruption happening, so the problem is possibly something happening
before the call to htmlentities. It would be great if you could
reproduce this.


[2010-10-20 22:07:46] cataphr...@php.net

Thanks for your report.



However, I can't reproduce this with:



http://bugs.php.net/bug.php?id=53109&edit=1


[PHP-BUG] Bug #53109 [NEW]: htmlentities and htmlspecialchars problems with __toString

2010-10-19 Thread ibber_of_crew42 at hotmail dot com
From: 
Operating system: Irrelevant
PHP version:  5.2.14
Package:  Strings related
Bug Type: Bug
Bug description:htmlentities and htmlspecialchars problems with __toString

Description:

When passing an instance of a class implementing __toString, as the first
argument 

to htmlentities or htmlspecialchars, the object is apparently not always
(maybe 

never?) cast to string before being pushed on the stack.

In some cases this will cause php to erronously output that the function
requires 

parameter 2 to be long, unknown given. This seems to be an error from the 

underlying C function?

Sadly, I cannot provide a test script to reproduce the behaviour, but it
should be 

easy enough to check whether my theory is correct.


-- 
Edit bug report at http://bugs.php.net/bug.php?id=53109&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53109&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53109&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=53109&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53109&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53109&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53109&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=53109&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=53109&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=53109&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=53109&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=53109&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=53109&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=53109&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53109&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=53109&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=53109&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=53109&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=53109&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=53109&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=53109&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=53109&r=mysqlcfg