appstract / laravel-opcache

Laravel Package for OPcache
MIT License
1.34k stars 119 forks source link

Trying to access array offset on value of type null #136

Open theara72 opened 2 years ago

theara72 commented 2 years ago

I come across this error such as below

php : v8.0.3 with opcache and xdebug laravel : v8 LTS

note: eror occure while pre-compile commanding

sorry for bad english

Trying to access array offset on value of type null

  at C:\xampp_old\htdocs\nib-backend-v2\vendor\laravel\framework\src\Illuminate\Http\Client\Response.php:349
    345▕      */
    346▕     #[\ReturnTypeWillChange]
    347▕     public function offsetGet($offset)
    348▕     {
  ➜ 349▕         return $this->json()[$offset];
    350▕     }
    351▕
    352▕     /**
    353▕      * Set the value at the given offset.

  1   C:\xampp_old\htdocs\nib-backend-v2\vendor\laravel\framework\src\Illuminate\Http\Client\Response.php:349
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Trying to access array offset on value of type null", "C:\xampp_old\htdocs\nib-backend-v2\vendor\laravel\framework\src\Illuminate\Http\Client\Response.php")

  2   C:\xampp_old\htdocs\nib-backend-v2\vendor\appstract\laravel-opcache\src\Commands\Compile.php:40
      Illuminate\Http\Client\Response::offsetGet("result")
m0stwan1ed commented 2 years ago

Same error: image

tormit commented 2 years ago

This project looks dead. Are there any forks with latest patches?

Stunext commented 2 years ago

I have seen that many have problems with the Http facade. You could try using the exclude array in the opcache.php file in the config folder, although I don't know if this array allows you to indicate the path to an entire folder to exclude. I should clarify that I have not had that problem in both laravel 8 and laravel 9.

In general, when the library has failed me, it is when I try to add it to an already advanced project. Sometimes I create a clean Laravel project and then I add little by little the code of the base project until I detect where the file that cannot be compiled is.

LocalHeroPro commented 2 years ago

I have similar issue:

$ php artisan opcache:compile --force --env=testing
Compiling scripts...

In Response.php line 361:

  Trying to access array offset on value of type null

I think it's pointing to: Illuminate\Http\Client\Response@offsetGet image