This should be Z_STRLEN_PP(tmp) to avoid an extra strlen()