-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Move a few custom type checks to ZPP #6034
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1736,31 +1736,31 @@ PHP_FUNCTION(odbc_fetch_row) | |
PHP_FUNCTION(odbc_result) | ||
{ | ||
char *field; | ||
zend_string *field_str; | ||
zend_string *field_str, *pv_field_str; | ||
zend_long pv_field_long; | ||
Comment on lines
-1739
to
+1740
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quick question: moving from Also, is that a good practice to follow? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @carusogabriel I don't think they are noticably cheaper. The real benefit is being able to accept arguments whose type is validated according to the standard semantics, rather than in a custom way. |
||
int field_ind; | ||
SQLSMALLINT sql_c_type = SQL_C_CHAR; | ||
odbc_result *result; | ||
int i = 0; | ||
RETCODE rc; | ||
SQLLEN fieldsize; | ||
zval *pv_res, *pv_field; | ||
zval *pv_res; | ||
#ifdef HAVE_SQL_EXTENDED_FETCH | ||
SQLULEN crow; | ||
SQLUSMALLINT RowStatus[1]; | ||
#endif | ||
|
||
field_ind = -1; | ||
field = NULL; | ||
|
||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pv_res, &pv_field) == FAILURE) { | ||
RETURN_THROWS(); | ||
} | ||
ZEND_PARSE_PARAMETERS_START(2, 2) | ||
Z_PARAM_RESOURCE(pv_res) | ||
Z_PARAM_STR_OR_LONG(pv_field_str, pv_field_long) | ||
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
if (Z_TYPE_P(pv_field) == IS_STRING) { | ||
field = Z_STRVAL_P(pv_field); | ||
if (pv_field_str) { | ||
field = ZSTR_VAL(pv_field_str); | ||
field_ind = -1; | ||
} else { | ||
convert_to_long_ex(pv_field); | ||
field_ind = Z_LVAL_P(pv_field) - 1; | ||
field = NULL; | ||
field_ind = (int) pv_field_long - 1; | ||
} | ||
|
||
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by note: I think the MAIL_ASCIIZ_CHECK_MBSTRING calls above are corrupting the argument strings :(