Kernel Plugin bug

11 views
Skip to first unread message

Chris Boden

unread,
Mar 2, 2011, 9:44:29 AM3/2/11
to Alloy
Vance,

I'm new go git/github and I can't seen to accomplish what I'm trying
to do in a pull request. I'm trying to request 1 commit I made, bug
GitHub keeps sending every commit I made to my fork (which mostly just
includes re-basing from your master).

The pull request https://github.com/alloyphp/alloy/pull/6 is supposed
to only include changes from commit
https://github.com/cboden/alloy/commit/3e62a2fefa8dc74a5a22ef86e40150c900888dd9

From the ticket:
"Calling the plugin method in the kernel always autoloads, despite
$init parameter being passed as FALSE.

For example, if I wanted to see if Spot was loaded I would type:

if ($kernel->plugin('Spot', false)) { // do stuff; }

but that will load Spot. Adding the FALSE to "class_exists" prevents
the autoloader from running and thus only returns if it was previously
loaded."


Sorry for the inconvenience/incompetence.
Cheers.

Vance Lucas

unread,
Mar 2, 2011, 11:16:56 AM3/2/11
to allo...@googlegroups.com
This is an interesting idea. What you're actually suggesting is a new use-case. Using the Plugin method as currently designed will always attempt to load the plugin, and throw an exception when it can't. This is a recent change, as it would previously only return false when it could not load the plugin (which is probably where the confusion is now).

What you need is a way to test if a Plugin is loaded or not, and return boolean true/false. That sounds like a good use-case that justifies a new method or a change in the existing one to support it. I'll take a look at it and see what I can do - the desired functionality will require more changes than your pull request.

--
Vance Lucas
www.vancelucas.com

Chris Boden

unread,
Mar 2, 2011, 11:21:42 AM3/2/11
to Alloy
Oops, I thought my fix was your intended use. A useful feature either
way.

Since checking was not an intended ability of the plugin method, what
was the intended purpose of the $init parameter?


On Mar 2, 11:16 am, Vance Lucas <va...@vancelucas.com> wrote:
> This is an interesting idea. What you're actually suggesting is a new
> use-case. Using the Plugin method as currently designed will always attempt
> to load the plugin, and throw an exception when it can't. This is a recent
> change, as it would previously only return false when it could not load the
> plugin (which is probably where the confusion is now).
>
> What you need is a way to test if a Plugin is loaded or not, and return
> boolean true/false. That sounds like a good use-case that justifies a new
> method or a change in the existing one to support it. I'll take a look at it
> and see what I can do - the desired functionality will require more changes
> than your pull request.
>
> --
> Vance Lucaswww.vancelucas.com
>
>
>
> On Wed, Mar 2, 2011 at 8:44 AM, Chris Boden <cbo...@gmail.com> wrote:
> > Vance,
>
> > I'm new go git/github and I can't seen to accomplish what I'm trying
> > to do in a pull request.  I'm trying to request 1 commit I made, bug
> > GitHub keeps sending every commit I made to my fork (which mostly just
> > includes re-basing from your master).
>
> > The pull requesthttps://github.com/alloyphp/alloy/pull/6is supposed
> > to only include changes from commit
>
> >https://github.com/cboden/alloy/commit/3e62a2fefa8dc74a5a22ef86e40150...

Vance Lucas

unread,
Mar 2, 2011, 11:49:16 AM3/2/11
to allo...@googlegroups.com
It was actually an artifact of copy & paste - check out the "module" method to see what I mean. I merged in your fix though - it doesn't break anything, and it is indeed useful.

--
Vance Lucas
www.vancelucas.com

Chris Boden

unread,
Mar 2, 2011, 2:20:14 PM3/2/11
to Alloy
Cool...but I just thought of a possible problem. If using it as a
check to see if a plugin is loaded ($init as false) would it be
expected behaviour to receive an Exception rather than false?

If so, I can submit another pull request inside the if statement that
will throw the exception if $init and return false if !$init?


On Mar 2, 11:49 am, Vance Lucas <va...@vancelucas.com> wrote:
> It was actually an artifact of copy & paste - check out the "module" method
> to see what I mean. I merged in your fix though - it doesn't break anything,
> and it is indeed useful.
>
> --

Vance Lucas

unread,
Mar 2, 2011, 2:50:46 PM3/2/11
to allo...@googlegroups.com, Chris Boden
Yes, that would be good. :)

--
Vance Lucas
www.vancelucas.com

Chris Boden

unread,
Mar 2, 2011, 3:29:29 PM3/2/11
to Alloy
Done.

I will look into creating a PHPUnit test for plugin when I have a bit
more free time.

Cheers.


On Mar 2, 2:50 pm, Vance Lucas <va...@vancelucas.com> wrote:
> Yes, that would be good. :)
>
> --

Chris Boden

unread,
Mar 27, 2011, 6:44:33 PM3/27/11
to Alloy
Bump as a reminder of pull request (https://github.com/alloyphp/alloy/
pull/7)

On Mar 2, 3:50 pm, Vance Lucas <va...@vancelucas.com> wrote:
> Yes, that would be good. :)
>
> --

Vance Lucas

unread,
Mar 28, 2011, 11:20:51 AM3/28/11
to allo...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages