php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10381 array_sum() on an undefined variable kills php
Submitted: 2001-04-18 10:58 UTC Modified: 2001-04-28 15:02 UTC
From: pgl at instinct dot org Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.4pl1 OS: Red Hat Linux 6.2
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: pgl at instinct dot org
New email:
PHP Version: OS:

 

 [2001-04-18 10:58 UTC] pgl at instinct dot org
Using array_sum() on an undefined causes php to core dump.

uname:
Linux redbox 2.2.17-14enterprise #1 SMP Mon Feb 5 18:31:31 EST 2001 i686 unknown

configure:
'./configure' '--with-apache=../apache_1.3.19' '--enable-gd-imgstrttf' '--with-gd' '--with-ttf' '--with-ldap' '--with-mysql=/usr' '--with-readline' '--enable-sysvsem' '--enable-sysvshm' '--enable-shmop' '--with-zlib' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-oracle=/opt/oracle/8.1.7' '--with-oci8=/opt/oracle/8.1.7' '--with-gdbm' '--enable-dbase' '--with-snmp' '--enable-ucd-snmp-hack' '--with-gettext' '--enable-track-vars' '--enable-versioning' '--enable-ftp' '--enable-bcmath' '--with-pgsql' '--enable-calendar'

[root@redbox address_book]# ls -l test.php 
-rwxr-xr-x    1 root     root           50 Apr 18 16:54 test.php
[root@redbox address_book]# cat test.php 
#!/usr/local/bin/php -q
<? echo array_sum($a); ?>
[root@redbox address_book]# ./test.php 
Segmentation fault (core dumped)

If $a is defined this doesn't happen:

[root@redbox address_book]# cat test.php 
#!/usr/local/bin/php -q
<? $a[]=''; echo array_sum($a); ?>
[root@redbox address_book]# ./test.php 
0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-28 15:02 UTC] jmoore@php.net
This works fine for me. Please test with latest CVS and/or 4.0.5 when its released.

- James
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 02:01:28 2025 UTC