-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php -z does not seem to work at all #17740
Comments
So the extension gets loaded but it's never registered in the module registry strangely, and so never initialized either... |
Oh this happens because parsing the |
Very dirty workaround PoC that demonstrates this is indeed the problem: https://gist.github.com/nielsdos/52fcc29433d568dd41399ad0c916b129 Another idea is to use the ini builder, which is cleaner, but I wonder how that interacts with escape chars etc...: diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 64fb9c5c515..31c96869ea4 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -819,9 +819,6 @@ static int do_cli(int argc, char **argv) /* {{{ */
behavior=PHP_MODE_STRIP;
break;
- case 'z': /* load extension file */
- zend_load_extension(php_optarg);
- break;
case 'H':
hide_argv = true;
break;
@@ -1283,6 +1280,9 @@ int main(int argc, char *argv[])
case 'e': /* enable extended info output */
use_extended_info = 1;
break;
+ case 'z': /* load extension file */
+ php_ini_builder_quoted(&ini_builder, ZEND_STRL("zend_extension"), php_optarg, strlen(php_optarg));
+ break;
}
}
exit_loop:
|
@nielsdos Shouldn’t Looks like nobody is relying on it, and there is already an alternative with |
Description
The examples below use the following
test.php
script:The
-d zend_extension
option accepts either a file name with or without the.so
extension, or an absolute path:The
-z
option, on the other hand, does not seem to accept a file name:It does not complain when passing an absolute path, but still does not load the extension:
Furthermore, its behaviour becomes really strange when you specify both
-d zend_extension
and-z
:In the last 2 runs, it now says that the extension was already loaded, even though specifying
-z
alone did not load the extension.Is the
-z
argument broken? Should it be removed from php, as it's redundant with-d zend_extension
anyway?PHP Version
PHP 8.1, 8.2, 8.3, 8.4
Operating System
Ubuntu 24.04
The text was updated successfully, but these errors were encountered: