evekb / evedev-kb

EVE Killboard
www.evekb.org
41 stars 22 forks source link

PHP7 / xajax deprecation breaks a bunch of things. #80

Closed Nuramori closed 7 years ago

Nuramori commented 7 years ago

PHP7 breaks xajax.php.

PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/www/xxx.com/kb/common/xajax/xajax.php:47\nStack trace:\n#0 /var/www/xxx.com/kb/common/includes/class.event.php(71): edk_xajax::lateProcess('')\n#1 /var/www/xxx.com/kb/common/index.php(236): event::call('mods_initialise...', '')\n#2 /var/www/xxx.com/kb/index.php(25): include('/var/www/drama-...')\n#3 {main}\n thrown in /var/www/xxx.com/kb/common/xajax/xajax.php on line 47

xajax is very old, and may not survive this next major upgrade to PHP. Researched xajax and it appears to be fairly unsupported.

Salvoxia commented 7 years ago

Hi,

thanks for reporting. This is actually a change that was introduce in PHP 7.1, PHP 7.0.x should work just fine. I just pushed a fix for it and tested with PHP 7.1.4 (was still on PHP 7.0.x in my testing environment), didn't find anything else. If you encounter any other problems, please let me know. Please also report back if everything appears to be in order, so I can close the issue.

A word about xajax use in EDK: The problem was not in xAjax itself, but in a Proxy class EDK uses. So it was in fact EDK legacy code ;) xAjax is not used that heavily in EDK, so even if there should arise fatal incompatibilities with future PHP versions, it wouldn't be THAT big of a deal (just a little bit ;) ).

Best Regards, Salvoxia

Nuramori commented 7 years ago

That's great news! Thanks for the quick reply - I wasn't sure how long I'd have to live without a killboard for the guys. After all these years I've been without the killboard longer than any "break" from eve. :)

Sent from my iPhone

On May 19, 2017, at 8:33 AM, Salvoxia notifications@github.com wrote:

Hi,

thanks for reporting. This is actually a change that was introduce in PHP 7.1, PHP 7.0.x should work just fine. I just pushed a fix for it and tested with PHP 7.1.4 (was still on PHP 7.0.x in my testing environment), didn't find anything else. If you encounter any other problems, please let me know.

A word about xajax use in EDK: The problem was not in xAjax itself, but in a Proxy class EDK uses. So it was in fact EDK legacy code ;) xAjax is not used that heavily in EDK, so even if there should arise fatal incompatibilities with future PHP versions, it wouldn't be THAT big of a deal (just a little bit ;) ).

Best Regards, Salvoxia

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Nuramori commented 7 years ago

It still isn't working. I commented out one line, and the killboard will work.

When I comment out line 236 in index.php located in /common/, then the board will show up. The offending line was : "event::call('mods_initialised', $none); "

Nuramori commented 7 years ago

ok, new issue. It's having an issue with the javascript. "NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier)." The generated error entry was "AH00128: File does not exist: /var/www/xxx.com/kb/xajax_js/xajax_core.js, referer: http://kbxxx.com/"

It seems that there's a part of the path missing, /commons/. When I open the debugging window, I'm seeing - "http://kb.xxx.com/xajax_js/xajax_core.js that generates the error.

Salvoxia commented 7 years ago

What page are you viewing when getting that error? You are right about /common/ missing in the path. When viewing the page source in your browser and looking at the page header, is that the path you see there, too?`

At my test kb:

<script type="text/javascript" src="http://localhost/edk/common/xajax/xajax_js/xajax_core.js" charset="UTF-8"></script>
Nuramori commented 7 years ago

It appears on all pages.

Sent from my iPhone

On May 24, 2017, at 10:10 AM, Salvoxia notifications@github.com wrote:

What page are you viewing when getting that error? You are right about /common/ missing in the path. When viewing the page source in your browser and looking at the page header, is that the path you see there, too?`

At my test kb:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Nuramori commented 7 years ago

Btw here's the site so you can see...

Http://kb.tiod.wtf

Sent from my iPhone

On May 24, 2017, at 10:10 AM, Salvoxia notifications@github.com wrote:

What page are you viewing when getting that error? You are right about /common/ missing in the path. When viewing the page source in your browser and looking at the page header, is that the path you see there, too?`

At my test kb:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Salvoxia commented 7 years ago

Hm. Following a hunch, could you please try the following: in common/xajax/xajax.php find this line

$obj->addHeader($xajax->getJavascript(config::get('cfg_kbhost')."/common/xajax/"));

and BEFORE that, add this line

$xajax->configure("javascript URI", config::get('cfg_kbhost')."/common/xajax/");

Best Regards, Salvoxia

Nuramori commented 7 years ago

BINGO. Solved :)

Salvoxia commented 7 years ago

Very glad to hear :) Out of curiosity: When chasing down the initial issue, did you change anything in the xajax library itself?

Nuramori commented 7 years ago

I did not.

Salvoxia commented 7 years ago

Resolved as per user feedback.