adapt eject.c to php-5.4 API