php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #211 Functions min() and max() on arrays crash PHP without trace
Submitted: 1998-03-29 09:24 UTC Modified: 1998-03-30 05:54 UTC
From: david at uws dot edu dot au Assigned: ssb (profile)
Status: Closed Package: Reproducible Crash
PHP Version: 3.0 Release Cand OS: Debian/GNU Linux 1.3
Private report: No CVE-ID: None
 [1998-03-29 09:24 UTC] david at uws dot edu dot au
The following script illustrates the problem:

<?PHP
   $results["a"] = 1;
   $results["b"] = 3;
   $results["c"] = 4;
   $results["d"] = 2;
   echo min($results) . "\n";
   echo max($results) . "\n";
   if( is_array($results) )
      echo "yes, \$results is an array\n";
?>

Comment-out the lines using min/max and the output indicates
that the variable is in fact an array.  According to the PHP3
documentation, min/max on an array should work (the larger
application in which this crashes is the survey demo from
PHP/FI2).

Leave the min/max lines uncommented and there will be no
trace of any problems - browser says document contains no
data, server returns no headers or part page, with full
pedantic warnings/errors/logging enabled, PHP's error log
file contains nothing, server's log file contains nothing,
there is even no evidence of the request in the server's
access log!  Server just ups and crashes without trace (sorry,
no core dump).

Environment is Debian/GNU Linux 1.3 (kernel 2.0.33, libc
5.4.33, gcc 2.7.2.1), Apache 1.2.6, PHP 3.0RC;  PHP has
support for GD and MySQL compiled-in (not modules).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-30 05:54 UTC] ssb
Fixed in 3.0RC2

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC