Patch oci8_statement.patch_8_2_0 for OCI8 related Bug #73002
Patch version 2022-12-31 20:02 UTC
Return to Bug #73002 |
Download this patch
Patch Revisions:
Developer: lzsiga@freemail.c3.hu
*** ext/oci8/oci8_statement.c 2022-12-06 15:26:47 +0100
--- ../php-8.2.0-patched/ext/oci8/oci8_statement.c 2022-12-31 20:18:55 +0100
***************
*** 42,47 ****
--- 42,57 ----
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)
***************
*** 1106,1112 ****
/* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temporary value) */
if (Z_LVAL_P(zv) == 0)
ZVAL_FALSE(zv);
! else if (Z_LVAL_P(zv) == 1)
ZVAL_TRUE(zv);
}
--- 1116,1122 ----
/* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temporary value) */
if (Z_LVAL_P(zv) == 0)
ZVAL_FALSE(zv);
! else
ZVAL_TRUE(zv);
}
***************
*** 1185,1191 ****
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;
--- 1195,1201 ----
return 1;
}
convert_to_long(param);
! bind_data = ZendLongPtr2OciPhpsizedIntPtr(&Z_LVAL_P(param));
value_sz = sizeof(oci_phpsized_int);
mode = OCI_DEFAULT;
break;
***************
*** 1250,1256 ****
return 1;
}
! value_sz = sizeof(zend_long);
mode = OCI_DEFAULT;
break;
--- 1260,1267 ----
return 1;
}
! bind_data = ZendLongPtr2UInt32Ptr (bind_data); /* relevant on bigendian 64-bit platforms */
! value_sz = sizeof(int32_t);
mode = OCI_DEFAULT;
break;
***************
*** 1502,1509 ****
efree(p);
}
! /* 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;
--- 1513,1520 ----
efree(p);
}
! /* 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;
|