我正在設置一個jenkins作業來構建和部署Zend Framework 2 php應用程序。 在我的ant構建腳本中,我定義了一個用於驗證php文件的lint作業。在Jenkins中構建和部署Zend Framework PHP應用程序
構建作業失敗,因爲lint在ZF2庫文件中檢測到錯誤。
這是由棉絨產生的輸出:
[apply] PHP Fatal error: Constructor Zend\Captcha\Factory::factory() cannot be static in /var/lib/jenkins/workspace/XXX/vendor/zendframework/zendframework/library/Zend/Captcha/Factory.php on line 90
[apply] Errors parsing /var/lib/jenkins/workspace/XXX/vendor/zendframework/zendframework/library/Zend/Captcha/Factory.php
有誰知道Zend/Captcha/Factory.php fails
爲什麼驗證?
Ant任務看起來是這樣的:
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/">
<include name="**/*.php" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
如果您發佈了作業的定義,那麼您的問題對未來的訪問者會更有用。我不知道我是否會對任何人回答問題的能力產生影響(這是我沒有降低這一點的原因),但通常只是發佈錯誤消息並不是很有幫助。 – Ben
你使用什麼版本的PHP?通常情況下,靜態工廠方法沒有問題(沒有任何構造函數)。最新的標記(2.0.3)看起來像這樣,並在我的機器上(php 5.3.14)罰款:罰款:https://github.com/zendframework/zf2/blob/7f49f1e1a22994ea5d7cf4da1c49119df274b99d/library/Zend/Captcha/Factory.php #L20 –
@Jurian Sluiman:謝謝你的迴應。 我使用PHP 5.3.2-1ubuntu4。18與Suhosin-Patch – MadeOfSport