Undefined variable $since, did you mean $sinces?

Notice: This thread is very old.
josef.sabl
Member | 153
+
0
-

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.

mira.cizek
Member | 1
+
0
-

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) :-)
David Grudl
Nette Core | 8218
+
+2
-

Fixed