Hi,

I'd like to propose an RFC to convert PCRE compilation E_WARNINGs to
E_RECOVERABLE_ERRORs, so I'm opening a prior discussion to see how viable
this could be.

The reason is quite simple. If userland code is using malformed regular
expressions, this is probably a programmer's mistake caused by lack of
attention or lack of knowledge about PCRE flavor. In any case, program
execution should be halted because the given regular expression is not
working as expected.

Consider the following (lame) code example:

    function securityCheck($input) {
        if (! preg_match('/some malformed regex', $input))
            throw new Exception("Dangerous user input!");
        }
    }

    // the regexp is malformed so
    // none of the following calls will throw exception :(
    securityCheck($good_input);
    securityCheck($danger_input);


This could cause a minor BC break for programs already running with
malformed regexp, but that's the hole purpose of this discussion. Do you
think such RFC would be a good idea?


Regards,
Marcio Almada.

Reply via email to