php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #73002
Patch oci8_statement.patch_8_2_0 revision 2022-12-31 20:02 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_8_0_9 revision 2021-08-30 09:49 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_8_0_0 revision 2020-08-17 10:52 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_4_0boolean2 revision 2019-12-16 10:52 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_4_0boolean revision 2019-12-16 10:17 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_4_0 revision 2019-11-27 10:12 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_3_0_RC2 revision 2018-10-01 11:57 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_3_0 revision 2018-06-12 15:01 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_1_11 revision 2017-10-29 14:53 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_1_8 revision 2017-08-10 13:06 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_1_4 revision 2017-04-28 08:33 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_0_13_v2 revision 2016-11-14 19:12 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_0_13 revision 2016-11-14 12:11 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement_v2.patch_7_0_11 revision 2016-09-16 11:13 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch_7_0_11 revision 2016-09-16 10:28 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement_v2.patch revision 2016-09-08 10:22 UTC by lzsiga at freemail dot c3 dot hu
Patch oci8_statement.patch revision 2016-09-02 11:14 UTC by lzsiga at freemail dot c3 dot hu

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;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC