Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notice - Undefined offset: 1 #91

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

sovetski
Copy link

@sovetski sovetski commented Mar 14, 2024

To reproduce, try the package phpoffice/phpspreadsheet with the version ^1.29

It will return
PHP Notice: Undefined offset: 1 in vendor/brianhenryie/strauss/src/ChangeEnumerator.php on line 211

@sovetski
Copy link
Author

Strange, it fixes the notice, but it does not work. I have this error

Interface "MyCustomPrefix_Stringable" not found

@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Mar 14, 2024

Weird. I'd expect when preg_match() returns 1 the array really should have an element at [1].

preg_match() returns 1 if the pattern matches given subject, 0 if it does not, or false on failure.

@BrianHenryIE BrianHenryIE merged commit d9734b2 into BrianHenryIE:master Mar 19, 2024
5 of 11 checks passed
@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Mar 19, 2024

I think I've fixed the Undefined offset problem: 7c3212061578d78fa1236ca69eeb0ec435f6520d. Basically, it was seeing the word "namespace" in a comment and tripping up. I think your fix was probably fine, but it wasn't until I'd rewritten it this way that I really understood what had been happening.

But I think the Stringable issue is probably still there: 1bd20b7 #79

You probably have a polyfill library. Please test and let me know if the problem is still present. You should be able to fix it with:

"extra": {
    "strauss": {
        "exclude_from_prefix": {
            "packages": [
                "symfony/polyfill-php80",
                "php-extended/polyfill-php80-stringable"
            ]
        }
    }
}

@BrianHenryIE
Copy link
Owner

The interface Stringable issue is fixed in master now 25db6cd...63d781d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants