pecl-database-ibm_db2 icon indicating copy to clipboard operation
pecl-database-ibm_db2 copied to clipboard

Convert resources to objects

Open NattyNarwhal opened this issue 2 years ago • 2 comments

PHP has semi-deprecated resources. They aren't going away, but they aren't recommended anymore, and built-in extensions are being converted.

The main benefit would be being able to use PHP's type system to distinguish between i.e. connections and statements, and declare methods on them (though the old functions would remain for compatibility). I suspect lifetimes would be easier to manage too.

This would be a breaking change for consumers like i.e. the PHP toolkit, that determine if something is ibm_db2 by using resource functions.

NattyNarwhal avatar Feb 27 '23 17:02 NattyNarwhal

for future reference, Zend's guide on extensions is pretty good and covers this topic (I think dstogov wrote it?): https://www.zend.com/resources/php-extensions/php-classes-and-objects

NattyNarwhal avatar Feb 27 '23 17:02 NattyNarwhal

See php/php-tasks#6.

phansys avatar Mar 05 '23 12:03 phansys