cvs: php4(PHP_4_3) /sapi/cli php_cli.c /tests/lang bug23584.phpt

From: Date: Wed, 14 May 2003 00:05:12 +0000
Subject: cvs: php4(PHP_4_3) /sapi/cli php_cli.c /tests/lang bug23584.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20879@lists.php.net to get a copy of this message
sniper Tue May 13 20:05:12 2003 EDT Added files: (Branch: PHP_4_3) /php4/tests/lang bug23584.phpt Modified files: /php4/sapi/cli php_cli.c Log: - Fixed bug #23584 (error line numbers off by one when using #!php). # already fixed in php5 Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.51.2.12 php4/sapi/cli/php_cli.c:1.51.2.13 --- php4/sapi/cli/php_cli.c:1.51.2.12 Tue May 13 19:36:38 2003 +++ php4/sapi/cli/php_cli.c Tue May 13 20:05:12 2003 @@ -447,7 +447,7 @@ char *arg_free=NULL, **arg_excp=&arg_free; char *script_file=NULL; zend_llist global_vars; - int interactive=0; + int interactive=0, is_hashbang=0; int module_started = 0; char *exec_direct=NULL; char *param_error=NULL; @@ -748,7 +748,7 @@ fseek(file_handle.handle.fp, pos - 1, SEEK_SET); } } - CG(zend_lineno) = -2; + is_hashbang = 1; } else { lseek(file_handle.handle.fd, 0, SEEK_SET); } @@ -779,6 +779,12 @@ PUTS("Could not startup.\n"); goto err; } + + /* Correct line numbers when #!php is used. This is reset in php_request_startup(). */ + if (is_hashbang) { + CG(zend_lineno) = -2; + } + *arg_excp = arg_free; /* reconstuct argv */ if (no_headers) { SG(headers_sent) = 1; Index: php4/tests/lang/bug23584.phpt +++ php4/tests/lang/bug23584.phpt

« previous php.cvs (#20879) next »