bug
avatar dbhurley
dbhurley
3 Nov 2013

The latest framework update to DI makes the code found here:

https://github.com/joomla/jissues/blob/framework/cli/CliApp/Command/TrackerCommand.php#L60

$this->logger      = Container::retrieve('logger');

fail when running CLI code because of the use of $this here:

https://github.com/joomla/jissues/blob/framework/cli/CliApp/Service/LoggerProvider.php#L73

Can be fixed by making $quiet and $fileName public and calling statically but not sure that's the best approach. I'd prefer changing the original static I think.

avatar dbhurley dbhurley - open - 3 Nov 2013
avatar dbhurley dbhurley - open - 3 Nov 2013
avatar elkuku
elkuku - comment - 3 Nov 2013

Can you state what the problem (error message) is ? I'm not getting any..

BTW.. I think we should pass around the container object and access its non static methods instead.

avatar davidhurley
davidhurley - comment - 3 Nov 2013

Agreed to passing the container. You should get a fatal error cannot use
$this when not in object context, in LoggerProvider line 73, I think.
On Nov 3, 2013 6:17 PM, "Nikolai Plath" notifications@github.com wrote:

Can you state what the problem (error message) is ? I'm not getting any..

BTW.. I think we should pass around the container object and access its
non static methods instead.


Reply to this email directly or view it on GitHubhttps://github.com//issues/164#issuecomment-27657540
.

avatar mbabker
mbabker - comment - 3 Nov 2013

The static Container was really a way to just ease the transition a lot.
Proper DI with our system would be to have the container build a lot of
the classes and fill its dependencies, but I haven't quite gotten there
myself with the proper understanding of its use.

On Sunday, November 3, 2013, Nikolai Plath wrote:

Can you state what the problem (error message) is ? I'm not getting any..

BTW.. I think we should pass around the container object and access its
non static methods instead.


Reply to this email directly or view it on GitHubhttps://github.com//issues/164#issuecomment-27657540
.

avatar mbabker
mbabker - comment - 4 Nov 2013

I finally got us in sync with the Framework again and cleared out of our Container override the unnecessary methods (so it really is now a lazy static instance of the parent container, nothing more). The $this uses can be blamed on @dongilbert from when he was refactoring the providers, but we won't tell him that ;-)

avatar elkuku
elkuku - comment - 4 Nov 2013

You should get a fatal error cannot use $this when not in object context,

Could it be that you are using PHP 5.3 while I am running 5.4 ? IIRC there was some "behavior change"...

avatar mbabker
mbabker - comment - 4 Nov 2013

I had it too on my PHP 5.4 local.

avatar elkuku
elkuku - comment - 7 Nov 2013

Are we good here ? (never managed to reproduce this :( )

avatar mbabker
mbabker - comment - 7 Nov 2013

I fixed the $this reference in 15ec7b5, so if that's all this was referring to then we're good.

avatar - close - 9 Nov 2013

Add a Comment

Login with GitHub to post a comment