Codeigniter + NetBeans + XDebug: debugger does not work after redirection ()

I am working on a project that uses CodeIgniter . I use Netbeans as my IDE and I have Xdebug installed. I am using XAMPP for local development.

What works: Xdebug works great for normal PHP code.

Problem: However, I have to deal with problems debugging my CodeIgniter project. The debugger stops at redirect()

Problem Details: Run the debug project in netbeans. Debugging begins, and we see the home page. There is a link on the home page corresponding to the method in the home controller. The debugger reaches the method in the controller that the reference points to. There is redirect in this method. At the moment the STOPS debugger is redirected.

Relevant code fragments:

URL clicked (This is part of the header menu)

 <a href="<?= base_url("somefunc/"); ?>">Click Me </a> 

routes.php - redirection for a more beautiful URL.

 $route['somefunc'] = "foo/somefunc"; 

And in my Foo Controller (foo.php):

 class Foo extends CI_Controller { public function somefunc() { redirect('/bar/otherfunc'); // DEBUGGER REACHES TILL HERE THEN STOPS WORKING } } 

As stated in the comment in function somefunc() above, Xdebug stops working where the redirect occurs.

In addition, you may need the following information:

config.php

 $config['uri_protocol'] = 'AUTO'; // I have also tried PATH_INFO, QUERY_STRING, REQUEST_URI & ORIG_PATH_INFO. $config['permitted_uri_chars'] = 'az 0-9~%.:_\-'; $config['enable_query_strings'] = TRUE; // Have tried FALSE too. $config['index_page'] = ''; // Tried index.php too. 

xdebug in php.ini

 zend_extension ="path\to\xampp\php\ext\php_xdebug.dll" xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000 

NOTE I already tried playing with various offers that I saw here, as well as through google, but to no avail. Can someone point me in the right direction?

+4
source share
3 answers

Found a solution. Perhaps this can help someone who struggled with this. Obviously, to ensure smooth debugging, you need to enable the option:

 xdebug.remote_autostart=1 

in php.ini . Now these settings work for me:

 xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_autostart=1 

The last line is the option I found ( Xdebug Official Documentation ). The relevant part of the documentation is mentioned below:

xdebug.remote_autostart

Type: boolean, Default value: 0

Typically, to start remote debugging (see Remote Debugging), you need to use a specific HTTP GET / POST variable. When this parameter is set to 1, Xdebug will always try to start a remote debugging session and try to connect to the client even if the GET / POST / COOKIE variable was missing.

+9
source

I found the same problem and fixed it by updating my version of xdebug.

There seems to be a bug in the version I used (xdebug 2.1.3), but it all works fine on xdebug 2.2.3.

Use this tool for custom installation instructions for your environment. http://xdebug.org/wizard.php

0
source

Keep in mind that netbeans doenst works with $_SERVER['PATH_INFO'] and url as http://127.0.0.1/site/test.php/v1/v2/parametertoputonphpathinfo/v3 , there is a bug Mon Sep 09, 2013 8:54 am on the netbeans board telling this unanswered until 2014:

http://forums.netbeans.org/topic56645.html

This makes it impossible to debug the structure using this sinatra method to route requests.
Rewriting my simple Sinatra router for $ _GET mode for debugging and better hook code.

0
source

Source: https://habr.com/ru/post/1486038/


All Articles