2012-04-06 78 views
1

我在這裏有一個相當有趣的(和煩人的)問題。出於某種原因,PHP方法ReflectionClass::getDocComment()在我的生產環境中返回false(雖然實際上在課程中有塊註釋...)。Doctrine 2/PHP的 - getDocComment()總是返回false - AnnotationReader/DocParser失敗

導致主義AnnotationReader/DocParser失敗:

(教義\ COMMON \註解\ AnnotationReader.php:143)

public function getClassAnnotations(ReflectionClass $class) 
    { 
     $this->parser->setTarget(Target::TARGET_CLASS); 
     $this->parser->setImports($this->getImports($class)); 
     $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); 

     return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); 
    } 

我環顧四周,並沒有看到很多有關這個問題,所以我想知道爲什麼這是發生在我的生產服務器,當它不在我的本地環境。

  • 難道是因爲一些PHP配置?
  • 難道是因爲一些讀/寫/文件訪問權限(chown等)?
  • 難道是因爲一些caching configuration ??

我必須說我已經沒有想法了。

任何幫助,非常感謝。

謝謝。

+0

進一步的調查使我認爲這是關係到eAccelerator在: http://wildlyinaccurate.com/eaccelerator-and-doctrine-2/ && http://stackoverflow.com/questions/9676328/inconsistent-results-with-php-reflection-api 我會嘗試禁用它並查明是否這是問題。 – eightyfive 2012-04-06 17:56:26

回答

2

好的。這似乎鏈接到的緩存字節代碼時eAccelerator在剝離所有評論一些奇怪的行爲...

http://wildlyinaccurate.com/eaccelerator-and-doctrine-2/

(重新)從教義團隊報價beberlei:

這過早優化以去除docblocks應該是 恢復。 Docblocks是一個PHP令牌的原因,他們是 語言的一部分,應該這樣使用。請修改您的立場 否則項目必須建議不要使用eAccelerator默認。

解決方法是,禁用eAccelerator在或與該選項重新進行配置:

--with-eaccelerator-doc-comment-inclusion 

(來源:https://eaccelerator.net/ticket/229