Bug Report
| Subject |
Details |
| Rector version |
0.17.1 |
if empty(...) is called for an string-element of an array, the resulting code does not check if the array-key actually exists.
Minimal PHP Code Causing Issue
$parts = parse_url($url);
if (!empty($parts['host'])) {
// is replaced with
if ($parts['host'] !== '') {
// but the host-key might not be set
https://getrector.com/demo/5df3320d-26b9-47a6-a4ee-7910f747bb9c
Expected Behaviour
I guess adding an additional isset(...)-check would fix this.
Bug Report
if empty(...) is called for an string-element of an array, the resulting code does not check if the array-key actually exists.
Minimal PHP Code Causing Issue
https://getrector.com/demo/5df3320d-26b9-47a6-a4ee-7910f747bb9c
Expected Behaviour
I guess adding an additional isset(...)-check would fix this.