Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#513 Error generated when login out.

User_Authentication
open
Reini Urban
5
2012-10-11
2005-11-12
Anonymous
No

Version:
WindowsXP pro IIS.
Php5 (lastest version)
phpwiki-1.3.11p1.tar.gz (but same error in the nightly
built)
Flat file version.
Open to anonymous.
Note: little experience in php. (but good experience in
Java)

Problem: an Error generated when login out.

Error in WikiUserNew: line: 1842:

// check and set the new value in the subobject
function set($name, $value) {

...

if (!isset($pref->{$value}) or $pref->{$value} != $pref-

default_value) {
...
}

$name = 'userid'
$value = ''

the function is called from Main.php in line 404, in the
function _setUser(...)

// login or logout or restore state
function _setUser (&$user) {
...
$this->_prefs->set('userid',
$user->isSignedIn() ? $user->getId
() : '');
...
}

The problem is that
(!isset($pref->{$value}) is generating an error !!!!

This is not surprising, since $value = 0.

Note:
What looks strange, is that I would have expected
something more like:
(!isset($pref->{$name}) in the code !!!!

Thierry Nabeth
thierry.nabeth@insead.edu
http://www.calt.insead.edu/
PS:
Please, remove my email address because of the email
cllector bots !!!!

Discussion

  • Logged In: NO

    Small typo in my posting:

    This is not surprising, since $value = 0.

    This is not surprising, since $value = ''

    pref->'' does not seem to mean anything

     
  • Logged In: NO

    Small error in my previous posting:

    This is not surprising, since $value = 0.

    should be

    This is not surprising, since $value = ''.

    $pref->{$value}) would therefore be: $pref->''

    Which does not seem to mean anything.

    Thierry
    thierry.nabeth@insead.edu

     
  • Logged In: NO

    Hello,

    By browsing the web, the problem seems to originate from
    the lastest version of PHP5 (5.05) which has done some
    change in the function isset(var).

    var has to be a variable and not an expression.

    I have now changed with the following:

        // if (!isset($pref->{$value}) or $pref->{$value} !
    

    = $pref->default_value) { // fix PHP 5.05 bug isset().
    thierry nabeth.
    // !isset($pref->{$value}) ==> (!
    array_key_exists( $value, get_object_vars( $pref )) &&
    isset($this->$field))
    // BUG? : (!isset($pref->{$name}) ???
    if ($value == '' or !isset($pref->{$value}) or
    $pref->{$value} != $pref->default_value) {

    Note:
    This is only a quick fix, since I do not understand
    exactly what is the meaning of
    $pref->{$value}

    Thierry Nabeth

     
  • Reini Urban
    Reini Urban
    2006-06-18

    Logged In: YES
    user_id=13755

    Good catch. Thanks!