ID: 14315
Updated by: derick
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: Arrays related
Operating System: RedHat 6.2
PHP Version: 4.0.5
New Comment:
Not a bug in 4.0.5 or later, but in 4.0.4(pl1). The manual states:
Note: Two elements are considered equal if and only if (string)
$elem1 === (string) $elem2. In words: when the string
representation is the same.
The string representation of 'array(0 => something);' is always 'Array':
<?php
echo array(0 => "one");
?>
outputs:
Array
The manual also states:
Warning
This was broken in PHP 4.0.4!
So this is not a bug.
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-12-02 15:48:28] [EMAIL PROTECTED]
I upgraded from php-4.0.4pl1 to php-4.0.5 and 4.0.6 and in both instances, the script
I run array_unique in only returns one item in my array. Here is a script that will
work as expected in php-4.0.4pl1 but not in any version higher:
$array1[] = array(0 => "one");
$array1[] = array(0 => "two");
$array1[] = array(0 => "two");
$array1[] = array(0 => "three");
$array1[] = array(0 => "three");
$array1[] = array(0 => "three");
echo "<PRE>";
echo "Before unique: <BR>";
var_dump($array1);
$array1 = array_values(array_unique($array1));
echo "After unique: <BR>";
var_dump($array1);
echo "</PRE>";
===
Output for 4.0.4pl1 looks like:
Before unique:
array(6) {
[0]=>
array(1) {
[0]=>
string(3) "one"
}
[1]=>
array(1) {
[0]=>
string(3) "two"
}
[2]=>
array(1) {
[0]=>
string(3) "two"
}
[3]=>
array(1) {
[0]=>
string(5) "three"
}
[4]=>
array(1) {
[0]=>
string(5) "three"
}
[5]=>
array(1) {
[0]=>
string(5) "three"
}
}
After unique:
array(3) {
[0]=>
array(1) {
[0]=>
string(3) "one"
}
[1]=>
array(1) {
[0]=>
string(3) "two"
}
[2]=>
array(1) {
[0]=>
string(5) "three"
}
}
===
Output for versions later look like:
Before unique:
array(6) {
[0]=>
array(1) {
[0]=>
string(3) "one"
}
[1]=>
array(1) {
[0]=>
string(3) "two"
}
[2]=>
array(1) {
[0]=>
string(3) "two"
}
[3]=>
array(1) {
[0]=>
string(5) "three"
}
[4]=>
array(1) {
[0]=>
string(5) "three"
}
[5]=>
array(1) {
[0]=>
string(5) "three"
}
}
After unique:
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "one"
}
}
===
configure lines for both:
php-4.0.4pl1:
'./configure' '--with-apache=../apache_1.3.14' '--prefix=/usr' '--enable-safe-mode'
'--with-exec-dir=/usr/bin' '--with-zlib' '--with-config-file-path=/etc/php3/apache'
'--disable-debug' '--enable-magic-quotes' '--enable-debugger' '--enable-bcmath'
'--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--with-imap' '--with-ldap'
'--with-ibm-db2' '--with-system-regex' '--with-informix'
'--with-pdflib=/usr/local/pdflib' '--enable-inline-optimization' '--without-gd'
php-4.0.6
'./configure' '--with-apache=../apache_1.3.14' '--prefix=/usr' '--enable-safe-mode'
'--with-exec-dir=/usr/bin' '--with-zlib' '--with-config-file-path=/etc/php3/apache'
'--disable-debug' '--enable-magic-quotes' '--enable-debugger' '--enable-bcmath'
'--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--with-mcrypt'
'--with-imap' '--with-ldap' '--with-ibm-db2' '--with-system-regex' '--with-informix'
'--with-pdflib=/usr/local/pdflib' '--enable-inline-optimization' '--without-gd'
===
As a side note, in order to get php-4.0.6 to compile for both IBM DB2 and Informix, I
had to apply the following:
diff -Naur php-4.0.6.orig/main/internal_functions.c php-4.0.6/main/internal_func
tions.c
--- php-4.0.6.orig/main/internal_functions.c Fri Nov 30 11:40:20 2001
+++ php-4.0.6/main/internal_functions.c Fri Nov 30 11:40:39 2001
@@ -32,11 +32,11 @@
#include "ext/zlib/php_zlib.h"
#include "ext/bcmath/php_bcmath.h"
#include "ext/imap/php_imap.h"
-#include "ext/informix/php_informix.h"
#include "ext/ldap/php_ldap.h"
#include "ext/mcrypt/php_mcrypt.h"
#include "ext/mysql/php_mysql.h"
#include "ext/odbc/php_odbc.h"
+#include "ext/informix/php_informix.h"
#include "ext/pcre/php_pcre.h"
#include "ext/pdf/php_pdf.h"
#include "ext/posix/php_posix.h"
But thats a whole other bug report. Mcrypt would also fail to compile in 4.0.4pl1,
prolly I need to downgrade it.
Those are the only differences I can think of between these versions.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14315&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]