使用Math_Matrix PEAR库的意外T_CLONE

时间:2021-10-27 07:17:39

I've not used PEAR before, and so I'm probably doing something dumb. I've installed the Math_Matrix library, but when I include it I just get an error. My entire code is this:

我之前没有使用过PEAR,所以我可能会做一些愚蠢的事情。我已经安装了Math_Matrix库,但是当我包含它时,我只是得到一个错误。我的整个代码是这样的:

<?php
  $path = '/home/PEAR/Math_Matrix-0.8.0';
  set_include_path(get_include_path() . PATH_SEPARATOR . $path);
  include_once 'Matrix.php';
?>

The error I get is this:

我得到的错误是这样的:

Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /home/PEAR/Math_Matrix-0.8.0/Matrix.php on line 272

I'm not really sure what to make of that. I guess the explanations I can think of are:

我不确定该怎么做。我想我能想到的解释是:

  1. I've not installed the Math_Matrix library properly (I'm on a shared server which already had PEAR installed on it) or have downloaded the wrong version of it.
  2. 我没有正确安装Math_Matrix库(我在已经安装了PEAR的共享服务器上)或者已经下载了错误的版本。

  3. I'm supposed to include something else before I include Matrix.php
  4. 在我加入Matrix.php之前,我应该包含其他内容

  5. I've included the wrong file (or the right filename but with the wrong path, somehow).
  6. 我已经包含了错误的文件(或正确的文件名,但错误的路径,不知何故)。

To install it, I did the following:

要安装它,我做了以下事情:

pear install --alldeps channel://pear.phpunit.de/PHPUnit
pear install --alldeps channel://pear.php.net/Math_Vector-0.6.2
pear install Math_Matrix

1 个解决方案

#1


From the [Math_Matrix](http://pear.php.net/package/Math_Matrix homepage) I can see that it was last updated in 2003. Since then, PHP has added the clone keyword, which is conflicting with the clone() function defined in Matrix.php.

从[Math_Matrix](http://pear.php.net/package/Math_Matrix主页)我可以看到它最后一次更新是在2003年。从那时起,PHP添加了clone关键字,它与clone()冲突在Matrix.php中定义的函数。

You need to update Matrix.php - a search & replace on "clone" with "clone2" should do it.

您需要更新Matrix.php - 使用“clone2”搜索并替换“clone”应该这样做。

#1


From the [Math_Matrix](http://pear.php.net/package/Math_Matrix homepage) I can see that it was last updated in 2003. Since then, PHP has added the clone keyword, which is conflicting with the clone() function defined in Matrix.php.

从[Math_Matrix](http://pear.php.net/package/Math_Matrix主页)我可以看到它最后一次更新是在2003年。从那时起,PHP添加了clone关键字,它与clone()冲突在Matrix.php中定义的函数。

You need to update Matrix.php - a search & replace on "clone" with "clone2" should do it.

您需要更新Matrix.php - 使用“clone2”搜索并替换“clone”应该这样做。