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

Warning - Trying to access array offset on value of type null - PHP 7.4.0 #7776

Closed
condor2 opened this issue Dec 22, 2019 · 10 comments
Closed

Comments

@condor2
Copy link
Contributor

condor2 commented Dec 22, 2019

What version of OpenCart are you reporting this for?
Master Branch

Describe the bug
This warning message is displayed on Error log using Php 7.4

PHP Notice: Trying to access array offset on value of type null in admin/controller/marketplace/extension.php on line 48

Same in vendor/leafo/scssphp/src/Compiler.php on line 5230

Server / Test environment (please complete the following information):

  • PHP 7.4
@condor2 condor2 closed this as completed Dec 24, 2019
@elanclarkson
Copy link

+1 Same problem here

@elanclarkson
Copy link

Not sure if there are other issues in PHP 7.4 yet but I managed to fix this error (which for me was occurring in storage/vendor/scss.inc.php) by changing this line:

$key = $key[1];

To this:

$key = isset($key[1]) ? $key[1] : null;

@condor2
Copy link
Contributor Author

condor2 commented Mar 6, 2020

No missing column_left icons for you? :)
Because somehow in 7.4 space has no effect.

#7778

Screenshot_2020-03-06_14-42-37

@elanclarkson
Copy link

Yes actually I realised the icons in the admin menu disappeared, and then ran into that problem with spacing which was causing css class names to merge together in some of the twig templates.

Ended up here twigphp/Twig#3248 and then decided attempting to cradle Opencart into PHP 7.4 wasn't a good idea when they obviously just don't support it yet (or at least not in the version I'm using - v3.0.2.0).

@condor2
Copy link
Contributor Author

condor2 commented Mar 9, 2020

From system/library/template/Twig/Lexer.php

Change this (line 164)
$text = rtrim($text);

Replace with:
Screenshot_2020-03-09_11-27-49

@wguerram
Copy link

@condor2 your if and elseif conditions evaluate the same?

@condor2
Copy link
Contributor Author

condor2 commented Apr 29, 2020

twigphp/Twig@1fb0f97

@rodrigomanara
Copy link

rodrigomanara commented May 12, 2020

I have found the same issue and I just done what @elanclarkson done as well and fixed the issue,
I don't if this fix was sugest to the verndor as well.
$Key = $Key[1] ?? null;

@condor2
Copy link
Contributor Author

condor2 commented May 21, 2020

@condor2 your if and elseif conditions evaluate the same?

I think the best solution is this: (and not from screenshot)

    if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) {
        $text = rtrim($text);
    }

instead of this:

    if (isset($this->positions[2][$this->position][0])) {
        $text = rtrim($text);
    }

Work just fine

@Giohuram
Copy link

Please can someone help me solve this issue??:

Warning: Trying to access array offset on value of type null in /htdocs/wp-content/plugins/tuturn/templates/single-tuturn-instructor/education.php on line 39

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

No branches or pull requests

5 participants