leonverschuren / lenex-php

PHP Lenex 3.0 implementation
MIT License
6 stars 4 forks source link

Fatal error Uncaught TypeError on parseResult #1

Closed swim89 closed 1 year ago

swim89 commented 6 years ago

Hi, I tried to use it like this code:

include_once("classi/lenex/Reader.php");
include_once("classi/lenex/Parser.php");

use leonverschuren\Lenex\Reader;
use leonverschuren\Lenex\Parser;

$reader = new Reader();
$parser = new Parser();

$result = $parser->parseResult($reader->read(__DIR__ . "/20180525_trofeoPiskeo.lxf"));

But I have this error:

Fatal error: Uncaught TypeError: Argument 1 passed to leonverschuren\Lenex\Parser::parseResult() must be an instance of SimpleXMLElement, boolean given, called in /var/www/finsicilia/leggiLenex.php on line 20 and defined in /var/www/finsicilia/classi/lenex/Parser.php:77 Stack trace: #0 /var/www/finsicilia/leggiLenex.php(20): leonverschuren\Lenex\Parser->parseResult(false) #1 {main} thrown in /var/www/finsicilia/classi/lenex/Parser.php on line 77

leonverschuren commented 6 years ago

Hi,

I'm sorry I completely missed this issue. As you can see in the error message, you are passing the boolean value 'false' to the parser. Most likely the file you are trying to read does not exist. The problem is $reader->read(__DIR__ . "/20180525_trofeoPiskeo.lxf")