PHP: variable is suddenly null -
i have problem data variable null. it's happening directly after if-statement when nothing written variable. knows happening here?
public function render() { ob_start(); if($this->ajax) $ext = '.ajax'; else if(file_exists($this->scriptpath.$this->template.'.mst')) $ext = '.mst'; else $ext = '.phtml'; #var_dump($this->data); // <-- filled many data if($ext === '.mst'){ var_dump($this->data); // <-- null $mustache = new \mustache_engine( array( 'escape' => function($value){return $value;}, 'partials_loader' => new \mustache_loader_filesystemloader(dirname(__file__).'/../../../frontendtarget/classes/lib/de/preis/frontend/viewfragments/partials',array('extension' => 'mst')) ) ); $content = file_get_contents($this->scriptpath.$this->template.$ext); $content = $mustache->render(($content),$this->data); echo $content; } else { include $this->scriptpath.$this->template.$ext; } return ob_get_clean(); }
i've here 2 var_dumps(). 1 before if, var filled data , 1 after if, data gone.
could assist me on one? in advance
more of learned lesson answer!
had problem once seemed real mystery, took me while figure out because didn't make sense @ time. answer was running code netbeans debugger , had set watch clear (unset()
) variable allow me debug code segment - i'd forgotten remove watch executing during debug session , null
ing variable
wiki
Comments
Post a Comment