ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: live627 on December 30, 2016, 05:39:40 pm

Title: Class 'BBC\Autolink' not found
Post by: live627 on December 30, 2016, 05:39:40 pm
Just got this error. Will try to debug further.

Notice: Class 'BBC\Autolink' not found

http://localhost/Elkarte/index.php?action=profile;u=100
Title: Re: Class 'BBC\Autolink' not found
Post by: live627 on December 30, 2016, 05:44:58 pm
Only happens on PHP 7.1. 7.0 is fine.
Title: Re: Class 'BBC\Autolink' not found
Post by: Spuds on December 30, 2016, 06:26:25 pm
Interesting ... do you know what changed in 7.1 that caused this issue?
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 30, 2016, 06:45:34 pm
O_o

What's the easiest way to have multiple versions of php handy?
Title: Re: Class 'BBC\Autolink' not found
Post by: radu81 on December 30, 2016, 07:06:01 pm
on my vps handled by serverpilot I can choose from 5 versions of php: 5.4, 5.5, 5.6, 7.0, 7.1
on my laptop using Mint 18 (derivate of Ubuntu 16.04) which comes with php 7.0 I was able to install and switch from php5 to php7, I used this guide to do this:

http://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04/762161#762161
Title: Re: Class 'BBC\Autolink' not found
Post by: live627 on December 30, 2016, 10:00:16 pm
Quote from: Spuds – Interesting ... do you know what changed in 7.1 that caused this issue?
no..    this may help you http://php.net/manual/en/migration71.php

Quote from: emanuele – O_o

What's the easiest way to have multiple versions of php handy?
wamp

http://www.wampserver.com/en/
Title: Re: Class 'BBC\Autolink' not found
Post by: Spuds on December 31, 2016, 09:59:38 am
Hey if I had time to RTFM I would not have asked LOL  :P

I use vagrant for my multiple php versions, so just *nix with multiple php versions installed.  I then ssh into the box and point the web server at whichever version I want to run.  Recently I've started to play with a multi-machine setup where the db is in one instance and the web in the other, then I can share that db across multiple web versions and simply start "up" the version I want so I don't even have to ssh in to the box.
Title: Re: Class 'BBC\Autolink' not found
Post by: ahrasis on December 31, 2016, 11:46:27 am
I kinda failed in setting up multiple php in ispconfig though it is fully working if run directly under ubuntu.  :D

So, normally, I just use UniServer (https://sourceforge.net/projects/miniserver/) to test multple php in windows.
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 31, 2016, 02:34:44 pm
On Vagrant works fine with 7.1, I feel like it may be a windows issue, I'll install wamp and see.
Title: Re: Class 'BBC\Autolink' not found
Post by: Spuds on December 31, 2016, 02:54:13 pm
The mystery deepens !
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 31, 2016, 05:57:03 pm
Actually, not even php 7 works.
It's windows specific, and even more the problem is stream_resolve_include_path that in 5.6 resolves properly to sources\subs\BBC\Autolink.class.php, while in php 7.x resolves to sources\Autolink.class.php

Any idea before I start reading about this function? (Hint: I would avoid having to read. LOL)
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 31, 2016, 06:12:01 pm
AHA!
No need to read, it doesn't like the "absolute" reference \BBC\Autolink that is added by the autoloader.
Remove it may break other things so... we have to check and think about it.
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 31, 2016, 07:28:30 pm
Actually, digging a bit more, the autoloader behaves in a completely different manner between windows and linux in php 7 and between windows and linux in general...
/me smells troubles
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on December 31, 2016, 08:20:37 pm
The easiest solution I found so far to the specific problem is to prefix all the namespaces of the BBC classes with ElkArte... :-\
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 01, 2017, 09:10:38 am
@live627 could you try the attached patch?

It's another way to work around the issue.
I'm not sure which one to pick, though.
Title: Re: Class 'BBC\Autolink' not found
Post by: live627 on January 01, 2017, 05:52:32 pm
Fixed.

I didn't know patch files could create commits.
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 01, 2017, 06:02:39 pm
Neither did I... lol
Title: Re: Class 'BBC\Autolink' not found
Post by: inter on January 11, 2017, 12:06:07 pm
Code: [Select]
namespace BBC;
Code: [Select]
interface Database
Code: [Select]
namespace ElkArte\sources\modules;

Do not you think that it is necessary to use a single namespace for the entire project?

http://www.php-fig.org/psr/psr-4/

Example:
Code: [Select]
\Elk\Sources\Database\DB;
\Elk\Sources\Subs\BBC;
\Elk\...

(I think I already wrote about this)
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 11, 2017, 02:08:25 pm
https://github.com/elkarte/Elkarte/issues/2809 <= best place for this discussion! :D
Title: Re: Class 'BBC\Autolink' not found
Post by: inter on January 11, 2017, 02:14:33 pm
my include path, before error

php 7.1

Code: [Select]
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
C:\apache\php\localhost\www\elk11-fix/addons;
C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs/CacheMethod;
\BBC;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
C:\apache\php\localhost\www\elk11-fix/addons;
C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs/CacheMethod;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
C:\apache\php\localhost\www\elk11-fix/addons;
C:\apache\php\localhost\www\elk11-fix/sources;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
C:\apache\php\localhost\www\elk11-fix/addons;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
.;
.C:\apache\php\localhost\www\elk11-fix/sources;
.;
.;
C:\php\pear

next
Code: [Select]
.C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs;
C:\apache\php\localhost\www\elk11-fix/sources/controllers;
C:\apache\php\localhost\www\elk11-fix/sources/admin;
C:\apache\php\localhost\www\elk11-fix/addons;
C:\apache\php\localhost\www\elk11-fix/sources;
C:\apache\php\localhost\www\elk11-fix/sources/subs/CacheMethod;
\BBC;
C:\apache\php\localhost\www\elk11-fix/sources/subs/MentionType;

error
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 11, 2017, 04:04:37 pm
Did you already try the patch (http://www.elkarte.net/community/index.php?topic=4173.msg29916#msg29916)?
Title: Re: Class 'BBC\Autolink' not found
Post by: inter on January 12, 2017, 04:35:50 am
how to save? there is a conflict. manually like there is no errors
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 12, 2017, 12:34:10 pm
Okay, back a second: are you using the beta 4 or the HEAD of the repository?
Title: Re: Class 'BBC\Autolink' not found
Post by: inter on January 12, 2017, 01:02:58 pm
I'll wait rc1
Title: Re: Class 'BBC\Autolink' not found
Post by: Joshua Dickerson on January 28, 2017, 04:03:05 pm
BTW, I wrote the BBC as a root namespace because I was hoping it would become its own project.
Title: Re: Class 'BBC\Autolink' not found
Post by: emanuele on January 29, 2017, 05:43:43 am
I remember, honestly the current solution is just a workaround, in 2.0 we should better fix the issue.
Also, since the idea is to have a completely separated project, the most appropriated place for the code is the ext directory. ;)