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

Bug: Deprecated: Required parameter $userAgent follows optional parameter $body in /opt/lampp/htdocs/framework-4.0.4/system/HTTP/IncomingRequest.php on line 161 #4172

Closed
MusheAbdulHakim opened this issue Jan 28, 2021 · 4 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@MusheAbdulHakim
Copy link

Direction
We use github issues to track bugs, not for support.
If you have a support question, or a feature request, raise these as threads on our
forum.

Describe the bug
A clear and concise description of what the bug is.
After downloading the framework from the main website,www.codeigniter.com/ ,I moved it to my htdocs folder, gave it write access and opened it in the browser only to get this error

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/framework-4.0.4/app/Config/Events.php:33) in /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php:164 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/opt/lampp/htdo...', 164) #1 /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php(164): header('HTTP/1.1 500 In...', true, 500) #2 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 {main} thrown in /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php on line 164

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/framework-4.0.4/app/Config/Events.php:33) in /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php:164 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/opt/lampp/htdo...', 164) #1 /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php(164): header('HTTP/1.1 500 In...', true, 500) #2 /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php(224): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #3 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #4 {main} thrown in /opt/lampp/htdocs/framework-4.0.4/system/Debug/Exceptions.php on line 164

CodeIgniter 4 version
Which version (and branch, if applicable) the bug is in.
version 4
Affected module(s)
Which package or class is the bug in, if known.
HTTP/IncomingRequest.php
Expected behavior, and steps to reproduce if appropriate
A clear and concise description of what you expected to happen,
and how you got there.
Feel free to include a text/log extract, but use a pastebin facility for any
screenshots you deem necessary.

Context

  • OS: [ Parrot Os 4.10]
  • Web server [Apache/2.4.46 (Debian)]
  • PHP version [7.4.11]
@MusheAbdulHakim MusheAbdulHakim added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 28, 2021
@samsonasik
Copy link
Member

Not a bug, you seems have a whitespace or header sent before start a session. Ask to forum for such question https://forum.codeigniter.com/index.php

@meigiyanto
Copy link

Not a bug, you seems have a whitespace or header sent before start a session. Ask to forum for such question https://forum.codeigniter.com/index.php

you did not indicate in which thread discussed the problem above, I had a hard time looking for it in the forum

@MusheAbdulHakim
Copy link
Author

i think you only have this issue when using the downloaded zip file from the official website.So if you want to avoid it , try using the app starter or composer to install it you will not have the issue.

@joshuaify
Copy link

This style of function declaration has been deprecated in PHP 8.0. Writing functions like this have never made sense since all parameters (up to the last required one) would need to be specified when the function was called. It also caused confusion with the use of the ReflectionFunctionAbstract class to analyze functions and methods.

The new deprecation simply ensures that function signatures follow the common-sense assumption that required parameters, which must appear, should always be declared before optional ones.

The function should be rewritten to remove the default value on the earlier parameters. Since the function could never be called without declaring all parameters, this should have no effect on its functionality.

function test_function(int $var1, int $var2) {
return $var1 / $var2;
}
OR

function test_function($var1 = '', $var2 = 0) {
return $var1 / $var2;
}
https://stackoverflow.com/questions/65297279/required-parameter-xxx-follows-optional-parameter-yyy?answertab=votes#tab-top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

4 participants