| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 Patch oci8_statement.patch_7_4_0 for OCI8 related Bug #73002Patch version 2019-11-27 10:12 UTC Return to Bug #73002 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions:Developer: lzsiga@freemail.c3.hu
*** ext/oci8/oci8_statement.c	Tue Nov 26 21:13:44 2019
--- ../php-7.4.0-patched/ext/oci8/oci8_statement.c	Wed Nov 27 06:58:23 2019
***************
*** 988,1009 ****
  		}
  		zval_ptr_dtor(zv);
  		ZVAL_NULL(zv);
! 	} else if (Z_TYPE_P(zv) == IS_STRING
! 			   && Z_STRLEN_P(zv) > 0
! 			   && Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] != '\0') {
! 		/* The post- PHP 5.3 feature for "interned" strings disallows
! 		 * their reallocation but (i) any IN binds either interned or
! 		 * not should already be null terminated and (ii) for OUT
! 		 * binds, php_oci_bind_out_callback() should have allocated a
! 		 * new string that we can modify here.
! 		 */
  #if PHP_VERSION_ID < 70300
! 		SEPARATE_STRING(zv);
! 		Z_STR_P(zv) = zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0);
  #else
! 		ZVAL_NEW_STR(zv, zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0));
  #endif
! 		Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] = '\0';
  	} else if (Z_TYPE_P(zv) == IS_ARRAY) {
  		int i;
  		zval *entry = NULL;
--- 988,1011 ----
  		}
  		zval_ptr_dtor(zv);
  		ZVAL_NULL(zv);
! 	} else if (Z_TYPE_P(zv) == IS_STRING) {
! 		Z_STRLEN_P(zv)= bind->dummy_len;
! 		if (Z_STRLEN_P(zv) > 0 &&
! 		    Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] != '\0') {
! 			/* The post- PHP 5.3 feature for "interned" strings disallows
! 			 * their reallocation but (i) any IN binds either interned or
! 			 * not should already be null terminated and (ii) for OUT
! 			 * binds, php_oci_bind_out_callback() should have allocated a
! 			 * new string that we can modify here.
! 			 */
  #if PHP_VERSION_ID < 70300
! 		    SEPARATE_STRING(zv);
! 		    Z_STR_P(zv) = zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0);
  #else
! 		    ZVAL_NEW_STR(zv, zend_string_extend(Z_STR_P(zv), Z_STRLEN_P(zv)+1, 0));
  #endif
! 		    Z_STRVAL_P(zv)[ Z_STRLEN_P(zv) ] = '\0';
! 		}
  	} else if (Z_TYPE_P(zv) == IS_ARRAY) {
  		int i;
  		zval *entry = NULL;
***************
*** 1391,1396 ****
--- 1393,1399 ----
  		*bufpp = 0;
  		*alenp = -1;
  		*indpp = (dvoid *)&phpbind->indicator;
+ 		phpbind->dummy_len= 0;          /* so far, 'dummy_len' meant the maximum length; from now, it is the actual length */
  	} else	if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) {
  		/* "normal" string bind */
  		if (!try_convert_to_string(val)) {
***************
*** 1408,1413 ****
--- 1411,1417 ----
  		if ((phpbind->dummy_len > 0) && (phpbind->dummy_len < *alenp))
  			*alenp = phpbind->dummy_len;
  		*indpp = (dvoid *)&phpbind->indicator;
+ 		phpbind->dummy_len= *alenp;	/* so far, 'dummy_len' meant the maximum length; from now, it is the actual length */
  	} else if (phpbind->statement != 0) {
  		/* RSET */
  		*bufpp = phpbind->statement;
***************
*** 1501,1508 ****
  		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;
--- 1505,1513 ----
  		ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1);
  #endif
  
! 		/* XXX we assume that zend-zval len has 4 bytes -- doesn't work on big endian PowerPC-64 */
!  		phpbind->dummy_len= Z_STRLEN_P(val);
! 		*alenpp = &phpbind->dummy_len;
  		*bufpp = Z_STRVAL_P(val);
  		*piecep = OCI_ONE_PIECE;
  		*rcodepp = &phpbind->retcode;
         | 
    
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC |