Skip to content

Commit 29bf338

Browse files
jmikoladerickr
authored andcommitted
PHPC-374: zend_string updates for OnUpdateDebug
1 parent df74d6d commit 29bf338

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

php_phongo.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,11 +2278,11 @@ ZEND_INI_MH(OnUpdateDebug)
22782278
MONGODB_G(debug_fd) = NULL;
22792279
}
22802280

2281-
if (!new_value_length
2282-
|| strcasecmp("0", new_value) == 0
2283-
|| strcasecmp("off", new_value) == 0
2284-
|| strcasecmp("no", new_value) == 0
2285-
|| strcasecmp("false", new_value) == 0
2281+
if (!new_value || (new_value && !phongo_str(new_value)[0])
2282+
|| strcasecmp("0", phongo_str(new_value)) == 0
2283+
|| strcasecmp("off", phongo_str(new_value)) == 0
2284+
|| strcasecmp("no", phongo_str(new_value)) == 0
2285+
|| strcasecmp("false", phongo_str(new_value)) == 0
22862286
) {
22872287
mongoc_log_trace_disable();
22882288
mongoc_log_set_handler(NULL, NULL);
@@ -2291,34 +2291,35 @@ ZEND_INI_MH(OnUpdateDebug)
22912291
}
22922292

22932293

2294-
if (strcasecmp(new_value, "stderr") == 0) {
2294+
if (strcasecmp(phongo_str(new_value), "stderr") == 0) {
22952295
MONGODB_G(debug_fd) = stderr;
2296-
} else if (strcasecmp(new_value, "stdout") == 0) {
2296+
} else if (strcasecmp(phongo_str(new_value), "stdout") == 0) {
22972297
MONGODB_G(debug_fd) = stdout;
22982298
} else if (
2299-
strcasecmp("1", new_value) == 0
2300-
|| strcasecmp("on", new_value) == 0
2301-
|| strcasecmp("yes", new_value) == 0
2302-
|| strcasecmp("true", new_value) == 0
2299+
strcasecmp("1", phongo_str(new_value)) == 0
2300+
|| strcasecmp("on", phongo_str(new_value)) == 0
2301+
|| strcasecmp("yes", phongo_str(new_value)) == 0
2302+
|| strcasecmp("true", phongo_str(new_value)) == 0
23032303
) {
23042304
tmp_dir = NULL;
23052305
} else {
2306-
tmp_dir = new_value;
2306+
tmp_dir = phongo_str(new_value);
23072307
}
23082308

23092309
if (!MONGODB_G(debug_fd)) {
23102310
time_t t;
23112311
int fd = -1;
23122312
char *prefix;
23132313
int len;
2314-
char *filename;
2314+
phongo_char *filename;
23152315

23162316
time(&t);
23172317
len = spprintf(&prefix, 0, "PHONGO-%ld", t);
23182318

23192319
fd = php_open_temporary_fd(tmp_dir, prefix, &filename TSRMLS_CC);
23202320
if (fd != -1) {
2321-
MONGODB_G(debug_fd) = VCWD_FOPEN(filename, "a");
2321+
const char *path = phongo_str(filename);
2322+
MONGODB_G(debug_fd) = VCWD_FOPEN(path, "a");
23222323
}
23232324
efree(filename);
23242325
efree(prefix);

0 commit comments

Comments
 (0)