Cerdic/CSSTidy

ctype_alpha() is wrong

TobiasBg opened this issue · 1 comments

The replacement definition for the ctype_alpha() function is wrong. In its current state, it will only check for the existence of a letter in the checked string, but it does not check if ALL characters are letters.
It should be something like

function ctype_alpha( $text ) {
    return ( 1 === preg_match( '/^[a-zA-Z]+$/', $text ) );
}

Also, the function ctype_xdigit() is used a couple times in CSSTidy, but doesn't have compatibility function.
See https://github.com/TobiasBg/CSSTidy/blob/master/class.csstidy.php#L52-L69 for fixed and extended versions.