Skip to content

ext-oci8: oci_new_descriptor() triggers dynamic property deprecation #8756

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

Closed
derrabus opened this issue Jun 12, 2022 · 16 comments · Fixed by #8844 · May be fixed by #8758
Closed

ext-oci8: oci_new_descriptor() triggers dynamic property deprecation #8756

derrabus opened this issue Jun 12, 2022 · 16 comments · Fixed by #8844 · May be fixed by #8758

Comments

@derrabus
Copy link
Contributor

derrabus commented Jun 12, 2022

Description

The following code:

https://github.com/doctrine/dbal/blob/e15d05d08172ceeb4f55066feed48d688fdb0250/src/Driver/OCI8/Statement.php#L75

Resulted in this output:

Creation of dynamic property OCILob::$descriptor is deprecated

https://github.com/doctrine/dbal/runs/6850136105?check_suite_focus=true

But I expected this output instead:

The piece of code that PHP complains about does not write any property directly but calls oci_new_descriptor() which is supposed to return a new OCILob instance. I don't feel like I could avoid the deprecation.

PHP Version

PHP 8.2-dev 13479ee

Operating System

Ubuntu 20.04

@adoy
Copy link
Member

adoy commented Jun 12, 2022

@derrabus Thanks. I started to work on a patch for your issue. I'm not a user of oci extension myself so if you have the oportunity to make sure the patch work and also to give some input on GH-8756, that would be appreciated.

@derrabus
Copy link
Contributor Author

Thank you very much for working on this. I don't use that extension much myself either. I help maintaining Doctrine DBAL and this issue bubbled up in our CI. 🙈

But as far as I can tell, DBAL never accesses those properties (descriptor and collection) directly.

@adoy
Copy link
Member

adoy commented Jun 13, 2022

@derrabus Thanks. I'll wait for answers on the code review. Would it be possible for you to run your test suite on the branch with the current fix ?

@cmb69
Copy link
Member

cmb69 commented Jun 13, 2022

We need to test oci8 and pdo_oci in our CI; there is #8348, but that needs more work. I doubt that a setup on AppVeyor makes sense, since the latest Oracle XE download is almost 2GB, and it is not yet preinstalled.

adoy added a commit to adoy/php-src that referenced this issue Jun 21, 2022
Fix phpGH-8756 : oci_new_descriptor() triggers dynamic property
deprecation.

This fix should be temporary. At some point we should either define
those properties or just hide them since they should probably not be
used.

Better fix is here : php#8758 but
waiting feedback from Oracle team before going ahead.
@adoy adoy closed this as completed in 6b6e5f3 Jun 22, 2022
@derrabus
Copy link
Contributor Author

The deprecation warnings are gone now. Thank you!

@adoy
Copy link
Member

adoy commented Jun 23, 2022

Welcome. Thanks for reporting

@dormadekhin
Copy link

Hi! After installing php 8.2 I keep getting the following error:
Creation of dynamic property OCILob::$descriptor is deprecated

@adoy
Copy link
Member

adoy commented Mar 28, 2023

Hi! After installing php 8.2 I keep getting the following error: Creation of dynamic property OCILob::$descriptor is deprecated

What exact version of PHP are you using ? Can you narrow it to a small reproducible script?

@dormadekhin
Copy link

Hi! After installing php 8.2 I keep getting the following error: Creation of dynamic property OCILob::$descriptor is deprecated

What exact version of PHP are you using ? Can you narrow it to a small reproducible script?

PHP Version 8.2.4
OCI8 Version 3.2.1
Oracle Run-time Client Library Version 21.3.0.0.0
Oracle Compile-time Instant Client Version 21.3

image
image

@dormadekhin
Copy link

dormadekhin commented Mar 30, 2023

I use php in a container, based on the basic php-fpm image
FROM php:8.2-fpm

@derrabus
Copy link
Contributor Author

I think, the important part was:

Can you narrow it to a small reproducible script?

@BigOHenry
Copy link

Same problem here.

PHP Version 8.2.4
OCI8 Version 3.2.1
Oracle Run-time Client Library Version 21.1.0.0.0
Oracle Compile-time Instant Client Version 21.1

based on php:8.2.4-apache-bullseye

@adoy
Copy link
Member

adoy commented Apr 23, 2023

@dormadekhin @BigOHenry I took some time to look at the issue but wasn't able to reproduce it. I tried first using the official 8.2.5 source code, then built a docker image based on php:8.2.4-apache-bullseye as you suggested and both of them worked.

PHP Version => 8.2.4
OCI8 Version => 3.2.1
Oracle Run-time Client Library Version => 21.6.0.0.0
Oracle Compile-time Instant Client Version => 21.6

Could you provide me a minimal script to reproduce the error, and how you built the image ? That would be helpful.

Also what's the output when you run a script like this:

<?php

foreach ([ OCILob::class, OCICollection::class ] as $cn) {
        $rc = new ReflectionClass($cn);
        foreach ($rc->getAttributes() as $attribute) {
                var_dump($attribute->getName());
        }
}

$x = new OCILob();
$x->foo = 'bar';

$y = new OCICollection();
$y->foo = 'bar';

@derrabus Do you also have the same issue ?

@derrabus
Copy link
Contributor Author

No, from my POV, the issue has been resolved.

@BigOHenry
Copy link

BigOHenry commented Apr 24, 2023

I will try prepare the image this week (kind of busy right now).
But for now. I getting the OCI error on every oci_fetch_array call, when there is a CLOB column:

oci_fetch_array($res, OCI_ASSOC | OCI_RETURN_NULLS);

obrazek

EDIT: Just found new version of oci8 php extension for php8.2 (released 4 days ago). I will try it, it could be fixed (dont know if error is caused by php or oci8)

@BigOHenry
Copy link

I made some test with new oci8 (3.3.0) and with php8.2.5 and it seems the issue is solved. Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants