php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5098 min() and max() functions broken if parameter is an array
Submitted: 2000-06-17 06:00 UTC Modified: 2000-06-17 06:02 UTC
From: jesusmc at scripps dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 Release OS: Solaris 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jesusmc at scripps dot edu
New email:
PHP Version: OS:

 

 [2000-06-17 06:00 UTC] jesusmc at scripps dot edu
The min() and max() functions work OK if a set of numeric values are passed, but if the parameter is an array it dies in PHP 4.0.0 Release.

The following script:

<?php
echo "Finding the min and max of some integers: 100,22,3,35,2,56,21<br>";
echo "Max val: ".max(100,22,3,35,2,56,21)."<br>";
echo "Min val: ".min(100,22,3,35,2,56,21)."<br>";
echo "<hr>";
echo "Now creating array from that list...";
$test = array(100,22,3,35,2,56,21);
echo "array created<br>"; 
echo "This shows the bug, the array will make the interpreter die<br>";
flush();
echo "Max val: ".max($test)."<br>";
echo "Min val: ".min($test)."<br>";
echo "This will not show";
?>

Will only output:


Finding the min and max of some integers: 100,22,3,35,2,56,21
Max val: 100
Min val: 2
_________________________________________________

Now creating array from that list...array created
This shows the bug, the array will make the interpreter die


As you can see it dies when the array is passed. 

My config line was:

./configure --prefix=/asd/dredox3/development/php4 \
--with-config-file-path=/asd/dredox3/development/php4 \
--enable-track-vars --enable-magic-quotes \
--enable-xml --enable-wddx --disable-debug\
--enable-ftp --enable-calendar\
--enable-bcmath --enable-trans-id\
--with-gd=/asd/metallo1/server/libs/gd \
--with-msql=/asd/dredox3/development/msql \
--with-mysql --disable-debug \
--with-apxs=/asd/dredox3/development/apache/sbin/apxs

And this happens irrespective of whether I use the Zend Optimizer or not.

The error log from Apache shows (from 2 tests of the script above):
...
[Fri Jun 16 20:33:45 2000] [notice] child pid 19188 exit signal Segmentation Fault (11)
[Fri Jun 16 20:36:52 2000] [notice] child pid 19165 exit signal Segmentation Fault (11)
...

Had not tested on a Linux (RH 6.1) box at home, will post more info later when I test there.

Tried checking the latest code on bonsai.php.net, but that site is out cold right now, it just shows a dir listing.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-17 06:02 UTC] rasmus at cvs dot php dot net
This is fixed in CVS.  Wait for 4.0.1 or grab a snapshot from http://snaps.php.net
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 27 14:01:33 2024 UTC