Edit report at http://bugs.php.net/bug.php?id=53163&edit=1

 ID:                 53163
 Comment by:         borovoy dot anton at gmail dot com
 Reported by:        borovoy dot anton at gmail dot com
 Summary:            trim() don't say about warning with
                     tidy_parse_string
 Status:             Bogus
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Gentoo
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

At first time it was: Fatal error: Allowed memory size of 1073741824
bytes 

exhausted (tried to allocate 3 bytes)



btw:

In http://php.net/manual/en/tidy.examples.basic.php we get:

<?php

$tidy = new tidy;

$tidy->parseString($html, $config, 'utf8');

$tidy->cleanRepair();

echo $tidy;

?>

If before echo() we put:

var_dump(is_object($tidy));

var_dump(is_string($tidy));



result will be:

bool(true)

bool(false)



In php.net/manual/en/function.echo.php says echo wanna string, not
object

And if use $tidy->value problem resolve.



What I don't understand?

thx


Previous Comments:
------------------------------------------------------------------------
[2010-10-26 10:46:08] ras...@php.net

You have your memory limit set really low and you are looping infinitely
over a 

tidy_parse_string call against a 50k blob of html.

This has nothing to do with trim.  You are running out of memory doing
all the 

tidy stuff long before trim() is even called.

------------------------------------------------------------------------
[2010-10-26 10:35:29] borovoy dot anton at gmail dot com

Description:
------------
<?php

class test { public $value = 'Hi'; }                                    
                                                     

$obj = new test();                                                      
                                                     

trim($obj);

?>

result: Warning: trim() expects parameter 1 to be string, object given



<?php

$content = file_get_contents('http://php.net');                         
                                                     

while ($i = 1) { trim(tidy_parse_string($content, $tidy_config,
'utf8')); }

?>

result: Fatal error: Allowed memory size of 1048576 bytes exhausted
(tried to 

allocate 104 bytes)

php: tidylib.c:168: tidyDocRelease: Assertion `doc->docIn == ((void
*)0)' 

failed.



I think need warning and not eat all memory

thx



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53163&edit=1

Reply via email to