Re: Mod Deinit Not Called if Bad Cmdline Option [PATCH]
| From: | Steph Fox | Date: | Tue, 13 Jun 2006 16:57:36 +0000 |
| Subject: | Re: Mod Deinit Not Called if Bad Cmdline Option [PATCH] | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24115@lists.php.net to get a copy of this message | ||
Hi Michael,
No, the script is reached OK - it's just that Zend thinks your php.ini filepath is 'foo' as well as your file, so it hangs when it's trying to work with them both :) You're supposed to put a path after the -c switch... but PHP really shouldn't hang when you don't. Patch for CLI sapi (5_2 branch) attached, if someone'd like to check it for misdemeanours/apply it? - StephActually it's not true either... what made you think that, Michael? Care to describe what you're seeing?Consider the following php script: #!/usr/bin/php -q -c foo <?php ... Apparently -c is a bad option because the script just prints usage and exits. Now, I have an extension that writes a message to a log file when it initializes and when it deinitializes. When the said script runs the initialization message is logged. When the script runs normally (no bad option) the deinitialization message is logged. When the script exits prematurely due to a bad command option, the deinitialization routine is not logged. This leads me to believe the deinitialization routine is not running. Perhaps it is or perhaps the script is being killed.
Mike -- Michael B Allen PHP Extension for SSO w/ Windows Group Authorization http://www.ioplex.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com
Index: sapi/cli/php_cli.c =================================================================== RCS file: /repository/php-src/sapi/cli/php_cli.c,v retrieving revision 1.129.2.13.2.3 diff -u -r1.129.2.13.2.3 php_cli.c --- sapi/cli/php_cli.c 3 Jun 2006 22:02:02 -0000 1.129.2.13.2.3 +++ sapi/cli/php_cli.c 13 Jun 2006 16:21:00 -0000 @@ -639,7 +639,14 @@ while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0))!=-1) { switch (c) { + case 'r': + break; case 'c': + if (!script_file) { + printf("You need to give the path to php.ini after -c.\n"); + exit_status = 1; + goto out_err; + } cli_sapi_module.php_ini_path_override = strdup(php_optarg); break; case 'n':