php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36092 typing error
Submitted: 2006-01-19 20:54 UTC Modified: 2006-01-19 23:07 UTC
From: v dot matys at seznam dot cz Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: doc on php.net
Private report: No CVE-ID: None
 [2006-01-19 20:54 UTC] v dot matys at seznam dot cz
Description:
------------
manual/en/language.variables.external.php#54634

line:

$this = unserialize($_SESSION['vars_serialized']);

should contain "xvars_..." not "vars_..."

I suggest my simplest version of that script:
<?php
if(!Array_Key_Exists('xvars_serialized',$_SESSION)) { $_SESSION['xvars_serialized']=""; echo "tudy\n";}
if(!$_SESSION['xvars_serialized']) {
    // If data has just been recieved, it is saved in $this and the current URL is builded.
    foreach ($_GET as $key => $value) $pa[$key] = $value;
    foreach($_POST as $key => $value) $pa[$key] = $value;
    $pa['doc_url'] = 'http://' .$_SERVER['HTTP_HOST'] .$_SERVER['PHP_SELF'] .'?' .$_SERVER['argv'][0];

    // If no POST data is recieved, nothing more is to be done. If POST data is recieved it is serialized to session and the page is redirected to itself with GET data but without POST data.
    if($_POST) {
        $_SESSION['xvars_serialized'] = serialize($pa);
        header('Location: ' .$pa['doc_url']);
        exit();
    }
}

// Just after the above redirecting, GET and POST data is unserialized into the object.
else {
    $_POST = unserialize($_SESSION['xvars_serialized']);
    $_SESSION['xvars_serialized'] = "";
}
?>

Viktor



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-19 23:07 UTC] vrana@php.net
I've fixed the example in DB, it will show on web after some time. However it's not a documentation bug but a problem in a user contributed note (thus I've marked this bug as bogus).

Next time, please send a message to php-notes@lists.php.net or add your own note to provide alternative example.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Nov 20 14:00:01 2025 UTC