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

From: Date: Thu, 13 Oct 2016 03:56:58 +0000
Subject: Bug #71148 [Nab->Fbk]: Bind reference overwritten on php7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204655@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:             Not a bug
+Status:             Feedback
 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:

Frank has a suggested patch; try it and let us know whether it works for you.


Previous Comments:
------------------------------------------------------------------------
[2016-10-13 03:56:08] sixd@php.net

The following patch has been added/updated:

Patch Name: oci8-php7-bind
Revision:   1476330968
URL:        https://bugs.php.net/patch-display.php?bug=71148&patch=oci8-php7-bind&revision=1476330968

------------------------------------------------------------------------
[2016-08-16 06:28:37] sixd@php.net

Related To: Bug #71947

------------------------------------------------------------------------
[2016-02-22 04:41:28] sixd@php.net

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."

------------------------------------------------------------------------
[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 (#204655) next »