php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27998 CGI 'php -n' + php_ini_scanned_files() == segfault
Submitted: 2004-04-14 17:09 UTC Modified: 2004-04-14 18:08 UTC
From: torben@php.net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.3.4 OS: Linux 2.4.22 (Fedora Core 1)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: torben@php.net
New email:
PHP Version: OS:

 

 [2004-04-14 17:09 UTC] torben@php.net
Description:
------------
On a recent install of PHP 4.3.4 (from RPM, not compile), the 
CGI binary segfaults if php is given the -n switch, either
on the command line or the bang-hash line.

Note: I just tried this script on FreeBSD 4.8-stable and it
worked fine (no segfault). 

Reproduce code:
---------------
#!/usr/bin/php -qn
<?php

echo phpversion() . "\n";

$inis = php_ini_scanned_files();

var_dump($inis);

?>



Expected result:
----------------
4.3.4
string(63) "/etc/php.d/imap.ini,
/etc/php.d/ldap.ini,
/etc/php.d/mysql.ini
"


Actual result:
--------------
Script output:
------------------------
4.3.4
Segmentation fault


Backtrace: (I know there're no symbols, but it seems to
point to strlen()).
------------------------
GNU gdb Red Hat Linux (5.3.90-0.20030710.41rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) file /usr/bin/php
Reading symbols from /usr/bin/php...(no debugging symbols found)...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) run -n -q ../bin/test.php
Starting program: /usr/bin/php -n -q ../bin/test.php
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[Thread debugging using libthread_db enabled]
[New Thread -1085134208 (LWP 9427)]
4.3.4

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1085134208 (LWP 9427)]
0x00707043 in strlen () from /lib/tls/libc.so.6
(gdb)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-14 18:08 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Nov 23 20:00:02 2025 UTC