Jump to content
Thomas Douscha

Login Error because of babble

Closed 2.8.11


Hello,

Some users have an issue that reported: "Fatal error: Method IPS\babble\Form\Editor::__toString() must not throw an exception, caught Error: Call to undefined method stdClass::html() in /mnt/diskssd/web/ibp/system/Theme/Theme.php(847) : eval()'d code on line 0 "

Should be fix it.

Thanks

Thomas

Share this comment


Link to comment

Again some users had that issue. We have disabled babble. We will not use it till issue solved. If we changed users mask issue is solved. But we cannot do it so we disabled babble

There is no log in system and error. Just give this error : Fatal error: Method IPS\babble\Form\Editor::__toString() must not throw an exception, caught Error: Call to undefined method stdClass::html() in /mnt/diskssd/web/ibp/system/Theme/Theme.php(847) : eval()'d code on line

 

Share this comment


Link to comment
2 hours ago, Thomas Douscha said:

Again some users had that issue. We have disabled babble. We will not use it till issue solved. If we changed users mask issue is solved. But we cannot do it so we disabled babble

There is no log in system and error. Just give this error : Fatal error: Method IPS\babble\Form\Editor::__toString() must not throw an exception, caught Error: Call to undefined method stdClass::html() in /mnt/diskssd/web/ibp/system/Theme/Theme.php(847) : eval()'d code on line

 

<?php

namespace IPS\babble\Form;

use IPS\babble\Room;
use IPS\Helpers\Form\Editor;
use IPS\Request;
use IPS\Settings;

use function json_decode;
use function json_encode;

/**
 * Class _Editor
 *
 * @package IPS\babble\Form
 * @mixin \IPS\babble\Form\Editor
 */
class _Editor extends Editor
{

    public function __construct(
        $name,
        $defaultValue = null,
        $required = false,
        $options = [],
        $customValidationCode = null,
        $prefix = null,
        $suffix = null,
        $id = null
    ) {
        $toolbars = json_decode(Settings::i()->ckeditor_toolbars, true);

        if (isset($toolbars[ 'desktop' ][ 0 ][ 'items' ])) {
            $toolbars[ 'desktop' ][ 0 ][ 'items' ][ 'babblehelp' ] = 'babblehelp';
        }

        if (isset($toolbars[ 'tablet' ][ 0 ][ 'items' ])) {
            $toolbars[ 'tablet' ][ 0 ][ 'items' ][ 'babblehelp' ] = 'babblehelp';
        }

        if (isset($toolbars[ 'phone' ][ 0 ][ 'items' ])) {
            $toolbars[ 'phone' ][ 0 ][ 'items' ][ 'babblehelp' ] = 'babblehelp';
        }
        Settings::i()->ckeditor_toolbars = json_encode($toolbars);

        $parent = parent::__construct(
            $name,
            $defaultValue,
            $required,
            $options,
            $customValidationCode,
            $prefix,
            $suffix,
            $id
        );
        $options = $this->options;
        $options[ 'ipsPlugins' ] .= ',babble,babblehelp';
        $this->options = $options; 
    }

    protected function getUploader($name)
    {
        $parent = parent::getUploader($name);
        if (Request::i()->room) {
            try {
                $room = Room::load((int)Request::i()->room);
                if ($room->bits[ 'defaults' ] === false) {
                    $parent->options[ 'allowedFileTypes' ] = $room->file_types;
                    $parent->options[ 'totalMaxSize' ] = $room->max_size;
                }
            } catch (\Exception $e) {
            }
        }

        return $parent;
    }
}

here is \IPS\babble\Form\Editor, it extends \IPS\Helpers\Form\Editor, and as you can see i don't use stdClass any where in it. i also don't override the html() or __toString() method, those are inherited from \IPS\Helpers\Form\Editor and \IPS\Helpers\Form\FormAbstract .

I suspect there is possibly another app/plugin in the mix here, that is being loaded as a hook (either on \IPS\Helpers\Form\Editor or \IPS\Helpers\Form\FormAbstract), that is passing the stdClass off as the \IPS\Helpers\Form\Editor or \IPS\Helpers\Form\FormAbstract to \IPS\babble\Form\Editor. I say this cause \IPS\babble\Form\Editor isn't a hook, its only loaded when called by babble, so the problem is before the loading of babble imho by the evidence presented.

basically i can't duplicate this one. if i can't duplicate, i can't fix. since i can't duplicate it, i will need your help to help debug it. basically we need to rule out conflicts with other third party apps/plugins.  this would require enabling babble again, leaving it enabled, and disable other apps one at a time, till babble or the problem doesn't persist. if the problem persist when babble is the only, then it is my problem. if it goes away when app/plugin X is disabled, then it is some one else's problem.  there is an option to narrow this down a bit, follow the squares in this picture below:

2020-03-04_04-59.png

click on view under the number in hooks, it will display all the hooks on your system:

2020-03-04_05-00.png

from here you can search for hooks that are hooked into specific classes, like \IPS\Helpers\Form\FormAbstract and \IPS\Helpers\Form\Editor. it should tell you the name of the app or plugin.  this could help make the narrowing down the conflict faster. 

Share this comment


Link to comment

That is all.

I read your notice but that is foresure if we disable babble it is ok there is not any problem. For this reason how could you find out solution i dont know.

Share this comment


Link to comment
8 minutes ago, Thomas Douscha said:

I read your notice but that is foresure if we disable babble it is ok there is not any problem. For this reason how could you find out solution i dont know.

sure babble is throwing an error, but is babble the cause of the problem creating the errror. this i do not believe to be the case, you can either trust me to know what i'm talking about or i can write out a very long, very dry, very technical explanation of why i don't believe babble to be causing the problem. are you willing to do the other debugging step, re-enable babble and start turning off your other 3rd party apps/plugins and if the problem stops happening when babble is the only one left enabled, then we will know it is babble or if it stops happening when babble is enabled, then we know its not babble.

there is literally only one place in all of babble that the editor is called, and that is the template for room. so i'm assuming you have a widget on the front page. widgets get get cached sometimes, this could be causing the problem as well.

are you certain there is absolutely nothing in the system log:

2020-02-22_02-28.png

Share this comment


Link to comment

its a plugin, install its as a plugin. it will replace the editor class in babble without any sort of modifications that i do (like adding the help to the toolbar and telling it load up the commands plugin. 

Share this comment


Link to comment
1 minute ago, Thomas Douscha said:

If it is not your code , why just babble have issue, why not others?

well its loading an editor on the front page thru the widget, there is a ton of moving parts there. a backtrace on the widgets alone is insane (several hundred paths). it is also happening inside a theme template, which is evaled, so there is another layer of insanity on top of that. i can't give you a simple answer, other than "its complicated". but i've doing this long enough to see where similar use cases where one works fine, but one with throw an error. and it usually comes down to the minute of details. 

all my experience is simply telling me, babble might be throwing the error, but babble is not the root cause of the error. 

the other thing we can try, instead of a widget, i could create a template plugin, to rule out widgets all together (just tell me where you have it, so i can match the area). 

Share this comment


Link to comment
8 minutes ago, Michael said:

is this something you can reproduce easily? or is it a random thing? 

if you can try this hook:

Babble Editor Overload.xml

this will restore the babble features, but use the IPS class. if there is no error, i'll update babble mainline with this. 

Share this comment


Link to comment

so are you using the last plugin i posted? or the original one? you weren't too clear in your last post, otherwise if there is no problem, i'll be updating babble to use what is in the latest plugin. 

Share this comment


Link to comment

×
×
  • Create New...