php-src icon indicating copy to clipboard operation
php-src copied to clipboard

showing warning oci8 install through pecl

Open saifulferoz opened this issue 5 years ago • 13 comments

installing oci8 extension through pecl sudo pecl -d php_suffix=8.1 install oci8

In function ‘php_oci_column_to_zval’: /tmp/pear/temp/oci8/oci8.c:1708:72: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘zend_long’ {aka ‘long int’} [-Wformat=] 1708 | php_error_docref(NULL, E_WARNING, "Unable to find LOB descriptor #%d", column->descid->handle);

saifulferoz avatar Nov 27 '21 17:11 saifulferoz

That's caused by https://github.com/php/php-src/commit/14f599ea7def7c7a59c40aff763ce8b105573e7a, so PECL/oci8 needs to be updated.

However, this bug tracker is about documentation issues, and this one clearly isn't. Not quite sure what to do, since PECL/oci8 doesn't have its own bug tracker.

Anyhow, @cjbj, are you planning to publish a new PECL/oci8 version which is compatible with PHP 8.1?

cmb69 avatar Nov 27 '21 17:11 cmb69

@cmb69 I was hoping to release a PECL OCI8 version that supported several PHP 8 versions, however @nikic's 902d64390e4 from https://wiki.php.net/rfc/deprecate_dynamic_properties has just borked OCI8 tests that use OCILob or OCICollection, which will delay things.

How do I pass #[AllowDynamicProperties] from oci8.stub.php? It seems to be ignored. And is there a way to have the stub generator create version-dependent #ifdef code so that oci8_arginfo.h can be used with, e.g. 8.2 and 8.1?

cjbj avatar Nov 28 '21 07:11 cjbj

Do OCILob and OCICollection use dynamic properties? If so, can't that be changed so they have declared properties or use read_property/write_property handlers. If that's not possible, I think that you need to add ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES to the ce_flags. I don't know whether #[AllowDynamicProperties] will be supported for the stubs.

cmb69 avatar Nov 28 '21 11:11 cmb69

From a quick look at the code, OCILob only has a $descriptor property, which can be declared. Though in this particular case, $descriptor probably shouldn't be exposed as a property at all -- it looks like a purely internal resource that the user can't interact with. Normally, we'd store something like this in a custom zend_object extension rather than an opaque resource. (Would also help with the migration away from resources.)

Though in any case, I think it's a bit early to think about an 8.2 compatible extension release, given how 8.2 is still a year away.

nikic avatar Nov 28 '21 11:11 nikic

Thanks for jumping in. I need to do a PECL release for 8.1, and I wanted to add the newest performance optimization feature which landed in 8.2.

The class code is all very old (pre dating me) and I haven't reviewed it for a long time. I don't know the answers to @cmb69's questions. Are the ce_flags controls via stubs?

@nikic can you expand on what 'which can be declared' means?

Thanks ! PS I'm out for a few days.

cjbj avatar Nov 28 '21 11:11 cjbj

Instead of calling add_property_resource(), you'd call zend_declare_property_ex(), but as Nikita said, this property would better be avoided in favor of a custom zend_object extension (e.g. like https://github.com/php/php-src/blob/php-8.1.0/ext/gd/gd.c#L162-L165).

The ce_flags are a member of zend_class_entry; I don't think you can mark a class to allow dynamic properties via the stubs (yet).

cmb69 avatar Nov 28 '21 12:11 cmb69

A sample of the required change for soap, which was using the exact same pattern: https://github.com/php/php-src/commit/c5d6f59e96dc56a1fbcdab957c22547f5091f171 (and still is, for three more resources...)

nikic avatar Nov 28 '21 17:11 nikic

Excellent. I'll take a look when I'm back.

cjbj avatar Nov 28 '21 21:11 cjbj

I just pushed OCI8 3.2 to PECL. Give it a whirl. It is for PHP 8.1 only.

cjbj avatar Dec 11 '21 12:12 cjbj

OCI8 3.2 uses OCI_ATTR_LOBPREFETCH_LENGTH and OCI_ATTR_LOBPREFETCH_SIZE which are apparently not defined in instaclient 10.2; should I disable 10.2 builds for Windows?

cmb69 avatar Dec 11 '21 18:12 cmb69

@cmb69 I should have made the build cleaner but, yes, it's time to move forward and stop building with ancient Oracle Client libraries. Thanks for identifying this. Builds with 11.2+ should work.

cjbj avatar Dec 11 '21 21:12 cjbj

Yes, 11.2+ builds succeed. I've updated rmtools and the PECL build machine, and triggered new builds. Thanks for the swift reply! :)

cmb69 avatar Dec 11 '21 22:12 cmb69

I'll release a OCI8 3.2.1 version which removes support for linking with Oracle Client 10. I don't have Windows so won't touch the config.w32 file.

cjbj avatar Dec 12 '21 02:12 cjbj