Issue #393 has been updated by Clément OUDOT.

Status changed from New to Closed
Assigned to set to Clément OUDOT
Target version changed from self-service-password-? to self-service-password-0.9
% Done changed from 0 to 100


----------------------------------------
Bug #393: Warning in logs if no forbidden caracters defined
http://tools.lsc-project.org/issues/393

Author: Stéphane Baud
Status: Closed
Priority: Normal
Assigned to: Clément OUDOT
Category: Self Service Password
Target version: self-service-password-0.9


Not having any forbidden characters, i.e. $pwd_forbidden_chars = ""; in 
conf.config.in.php triggers the following warning :

<pre>
[Mon Jan 30 17:40:40 2012] [error] [client 172.23.1.214] PHP Warning:  
preg_match_all(): Compilation failed: missing terminating ] for character class 
at offset 2 in /application/pwdreset/test/lib/functions.inc.php on line 153
</pre>

The corresponding code :

<pre>
preg_match_all("/[$pwd_forbidden_chars]/", $password, $forbidden_res);
$forbidden = count( $forbidden_res[0] );
</pre>

should include a test for both existence and non emptyness of 
$pwd_forbidden_chars and should be replaced by something like this :

<pre>
$forbidden = 0;
if ( isset($pwd_forbidden_chars) && !empty($pwd_forbidden_chars) ) {
    preg_match_all("/[$pwd_forbidden_chars]/", $password, $forbidden_res);
    $forbidden = count( $forbidden_res[0] );
}
</pre>

Please note that the same applies to special characters ($pwd_special_chars) 
which will trigger the same warning if undefined or empty.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://tools.lsc-project.org/my/account
_______________________________________________
ltb-dev mailing list
[email protected]
http://lists.ltb-project.org/listinfo/ltb-dev

Reply via email to