Fix array offset error for canonical url in meta#3411
Fix array offset error for canonical url in meta#3411carakas merged 2 commits intoforkcms:masterfrom crydotsnake:crydotsnake-patch-1
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3411 +/- ##
=========================================
Coverage 27.64% 27.64%
- Complexity 8107 8109 +2
=========================================
Files 572 572
Lines 30924 30924
=========================================
Hits 8549 8549
Misses 22375 22375
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
src/Backend/Core/Engine/Meta.php
Outdated
| public function getCanonicalUrl(): ?string | ||
| { | ||
| if (!is_array($this->data['data'])) { | ||
| if (!isset($this->data['data'])) { |
There was a problem hiding this comment.
Now you aren't checking if it is an array anymore so if there is an integer in there the next line will throw an error
!isset($this->data['data']) || !is_array($this->data['data'])
There was a problem hiding this comment.
Ah okay. Thanks!. My PHP Experience is not much good so far 😊
There was a problem hiding this comment.
That's oke, this is one of the best ways to learn
Fixing the error message:
Notice: Trying to access array offset on value of type null