Re: [phplib] PHPLIB+PHP4 session variable not registered From: Renato Lins (TheBest <email protected>)
Date: 11/25/00

I know about the "$" I typed it wrong only in the e-mail, but thanks
any way.

I found the problem, here it is :

<?php
        require("inc.php");
        require($_PHPLIB["libdir"] . "db_mysql.inc");
        require($_PHPLIB["libdir"] . "ct_sql.inc");
        require($_PHPLIB["libdir"] . "my_db.inc");
        require($_PHPLIB["libdir"] . "session.inc");
        require($_PHPLIB["libdir"] . "my_sess.inc");
        require($_PHPLIB["libdir"] . "page.inc");

        page_open(array("sess"=>"my_sess") );

        function xxx() {
                global $info;

                if( some_condition ){

                        unset $info;
                        $info[0][1] = some_value;
                        $info[0][2] = some_other_value;
                        $sess->register("info");
                }
        }
?>

This works in php3 but not in php4, because the unset removes the global
references of $info, so $sess->serialize() can't find the correct values
for $info and simple don't register the $info array. But in php3 it
works fine, unset simple clears the values of $info and do not remove
the global reference, so when a re-set $info after unset it is still
global and then $sess->serialize() do find the values. But I could not
find any references in manual about this diferent behavior between
versions;

"Arno A. Karner" wrote:
>
> i use multi dimsion arrays all the time when u register the variable
> drop the "$" sign
> i register $sess->register("ss"); // for state stack
> i register $sess->register("sp"); // for stack pointer
> and use vars like $ss[$sp]["r"]["fieldname"]["type"]=value;
> with no problems
> in either php3, or php4

-- 
Linux User #180985
ICQ UIN# 2986849
*--------------------------------------------------------------*
In most countries selling harmful things like drugs is punishable. Then
howcome people can sell Microsoft software and go unpunished?

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>