8000 Fix array offset error for canonical url in meta by crydotsnake · Pull Request #3411 · forkcms/forkcms · GitHub
[go: up one dir, main page]

Skip to content

Fix array offset error for canonical url in meta#3411

Merged
carakas merged 2 commits intoforkcms:masterfrom
crydotsnake:crydotsnake-patch-1
May 26, 2021
Merged

Fix array offset error for canonical url in meta#3411
carakas merged 2 commits intoforkcms:masterfrom
crydotsnake:crydotsnake-patch-1

Conversation

@crydotsnake
Copy link
Contributor

Fixing the error message: Notice: Trying to access array offset on value of type null

@codecov
Copy link
codecov bot commented May 26, 2021

Codecov Report

Merging #3411 (7d4ff16) into master (f4ac874) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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           
Flag Coverage Δ
functional 23.62% <100.00%> (ø)
installer 3.81% <0.00%> (ø)
unit 7.57% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Backend/Core/Engine/Meta.php 59.55% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4ac874...7d4ff16. Read the comment docs.

public function getCanonicalUrl(): ?string
{
if (!is_array($this->data['data'])) {
if (!isset($this->data['data'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay. Thanks!. My PHP Experience is not much good so far 😊

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's oke, this is one of the best ways to learn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it :)

@carakas carakas added this to the 5.10.1 milestone May 26, 2021
@carakas carakas merged commit b77ae1e into forkcms:master May 26, 2021
@carakas carakas changed the title Fix array offset error Fix array offset error for canonical url in meta May 26, 2021
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

0