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

PHP 8 throws Fatal Error in Logging.php when loading a Mezzio page via AJAX #78

Closed
4 tasks done
dennis-fedco opened this issue Apr 28, 2021 · 3 comments · Fixed by #79
Closed
4 tasks done

PHP 8 throws Fatal Error in Logging.php when loading a Mezzio page via AJAX #78

dennis-fedco opened this issue Apr 28, 2021 · 3 comments · Fixed by #79

Comments

@dennis-fedco
Copy link

dennis-fedco commented Apr 28, 2021

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • Mezzio 3

What PHP version you're using?

  • PHP 8.0

What ErrorHeroModule version you're using?

  • ^3.1

What Database you're using?

  • MySQL version 8.0

Expected behavior

no errors are thrown when loading a Mezzio page via AJAX

Actual behavior

PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, Laminas\Diactoros\PhpInputStream given in vendor\samsonasik\error-hero-module\src\Handler\Logging.php:120
Stack trace:
#0 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(120): str_replace('\r\n', '', Object(Laminas\Diactoros\PhpInputStream))
#1 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(192): ErrorHeroModule\Handler\Logging->getRequestData(Object(Laminas\Psr7Bridge\Laminas\Request))
#2 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(227): ErrorHeroModule\Handler\Logging->collectErrorExceptionExtraData(Array, Object(Laminas\Psr7Bridge\Laminas\Request))
#3 vendor\samsonasik\error-hero-module\src\Middleware\Mezzio.php(78): ErrorHeroModule\Handler\Logging->handleErrorException(Object(ErrorException), Object(Laminas\Psr7Bridge\Laminas\Request))
#4 vendor\samsonasik\error-hero-module\src\HeroTrait.php(107): ErrorHeroModule\Middleware\Mezzio->exceptionError(Object(ErrorException))
#5 [internal function]: ErrorHeroModule\Middleware\Mezzio->execOnShutdown()
#6 {main}
thrown in vendor\samsonasik\error-hero-module\src\Handler\Logging.php on line 120

Steps/Codes to reproduce the behavior

With PHP 8.0.3 I used AJAX loading method
My code has this: <a href="#" onclick="$('#div_id').load('/proposal/form');">Load Form</a>

Note - going to /proposal/form URL directly loads the form just fine. The error only happens when I use AJAX link to load the form.
I am not sure if the error is related to AJAX specifically, but that is what I am observing at this time.

@samsonasik
Copy link
Owner

This module is not support php 8 yet, see

"php": "^7.1",

@samsonasik
Copy link
Owner

Please check if #79 fix the issue.

Otherwise, there are an ongoing works for php 8 compatible #77 , just not sure when I will have a chance to implement it.

@samsonasik
Copy link
Owner

I just released version 4 which support php 8 https://github.com/samsonasik/ErrorHeroModule/releases/tag/4.0.0

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 a pull request may close this issue.

2 participants