|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-03-30 10:02 UTC] nohn@php.net
If the memory limit of a PHP-script gets exhausted, the PHP interpreter does'nt shut down cleanly and print an error regarding this issue; it segfaults. If the user enables following options in php.ini ([PHP]-section), --- log_errors = On error_log = syslog --- PHP first shows an memory-limit error, after that Apache/PHP dies with an segmentation fault. If "error_log" is set to "/some/file", PHP is unable to log anything. The only logging facility that logs the segmentation fault is syslog. Demonstration: <?php $theline = "hello, i'm the line"; for ($i = 0; $i < 1000000; $i++) $testarr[$i] = $theline; ?> Following script does'nt cause a segmentation fault: <?php for ($i = 0; $i < 1000000; $i++) $testarr[$i] = "hello, i'm the line"; ?> So far we could test following Versions: PHP Webserver OS console (sf/ml) apachemod (sf/ml) 4.0.1 - Linux ? X/- -/- 4.0.2 Apache 1.3.? Linux ? ?/? ?/? 4.0.6 Apache 1.3.19 Linux 2.2.19 X/X X/X 4.0.6 Apache 1.3.22 Linux 2.4.18 X/X X/X 4.1.2 Apache 1.3.22 Linux ? X/X X/X 4.1.2 - Linux 2.4.17 X/X -/- 4.1.2 Apache 1.2.24 Windows 2000 X/- X/- 4.2.0rc1 Apache 1.3.24 Linux 2.4.18 -/X X/X * sf = Segmentation fault * ml = Memory limit error PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 17:00:01 2025 UTC |
This should be refcount issue. Change _zval_struct's refcount data type from unsingned short to unsinged int, then PHP should be fine upto 4G. Without patch refcount can be upto 64K and no error check is done -> segfualts. ZE2 is changed to use unsinged int already. IIRC. Index: Zend/zend.h =================================================================== RCS file: /repository/Zend/zend.h,v retrieving revision 1.152 diff -u -r1.152 zend.h --- Zend/zend.h 15 Mar 2002 04:33:05 -0000 1.152 +++ Zend/zend.h 31 Mar 2002 10:03:41 -0000 @@ -209,9 +209,9 @@ struct _zval_struct { /* Variable information */ zvalue_value value; /* value */ + zend_uint refcount; zend_uchar type; /* active type */ zend_uchar is_ref; - zend_ushort refcount; };