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

Runtime notice: Non-static method #256

Closed
Schnubl opened this issue May 14, 2016 · 7 comments
Closed

Runtime notice: Non-static method #256

Schnubl opened this issue May 14, 2016 · 7 comments
Assignees
Milestone

Comments

@Schnubl
Copy link

Schnubl commented May 14, 2016

Hallo,

ich hab heute ein Update gemacht und erhalte nun diese Fehlermeldung wenn ich im backend einen neuen Eintrag hinzufügen möchte:

Runtime notice: Non-static method ContaoCommunityAlliance\DcGeneral\Contao\Event\Subscriber::getConfig() should not be called statically in composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/Event/Subscriber.php on line 442

#0 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/Event/Subscriber.php(442): __error(2048, 'Non-static meth...', '/www/htdocs/w01...', 442, Array)
#1 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/Event/Subscriber.php(442): ContaoCommunityAlliance\DcGeneral\Contao\Event\Subscriber::getConfig()
#2 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/Event/Subscriber.php(240): ContaoCommunityAlliance\DcGeneral\Contao\Event\Subscriber::renderTimestampReadable(Object(ContaoCommunityAlliance\DcGeneral\View\Event\RenderReadablePropertyValueEvent), Array, Object(Symfony\Component\EventDispatcher\EventDispatcher), '2015-10-18')
#3 [internal function]: ContaoCommunityAlliance\DcGeneral\Contao\Event\Subscriber->renderReadablePropertyValue(Object(ContaoCommunityAlliance\DcGeneral\View\Event\RenderReadablePropertyValueEvent), 'dc-general.view...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#4 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\View\Event\RenderReadablePropertyValueEvent), 'dc-general.view...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#5 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.view...', Object(ContaoCommunityAlliance\DcGeneral\View\Event\RenderReadablePropertyValueEvent))
#6 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/ViewHelpers.php(212): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.view...', Object(ContaoCommunityAlliance\DcGeneral\View\Event\RenderReadablePropertyValueEvent))
#7 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php(104): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ViewHelpers::getReadableFieldValue(Object(ContaoCommunityAlliance\DcGeneral\DefaultEnvironment), Object(ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\Properties\DefaultProperty), Object(MetaModels\DcGeneral\Data\Model))
#8 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php(59): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Subscriber\GetGroupHeaderSubscriber->formatGroupHeader(Object(ContaoCommunityAlliance\DcGeneral\DefaultEnvironment), Object(MetaModels\DcGeneral\Data\Model), 'insertdatum', 'none', 0)
#9 [internal function]: ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Subscriber\GetGroupHeaderSubscriber->handle(Object(ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetGroupHeaderEvent), 'dc-general.view...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#10 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetGroupHeaderEvent), 'dc-general.view...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#11 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.view...', Object(ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetGroupHeaderEvent))
#12 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/BaseView.php(280): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.view...', Object(ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetGroupHeaderEvent))
#13 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/ListView.php(209): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\BaseView->formatCurrentValue('insertdatum', Object(MetaModels\DcGeneral\Data\Model), 'none', 0)
#14 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/ListView.php(264): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ListView->setListViewLabel(Object(ContaoCommunityAlliance\DcGeneral\Data\DefaultCollection), Array)
#15 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/ListView.php(324): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ListView->viewList(Object(ContaoCommunityAlliance\DcGeneral\Data\DefaultCollection))
#16 [internal function]: ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ListView->showAll(Object(ContaoCommunityAlliance\DcGeneral\Action))
#17 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/BaseView.php(140): call_user_func_array(Array, Array)
#18 [internal function]: ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\BaseView->handleAction(Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#19 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#20 composer/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#21 composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/Controller/DefaultController.php(130): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#22 composer/vendor/metamodels/core/src/MetaModels/BackendIntegration/Module.php(74): ContaoCommunityAlliance\DcGeneral\Controller\DefaultController->handle(Object(ContaoCommunityAlliance\DcGeneral\Action))
#23 system/modules/core/classes/Backend.php(409): MetaModels\BackendIntegration\Module->generate()
#24 contao/main.php(142): Contao\Backend->getBackendModule('metamodel_mm_bi...')
#25 contao/main.php(293): Main->run()
#26 {main}

System:

Contao 3.3.5
        "contao-community-alliance/composer-client": ">=0.16.4.0,<0.17-dev as 2.0.0",
        "contao-legacy/dk_masonry": "1.2.1.9006 as 2.0.0",
        "contao-legacy/easyupdate3": ">=3.3.2.9008,<3.4-dev as 2.0.0",
        "contao-legacy/image_sort_wizard": "2.2.0.9005 as 2.0.0",
        "contao-legacy/om_watermark": "1.0.4.9008 as 2.0.0",
        "contao-legacy/rocksolid-columns": "1.0.6.9005 as 2.0.0",
        "contao-legacy/rocksolid-custom-elements": "1.3.4.9005 as 2.0.0",
        "contao-legacy/rocksolid-icon-picker": "1.0.7.9005 as 2.0.0",
        "contao-legacy/rocksolid-slider": "1.5.3.9005 as 2.0.0",
        "contao-legacy/rocksolid-theme-assistant": "1.1.6.9006 as 2.0.0 as 2.0.0",
        "contao-legacy/sort_wizard": "1.3.0.9006 as 2.0.0",
        "contao-legacy/translation_fields": "1.5.0.9007 as 2.0.0",
        "madeyourday/contao-rocksolid-frontend-helper": ">=1.2.3.0,<1.3-dev as 2.0.0",
        "metamodels/attribute_rating": "dev-master as 2.0.0",
        "metamodels/bundle_all": ">=2.0.0.0,<2.1-dev as 2.0.0",
        "metamodels/core": "dev-hotfix-2.0.0-alpha11 as 2.0.0"
        "contao-community-alliance/dc-general": "dev-hotfix/2.0.0-beta35 as 2.0.0"

Hat jemand eine Ahnung woran das liegt?
Das Update vom DCG auf 35 hat keinen Unterschied gemacht.

@zonky2
Copy link
Contributor

zonky2 commented May 14, 2016

bitte Quelltext und Fehlerausgaben in "drei Ticks" setzen - siehe https://guides.github.com/features/mastering-markdown/#examples => "Code"

Du solltest auch schreiben, dass Du mit MetaModels gearbeitet hast - der DCG wird auch in anderen Projekten verwendet! Es ist nicht erkennbar. welche Attribute Du in MM verwendest, und ob es auf ein bestimmtes Attribut ankommt. Wie soll die Umgebung nach gebaut werden, damit der Fehler reproduziert werden kann?

@zonky2
Copy link
Contributor

zonky2 commented May 14, 2016

probier mal
in https://github.com/contao-community-alliance/dc-general/blob/master/src/ContaoCommunityAlliance/DcGeneral/Contao/Event/Subscriber.php#L361-L368

-    public function getConfig()
+    public static function getConfig()
    {
        if (!self::$config) {
            return self::$config = Config::getInstance();
        }
        return self::$config;
    }

@Schnubl
Copy link
Author

Schnubl commented May 14, 2016

Das hat den Fehler behoben.

Gewaltig!!

@Schnubl Schnubl closed this as completed May 14, 2016
@Schnubl Schnubl reopened this May 14, 2016
@zonky2
Copy link
Contributor

zonky2 commented May 14, 2016

m.E. sollte dann auch folgendes "richtiger" sein

-    public function setConfig(Config $config)
+    public static function setConfig(Config $config)
    {
        self::$config = $config;
    }

aber da sollte @discordier oder @dmolineus nochmal drüber gucken...

@fritzmg
Copy link

fritzmg commented May 17, 2016

Der Fehler passiert in der Methode Subscriber::renderTimestampReadable. Dies ist eine statische Methode (die daher auch nur statisch aufgerufen werden kann) und in dieser Methode gibt es den Aufruf self::getConfig(). Da die Methode statisch aufgerufen wird, ist auch self::… in diesem Fall ein statischer Aufruf.

stefanheimes added a commit that referenced this issue May 30, 2016
This shoul fix the porblem with the error that the parent function is a static one.
@stefanheimes stefanheimes added this to the 2.0.0 milestone May 30, 2016
@stefanheimes stefanheimes self-assigned this May 30, 2016
@stefanheimes
Copy link
Member

Should be fixed with the hotfix 35. Can you please test it.

@zonky2
Copy link
Contributor

zonky2 commented Jun 4, 2016

hat Schnubl getestet - funktioniert...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants