symfony / panther

A browser testing and web crawling library for PHP and Symfony
MIT License
2.94k stars 222 forks source link

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /panther/vendor/symfony/panther/src/Client.php on line 58 #280

Closed nomaam closed 4 years ago

nomaam commented 4 years ago

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /panther/vendor/symfony/panther/src/Client.php on line 58

I have done a fresh install and am using the documented example. Installed on Debian using composer.

require "../../panther/vendor/autoload.php"; // Composer's autoloader

$client = \Symfony\Component\Panther\Client::createChromeClient(); // fails here <<<<<<<

$client->request('GET', 'https://api-platform.com'); // Yes, this website is 100% written in JavaScript
$client->clickLink('Support');
$crawler = $client->waitFor('.support');
echo $crawler->filter('.support')->text();
$client->takeScreenshot('screen.png'); // Yeah, screenshot!
xabbuh commented 4 years ago

It looks like your runtime is not PHP 7.1 or higher as required by the composer.json file.

nomaam commented 4 years ago

strange as I updated PHP before installing Panther.

php -v
PHP 7.3.13-1+0~20191218.50+debian9~1.gbp23c2da (cli) (built: Dec 18 2019 15:03:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.13-1+0~20191218.50+debian9~1.gbp23c2da, Copyright (c) 1999-2018,      by Zend Technologies
nomaam commented 4 years ago

my apologies, you were right!

echo PHP_VERSION;
7.0.33-0+deb9u6

Now I just need to figure out why two versions are running at the same time...

EDIT:

For others with the same problem, this will remove the old version apt purge php7.0 php7.0