pear2 / Net_RouterOS

This package allows you to read and write information from a RouterOS host using the MikroTik RouterOS API protocol.
http://pear2.php.net/PEAR2_Net_RouterOS
241 stars 116 forks source link

wrong namespace #13

Closed nosovk closed 9 years ago

nosovk commented 10 years ago

When I try to load phar - I got an exception abour wrong namespace PEAR2\Net\RouterOS\RouterOS\Client RouterOS written twice, but in client.php - namespace declare with one RouterOS. And execution fails.

[Mon Sep 01 19:06:55 2014] [warn] [client 141.101.89.158] mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'Exception' with message 'Class PEAR2\Net\RouterOS\RouterOS\Client could not be loaded from PEAR2/Net/RouterOS/RouterOS/Client.php, file does not exist (registered paths="phar:///var/www/clients/client1/web2/web/rs/test2.php/PEAR2_Net_RouterOS-1.0.0b4/src" ) [PEAR2_Autoload-0.2.4]' in phar:///var/www/clients/client1/web2/web/rs/test2.php/PEAR2_Net_RouterOS-1.0.0b4/src/PEAR2/Autoload.php:181 [Mon Sep 01 19:06:55 2014] [warn] [client 141.101.89.158] mod_fcgid: stderr: Stack trace:

[Mon Sep 01 19:06:55 2014] [warn] [client 141.101.89.158] mod_fcgid: stderr: #1 /var/www/clients/client1/web2/web/rs/test.php(16): spl_autoload_call('PEAR2\Net\Route...') [Mon Sep 01 19:06:55 2014] [warn] [client 141.101.89.158] mod_fcgid: stderr: #2 {main} [Mon Sep 01 19:06:55 2014] [warn] [client 141.101.89.158] mod_fcgid: stderr: thrown in phar:///var/www/clients/client1/web2/web/rs/test2.php/PEAR2_Net_RouterOS-1.0.0b4/src/PEAR2/Autoload.php on line 181

boenrobot commented 10 years ago

I think you might want to keep the ".phar" extension of the PHAR file. Perhaps the SPL autoloader (and by extension, PEAR2_Autoload) is looking at "PEAR2_Net_RouterOS-1.0.0b4/", and thinks "that's a folder, not a PHAR file", and hence the error.

Oh, and... How does the file you're including the PHAR from look like? I'd just like to make sure your use statements and "new" call are fine.

boenrobot commented 9 years ago

Judging from your posts at the MikroTik forum, I take it you've abandoned the idea of using the API protocol altogether?

I'm therefore closing this issue. If I've misread your direction, and you intend to pursue an API protocol solution, feel free to reopen this issue.

nosovk commented 9 years ago

Yep, I used telnet scripts.