Skip to content
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

Class 'BBC\Autolink' not found #2305

Closed
wintstar opened this issue Dec 10, 2015 · 10 comments
Closed

Class 'BBC\Autolink' not found #2305

wintstar opened this issue Dec 10, 2015 · 10 comments
Labels
Milestone

Comments

@wintstar
Copy link

pull request #2303 from emanuele45/BBC2 from 10.12.2015
brunch development
1.1 Beta 1

After installing a white page with this error message appears:
Fatal error: Class 'BBC\Autolink' not found in C:\xampp\htdocs\elk11\sources\subs\BBC\ParserWrapper.php on line 380

@emanuele45
Copy link
Contributor

Looks good here.
Unless it's a windows issue, but at the moment I can't test on that system...
@wintstar could you check the file is actually there? (C:\xampp\htdocs\elk11\sources\subs\BBC\Autolink.class.php)

@emanuele45 emanuele45 added the bug label Dec 11, 2015
@emanuele45 emanuele45 added this to the 1.1 Beta 1 milestone Dec 11, 2015
@wintstar
Copy link
Author

The file Autolink.class.php is available and the class also
exists => /sources/subs/BBC/Autolink.class.php

namespace BBC;

class Autolink
{
    protected $bbc;
    protected $url_enabled;
    protected $email_enabled;
    protected $possible_link;
    protected $possible_email;
    protected $search;
    protected $replace;
    protected $email_search;
    protected $email_replace;

bug_autolink

@emanuele45
Copy link
Contributor

emanuele45 commented Dec 11, 2015 via email

@wintstar
Copy link
Author

In htdocs lie the roots of localhost (xampp)

localhostk

libraries in windows => http://www.tenforums.com/tutorials/8867-library-create-new-library-windows-10-a.html

@wintstar
Copy link
Author

On Linix Server works and of Windows Server not.

Linux
This version: ElkArte 1.1 (more detailed)
Current version: 1.0.5 bug fix update
GD version: bundled (2.1.0 compatible)
MySQL version: 5.5.46-log
Zend OPcache: 7.0.6-dev
PHP: 5.5.29 (cgi-fcgi) (more detailed)
Server version: Apache/2.2.31 (Unix)
Version Information: SunOS localhost 5.10 Generic_142901-13 i86pc
Load Balancing: 14.46484375

Windows xampp
This version: ElkArte 1.1 (more detailed)
Current version: 1.0.5 bug fix update
GD version: bundled (2.1.0 compatible)
MySQL version: 5.6.26
PHP: 5.6.12 (apache2handler) (more detailed)
Server version: Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12
Version Information: Windows NT DATEN-HIGHWAY 6.2 build 9200 (Windows 8 Professional Edition) i586

if I add on the Windows Server each require it works
sources\subs\BBC\ParserWrapper.php:

    public function get***()
    {

        require_once(SUBSDIR . '/BBC/***.class.php');

example:

    /**
     * @return BBCParser
     */
    public function getBBCParser()
    {

        require_once(SUBSDIR . '/BBC/BBCParser.class.php');

        if ($this->bbc_parser === null)
        {
            $this->bbc_parser = new \BBC\BBCParser($this->getCodes(), $this->getAutolinkParser());
        }

        return $this->bbc_parser;
    }

@emanuele45
Copy link
Contributor

And if you just add the require_once in the getAutolinkParser?

@wintstar
Copy link
Author

Then there is an error message that also missing the other classes.

@wintstar
Copy link
Author

How it would define BBC?

DEFINE('BBC', $sourcedir . '/subs/BBC');

        if (!empty($modSettings['bbc']) && $modSettings['current_load'] >= $modSettings['bbc'])
        {
            require_once(BBC . '/Codes.class.php');
            require_once(BBC . '/BBCParser.class.php');
            require_once(BBC . '/Autolink.class.php');
            require_once(BBC . '/SmileyParser.class.php');
            require_once(BBC . '/HtmlParser.class.php');
            require_once(BBC . '/Codes.class.php');
        }

@emanuele45
Copy link
Contributor

There is no much point in have an autoloader is then we have to rely on require_once again. ;)

Try editing Autoloader.class.php, find:

            // Simple one word class names like Util.class, Action.class, Request.class ...
            case '':
                $this->_file_name = $this->_surname;

                // validate the file since it can vary

and replace it wth>

            // Simple one word class names like Util.class, Action.class, Request.class ...
            case '':
                $this->_file_name = $this->_surname;

                if (!empty($this->_current_namespace))
                    $this->_file_name = $this->_current_namespace . '/' . $this->_file_name;

                // validate the file since it can vary

This change may very well make some namespaces "registration" obsolete (in fact those I was too lazy to find a solution about LOL).

Though, it's really, really funny the code works on linux and not on windows... oh well, whatever.

@wintstar
Copy link
Author

👍 Thats work of Windows Server and of Linux Server.

Spuds added a commit that referenced this issue Dec 14, 2015
Add option for namespace autoloading - fixes #2305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants