cuke4php crashes on optional backreferences
Capture groups that create backreferences but are optional cause cuke4php to crash. For example:
/^the(?: losing)? code "([^"]*)"(?: has the prize "([^"]*)")?$/
The fourth capture group in this regex (the second ([^"]*)) causes cuke4php to crash because it is contained within a capture group that is optional. Note that the first and third capture groups are not an issue because they do not create backreferences (?:).
The crash can also be reproduced with a single, rather than nested, capture group which requires one or more characters but is optional as a whole, e.g. (.+)?
The resulting exception is:
PHP Fatal error: Uncaught exception 'PHPUnit_Framework_Error_Notice' with message 'Uninitialized string offset: 0' in /usr/lib/ruby/gems/1.8/gems/cuke4php-0.9.5/lib/Cuke4Php.php:204
what version of PHP are you using? You might also try using the 0.9.6.c pre-release gem