https://bugzilla.wikimedia.org/show_bug.cgi?id=38294

--- Comment #5 from Roan Kattouw <[email protected]> 2012-08-28 19:25:35 
UTC ---
This seems to be because of unhelpful behavior in preg_replace_callback(),
which returns null on error. And for some reason, the following is triggering
an error and causing preg_replace_callback() to return null, even though
preg_match() (and, not shown here, preg_match_all()) don't have a problem with
the given regex and agree it doesn't match the string.

> $style = 
> file_get_contents('/usr/local/apache/common/php-1.20wmf10/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css')

> $regex = 
> '/(background(?:-position)?\s*:\s*[^%]*?)(-?(?:[0-9]*\.[0-9]+|[0-9]+))(%\s*(?:(?:[0-9]*\.[0-9]+|[0-9]+)(?:\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|-?(?:[_a-z]|[\200-\377]|(?:(?:(?:\[0-9a-f]{1,6})(?:\r\n|\s)?)|\[^\r\n\f0-9a-f]))(?:[_a-z0-9-]|[\200-\377]|(?:(?:(?:\[0-9a-f]{1,6})(?:\r\n|\s)?)|\[^\r\n\f0-9a-f]))*)?|-?(?:[_a-z]|[\200-\377]|(?:(?:(?:\[0-9a-f]{1,6})(?:\r\n|\s)?)|\[^\r\n\f0-9a-f]))(?:[_a-z0-9-]|[\200-\377]|(?:(?:(?:\[0-9a-f]{1,6})(?:\r\n|\s)?)|\[^\r\n\f0-9a-f]))*))/';

> echo preg_match( $regex, $style )
0
> var_dump(preg_replace_callback($regex, function($matches) { return 
> $matches[1] . (100 - $matches[2]) . $matches[3]; }, $style ))
NULL

Of course there's no way to find out what the error is, because it's not
actually returned :S . Will fix the code to handle a null return value
correctly.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to