Skip to first unread message

Chris Johnson

Jul 30, 2020, 12:04:12 PM7/30/20
to The Aura Project for PHP
What am I doing wrong here?  AbstractHttpResponder takes an instance of ClxMsg in its constructor, and ClxMsg takes an instance of Logger in its constructor.  Logger takes 4 parameters in its constructor.  Yet when my framework tries to call a method within the AbstractHttpResponder class, I get an error like this:

"PHP Fatal error:  Uncaught Error: Typed property Clx\WebResponder\AbstractHttpResponder::$log must not be accessed before initialization"

Why isn't my Aura.Di container configuration code (below) properly initializing this class through its constructor?

        $di->set('clx/clxmsg', $di->lazyNew(ClxMsg::class));
        $di->set('cxj/phpsyslog', $di->lazyNew(Logger::class));

        $di->params[Logger::class] = [
            'ident'    => $ident,
            'level'    => $logLevel,
            'options'  => $logOptions,
            'facility' => $logFacility,
        $di->params[ClxMsg::class] = [
            'psr3-log' => $di->lazyGet('cxj/phpsyslog'),
        $di->params[AbstractHttpResponder::class] = [
            'log' => $di->lazyGet('clx/clxmsg'),

This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the individual responsible for delivering the e-mail to the intended recipient, please be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.

If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender or call ClaimLynx at (952) 593-5969.

Hari K T

Jul 31, 2020, 12:15:01 AM7/31/20
Is there a full sample code that you can put in gist. So we can run 

php sample.php

I believe there is some other issue in code.

You received this message because you are subscribed to the Google Groups "The Aura Project for PHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Chris Johnson

Jul 31, 2020, 1:09:43 PM7/31/20
to The Aura Project for PHP
You are correct.  There was another obscure problem in the code.  The parent and child constructors did not match, e.g.:
class Parent {
    public function __construct(Logger $log, Template $template) {  }
class Child extends Parent {
    public function __construct(Template $template, string $path) {  }

It is very strange that this did not cause any error during construction, but rather only failed later when an uninitialized property was used.

Thank you for the reply!

Hari K T

Jul 31, 2020, 1:13:52 PM7/31/20
Glad to know you were able to fix it.

Some times debugging di is a mess. ;) .

One thing I was sure Aura.Di is very stable. 

Let me Thank our developers and consumers for their awesome work.

Reply all
Reply to author
0 new messages