Running code with XDEBUG option enabled, getting: Fatal error: Call to a member function getCookieJar() on null in ....vendor\codeception\codeception\src\Codeception\Module\REST.php on line 102 #3883

andsol opened this Issue Dec 30, 2016 · 4 comments


None yet

3 participants

andsol commented Dec 30, 2016

What are you trying to achieve?

What do you get instead?

If its null catch this case

Provide console output if related. Use -vvv mode for more details.

Call to a member function getCookieJar() on null 
in C:\Web\api\vendor\codeception\codeception\src\Codeception\Module\REST.php:102
PHP Fatal error:  Call to a member function getCookieJar() on null in C:\Web\api\vendor\codeception\codeception\src\Codeception\Module\REST.php on line 102
PHP Stack trace:
PHP   1. {main}() C:\Php\codecept.phar:0
PHP   2. require_once() C:\Php\codecept.phar:7
PHP   3. Codeception\Application->run() phar://C:/Php/codecept.phar/codecept:36
PHP   4. Symfony\Component\Console\Application->run() phar://C:/Php/codecept.phar/src/Codeception/Application.php:103


  • Codeception version: ^2.2
  • PHP Version: 7
  • Operating System: win
  • Installation type: Composer
# Codeception API suite configuration
class_name: ApiTester
        - Db
        - REST:
#            url:
            depends: PhpBrowser
            part: Json
            xdebug_remote: true

You found some dead code.

        if ($this->config['xdebug_remote']
            && function_exists('xdebug_is_enabled')
            && ini_get('xdebug.remote_enable')
            && !$this->isFunctional
        ) {
            $cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');

This code remained mostly untouched since it was written in 2012 and we have no tests for it.
Probably it was broken since one of minor releases (2.1.0 or 2.2.0).

Skipping this code if $this->client is not set is not a solution, because xdebug won't work if the code didn't run.

The client is null, because REST::_before() method runs before PhpBrowser::_before().
@DavertMik What is the best way to ensure that _before of connection module runs first?

@Naktibalda Naktibalda added the REST label Dec 30, 2016

It would be easier to move xdebug_remote code and configuration to PhpBrowser.


Nobody wants to debug their entire test suite, they want to debug a specific request.
I think that startRemoteXdebugSession method would be a useful addition to Phpbrowser.

@Naktibalda Naktibalda assigned Naktibalda and unassigned DavertMik Jan 1, 2017

I haven't found any documentation or search results about xdebug_remote option of REST module,
however I discovered codeception/remote-debug extension which provides very similar functionality.

@Naktibalda Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Jan 1, 2017
@Naktibalda Naktibalda [REST] Removed broken xdebug_remote functionality
Please use codeception/remote-debug package instead
@Naktibalda Naktibalda closed this in #3887 Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment