升级到PHPUnit 3.5.13的问题

4

我已经使用phpunit一段时间了,从3.5.8开始,随后升级到3.5.10,现在使用的是3.5.11。

今天我想用以下命令升级到3.5.13:

pear channel-update pear.phpunit.de pear upgrade phpunit/PHPUnit

不幸的是,pear只升级自己,但phpunit的升级失败,如下所示。是的,我处于管理员模式,因此授权不应该是一个问题。我认为这更加奇怪,因为我之前已经成功升级过两次。因此,我很难相信这是与我的设置有关的问题(开发机器正在运行Windows 7 64位)。

有其他人遇到过这个问题并能提供解决方案吗?

'pear upgrade phpunit/PHPUnit'的输出:

第一次运行:

>pear upgrade phpunit/PHPUnit
    phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is
     1.9.1
    phpunit/PHPUnit can optionally use PHP extension "dbus"
    phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed vers
    ion is 1.9.1
    downloading YAML-1.0.5.tgz ...
    Starting to download YAML-1.0.5.tgz (9,966 bytes)
    .....done: 9,966 bytes
    downloading XML_RPC2-1.0.8.tgz ...
    Starting to download XML_RPC2-1.0.8.tgz (67,063 bytes)
    ...done: 67,063 bytes
    downloading PEAR-1.9.2.tgz ...
    Starting to download PEAR-1.9.2.tgz (295,120 bytes)
    ...done: 295,120 bytes
    downloading Cache_Lite-1.7.9.tgz ...
    Starting to download Cache_Lite-1.7.9.tgz (30,318 bytes)
    ...done: 30,318 bytes
    downloading Console_Getopt-1.3.1.tgz ...
    Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
    ...done: 4,471 bytes
    upgrade ok: channel://pear.symfony-project.com/YAML-1.0.5
    upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1
    upgrade ok: channel://pear.php.net/PEAR-1.9.2
    upgrade ok: channel://pear.php.net/Cache_Lite-1.7.9
    upgrade ok: channel://pear.php.net/XML_RPC2-1.0.8
    PEAR: Optional feature webinstaller available (PEAR's web-based installer)
    PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
    PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)

    PEAR: To install optional features use "pear install pear/PEAR#featurename"

第二次运行:

>pear upgrade phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "dbus"
downloading PHPUnit-3.5.13.tgz ...
Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
..........................done: 118,553 bytes
could not extract the package.xml file from "C:\Program Files (x86)\Zend\ZendSer
ver\bin\tmp\PHPUnit-3.5.13.tgz" Unable to create directory 'C:/Program/Fil7414.t
mp'
Unable to create path for C:/Program/Fil7414.tmp/package.xml
Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit"
downloading File_Iterator-1.2.6.tgz ...
Starting to download File_Iterator-1.2.6.tgz (3,439 bytes)
...done: 3,439 bytes
could not extract the package.xml file from "C:\Program Files (x86)\Zend\ZendSer
ver\bin\tmp\File_Iterator-1.2.6.tgz" Unable to create directory 'C:/Program/Fil7
675.tmp'
Unable to create path for C:/Program/Fil7675.tmp/package.xml
Download of "phpunit/File_Iterator" succeeded, but it is not a valid package arc
hive
Error: cannot download "phpunit/File_Iterator"
Download failed
upgrade failed

这里是梨配置文件:

C:\Users\Hanno Schupp>pear config-show
PHP Warning:  Module 'Zend Data Cache' already loaded in Unknown on line 0
PHP Warning:  Zend Extension Manager: Cannot load Zend Data Cache module in Unkn
own on line 0
PHP Warning:  Module 'Zend Utils' already loaded in Unknown on line 0
PHP Warning:  Zend Extension Manager: Cannot load Zend Utils module in Unknown o
n line 0
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels     auto_discover    <not set>
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          C:\Program Files
                                                (x86)\Zend\ZendServer\bin
PEAR documentation directory   doc_dir          C:\Program Files
                                                (x86)\Zend\ZendServer\bin\docs
PHP extension directory        ext_dir          C:\Program Files
                                                (x86)\Zend\ZendServer\lib\phpext

PEAR directory                 php_dir          C:\Program Files
                                                (x86)\Zend\ZendServer\bin\pear
PEAR Installer cache directory cache_dir        C:\Users\HANNOS~1\AppData\Local\
Temp\pear\cache
PEAR configuration file        cfg_dir          C:\Program Files
directory                                       (x86)\Zend\ZendServer\bin\cfg
PEAR data directory            data_dir         C:\Program Files
                                                (x86)\Zend\ZendServer\bin\data
PEAR Installer download        download_dir     C:\Program Files
directory                                       (x86)\Zend\ZendServer\bin\tmp
PHP CLI/CGI binary             php_bin          C:\Program Files
                                                (x86)\Zend\ZendServer\bin\.\php.
exe
php.ini location               php_ini          <not set>
--program-prefix passed to     php_prefix       <not set>
PHP's ./configure
--program-suffix passed to     php_suffix       <not set>
PHP's ./configure
PEAR Installer temp directory  temp_dir         C:\Program Files
                                                (x86)\Zend\ZendServer\bin\tmp
PEAR test directory            test_dir         C:\Program Files
                                                (x86)\Zend\ZendServer\bin\tests
PEAR www files directory       www_dir          C:\Program Files
                                                (x86)\Zend\ZendServer\bin\www
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  stable
Unix file mask                 umask            0
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          c:\gnupg\gpg.exe
Signature Key Directory        sig_keydir       C:\Program Files
                                                (x86)\Zend\ZendServer\bin\pearke
ys
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         <not set>
maintainers)
User Configuration File        Filename         C:\Program Files
                                                (x86)\Zend\ZendServer\bin\pear.i
ni
System Configuration File      Filename         C:\Program Files
                                                (x86)\Zend\ZendServer\bin\pearsy
s.ini
enter code here

请问您能否更新您的问题,并附上 pear config-show 的输出结果吗? - Gordon
错误报告在这里:http://pear.php.net/bugs/bug.php?id=18362 - Álvaro González
3个回答

6

更新

正如 @amateur barista 和 @Tibor 指出的那样,您可以使用以下命令应用相同的修复方法而无需修改您的 pear.ini

> pear config-set temp_dir "C:\tmp"
> pear config-set download_dir "C:\tmp"

Translated

我在运行WampServer的 Windows 7 64位电脑上遇到了同样的问题。

看起来 PEAR 处理 temp_dirdownload_dir 变量的方式不同。对于 download_dir,它可以正确处理路径中的空格,而对于 temp_dir,则会出现问题。

以下是纠正问题的步骤:

  1. Open your pear.ini (mine was: C:\Program Files (x86)\WAMP\bin\php\php5.3.4\pear.ini)

    Note: This file is serialize'd so make sure you understand the syntax before changing anything.

  2. Alter the temp_dir and download_dir variables to paths without spaces.

    Example (before):

    s:8:"temp_dir";s:48:"C:\Program Files (x86)\WAMP\bin\php\php5.3.4\tmp";s:12:"download_dir";s:48:"C:\Program Files (x86)\WAMP\bin\php\php5.3.4\tmp"
    

    Example (after):

    s:8:"temp_dir";s:6:"C:\tmp";s:12:"download_dir";s:6:"C:\tmp"
    
  3. All done! Try your install command again.

大概只需要更改pear.ini中的一个路径,但是这是我让它正常工作的方法。


2
与其搞乱序列化变量,最好使用PEAR的命令行config-set命令。 - amateur barista
我也遇到了同样的问题——无法安装新的PEAR包。你的解决方法起了作用,帮我省去了很多麻烦,谢谢。 - Michael

1

修改pear配置属性的命令行

pear config-set temp_dir "C:\tmp"
pear config-set download_dir "C:\tmp"

0
从错误信息 Unable to create directory 'C:/Program/Fil7675.tmp' 来看,似乎是在配置的临时文件路径中截取了 Files。我不知道 PEAR 在 Windows 上安装在哪里,但它似乎试图在 "C:/Program Files/PEAR" 下创建一个文件夹,但将空格后面的所有内容都截掉了。
实际上,它似乎将 Files 的一部分塞进了新路径中。

是的,我认为这看起来很可疑,但为什么直到现在它都能正常工作呢?如果这是从PEAR安装程序1.9.1更改到1.9.2引入的错误,那么人们应该会在Google上找到很多抱怨。但我找不到任何东西。 - Hanno
@Hanno - 或许PEAR 1.9.2在Windows上引入了一个bug。你知道为什么PHP 3.5.13需要最新版本的PEAR吗? - David Harkness
不,phpunit的变更日志没有提供任何上下文信息: https://github.com/sebastianbergmann/phpunit/commit/cfd655ce728c57340e12c7f176b7490b4afa463c - Hanno

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接