php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19006 Test failure orange/banana
Submitted: 2002-08-20 19:13 UTC Modified: 2002-08-21 07:44 UTC
From: msopacua at idg dot nl Assigned:
Status: Closed Package: Arrays related
PHP Version: 4CVS-2002-08-20 OS: BSD/OS
Private report: No CVE-ID: None
 [2002-08-20 19:13 UTC] msopacua at idg dot nl
STABLE cvs:
--- ./ext/standard/tests/array/003.exp  Wed Aug 21 00:20:56 2002
+++ ./ext/standard/tests/array/003.out  Wed Aug 21 00:20:56 2002
@@ -5,9 +5,9 @@
   ["-2147483648"]=>
   array(2) {
     [0]=>
-    int(0)
+    string(6) "banana"
     [1]=>
-    int(0)
+    string(6) "orange"
   }
   ["test"]=>
   int(27)
@@ -26,9 +26,9 @@
   ["-2147483648"]=>
   array(2) {
     [0]=>
-    int(0)
+    string(6) "banana"
     [1]=>
-    int(0)
+    string(6) "orange"
   }
   [-2147483648]=>
   float(-0.33333333333333)
@@ -51,9 +51,9 @@
   [1]=>
   array(2) {
     [0]=>
-    int(0)
+    string(6) "banana"
     [1]=>
-    int(0)
+    string(6) "orange"
   }
   [2]=>
   int(27)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-20 21:45 UTC] sniper@php.net
Can you explain this a bit?? What's the problem?
Was this one of those tests that has failed always?

 [2002-08-21 02:55 UTC] msopacua at idg dot nl
Yes. This one always fails. Since the output is quite lengthly and generated by multiple array functions, it's hard to pin down the actual problem.

So, IMO the test should be split into three seperate tests for the respective functions and then this one. Maybe it is the combination of the functions, maybe it's print_r, maybe it's one seperate one.
No way to tell now.
 [2002-08-21 03:34 UTC] msopacua at idg dot nl
Ok, strike that last one.
With sdiff, it became clearer.

Seems that the problem is in array_sum rather than the ua* functions. I'll look into it.
 [2002-08-21 03:46 UTC] msopacua at idg dot nl
Ok - got it, see the note for array_sum in the manual:
" PHP versions prior to 4.0.6 modified the passed array itself and converted strings to numbers (which most of the time converted them to zero, depending on their value)."

The expected output, is expecting exactly that:
 -- Testing uasort() --                                          -- Testing uasort() -- 
array(7) {                                                      array(7) {
  [-2147483648]=>                                                 [-2147483648]=>
  float(-0.33333333333333)                                        float(-0.33333333333333)
  ["-2147483648"]=>                                               ["-2147483648"]=>
  array(2) {                                                      array(2) {
    [0]=>                                                           [0]=>
    int(0)                                                    |     string(6) "banana"
    [1]=>                                                           [1]=>
    int(0)                                                    |     string(6) "orange"
  }                                                               }
 [2002-08-21 03:50 UTC] msopacua at idg dot nl
Sorry for the screwed output,
the expected output, expects an int(0) (the result of array_sum). But since array_sum no longer changes the actual array, the array remains in tact as 'string[6] => banana'.
 [2002-08-21 06:43 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-08-21 07:44 UTC] msopacua at idg dot nl
Helly,
could you also commit to PHP_4_2_0 branch?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 16:01:31 2024 UTC