Bug #1488: Problems with fopen() and fclose(): segfaults and document contains no data msg
| From: | fvkuipers at home dot com | Date: | Thu, 03 Jun 1999 00:47:18 +0000 |
| Subject: | Bug #1488: Problems with fopen() and fclose(): segfaults and document contains no data msg | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6490@lists.php.net to get a copy of this message | ||
From: fvkuipers@home.com
Operating system: Linux RH 5.9
PHP version: 3.0.7
PHP Bug Type: Misbehaving function
Bug description: Problems with fopen() and fclose(): segfaults and document contains no data msg
Consider the script:
<?
$fp = fopen("/home/httpd/html/hit.count","w");
echo $fp;
/*fclose ($fp);*/
?>
Upon running this program, the code executes as expected by opening the file and allowing file IO.
However, the error log reports the following:
[Wed Jun 2 21:31:05 1999] [notice] child pid 1557 exit signal Segmentation fault (11)
Uncommenting the third line causes a "document contains no data" error.
The value of $fp usually 1 as output by the echo statement. In the script in which I noticed this
behaviour, the program runs perfectly (except I must exclude the fclose() to avoid the
"document contains no data" error). However, doing a tail /var/log/httpd/error_log
--follow reveals a seg fault each time the page is reloaded. Hence, it is bloating my logs!
The file in question has the following permissions:
-rwxrw-rw- 1 webmaste web 0 Jun 2 21:19 hit.count
I couldn't produce/locate a coredump, if I do, I will add the backtrace then.
I enabled setting $php_errormsg but when I echo it it gives me an "uninitialized variable"
notice. What's with that?
I am using php3 as a module in Apache. I downloaded both php3 and apache as rpms from the RH
distribution sites:
mod_php3-3.0.7-4.i386.rpm
apache-1.3.6-7.i386.rpm
Hence, I have no idea what was compiled in... Any ideas?? Thanks.
FK
Here is the relavant portion of my php3.ini (excluded all db related content):
-----------------8<-------------------------------
;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;
engine = On ; enable PHP 3.0 parser
short_open_tag = On ; allow the <? tag. otherwise, only <?php and <script> tags are
recognized.
asp_tags = On ; allow ASP-style <% %> tags
precision = 14 ; number of significant digits displayed in floating point numbers
y2k_compliance = Off ; whether to be year 2000 compliant (will cause problems with non y2k compliant
browsers)
; Safe Mode
safe_mode = Off
safe_mode_exec_dir =
; Colors for Syntax Highlighting mode. Anything that's acceptable in <font color=???>
would work.
highlight.string = #DD0000
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg = #FFFFFF
highlight.default = #0000BB
highlight.html = #000000
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
memory_limit = 8388608 ; Maximum amount of memory a script may consume (8MB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; error_reporting is a bit-field. Add each number up to get desired error reporting level
; 1 = Normal errors
; 2 = Normal warnings
; 4 = Parser errors
; 8 = Notices - warnings you can ignore, but sometimes imply a bug (e.g., using an uninitialized
variable)
error_reporting = 15
display_errors = On ; Print out errors (as a part of the HTML script)
log_errors = On ; Log errors into a log file (server-specific log, stderr, or error_log (below))
track_errors = On ; Store the last error/warning message in $php_errormsg (boolean)
;error_prepend_string = "<font color=ff0000>" ; string to output before an error
message
;error_append_string = "</font>" ; string to output after an error
message
error_log = /var/log/httpd/php3errors.log ; log errors to specified file
;error_log = syslog ; log errors to syslog (Event Log on NT, not valid in Windows 95)
warn_plus_overloading = Off ; warn if the + operator is used with strings
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
magic_quotes_gpc = On ; magic quotes for incoming GET/POST/Cookie data
magic_quotes_runtime= Off ; magic quotes for runtime-generated data, e.g. data from SQL, from
exec(), etc.
magic_quotes_sybase = Off ; Use Sybase-style magic quotes (escape ' with '' instead
of \')
track_vars = On ; enable $HTTP_GET_VARS[], $HTTP_POST_VARS[] and $HTTP_COOKIE_VARS[] arrays
; automatically add files before or after any PHP 3.0 document
auto_prepend_file =
auto_append_file =
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
include_path = ; UNIX: "/path1:/path2" Windows:
"\path1;\path2"
doc_root = ; the root of the php pages, used only if nonempty
user_dir = ; the directory under which php opens the script using /~username, used only if
nonempty
;upload_tmp_dir = ; temporary directory for HTTP uploaded files (will use system
default if not specified)
upload_max_filesize = 2097152 ; 2 Meg default limit on file uploads
extension_dir = ./ ; directory in which the loadable extensions (modules) reside
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; if you wish to have an extension loaded automaticly, use the
; following syntax: extension=modulename.extension
; for example, on windows,
; extension=msql.dll
; or under UNIX,
; extension=msql.so
; Note that it should be the name of the module only, no directory information
; needs to go here. Specify the location of the extension with the extension_dir directive above.
;Windows Extensions
;extension=php3_mysql.dll
;extension=php3_nsmail.dll
;extension=php3_calendar.dll
;extension=php3_dbase.dll
;extension=php3_gd.dll
;extension=php3_dbm.dll
;extension=php3_mssql.dll
;extension=php3_zlib.dll
;extension=php3_filepro.dll
;extension=php3_imap4r2.dll
;extension=php3_ldap.dll
;extension=php3_crypt.dll
;extension=php3_msql2.dll
;extension=php3_odbc.dll
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Syslog]
define_syslog_variables = Off ; Whether or not to define the various syslog variables,
; e.g. $LOG_PID, $LOG_CRON, etc. Turning it off is a
; good idea performance-wise. In runtime, you can define
; these variables by calling define_syslog_variables()
--------------8<----------------------------------