From:             reboot at gmx dot ch
Operating system: Linux
PHP version:      4.4.1
PHP Bug Type:     Strings related
Bug description:  str_pad doesn't check parameters

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 bug report at http://bugs.php.net/?id=35794&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35794&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35794&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35794&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35794&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35794&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35794&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35794&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35794&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35794&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35794&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35794&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35794&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35794&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35794&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35794&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35794&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35794&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35794&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35794&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35794&r=mysqlcfg

Reply via email to