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

Uninitialized string offset & Undefined array key #76

Open
garak opened this issue Jul 25, 2024 · 0 comments · May be fixed by #77
Open

Uninitialized string offset & Undefined array key #76

garak opened this issue Jul 25, 2024 · 0 comments · May be fixed by #77

Comments

@garak
Copy link
Contributor

garak commented Jul 25, 2024

While testing some cf validation, I stumbled upon these warnings:

Warning: Uninitialized string offset 13 in /myproject/vendor/davidepastore/codice-fiscale/src/AbstractCalculator.php on line 155

Warning: Undefined array key "" in /myproject/vendor/davidepastore/codice-fiscale/src/AbstractCalculator.php on line 156

Warning: Uninitialized string offset 14 in /myproject/vendor/davidepastore/codice-fiscale/src/AbstractCalculator.php on line 155

Warning: Undefined array key "" in /myproject/vendor/davidepastore/codice-fiscale/src/AbstractCalculator.php on line 156

This is similar to issue #36 but IMHO is more serious, because in this case it doesn't depend on any mistaken arguments.

I can propose a PR, which is by the way as simple as:

<             $k = $temporaryCodiceFiscale[$i];
<             $sum = $sum + $dictionaryArray[$k];
---
>             $k = $temporaryCodiceFiscale[$i] ?? '';
>             $sum += $dictionaryArray[$k] ?? 0;
@garak garak linked a pull request Jul 26, 2024 that will close this issue
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 a pull request may close this issue.

1 participant