-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCI8 - bindValue overwrite previous values #2261
Comments
This fix solved the problem that I was having with doctrine+oci8 on php7. Thanks my friend! |
@pdgcvs is that actually the "new" expected behaviour of OCI8 on PHP7 or rather a bug in PHP7? We should try to avoid fixing PHP bugs in userland where possible. If it is a PHP bug, we could still fix that in DBAL as a workaround, but should then try to get that fixed in PHP itself in the long term. |
@deeky666 and if this bug was in earlier versions of php 7? The simple way that is fixed, if it's a bug of php 7, the code yet will keep running. Good that's now working on php 7. |
That's why they're called "patch releases": you'd simply upgrade |
I'll leave this issue open for reference until it is fixed in the driver. See PHP ticket. Let's see what's happening at PHP side before taking any action in Doctrine. |
In PHP ticket: OCI8 needs the zval of the bound variable to be available when OCIExecute is called. 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." |
So there's been no movement on this in a while, is anyone going to evaluate and or comment on the pull request? |
Handled in #2434 |
FWIW there is a proposed OCI8 patch in https://bugs.php.net/patch-display.php?bug_id=71148&patch=oci8-php7-bind&revision=latest |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Simple successful insert example, to show that all columns get overwritten:
https://github.com/pdgcvs/DoctrineInsertPHP7
When trying to use persist method with OCI8 driver on PHP 7 all the column values got overwritten by one.
This also leads to many format validation errors preventing the data from being inserted into table.
The problem seems to be on OCI8Statement->bindValue function when the local variable $value is passed as reference to bindParam.
I tried to make a simple fix by storing values of bind call in an array (instance member) before passing it as reference to bindParam.
So far it seems to be working.
https://github.com/pdgcvs/dbal/commit/4906c6518e09d56063c6c1e9594987467071bc35
The text was updated successfully, but these errors were encountered: