Undefined variable $since, did you mean $sinces?

24 days ago

Member | 134

Is this a bug or a feature?

In Nette\Application\UI\Presenter there is getGlobalState method that throws aforementioned notice (on line 1171) when I use my custom form control. The since variable seems to be uninitialized when $iterator->getDepth() doesn't evaluate to zero.

Simple $since = FALSE put inside the foreach solves the problem for me and everything works as expected but I am not sure if I miss something.

18 days ago

Member | 1

I had the same problem. It appears when your custom form control implements interface Nette\Application\UI\IStatePersistent (usually when its inherited from Nette\Application\UI\Control or Nette\Application\UI\PresenterComponent), while its parent (Form) does not. In this case, the parent is filtered out and the $iterator contains only your component (with depth > 0) and not it's parents… IMO there are three possible solutions:

  1. rewrite your custom form control (get rid of Nette\Application\UI\PresenterComponent inheritance)
  2. use custom Form class that overrides \Nette\Application\UI\Form and implements Nette\Application\UI\IStatePersistent
  3. add “$since = null” line to Nette\Application\UI\Presenter (terrible solution) :-)

12 days ago

David Grudl
founder | 6658


Board footer

Terms and conditions