Use init INIT_PZVAL_COPY for copying result
Fix compatibility issues
Fix compiler warnings for scanner