ID:               24007
 Updated by:       [EMAIL PROTECTED]
-Summary:          some get global variables not registering
 Reported By:      gateschris at yahoo dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: Linux version 2.2.19
 PHP Version:      4.3.2
-Assigned To:      
+Assigned To:      ilia
 New Comment:

Verified and related to bug #23454  Note that $_REQUEST works perfectly
here...

<?php
if (@$_POST['action'] == 'submit') {
    print "<pre>";
    print_r(array('get'     => $_GET,
                  'post'    => $_POST,
                  'request' => $_REQUEST,
                  'foo'     => $foo));
} else {
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']
?>?foo[a][a]=a">
 <br><input type="text" name="foo[]" value="b">
 <br><input type="text" name="foo[a][b]" value="c">
 <br><input type="submit" name="submit" value="submit">
     <input type="hidden" name="action" value="submit">
</form>
<?php
}
?>

Outputs:

Array
(
    [get] => Array
        (
            [foo] => Array
                (
                    [a] => Array
                        (
                            [a] => a
                        )

                )

        )

    [post] => Array
        (
            [foo] => Array
                (
                    [0] => b
                    [a] => Array
                        (
                            [b] => c
                        )

                )

            [submit] => submit
            [action] => submit
        )

    [request] => Array
        (
            [foo] => Array
                (
                    [a] => Array
                        (
                            [a] => a
                            [b] => c
                        )

                    [0] => b
                )

            [submit] => submit
            [action] => submit
        )

    [foo] => Array
        (
            [0] => b
            [a] => Array
                (
                    [b] => c
                )

        )

)




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

[2003-06-04 00:04:38] gateschris at yahoo dot com

when performing a post in a form, if the url contains a variable of the
form name[key]=value, and php has register_globals enabled, the
name/key is not registered.

example form:

<form enctype="multipart/form-data" method="post"
action="test.php?name[key][key2]=value">
<input name="name[key][key3]" value="value" type="hidden">
</form>

example php:

<?
print_r($name);
?>

with register_globals on, this script will only remember the 
name[key][key3] and not the name[key][key2], please note that i have
not tested this script, its just a summary of what i have found in a
much larger script, and ive already reverted back to an older version
of php and im to lazy to try it on another machine.

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


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

Reply via email to