zend_bailout() should work fine and shouldn't leak file descriptors because the opened file is in the CG(open_files) list.
Andi
At 01:28 PM 2/1/2004 -0500, Ilia Alshanetsky wrote:
On February 01, 2004 01:08 pm, you wrote: > Oh OK. As I mentioned in a previous email I'm not sure this is the best way > of doing the patch. It should be possible to bailout when the parse error > is detected.
That was my initial concern as well, however the problem is that any earlier attempts to bail out on the parse error result in leaked file handle. For example, commenting out E_PARSE error handling in PHP's error handling allows the behaviour to be addressed without even touch ZE code. But, the consequence is that the opened filehandle is leaked.
The only other solutions (least code change) is to apply the following patch (reverting the original). It seems to handle the problem adequatly.
Index: zend_language_scanner.l =================================================================== RCS file: /repository/Zend/Attic/zend_language_scanner.l,v retrieving revision 1.54.2.25 diff -u -3 -p -r1.54.2.25 zend_language_scanner.l --- zend_language_scanner.l 29 Nov 2003 19:05:59 -0000 1.54.2.25 +++ zend_language_scanner.l 1 Feb 2004 18:27:39 -0000 @@ -383,8 +383,7 @@ ZEND_API zend_op_array *compile_file(zen zend_do_return(&retval_znode, 0 TSRMLS_CC); CG(in_compilation) = original_in_compilation; if (compiler_result==1) { /* parser error */ - CG(unclean_shutdown) = 1; - retval = NULL; + zend_bailout(); } compilation_successful=1; #ifdef ZEND_MULTIBYTE
Ilia
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php