Skip to content
This repository was archived by the owner on Dec 28, 2021. It is now read-only.
This repository was archived by the owner on Dec 28, 2021. It is now read-only.

cuke4php crashes on optional backreferences #12

@mrtorrent

Description

@mrtorrent

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions