@@ -2268,107 +2268,109 @@ consult the installation file that came with this distribution, or visit \n\
2268
2268
init_request_info (request );
2269
2269
2270
2270
if (!cgi && !fastcgi ) {
2271
- while ((c = php_getopt (argc , argv , OPTIONS , & php_optarg , & php_optind , 0 , 2 )) != -1 ) {
2272
- switch (c ) {
2273
-
2274
- case 'a' : /* interactive mode */
2275
- printf ("Interactive mode enabled\n\n" );
2276
- fflush (stdout );
2277
- break ;
2278
-
2279
- case 'C' : /* don't chdir to the script directory */
2280
- SG (options ) |= SAPI_OPTION_NO_CHDIR ;
2281
- break ;
2282
-
2283
- case 'e' : /* enable extended info output */
2284
- CG (compiler_options ) |= ZEND_COMPILE_EXTENDED_INFO ;
2285
- break ;
2286
-
2287
- case 'f' : /* parse file */
2288
- if (script_file ) {
2289
- efree (script_file );
2290
- }
2291
- script_file = estrdup (php_optarg );
2292
- no_headers = 1 ;
2293
- break ;
2271
+ if (behavior != PHP_MODE_LINT ) {
2272
+ while ((c = php_getopt (argc , argv , OPTIONS , & php_optarg , & php_optind , 0 , 2 )) != -1 ) {
2273
+ switch (c ) {
2274
+
2275
+ case 'a' : /* interactive mode */
2276
+ printf ("Interactive mode enabled\n\n" );
2277
+ fflush (stdout );
2278
+ break ;
2279
+
2280
+ case 'C' : /* don't chdir to the script directory */
2281
+ SG (options ) |= SAPI_OPTION_NO_CHDIR ;
2282
+ break ;
2283
+
2284
+ case 'e' : /* enable extended info output */
2285
+ CG (compiler_options ) |= ZEND_COMPILE_EXTENDED_INFO ;
2286
+ break ;
2287
+
2288
+ case 'f' : /* parse file */
2289
+ if (script_file ) {
2290
+ efree (script_file );
2291
+ }
2292
+ script_file = estrdup (php_optarg );
2293
+ no_headers = 1 ;
2294
+ break ;
2294
2295
2295
- case 'i' : /* php info & quit */
2296
- if (script_file ) {
2297
- efree (script_file );
2298
- }
2299
- if (php_request_startup () == FAILURE ) {
2300
- SG (server_context ) = NULL ;
2301
- php_module_shutdown ();
2302
- free (bindpath );
2303
- return FAILURE ;
2304
- }
2305
- if (no_headers ) {
2296
+ case 'i' : /* php info & quit */
2297
+ if (script_file ) {
2298
+ efree (script_file );
2299
+ }
2300
+ if (php_request_startup () == FAILURE ) {
2301
+ SG (server_context ) = NULL ;
2302
+ php_module_shutdown ();
2303
+ free (bindpath );
2304
+ return FAILURE ;
2305
+ }
2306
+ if (no_headers ) {
2307
+ SG (headers_sent ) = 1 ;
2308
+ SG (request_info ).no_headers = 1 ;
2309
+ }
2310
+ php_print_info (0xFFFFFFFF );
2311
+ php_request_shutdown ((void * ) 0 );
2312
+ fcgi_shutdown ();
2313
+ exit_status = 0 ;
2314
+ goto out ;
2315
+
2316
+ case 'l' : /* syntax check mode */
2317
+ no_headers = 1 ;
2318
+ behavior = PHP_MODE_LINT ;
2319
+ break ;
2320
+
2321
+ case 'm' : /* list compiled in modules */
2322
+ if (script_file ) {
2323
+ efree (script_file );
2324
+ }
2325
+ SG (headers_sent ) = 1 ;
2326
+ php_printf ("[PHP Modules]\n" );
2327
+ print_modules ();
2328
+ php_printf ("\n[Zend Modules]\n" );
2329
+ print_extensions ();
2330
+ php_printf ("\n" );
2331
+ php_output_end_all ();
2332
+ fcgi_shutdown ();
2333
+ exit_status = 0 ;
2334
+ goto out ;
2335
+
2336
+ case 'q' : /* do not generate HTTP headers */
2337
+ no_headers = 1 ;
2338
+ break ;
2339
+
2340
+ case 'v' : /* show php version & quit */
2341
+ if (script_file ) {
2342
+ efree (script_file );
2343
+ }
2344
+ no_headers = 1 ;
2345
+ if (php_request_startup () == FAILURE ) {
2346
+ SG (server_context ) = NULL ;
2347
+ php_module_shutdown ();
2348
+ free (bindpath );
2349
+ return FAILURE ;
2350
+ }
2306
2351
SG (headers_sent ) = 1 ;
2307
2352
SG (request_info ).no_headers = 1 ;
2308
- }
2309
- php_print_info (0xFFFFFFFF );
2310
- php_request_shutdown ((void * ) 0 );
2311
- fcgi_shutdown ();
2312
- exit_status = 0 ;
2313
- goto out ;
2314
-
2315
- case 'l' : /* syntax check mode */
2316
- no_headers = 1 ;
2317
- behavior = PHP_MODE_LINT ;
2318
- break ;
2319
-
2320
- case 'm' : /* list compiled in modules */
2321
- if (script_file ) {
2322
- efree (script_file );
2323
- }
2324
- SG (headers_sent ) = 1 ;
2325
- php_printf ("[PHP Modules]\n" );
2326
- print_modules ();
2327
- php_printf ("\n[Zend Modules]\n" );
2328
- print_extensions ();
2329
- php_printf ("\n" );
2330
- php_output_end_all ();
2331
- fcgi_shutdown ();
2332
- exit_status = 0 ;
2333
- goto out ;
2334
-
2335
- case 'q' : /* do not generate HTTP headers */
2336
- no_headers = 1 ;
2337
- break ;
2338
-
2339
- case 'v' : /* show php version & quit */
2340
- if (script_file ) {
2341
- efree (script_file );
2342
- }
2343
- no_headers = 1 ;
2344
- if (php_request_startup () == FAILURE ) {
2345
- SG (server_context ) = NULL ;
2346
- php_module_shutdown ();
2347
- free (bindpath );
2348
- return FAILURE ;
2349
- }
2350
- SG (headers_sent ) = 1 ;
2351
- SG (request_info ).no_headers = 1 ;
2352
- #if ZEND_DEBUG
2353
- php_printf ("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s" , PHP_VERSION , sapi_module .name , __DATE__ , __TIME__ , get_zend_version ());
2354
- #else
2355
- php_printf ("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s" , PHP_VERSION , sapi_module .name , __DATE__ , __TIME__ , get_zend_version ());
2356
- #endif
2357
- php_request_shutdown ((void * ) 0 );
2358
- fcgi_shutdown ();
2359
- exit_status = 0 ;
2360
- goto out ;
2361
-
2362
- case 'w' :
2363
- behavior = PHP_MODE_STRIP ;
2364
- break ;
2365
-
2366
- case 'z' : /* load extension file */
2367
- zend_load_extension (php_optarg );
2368
- break ;
2369
-
2370
- default :
2371
- break ;
2353
+ #if ZEND_DEBUG
2354
+ php_printf ("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s" , PHP_VERSION , sapi_module .name , __DATE__ , __TIME__ , get_zend_version ());
2355
+ #else
2356
+ php_printf ("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s" , PHP_VERSION , sapi_module .name , __DATE__ , __TIME__ , get_zend_version ());
2357
+ #endif
2358
+ php_request_shutdown ((void * ) 0 );
2359
+ fcgi_shutdown ();
2360
+ exit_status = 0 ;
2361
+ goto out ;
2362
+
2363
+ case 'w' :
2364
+ behavior = PHP_MODE_STRIP ;
2365
+ break ;
2366
+
2367
+ case 'z' : /* load extension file */
2368
+ zend_load_extension (php_optarg );
2369
+ break ;
2370
+
2371
+ default :
2372
+ break ;
2373
+ }
2372
2374
}
2373
2375
}
2374
2376
@@ -2512,7 +2514,6 @@ consult the installation file that came with this distribution, or visit \n\
2512
2514
PG (during_request_startup ) = 0 ;
2513
2515
if (php_lint_script (& file_handle ) == SUCCESS ) {
2514
2516
zend_printf ("No syntax errors detected in %s\n" , ZSTR_VAL (file_handle .filename ));
2515
- exit_status = 0 ;
2516
2517
} else {
2517
2518
zend_printf ("Errors parsing %s\n" , ZSTR_VAL (file_handle .filename ));
2518
2519
exit_status = -1 ;
@@ -2581,6 +2582,11 @@ consult the installation file that came with this distribution, or visit \n\
2581
2582
}
2582
2583
}
2583
2584
}
2585
+ if (behavior == PHP_MODE_LINT && argc - 1 > php_optind ) {
2586
+ php_optind ++ ;
2587
+ script_file = NULL ;
2588
+ continue ;
2589
+ }
2584
2590
break ;
2585
2591
}
2586
2592
0 commit comments