Edit report at https://bugs.php.net/bug.php?id=73002&edit=1
ID: 73002
Comment by: lzsiga at freemail dot c3 dot hu
Reported by: lzsiga at freemail dot c3 dot hu
Summary: bigendian64/php7/oci8: output bind-variables doesn't
work
Status: Open
Type: Bug
Package: OCI8 related
Operating System: 64-bit / BigEndian
PHP Version: 7.*
Block user comment: N
Private report: N
New Comment:
The changes in 7.1.8 rendered my patch unusable: the input-bind variables lose their content (guess
their length become zero). Non-using my patch doesn't help, in that case oci_execute end is in
ORA-3113 (disconnect). [Platform AIX, PowerPC/64-bit big-endian, Oracle client 12.1]
Previous Comments:
------------------------------------------------------------------------
[2017-05-02 15:26:14] velazquez dot pascual at ciime dot mx
The same problem is observed in Solaris 11.3, in Sparc architecture. The proposed patch works.
Thank you very much for posting the patch.
------------------------------------------------------------------------
[2017-04-28 08:34:31] lzsiga at freemail dot c3 dot hu
Moved the patch to versiom 7.1.4
------------------------------------------------------------------------
[2016-09-16 10:29:39] lzsiga at freemail dot c3 dot hu
Modified the patch to match version 7.0.11
------------------------------------------------------------------------
[2016-09-08 10:35:38] lzsiga at freemail dot c3 dot hu
Hi, I had to add some lines to prevent destruction of 'IN-only' bind variables. (I think
'php_oci_bind' should be reorganized, field 'dummy_len' replaced with fields
'maximum_len', 'before_exec_len' and 'after_exec_len'. Also it should
be tracked in a boolean field if 'bind_out_callback' has been called on the field or not.
If not, the bind-variable shouldn't be changed in 'bind_post_exec')
------------------------------------------------------------------------
[2016-09-02 11:14:34] lzsiga at freemail dot c3 dot hu
Description:
------------
Hi, I think I've found a little bug in component ext/oci8 that affects only 64-bit big-endian
platforms.
In ext/oci8/oci8_statement.c:php_oci_bind_out_callback (line 1461) the program assumes that
&val->string->len (type size_t *) can be type-casted to (ub4 *)
Well, that works on 32-bit platforms, also on 64-bit/little-endian platforms, but fails on
bi-bit/big-endian platforms such as PowerPc64/Aix (size_t is eight bytes, ub4 is four bytes, and a
simple type-cast does the wrong thing).
The attached patch seems to solve the problem.
Test script:
---------------
/* anonymous PL/SQL block */
BEGIN
SELECT ename INTO :ename FROM emp WHERE empno=7876;
END;
Expected result:
----------------
ename=ADAMS
Actual result:
--------------
oci_execute(): ORA-03131: an invalid buffer was provided for the next piece
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73002&edit=1