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

Undefined property: Config\App::$errorViewPath #765

Closed
rehiy opened this issue Oct 10, 2017 · 9 comments
Closed

Undefined property: Config\App::$errorViewPath #765

rehiy opened this issue Oct 10, 2017 · 9 comments

Comments

@rehiy
Copy link

rehiy commented Oct 10, 2017

Displayed at 12:12:06pm — PHP: 7.1.9 — CodeIgniter: 4.0-dev

ErrorException
Undefined property: Config\App::$errorViewPath search →
BASEPATH/CodeIgniter.php at line 805

798 // Show the 404 error page
799 if (is_cli())
800 {
801 require $this->config->errorViewPath . '/cli/error_404.php';
802 }
803 else
804 {
805 require $this->config->errorViewPath . '/html/error_404.php';
806 }
807
808 $buffer = ob_get_contents();
809 ob_end_clean();
810
811 $this->response->setBody($buffer);
812 $this->response->send();

@lonnieezell
Copy link
Member

@anrip Is this using the very latest code?

@jaynarayan89
Copy link
Contributor

jaynarayan89 commented Oct 10, 2017

@lonnieezell Yes, i am getting this error too,after merging with latest code.
for reproducing it try to access some non exit path.
for example ci4,dev/dummy

@jaynarayan89
Copy link
Contributor

latest commit in my fork is 6eedefb (a day ago)

@rehiy
Copy link
Author

rehiy commented Oct 10, 2017

yes, last code

@deathart
Copy link
Contributor

Can you show us the code of the Application/Config/Exceptions.php file?

@rehiy
Copy link
Author

rehiy commented Oct 10, 2017

<?php namespace Config;

/**
 * Setup how the exception handler works.
 *
 * @package Config
 */
class Exceptions
{
	/*
	 |--------------------------------------------------------------------------
	 | LOG EXCEPTIONS?
	 |--------------------------------------------------------------------------
	 | If true, then exceptions will be logged
	 | through Services::Log.
	 |
	 | Default: true
	 */
	public $log = true;

	/*
	 |--------------------------------------------------------------------------
	 | DO NOT LOG STATUS CODES
	 |--------------------------------------------------------------------------
	 | Any status codes here will NOT be logged if logging is turned on.
	 | By default, only 404 (Page Not Found) exceptions are ignored.
	 */
	public $ignoreCodes = [ 404 ];

	/*
	|--------------------------------------------------------------------------
	| Error Views Path
	|--------------------------------------------------------------------------
	| This is the path to the directory that contains the 'cli' and 'html'
	| directories that hold the views used to generate errors.
	|
	| Default: APPPATH.'Views/errors'
	*/
	public $errorViewPath = APPPATH.'Views/errors';
}

@Iamscalla
Copy link
Contributor

the issue is codeigniter.php uses the config property "$this->config->errorViewPath " from \Config\App.
so get it fixed, a possible merging of property from \Config\App and \Config\Exception or returm that property to it previous place. or call the exception config seperately where required.

@lonnieezell
Copy link
Member

Yup, only happens with 404Overides in place, by the looks of it. Will look at it closer tonight, hopefully, but looks like we should be throwing a PageNotFoundException there and letting the exceptions class handle it.

@jaynarayan89
Copy link
Contributor

jaynarayan89 commented Oct 10, 2017

@chistel Your are right. I tested with a fresh install and get the same error. when I created public $errorViewPath = APPPATH.'Views/errors' in Config\app then it works. codeigniter.php is trying to access errorviewpath property on instance of \config\app but the property does not exists.

what do you mean by "a possible merging of property from \Config\App and \Config\Exception or returm that property to it previous place. or call the exception config seperately where required." ?

both property $config and $viewpath of \CodeIgniter\Debug\Exceptions is protected so cant be used in codeigniter.php

i think 490a31c has something to do with this problem

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