-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't catch Client creation error #15
Comments
Do you get any other errors when the IP does exist? What is your PHP version? The parse error leads me to believe the problem is you're using PHP 5.2, but then again, your own file should've triggered its own parse error in that case. |
No. No other error. Everything works fine if the IP exist. |
I tried with 5.4.6 and 5.4.0 and couldn't duplicate this issue. Also tried specifically with 5.4.5, all tried after extracting the tgz archive, and including its Autoload.php with no other code... I'm always getting "Error...", exactly as expected. Have you made any modifications to /www/cgi-bin/src/PEAR2/Net/Transmitter/Exception.php at all? Could you possibly try with any other PHP version and/or the same setup (including the exact same files) but on Windows? |
|
Ah. That's interesting... How much memory does the MetaRouter have allocated for it? Try giving it some more. I'm thinking maybe by the time PHP decides to parse Exception.php, the router goes out of memory in the middle of parsing, ultimately causing the parse error. I'm going to try setting up Openwrt too... (I've been meaning to try to anyway, and now I have a good motivation to) |
Hmm... I'm trying to run those exact images on a MetaRouter with 64MiB RAM, and I get a segmentation fault. I get that even from just a phpinfo()... Although I'm using php-cli, which may be part of my problem. (I always knew MetaRouter is not exactly a stable environment, but this is ridiculous...) |
After some more digging, I'm able to almost reproduce the error. The error you're experiencing is likely related. The segfault from before seems to be a known issue that's already fixed in trunk, so that's what I did. I used the 31411 image from http://openwrt.wk.cz/trunk/mr-mips/, with all related modules from there. With that PHP version (5.3.10), I get no segfaults on phpinfo(), and trying to run your code gives me
Further trial&error showed the error is... very silly... There needs to be one blank line at the end of all files, or this particular PHP borks. This is already the case for all files on the "develop" branches of Net_RouterOS and Net_Transmitter. The only thing that's not yet fixed is PEAR2/Autoload.php, which you can manually modify: Just add a new line at the end. The exact error you're experiencing might be something different, as you would've seen the Autoload.php error yourself as well... Unless maybe you used composer for the installation? In that case, you don't need to deal with PEAR2/Autoload.php anyway. |
This solved the problem(added a few empty lines to Autoload.php) |
The latest version now includes a fixed version of PEAR2_Autoload. I haven't tried to run it on a MetaRouter again (just because of how ridiculously difficult it still is to set up...), so please let me know if it still happens with it. I'll close this issue now anyway. |
Gets syntax error when used wrong/none existing ip address when creating client object with wrong ip address:
In the following example, if there is no router with the address: 10.20.30.42 then I get the following errors:
Parse error: syntax error, unexpected end of file in /www/cgi-bin/src/PEAR2/Net/Transmitter/Exception.php on line 37
Fatal error: Call to a member function getTransmitter() on a non-object in /www/cgi-bin/src/PEAR2/Net/RouterOS/Client.php on line 747
Exeample:
try{
$client = new RouterOS\Client('10.20.30.42', 'user','PASS');
} catch(Exception $ex){
}
The text was updated successfully, but these errors were encountered: