Fix of infinity loop

More info at https://bugs.php.net/bug.php?id=63842