ID:               35794
 User updated by:  reboot at gmx dot ch
 Reported By:      reboot at gmx dot ch
-Status:           Bogus
+Status:           Open
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      4.4.1
 New Comment:

Of course that is correct. But even then the script should not just
terminate without a message. And that is possible with this call. I
once had an out of memory message with my test script, but when I tried
to find out under which conditions str_pad outputs the message or
silently dies it disappeared and I could not make it appear again. In
the script where I discovered this behavior the out of memory message
never appeared and it was really hard to find out why the script did
not print anything anymore.


Previous Comments:
------------------------------------------------------------------------

[2005-12-24 21:51:42] [EMAIL PROTECTED]

There are 1000 and 1 other ways too to consume all the available
memory. Just don't do it.

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

[2005-12-24 20:21:53] reboot at gmx dot ch

Using -INF as the length of the target string is always impossible. I
think this value should not be accepted instead of trying to allocate
this much memory.

And there still remains the problem that PHP silently terminates the
script without printing an error. I only found the reason why my script
dies in the apache log.

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

[2005-12-24 16:22:39] [EMAIL PROTECTED]

You're knowingly consuming all the memory available.
How exactly PHP should understand that you meant something else?

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

[2005-12-24 16:14:29] reboot at gmx dot ch

Description:
------------
str_pad should check it's parameters. With wrong parameters it is
possible to cause an out of memory error. This problem also sometimes
causes the PHP script to die completely and only leave an error in the
apache error log, no out of memory error  is reported by PHP.


Reproduce code:
---------------
<?                                                                     
                                                                        
                                                                        
                                                                        
                                             str_pad("", log10(0), " ");
                                                                        
                                                                        
                                                                        
                                                                        
                ?>


Expected result:
----------------
Warning or error reported by PHP about wrong usage of str_pad for
better debugging, not just an our of memory error or silent death of
the PHP script.

Actual result:
--------------
Error in the apache log:

Allowed memory size of 8388608 bytes exhausted (tried to allocate 10
bytes)



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


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

Reply via email to