Doctrine Common
  1. Doctrine Common
  2. DCOM-243

'Zend OPcache' PHP extension might prevent AnnotationReader from getting entity class comments

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4.1
    • Fix Version/s: None
    • Component/s: Annotations
    • Labels:
      None

      Description

      If module Zend OPcache is installed and configured not to save comments the AnnotationReader class fails to parse data for entities.

      Output from php -m contains line Zend OPcache.
      The module is configured with the following parameter opcache.save_comments=0.

      I would expect the AnnotationReader constructor to throw an exception. But it does not check if the module is loaded.

      In addition to the check for opcache module

              if (extension_loaded('opcache') && ini_get('opcache.save_comments') == 0) {
                  throw AnnotationException::optimizerPlusSaveComments();
              }
      

      we might have a new check for the Zend OPcache module

              if (extension_loaded('Zend OPcache') && ini_get('opcache.save_comments') == 0) {
                  throw AnnotationException::optimizerPlusSaveComments();
              }
      

        Activity

        Hide
        Victor Smirnov added a comment -

        Please check the pull request - https://github.com/doctrine/annotations/pull/35
        I think this might be a simple fix.

        It took us a while here to discover the issue on production. I think the setup might be quite common on production servers. Adding the check should save people time on troubleshooting.

        Warm regards,
        Victor

        Show
        Victor Smirnov added a comment - Please check the pull request - https://github.com/doctrine/annotations/pull/35 I think this might be a simple fix. It took us a while here to discover the issue on production. I think the setup might be quite common on production servers. Adding the check should save people time on troubleshooting. Warm regards, Victor

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Victor Smirnov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: