PHP: Fix memory leak if a director method is passed Null for self