$this reference not available in anonymous function in old PHP versions.