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