Question

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:

<?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. I'm supposed to include something else before I include Matrix.php
  3. I've included the wrong file (or the right filename but with the wrong path, somehow).

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
Was it helpful?

Solution

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top