Handle nesting correctly
See feedback by @nikic, https://github.com/php/php-src/pull/647#issuecomment-48050551