Bug #71148 [Asn->Nab]: Bind reference overwritten on php7

From: Date: Mon, 22 Feb 2016 04:41:31 +0000
Subject: Bug #71148 [Asn->Nab]: Bind reference overwritten on php7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199378@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71148&edit=1

 ID:                 71148
 Updated by:         sixd@php.net
 Reported by:        arcostasi at gmail dot com
 Summary:            Bind reference overwritten on php7
-Status:             Assigned
+Status:             Not a bug
 Type:               Bug
 Package:            OCI8 related
 Operating System:   Linux
 PHP Version:        7.0.0
 Assigned To:        sixd
 Block user comment: N
 Private report:     N

 New Comment:

Looks like an expected change with PHP 7.

OCI8 needs the zval of the bound variable to be available when OCIExecute is called.
Try using pass by reference in your bindValue() function, or don't bind in a function.
This is similar to example #3 in http://php.net/manual/en/function.oci-bind-by-name.php

From the dev who analyzed this:

"Reason for this new behavior in PHP 7 is that, unlike in PHP 5.6, zval (_zend_value) in PHP
7.0 is no more have reference count field. Only its values field (zend_value) has reference count
field.

Since we store the placeholder (i.e., zval variable) [not its content (zend_value)] in php_oci_bind
structure, it gets overwritten when oci_bind_by_name() is called with same variable and different
content in it."


Previous Comments:
------------------------------------------------------------------------
[2016-01-07 11:29:29] deepdiver at owncloud dot com

duplicate of https://bugs.php.net/bug.php?id=70302

------------------------------------------------------------------------
[2015-12-17 11:15:51] arcostasi at gmail dot com

Description:
------------
Simple insert on oracle database using Doctrine with OCI8 driver on PHP 7.

All the columns get overwritten by value of the last call to OCI8Statement->bindValue.

Table creation script can be found at db/ of the test script repository

The code on public/only_oci8.php reproduces the problem without Doctrine.

Test script:
---------------
https://github.com/pdgcvs/DoctrineInsertPHP7

https://github.com/pdgcvs/DoctrineInsertPHP7/blob/master/public/only_oci8.php

https://github.com/pdgcvs/DoctrineInsertPHP7/blob/master/public/only_oci8_2.php






------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71148&edit=1


Thread (6 messages)

« previous php.bugs (#199378) next »