Skip to content

Commit 8a90dcd

Browse files
committed
Drop support for -z CLI/CGI option
This functionality didn't actually work. This was discussed on the mailing list [1] and no one objected. [1] https://externals.io/message/126368
1 parent 8ce16d5 commit 8a90dcd

File tree

6 files changed

+168
-21
lines changed

6 files changed

+168
-21
lines changed

UPGRADING

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,13 @@ PHP 8.5 UPGRADE NOTES
358358
========================================
359359

360360
- Core:
361-
The high resolution timer (`hrtime()`) on macOS now uses the recommended
362-
`clock_gettime_nsec_np(CLOCK_UPTIME_RAW)` API instead of
363-
`mach_absolute_time()`.
361+
. The high resolution timer (`hrtime()`) on macOS now uses the recommended
362+
`clock_gettime_nsec_np(CLOCK_UPTIME_RAW)` API instead of
363+
`mach_absolute_time()`.
364+
365+
- CLI/CGI:
366+
. The `-z` or `--zend-extension` option has been removed as it was
367+
non-functional. Use `-d zend_extension=<path>` instead.
364368

365369
========================================
366370
14. Performance Improvements

sapi/cgi/cgi_main.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ static const opt_struct OPTIONS[] = {
158158
{'w', 0, "strip"},
159159
{'?', 0, "usage"},/* help alias (both '?' and 'usage') */
160160
{'v', 0, "version"},
161-
{'z', 1, "zend-extension"},
162161
{'T', 1, "timing"},
163162
{'-', 0, NULL} /* end of args */
164163
};
@@ -1042,7 +1041,6 @@ static void php_cgi_usage(char *argv0)
10421041
" -s Display colour syntax highlighted source.\n"
10431042
" -v Version number\n"
10441043
" -w Display source with stripped comments and whitespace.\n"
1045-
" -z <file> Load Zend extension <file>.\n"
10461044
" -T <count> Measure execution time of script repeated <count> times.\n",
10471045
prog, prog);
10481046
}
@@ -2383,10 +2381,6 @@ consult the installation file that came with this distribution, or visit \n\
23832381
behavior = PHP_MODE_STRIP;
23842382
break;
23852383

2386-
case 'z': /* load extension file */
2387-
zend_load_extension(php_optarg);
2388-
break;
2389-
23902384
default:
23912385
break;
23922386
}

sapi/cli/php.1.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,6 @@ Version number
303303
.PD 1
304304
.B \-w
305305
Output source with stripped comments and whitespace
306-
.TP
307-
.PD 0
308-
.B \-\-zend\-extension \fIfile\fP
309-
.TP
310-
.PD 1
311-
.B \-z \fIfile\fP
312-
Load Zend extension
313306
.IR file
314307
.TP
315308
.IR args.\|.\|.

sapi/cli/php_cli.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ const opt_struct OPTIONS[] = {
148148
{'w', 0, "strip"},
149149
{'?', 0, "usage"},/* help alias (both '?' and 'usage') */
150150
{'v', 0, "version"},
151-
{'z', 1, "zend-extension"},
152151
{10, 1, "rf"},
153152
{10, 1, "rfunction"},
154153
{11, 1, "rc"},
@@ -496,7 +495,6 @@ static void php_cli_usage(char *argv0)
496495
" -s Output HTML syntax highlighted source.\n"
497496
" -v Version number\n"
498497
" -w Output source with stripped comments and whitespace.\n"
499-
" -z <file> Load Zend extension <file>.\n"
500498
"\n"
501499
" args... Arguments passed to script. Use -- args when first argument\n"
502500
" starts with - or script is read from stdin\n"
@@ -800,9 +798,6 @@ static int do_cli(int argc, char **argv) /* {{{ */
800798
context.mode = PHP_CLI_MODE_STRIP;
801799
break;
802800

803-
case 'z': /* load extension file */
804-
zend_load_extension(php_optarg);
805-
break;
806801
case 'H':
807802
hide_argv = true;
808803
break;

sapi/fpm/custom.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[global]
2+
error_log = /dev/stderr
3+
4+
[www]
5+
listen = 127.0.0.1:9000
6+
pm = static
7+
pm.max_children = 10

sapi/fpm/patch

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
2+
index 96a400ee29c..aae59a1293f 100644
3+
--- a/ext/opcache/ZendAccelerator.c
4+
+++ b/ext/opcache/ZendAccelerator.c
5+
@@ -2055,6 +2055,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
6+
}
7+
8+
if (file_handle->opened_path) {
9+
+ zend_shared_alloc_lock();
10+
+
11+
bucket = zend_accel_hash_find_entry(&ZCSG(hash), file_handle->opened_path);
12+
13+
if (bucket) {
14+
@@ -2063,13 +2065,13 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
15+
if (key && !persistent_script->corrupted) {
16+
HANDLE_BLOCK_INTERRUPTIONS();
17+
SHM_UNPROTECT();
18+
- zend_shared_alloc_lock();
19+
zend_accel_add_key(key, bucket);
20+
- zend_shared_alloc_unlock();
21+
SHM_PROTECT();
22+
HANDLE_UNBLOCK_INTERRUPTIONS();
23+
}
24+
}
25+
+
26+
+ zend_shared_alloc_unlock();
27+
}
28+
}
29+
}
30+
@@ -2323,8 +2325,12 @@ static zend_class_entry* zend_accel_inheritance_cache_add(zend_class_entry *ce,
31+
ZEND_ASSERT(!(ce->ce_flags & ZEND_ACC_IMMUTABLE));
32+
ZEND_ASSERT(ce->ce_flags & ZEND_ACC_LINKED);
33+
34+
+ //SHM_UNPROTECT();
35+
+ //zend_shared_alloc_lock();
36+
if (!ZCG(accelerator_enabled) ||
37+
(ZCSG(restart_in_progress) && accel_restart_is_active())) {
38+
+ //zend_shared_alloc_unlock();
39+
+ //SHM_PROTECT();
40+
return NULL;
41+
}
42+
43+
@@ -2520,15 +2526,19 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename)
44+
/* lookup by "not-real" path */
45+
key = accel_make_persistent_key(filename);
46+
if (key) {
47+
+ zend_shared_alloc_lock();
48+
zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), key);
49+
if (bucket != NULL) {
50+
zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data;
51+
if (!persistent_script->corrupted) {
52+
ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL;
53+
ZCG(cache_persistent_script) = persistent_script;
54+
- return zend_string_copy(persistent_script->script.filename);
55+
+ zend_string *str = zend_string_copy(persistent_script->script.filename);
56+
+ zend_shared_alloc_unlock();
57+
+ return str;
58+
}
59+
}
60+
+ zend_shared_alloc_unlock();
61+
} else {
62+
ZCG(cache_opline) = NULL;
63+
ZCG(cache_persistent_script) = NULL;
64+
@@ -2541,6 +2551,7 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename)
65+
66+
if (resolved_path) {
67+
/* lookup by real path */
68+
+ zend_shared_alloc_lock();
69+
zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path);
70+
if (bucket) {
71+
zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data;
72+
@@ -2549,19 +2560,19 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename)
73+
/* add another "key" for the same bucket */
74+
HANDLE_BLOCK_INTERRUPTIONS();
75+
SHM_UNPROTECT();
76+
- zend_shared_alloc_lock();
77+
zend_accel_add_key(key, bucket);
78+
- zend_shared_alloc_unlock();
79+
SHM_PROTECT();
80+
HANDLE_UNBLOCK_INTERRUPTIONS();
81+
} else {
82+
ZSTR_LEN(&ZCG(key)) = 0;
83+
}
84+
+ zend_shared_alloc_unlock();
85+
ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL;
86+
ZCG(cache_persistent_script) = persistent_script;
87+
return resolved_path;
88+
}
89+
}
90+
+ zend_shared_alloc_unlock();
91+
}
92+
93+
ZCG(cache_opline) = NULL;
94+
diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c
95+
index 2fd3dfb5ed5..484489eff03 100644
96+
--- a/ext/opcache/zend_accelerator_hash.c
97+
+++ b/ext/opcache/zend_accelerator_hash.c
98+
@@ -31,9 +31,12 @@ static const uint32_t num_prime_numbers = sizeof(prime_numbers) / sizeof(uint32_
99+
100+
void zend_accel_hash_clean(zend_accel_hash *accel_hash)
101+
{
102+
+ ZEND_ASSERT(ZCG(locked));
103+
+
104+
accel_hash->num_entries = 0;
105+
accel_hash->num_direct_entries = 0;
106+
memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
107+
+ memset(accel_hash->hash_entries, 0xf0, sizeof(zend_accel_hash_entry )*accel_hash->max_num_entries);
108+
}
109+
110+
void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
111+
@@ -65,6 +68,7 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
112+
return;
113+
}
114+
memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
115+
+ memset(accel_hash->hash_entries, 0xf0f0, sizeof(zend_accel_hash_entry )*accel_hash->max_num_entries);
116+
}
117+
118+
/* Returns NULL if hash is full
119+
diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c
120+
index 55139a0e02e..7a8b0cd9546 100644
121+
--- a/sapi/fpm/fpm/fpm_stdio.c
122+
+++ b/sapi/fpm/fpm/fpm_stdio.c
123+
@@ -26,7 +26,7 @@ static int fd_stderr[2];
124+
125+
int fpm_stdio_init_main(void)
126+
{
127+
- int fd = open("/dev/null", O_RDWR);
128+
+ /*int fd = open("/dev/null", O_RDWR);
129+
130+
if (0 > fd) {
131+
zlog(ZLOG_SYSERROR, "failed to init stdio: open(\"/dev/null\")");
132+
@@ -38,7 +38,7 @@ int fpm_stdio_init_main(void)
133+
close(fd);
134+
return -1;
135+
}
136+
- close(fd);
137+
+ close(fd);*/
138+
return 0;
139+
}
140+
141+
@@ -62,11 +62,11 @@ static inline int fpm_use_error_log(void) {
142+
143+
int fpm_stdio_init_final(void)
144+
{
145+
- if (0 > fpm_stdio_redirect_stderr_to_error_log() ||
146+
+ /*if (0 > fpm_stdio_redirect_stderr_to_error_log() ||
147+
0 > fpm_stdio_redirect_stderr_to_dev_null_for_syslog()) {
148+
149+
return -1;
150+
- }
151+
+ }*/
152+
153+
zlog_set_launched();
154+
return 0;

0 commit comments

Comments
 (0)