Patch oci8_statement.patch_8_0_9 for OCI8 related Bug #73002
Patch version 2021-08-30 09:49 UTC
Return to Bug #73002 |
Download this patch
Patch Revisions:
Developer: lzsiga@freemail.c3.hu
*** ext/oci8/oci8_statement.c Thu Jul 29 14:53:58 2021
--- ../php-8.0.9-patched/ext/oci8/oci8_statement.c Thu Aug 26 16:06:46 2021
***************
*** 43,48 ****
--- 43,58 ----
typedef ub4 oci_phpsized_int;
#endif
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ #define ZendLongPtr2UInt32Ptr(zendlongptr) ((uint32_t *)(zendlongptr))
+ #define ZendLongPtr2OciPhpsizedIntPtr(zendlongptr) ((oci_phpsized_int *)(zendlongptr))
+ #else
+ #define ZendLongPtr2UInt32Ptr(zendlongptr) \
+ ((uint32_t *)((char *)(zendlongptr)+(sizeof(zend_long)-sizeof(uint32_t))))
+ #define ZendLongPtr2OciPhpsizedIntPtr(zendlongptr) \
+ ((oci_phpsized_int *)((char *)(zendlongptr)+(sizeof(zend_long)-sizeof(oci_phpsized_int))))
+ #endif
+
/* {{{ php_oci_statement_create()
Create statemend handle and allocate necessary resources */
php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len)
***************
*** 1088,1094 ****
/* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temporary value) */
if (Z_LVAL_P(zv) == 0)
ZVAL_BOOL(zv, FALSE);
! else if (Z_LVAL_P(zv) == 1)
ZVAL_BOOL(zv, TRUE);
}
--- 1098,1104 ----
/* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temporary value) */
if (Z_LVAL_P(zv) == 0)
ZVAL_BOOL(zv, FALSE);
! else
ZVAL_BOOL(zv, TRUE);
}
***************
*** 1167,1173 ****
return 1;
}
convert_to_long(param);
! bind_data = (oci_phpsized_int *)&Z_LVAL_P(param);
value_sz = sizeof(oci_phpsized_int);
mode = OCI_DEFAULT;
break;
--- 1177,1183 ----
return 1;
}
convert_to_long(param);
! bind_data = ZendLongPtr2OciPhpsizedIntPtr(&Z_LVAL_P(param));
value_sz = sizeof(oci_phpsized_int);
mode = OCI_DEFAULT;
break;
***************
*** 1232,1238 ****
return 1;
}
! value_sz = sizeof(zend_long);
mode = OCI_DEFAULT;
break;
--- 1242,1249 ----
return 1;
}
! bind_data = ZendLongPtr2UInt32Ptr (bind_data); /* relevant on bigendian 64-bit platforms */
! value_sz = sizeof(int32_t);
mode = OCI_DEFAULT;
break;
***************
*** 1490,1497 ****
ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1);
#endif
! /* XXX we assume that zend-zval len has 4 bytes */
! *alenpp = (ub4*) &Z_STRLEN_P(val);
*bufpp = Z_STRVAL_P(val);
*piecep = OCI_ONE_PIECE;
*rcodepp = &phpbind->retcode;
--- 1501,1508 ----
ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1);
#endif
! /* in 64-bit, length is 8 bytes long, Oracle expects 4 bytes */
! *alenpp = ZendLongPtr2UInt32Ptr(&Z_STRLEN_P(val));
*bufpp = Z_STRVAL_P(val);
*piecep = OCI_ONE_PIECE;
*rcodepp = &phpbind->retcode;
|