On Fri, 11 Oct 2002, Rasmus Lerdorf wrote:
> Sascha, would you mind explaining the reasoning for changing this
> behaviour? Whether it is documented or not, I'd like to hear a technical
> reason for not allowing session_register() to act on global variables when
> register_globals is off. I still don't see it. All I see is
> inconsistency here.
PHP 4.2 and earlier versions behave inconsistenly with regard
to treating global variables as source of session variables.
They work exactly like this:
1st request
session_register('c');
$c = 3; # Updates session variable
2nd request
session_start();
$c = 5; # Does NOT update session variable
That is clearly broken under the assumption that
session_register() should act on global variables. It
clearly does not (always). A user should be able to access a
session var using globals either all the time or never. If
it is 'sometimes', valid code will cause unexpected results
(imagine in the above example that $c is a global,
non-session variable and that $_SESSION["c"] is not set
during the first request).
From my point of view, it is a fallacy to ask for prolonging
this misfeature of earlier PHP 4.2 releases. It absolutely
had to be addressed.
- Sascha
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php