ostepu / ostepu-core

OSTEPU: Open Source Tutorial and Exercise Platform for Universities
8 stars 3 forks source link

Wie meldet man sich nach der Installation an? #328

Open Rillke opened 3 years ago

Rillke commented 3 years ago

Nach dem Aufruf von / wird man auf /UI/Login.php?back=index.php weiter geleitet. Dort gibt dann die Parametervalidierung für den POST $key back (der dieser Anfrage ja fehlt) folgende Meldung:

Fatal error: Uncaught exception 'Exception' with message 'Validation rule 'Validation_Set::validate_set_default', missing parameter.' in /var/www/html/Assistants/vendor/Validation/validator/Validation_Set.php:30 Stack trace:
#0 [internal function]: Validation_Set::validate_set_default('back', Array, Array, NULL)
#1 /var/www/html/Assistants/vendor/Validation/Validation.php(650): call_user_func('Validation_Set:...', 'back', Array, Array, NULL) #2 /var/www/html/Assistants/vendor/Validation/Validation.php(752): Validation->isValid()
#3 /var/www/html/UI/Login.php(57): Validation->validate() #4 {main} thrown in /var/www/html/Assistants/vendor/Validation/validator/Validation_Set.php on line 30

Sieht so aus, als ob die Regel set_default => null des Regelsets: UI/Login.php:38

  ->addSet('back',
           array('valid_url_query',
                 'set_default'=>null,
                 'on_error'=>array('type'=>'error',
                                   'text'=>Language::Get('main',Language::Get('main','invalidBackURL', $langTemplate), $langTemplate))))

das Verhalten auslöst.

Rillke commented 3 years ago

The code in Assistants/vendor/Validation/validator/Validation_Set.php:29 looks like it doesn't accept "null" defaults.

        if (!isset($param)) {
            throw new Exception('Validation rule \''.__METHOD__.'\', missing parameter.');
        }

A variable whose value is null will be reported not to be set by isset().

Determine if a variable is considered set, this means if a variable is declared and is different than null.

Rillke commented 3 years ago

Sollte https://github.com/ostepu/ostepu-validation/blob/master/validator/Validation_Set.php#L29 lauten:

if (!isset($param) && !is_null($param)) {