ID:               32121
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jbeall at heraldic dot us
-Status:           Open
+Status:           Feedback
 Bug Type:         Arrays related
 Operating System: Linux
 PHP Version:      5.0.3
 New Comment:

Did you or did you not try the snapshot?



Previous Comments:
------------------------------------------------------------------------

[2005-03-01 01:10:09] jbeall at heraldic dot us

I have tracked down the problem to WDDX not properly serializing
arrays.  Consider the following:

$data = array(1=>"First value",2=>"Second Value",3=>"Third Value");

$wddxPacket = wddx_serialize_value($data);
$deserialized = wddx_deserialize($wddxPacket);

echo gettype($deserialized[1])." {$deserialized[1]}\n";
var_dump($deserialized);

It outputs:

NULL 
array(3) {
  ["1"]=>
  string(11) "First value"
  ["2"]=>
  string(12) "Second Value"
  ["3"]=>
  string(11) "Third Value"
}

You will note that the indices are now string values rather than
integers.  This is apparently because the array begins at an index
other than 0.  The expected output is of course:

string First value
array(3) {
  [1]=>
  string(11) "First value"
  [2]=>
  string(12) "Second Value"
  [3]=>
  string(11) "Third Value"
}

Perhaps this should be filed as a separate bug report, or is already a
known bug?

As far as changing the status, the only statuses that I am able to set
it to are "open" and "closed" - "feedback" is not listed as one of my
options.

------------------------------------------------------------------------

[2005-02-27 13:59:28] jbeall at heraldic dot us

Actually I just had a possible epiphany - I am serializing the entire
$_POST variable using WDDX and recovering on a subsequent page by
deserializing the WDDX packet.

I wonder if when WDDX deserializes an array, it stores everything at
string indices, even if the indices are integers.  Note that for
convenience reasons the arrays in question start at [1], not [0]; that
may be significant, I don't know enough about PHP's WDDX functionality
to say.

I will not be able to investigate this further for several days, but I
will post back when I can.

------------------------------------------------------------------------

[2005-02-27 13:25:43] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

ALWAYS try the snapshots first.


------------------------------------------------------------------------

[2005-02-27 13:09:59] jbeall at heraldic dot us

You are right.  I must not be truly understanding what is causing the
problem (I am definitely having the problem that I cannot access array
values from a form), but it must be something other than the
name='fname[1]' field name.

I was trying to simplify my code down to less than 20 lines for the
post and I was missing $_REQUEST.

What I may have to do is simply save is serialize the variable that I
have that is causing me so much trouble and post a link to that.  I'm
really at a loss at this point as to what might be the cause since it
is apparently not the form problem.  Sorry for messing up the reproduce
code.

------------------------------------------------------------------------

[2005-02-27 12:30:14] [EMAIL PROTECTED]

<form method="post" action="index.php">
<input type="text" name="test[1]" value="bla-bla"/>
<input type="submit">
</form>

<?
var_dump($_POST);
var_dump($_POST['test'][1]);
?>
Works fine here, debug your code.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/32121

-- 
Edit this bug report at http://bugs.php.net/?id=32121&edit=1

Reply via email to