With this code , I get a blank screen, and the debug stop but doesn't shows an error
$instance = app('App\Http\Controllers\MyControllers\ConsumerController');
$consumerSegmentList = $this->getSegmentList($instance);
The problem its when I try to get a controller instance with app function the route its correct but I don't know whats the problem, this code its ib ParentController which is the parent of ConsumerController
Related
So I just had an error on laravel.
Call to a member function getName() on null
I was running this code
view()->composer('*', function ($view)
{
$view->with('route_name', ucfirst(explode(".", \Route::current()->getName())[1]));
});
This code only broke in the first place on one of my pages, a newly added route. The pages that it worked on seem to be caching whatever was there before, I even made the second argument "test".
It seems to be caching the error when I've replaced the code? But only showing the error on the page it showed it, to begin with.
I have a PHP website that runs on AWS and on a local WAMP host. If I use a browser (lets say Chrome) to log into the AWS application and then open a new tab to log into the local application, the SESSION variable breaks on the AWS server. And I literally mean break, the error I get is
PHP Fatal error: Call to undefined method stdClass::refreshState()
The SESSION has a field ("helper") that contains an object. If I print the Session out after the critical error then it still has the "helper" object, but it only has the first 4 fields from the class definition, the rest are gone. The above mentioned error happens because the refreshState method just disappeared along with the rest of the class methods and fields
For reference, this is the first part of the helper class:
class SessionHelper
{
const VIEW_TYPE_LANDING = "landing";
const VIEW_TYPE_USER = "user";
const VIEW_TYPE_ADMIN = "admin";
public $logged_in_user_id;
public $logged_in_org_user_id;
public $login_date;
public $prev_login_date;
public $current_org_id;
...
Printing the instance out after it breaks yields:
The session stays broken in the browser even after restarting the browser. The only way to fix the error is to clear the browsing history on the browser, after which the error is gone. Any ideas what could be causing this? Any information regarding SESSIONS that break in this fashion would be welcome
I use codeigniter in my blog and since a while I get this error
PHP Fatal error: Call to a member function append_output() on a non-object in /var/www/site/blog/system/core/Loader.php on line 862
I don't know what change caused this and why it appears. The site gets rendered and send to browser completely, from views header.php, index.php to footer.php everything is there and after that this error appears. Search with google showed another site, that has this error at the very bottom of their site...
I now supressed the error with error_reporting(0) as the whole site works fine, but that's not a solution I want to stay with.
It happens on all pages, I have one Controler (blog.php) and several methods like index(), article(), archive() in it. The methods do what they are supposed to do, but when CI finished rendering the page, the error appears, with all controler methods.
What can I do to trace where this problem appears?
https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Loader.php#L938
If the error is occurring on the value returned from get_instance, here will be your problem. Although you may have to look at the version you are using to get the right line number.
Additionally:
https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Controller.php#L75
This appears to be the singleton class that function leads to, it is returning self::$instance which is created in the constructor.
To me this means the CI_Controller singleton has not been instantiated at the time that error has occurred.
Hope that helps you debug your problem.
I had the same problem. I'd overwritten the output class ($this->output) in my controller.
I am stuck with a Symfony application using version 1.0.17 which can't be upgraded at the moment.
Right now there is a page that contains an iframe which loads a webpage of a different action from the same module. The iframe is causing some design issues as well and some user-experience issues so I want to get rid of it and just render the HTML from the iframe directly in the page.
I just can't figure out how to execute another action and render the view template into a variable that I can assign to the calling action's view.
I've tried getPresentationFor() but that either results in a 404 on the calling page, an exception or fatal error depending on how I try it.
I think I need to put the code in the execute method of the action. The controller is an sfAction object. If I call $this->getController() I get an sfWebController object.
Calling:
$this->getController()->getPresentationFor('module', 'ContactIframeAction');
Results in a blank page; any code after that call does not get executed but if I output something before it I can see it on the page. No errors in the server error log.
Calling:
$this->getController()->getPresentationFor('module', 'ContactIframe');
just causes our 404 page to show so I think the previous call is closer to what I want.
Is there a way to render the output of another action from another action's code?
Thanks.
It's probably
$this->theContent = $this->getController()->getPresentationFor('module', 'contactIframe'); // minus 'c'
Use :
// modules/mymodule/actions/actions.class.php
class myPageActions extends sfActions {
public function executeIndex() {
// ...
$this->theContent = $this->getController()->getPresentationFor('module', 'contactIframe');
}
}
// modules/mymodule/templates/indexSuccess.php
<?php echo $theContent ?>
In production mode (minimal errors), when a controller is not found, Zend gives a 404 page not found error. There are a couple of controllers that I don't want this activated for. Even though they don't exist, I don't want the page not found error activated. Is it possible to somehow block that error and give an empty page. I'm guessing, if at all possible, it has to be done at the plugin level since no controller really exists to handle this.
One possible solution would be to check the request object in your errorAction for controller and/or action that threw the exceptions (for non-existing controllers and actions you could also get their names this way). Based on this you could customize the rest of errorAction. For example:
public function errorAction() {
$errors = $this->_getParam('error_handler');
$whatController = $errors->request->getControllerName();
if ('secretController' == $whatController) {
return $this->_redirect('blankErrorPage');
}
// usual rest of errorAction
}