Skip to content

Commit 3e377e3

Browse files
committed
Use known zend_string instead of C string
For strings related to exception properties
1 parent 8810599 commit 3e377e3

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

ext/soap/soap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ PHP_METHOD(SoapFault, __toString)
584584
this_ptr = ZEND_THIS;
585585
faultcode = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultcode", sizeof("faultcode")-1, 1, &rv1);
586586
faultstring = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultstring", sizeof("faultstring")-1, 1, &rv2);
587-
file = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "file", sizeof("file")-1, 1, &rv3);
588-
line = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "line", sizeof("line")-1, 1, &rv4);
587+
file = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr) ZSTR_KNOWN(ZEND_STR_FILE), /* silent */ true, &rv));
588+
line = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr), ZSTR_KNOWN(ZEND_STR_LINE), /* silent */ true, &rv));
589589

590590
zend_call_method_with_0_params(
591591
Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), NULL, "gettraceasstring", &trace);
@@ -1107,7 +1107,7 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi
11071107
} else if (instanceof_function(Z_OBJCE(exception_object), zend_ce_error)) {
11081108
if (service->send_errors) {
11091109
zval rv;
1110-
zend_string *msg = zval_get_string(zend_read_property(zend_ce_error, Z_OBJ(exception_object), "message", sizeof("message")-1, 0, &rv));
1110+
zend_string *msg = zval_get_string(zend_read_property_ex(zend_ce_error, Z_OBJ(exception_object), ZSTR_KNOWN(ZEND_STR_MESSAGE), /* silent */ false, &rv));
11111111
add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL);
11121112
zend_string_release_ex(msg, 0);
11131113
} else {
@@ -2747,7 +2747,7 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha
27472747
}
27482748

27492749
ZVAL_STRING(Z_FAULT_STRING_P(obj), fault_string ? fault_string : "");
2750-
zend_update_property_string(zend_ce_exception, Z_OBJ_P(obj), "message", sizeof("message")-1, (fault_string ? fault_string : ""));
2750+
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(obj), ZSTR_KNOWN(ZEND_STR_MESSAGE), Z_FAULT_STRING_P(obj));
27512751

27522752
if (fault_code != NULL) {
27532753
int soap_version = SOAP_GLOBAL(soap_version);

ext/standard/filestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
889889
case S_IFCHR: RETURN_STRING("char");
890890
case S_IFDIR: RETURN_STRING("dir");
891891
case S_IFBLK: RETURN_STRING("block");
892-
case S_IFREG: RETURN_STRING("file");
892+
case S_IFREG: RETURN_STR(ZSTR_KNOWN(ZEND_STR_FILE)); /* "file" */
893893
#if defined(S_IFSOCK) && !defined(PHP_WIN32)
894894
case S_IFSOCK: RETURN_STRING("socket");
895895
#endif

ext/standard/proc_open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ static zend_result set_proc_descriptor_from_array(zval *descitem, descriptorspec
917917
} else if (zend_string_equals_literal(ztype, "socket")) {
918918
/* Set descriptor to socketpair */
919919
retval = set_proc_descriptor_to_socket(&descriptors[ndesc]);
920-
} else if (zend_string_equals_literal(ztype, "file")) {
920+
} else if (zend_string_equals(ztype, ZSTR_KNOWN(ZEND_STR_FILE))) {
921921
/* Set descriptor to file */
922922
if ((zfile = get_string_parameter(descitem, 1, "file name parameter for 'file'")) == NULL) {
923923
goto finish;

sapi/cli/php_cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
10761076

10771077
if (EG(exception)) {
10781078
zval rv;
1079-
zval *msg = zend_read_property(zend_ce_exception, EG(exception), "message", sizeof("message")-1, 0, &rv);
1079+
zval *msg = zend_read_property_ex(zend_ce_exception, EG(exception), ZSTR_KNOWN(ZEND_STR_MESSAGE), /* silent */ false, &rv);
10801080
zend_printf("Exception: %s\n", Z_STRVAL_P(msg));
10811081
zend_object_release(EG(exception));
10821082
EG(exception) = NULL;

sapi/phpdbg/phpdbg_frame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ void phpdbg_dump_backtrace(size_t num) /* {{{ */
287287
phpdbg_out(" (internal function)\n");
288288
}
289289

290-
file = zend_hash_str_find(Z_ARRVAL_P(tmp), ZEND_STRL("file"));
291-
line = zend_hash_str_find(Z_ARRVAL_P(tmp), ZEND_STRL("line"));
290+
file = zend_hash_find(Z_ARRVAL_P(tmp), ZSTR_KNOWN(ZEND_STR_FILE));
291+
line = zend_hash_find(Z_ARRVAL_P(tmp), ZSTR_KNOWN(ZEND_STR_LINE));
292292
zend_hash_move_forward_ex(Z_ARRVAL(zbacktrace), &position);
293293
}
294294

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,8 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
715715
EG(exception) = NULL;
716716

717717
zend_call_known_instance_method_with_0_params(ex->ce->__tostring, ex, &tmp);
718-
file = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("file"), 1, &rv));
719-
line = zval_get_long(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("line"), 1, &rv));
718+
file = zval_get_string(zend_read_property_ex(zend_get_exception_base(ex), ex, ZSTR_KNOWN(ZEND_STR_FILE), /* silent */ true, &rv));
719+
line = zval_get_long(zend_read_property_ex(zend_get_exception_base(ex), ex, ZSTR_KNOWN(ZEND_STR_LINE), /* silent */ true, &rv));
720720

721721
if (EG(exception)) {
722722
EG(exception) = NULL;
@@ -1695,9 +1695,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
16951695
PHPDBG_G(handled_exception) = exception;
16961696

16971697
zval rv;
1698-
zend_string *file = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("file"), 1, &rv));
1699-
zend_long line = zval_get_long(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("line"), 1, &rv));
1700-
zend_string *msg = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("message"), 1, &rv));
1698+
zend_string *file = zval_get_string(zend_read_property_ex(zend_get_exception_base(exception), exception, ZSTR_KNOWN(ZEND_STR_FILE), /* silent */ true, &rv));
1699+
zend_long line = zval_get_string(zend_read_property_ex(zend_get_exception_base(exception), exception, ZSTR_KNOWN(ZEND_STR_LINE), /* silent */ true, &rv));
1700+
zend_string *msg = zval_get_string(zend_read_property_ex(zend_get_exception_base(exception), exception, ZSTR_KNOWN(ZEND_STR_MESSAGE), /* silent */ true, &rv));
17011701

17021702
phpdbg_error("Uncaught %s in %s on line " ZEND_LONG_FMT ": %.*s",
17031703
ZSTR_VAL(exception->ce->name), ZSTR_VAL(file), line,

0 commit comments

Comments
 (0)