Jump to content

E_NOTICE: Use of undefined constant COREDIR


Blesta Addons

Recommended Posts

in the blesta logs we found a lot of this notice message, is not a big deal , but it fill the logs and make them big sizer.

E_NOTICE: Use of undefined constant COREDIR - assumed 'COREDIR' {"code":8,"message":"Use of undefined constant COREDIR - assumed 'COREDIR'","file":"/home/hhhhhh/public_html/core/Automation/Tasks/Common/AbstractTask.php","line":116}

and still this old notice when editing invoice logged

E_WARNING: sprintf(): Too few arguments {"code":2,"message":"sprintf(): Too few arguments","file":"/home/hhhhhh/public_html/vendors/minphp/language/src/Language.php","line":125}

 

Link to comment
Share on other sites

1 hour ago, Tyson said:

Do you have COREDIR defined in /core/ServiceProviders/MinphpBridge.php? It sounds like it's missing. 

Yes , i have checked, it exist, but i have found that we didn't add it in a custom plugin that override  some container functions.

Link to comment
Share on other sites

23 hours ago, Tyson said:

I'm curious to know what the reason is behind overriding WEBDIR? Adding a new constant for your case would not suffice? 

Also, you can override WEBDIR by extending the container. 

we have some seo practice in our website, nd we need this to do it in our multilanguage plugin that add instance for every language in blesta like /fr/ or /ar/ ...ect

how we can override only WEBDIR by extending the container?

Link to comment
Share on other sites

Interesting. You can extend it by calling the container's ::extend method, e.g.:

$this->container->extend(
    'minphp.constants',
    function ($instance, $c) {
        return array_merge($instance, ['WEBDIR' => $instance['WEBDIR'] . 'fr/']);
    }
);

There is an example in Blesta v4.6 that does this to override a few of the services for the application.

Link to comment
Share on other sites

9 hours ago, Tyson said:

Interesting. You can extend it by calling the container's ::extend method, e.g.:


$this->container->extend(
    'minphp.constants',
    function ($instance, $c) {
        return array_merge($instance, ['WEBDIR' => $instance['WEBDIR'] . 'fr/']);
    }
);

There is an example in Blesta v4.6 that does this to override a few of the services for the application. 

thank tyson, this only for the upcoming blesta 4.6 ?

i will test it later,  this will allow us to override it globally in blesta. so anywhere to call $this->base_uri will get the overridden value and not the default one ?  so from the preAction event we can dot it without changing or modifying any blesta files ?

Link to comment
Share on other sites

Extending the container has been available since v4.0. We just happen to use it for v4.6.

I suspect you can extend the container from wherever you'd like (although I have not tested that), but it is better to extend it as early as possible in execution or it may be possible for some places to have already used the value before you override it.

Link to comment
Share on other sites

  • Tyson locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...