Closed arthurdarcet closed 7 years ago
Bit late to reply, but the balancing is to cater for cases like Composer (further details at https://en.wikipedia.org/wiki/Composer_(software))
(the second closing parenthesis shouldn't form part of it).
Also without surrounding parentheses this bug occurs:
https://example.com/x_(aaaaaaaaaaaaaaaaa)
(17 times 'a') will fail by resulting in a PREG_BACKTRACK_LIMITERROR
`https://example.com/x(aaaaaaaaaaaaaaaa)will successfully return a match (16 times 'a')
https://example.com/x_(aaaaaaaaaaaaaaaaa)b` succeeds again (17 times 'a')
Trying to
processUrl
the stringftp://(123456789012345678
will result in a PREG_BACKTRACK_LIMIT_ERROR (I think it has something to do with this ).I don't understand why the
linkifyUrl
regex is trying to match balanced parenthesis, the above URL should be considered valid and there isn't any reason for(
or<
to be balanced in an URL. (real life example: http://i.ebayimg.com/00/s/MTYwMFgxMDg5/$(KGrHqYOKjIE6Sv7R)(rBOw8jhvfD!~~60_35.JPG )