php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch oci8_statement.patch_7_0_13 for OCI8 related Bug #73002Patch version 2016-11-14 12:11 UTC Return to Bug #73002 | Download this patchThis patch is obsolete Obsoleted by patches:
This patch renders other patches obsolete Obsolete patches:
Developer: lzsiga@freemail.c3.hu--- oci8_statement.corig 2016-11-08 16:07:49.000000000 +0100 +++ oci8_statement.c 2016-11-14 12:49:59.000000000 +0100 @@ -972,17 +972,18 @@ } zval_dtor(val); ZVAL_NULL(val); - } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRLEN_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\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. - */ - Z_STR_P(bind->zval) = zend_string_extend(Z_STR_P(bind->zval), Z_STRLEN_P(bind->zval)+1, 0); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; + } else if (Z_TYPE_P(bind->zval) == IS_STRING) { + Z_STRLEN_P(bind->zval)= bind->dummy_len; + if (Z_STRLEN_P(bind->zval) > 0 && + Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\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. + */ + Z_STR_P(bind->zval) = zend_string_extend(Z_STR_P(bind->zval), Z_STRLEN_P(bind->zval)+1, 0); + Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { int i; zval *entry = NULL; @@ -1370,6 +1371,7 @@ *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 */ convert_to_string(val); @@ -1385,6 +1387,7 @@ 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; @@ -1476,8 +1479,9 @@ ZVAL_STRINGL(val, NULL, Z_STRLEN(phpbind->zval) + 1); #endif - /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); + /* XXX we assume that zend-zval len has 4 bytes -- doesn't work on big endian PowerPC-64 */ + phpbind->dummy_len= Z_STRLEN_P(phpbind->zval); + *alenpp = &phpbind->dummy_len; *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Sat Dec 21 14:01:32 2024 UTC |