CRM-13295 Civix fails to create session when trying to add API function

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.2.9
    • Fix Version/s: 4.4.1
    • Component/s: Extension System
    • Labels:
      None

      Description

      I'm having trouble adding an API function to a module. It's failing, and I'm not clear on why.

      Errors as follows:

      <pre>
      root@sandbox-006:/var/local/www/xxxxxx/htdocs/sites/all/civicrm/extensions/xxxxxx.mailingstats# civix generate:api MailingStatsReport Update
      Write /var/local/www/xxxxxx/htdocs/sites/all/civicrm/extensions/xxxxxx.mailingstats/api/v3/MailingStatsReport/Update.php

      [ErrorException]
      Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in /home/xxxxxx/civix/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php line 56

      generate:api [--schedule[="..."]] <EntityName> <ActionName>
      </pre>

      I'm running:
      Debian 6.0 (squeeze).

      • Civicrm 4.2.9 (with some backports from 4.2.10),
      • PHP 5.3.3-7+squeeze17 with Suhosin-Patch v0.9.32.1
      • civix/composer.lock referes to Symfony 2.1.7.

      Looking at strace output, I can see where it loads civix/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php and just afterwards runs stat64 on civix/app/cache/dev/sessions, which has session files in it from earlier use of civix, but no new ones. I don't see any system call that tries to create a session file, or otherwise access the directory after stat'ing it.

      I'm not all that clear on how some of the fields for this issue. Please correct as appropriate

        Attachments

          Activity

          [CRM-13295] Civix fails to create session when trying to add API function
          Tim Otten added a comment -

          Hm, I setup a VM with Debian 6. It's running the same versions of everything – except that it has the bleeding edge version of CiviCRM 4.2 from git ("4.2.11"), and I can't reproduce.

          For a little more detail about my setup (in case it helps to find differences):

          • Tried with Drupal 7.12 and 7.23
          • The line referenced in the error looks to be "ini_set('session.save_handler', 'files');".
          • Can you get a backtrace? If nothing else, add the line "CRM_Core_Error::backtrace();" or "debug_print_backtrace();" to NativeSessionHandler.php right before line 56.
          • When I run "civix generate:api" on my system, CRM_Core_Session::initialize() is called. (See https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Session.php#L111 ) It might be interesting to add some print() statements in there to see if it executes the same way on your system as it does on mine. On mine, the key conditions evaluate as follows:
            + L114: !isset($this->_session) ---> TRUE (run the nested code...)
            + L116: !isset($_SESSION) && PHP_SAPI !== 'cli' ---> FALSE (skip the nested code...)
            + L131: $isRead ---> TRUE (run the nested code...)
          Tim Otten added a comment -

          Oops, hyperlink above was to "master". I think the content is same, but the URL for 4.2 is:

          https://github.com/CiviCRM42/civicrm42-core/blob/4.2/CRM/Core/Session.php#L111

          Tim Otten added a comment -

          Andrew, are you still having this problem? Have you tried getting a backtrace or inspecting the execution (per above)?

            People

            • Assignee:
              Tim Otten
              Reporter:
              Andrew McNaughton

              Dates

              • Created:
                Updated:
                Resolved: