Skip to content

Undocumented BC break - Longo ption must be longer than 1 char #143

@JanMikes

Description

@JanMikes

Hello, i have just upgraded from 1.1 to latest version and i receive this exception:
Long option must be null or an alphanumeric string, found 'c'

We have this option: [null, 'c', GetOpt::OPTIONAL_ARGUMENT, 'Set working copy.'],

I have found out the issue is in Option::setLong() where this regex wont pass: /^[a-zA-Z0-9][a-zA-Z0-9_-]{1,}$/ - https://regex101.com/r/v3F9pu/1

It worked fine with version 1.1, but now it does not.

If i change the regex like this, it works: /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/ https://regex101.com/r/qKbrCc/2

The problem is it expects at least 2 charactes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions