yohang / Finite

A Simple PHP Finite State Machine

Home Page:http://yohan.giarel.li/Finite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Finite don't work on Linux box

ppavlovic opened this issue · comments

It does work on my windows development machine (php version 5.4.27) but it doesn't work on linux test or production server with php 5.4.33
The error I'm getting is:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\OptionsResolver\Exception\InvalidOptionsException: "The option "disabled" does not exist. Known options are: "exclude_from", "exclude_to", "from", "on", "to"" at /var/www/vhosts/xxxxxxx.local/httpdocs/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 255 {"exception":"[object](Symfony\Component\OptionsResolver\Exception\InvalidOptionsException: The option "disabled" does not exist. Known options are: "exclude_from", "exclude_to", "from", "on", "to" at /var/www/vhosts/xxxxxxx.local/httpdocs/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php:255)"

state-machine.yml is

    callbacks:
      after:
        callback1:
          do:
            [@xxxxxxx_finite.transition_events, transitionEverytimeAfter]

@ppavlovic That doesn’t look like the part of the config which has an error because disabled doesn’t appear in it.

Yes, I know it isn't in yml config, but it defaults it to false as set in https://github.com/yohang/Finite/blob/master/src/Finite/Bundle/FiniteBundle/DependencyInjection/Configuration.php#L104 (line 104) and the OptionsResolver is "confused" by that part.
Anyhow, if I set explicitly disabled in my yml, it also generates an error.

@ppavlovic Oh..ok. I’m gonna quickly check that. If I come up with a solution I’ll create PR.

@hacfi , Thank you for the quick fix, I haven't got the time to look at it earlier.
Sorry, that fix didn't helped me. What helped is adding 'disabled' => false after line 43 at https://github.com/yohang/Finite/blob/master/src/Finite/Event/CallbackHandler.php#L43

Also the line 104 at https://github.com/yohang/Finite/blob/master/src/Finite/Bundle/FiniteBundle/DependencyInjection/Configuration.php#L104 should look like

->booleanNode('disabled')->defaultFalse()->end()

although I'm not sure about defaultFalse() because it's more or less redudant after the above change is set (in CallbackHandler.php#L43)

It'll be fixed in the CallbackHandler refactoring : #51