From:             [EMAIL PROTECTED]
Operating system: RedHat 6.2
PHP version:      4.0.5
PHP Bug Type:     Arrays related
Bug description:  array_unique stopped working on arrays after 4.0.4pl1

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 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]

Reply via email to