Skip to content

Add PHP 7.3 support #6

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
wants to merge 12 commits into from
Closed

Add PHP 7.3 support #6

wants to merge 12 commits into from

Conversation

kadler
Copy link
Contributor

@kadler kadler commented Jan 31, 2019

Depends on #5

The biggest change is in the removal of the IS_TYPE_COPYABLE checks:

(Z_TYPE_FLAGS_P(params) & (IS_TYPE_COPYABLE & !IS_TYPE_REFCOUNTED)) will always be false, since !IS_TYPE_REFCOUNTED is 0. I believe !IS_TYPE_REFCOUNTED was meant to be ~IS_TYPE_REFCOUNTED since it's attempting to make a bitmask, but as it is written, it will be 0 and anything bitwise ANDed with 0 is 0, so (IS_TYPE_COPYABLE & !IS_TYPE_REFCOUNTED) is also 0, and thus the whole thing is 0 and therefore false.

Since the 7.3 upgrading docs say that all checks for IS_TYPE_COPYABLE were replaced with IS_TYPE_ARRAY, which we're already checking, I just removed the pointless check for all releases instead of #ifdefing for just 7.3.

All tests are passing. Travis CI status is here: https://travis-ci.com/kadler/pecl-database-ibm_db2/builds/99230685

kadler added 12 commits January 30, 2019 16:45
This is similar to what I did for Python ibmdb
ibmdb/python-ibmdb#343
Mostly involved finding resources relative to the script directory
instead of from the current directory, which make test sets as the
source directory. Instead of writing a file and then reading it
back in to compare, just build up a string in memory and compare
them.

Connecting to a missing db alias returns an empty SQLSTATE. I'm
not sure if/when that changed, but I've adjusted the code to
handle either case.

Finally, escape.dat was missing a \r in the file.
The code does an SQLGetData, binding as SQL_CLOB_LOCATOR, but
DB2 Connect CLI returns invalid conversion to bind a CLOB to a
locator for some reason:
07006[IBM][CLI Driver] CLI0102E  Invalid conversion. SQLSTATE=07006

The BLOB path works, using SQLGetData with SQL_BLOB_LOCATOR,
so I'm not sure what's wrong with CLOBs. It seems like a bug, but I
can't get it to work and the test predates the CI setup, so just
expect it to fail for now.
db2_execute calls _php_db2_execute_helper, which allocs curr->value
if it is currently NULL. Later, _php_db2_set_symbol is called
which frees tmp_curr->value, but it does not set it to NULL, which
means on the next time through, _php_db2_execute_helper will skip
allocating new memory and instead re-use a previously freed address.

Found using Valgrind.
Check for IBM_DB2_TEST_SKIP_CONNECT_FAILURE if it's set to an empty string
or 0, instead of skipping the test it continues onward (and probaby fails).
See https://github.com/php/php-src/blob/php-7.3.0/UPGRADING.INTERNALS#L123-L128

It was only used in two places, which both were completely broken:

(Z_TYPE_FLAGS_P(params) & (IS_TYPE_COPYABLE & !IS_TYPE_REFCOUNTED)) will always
be false, since !IS_TYPE_REFCOUNTED is 0. I believe !IS_TYPE_REFCOUNTED was
meant to be ~IS_TYPE_REFCOUNTED, but regardless the above document says that
all checks for IS_TYPE_COPYABLE were replaced with IS_TYPE_ARRAY, which we're
already checking so I just removed the pointless check for all releases.
@mattkoch614
Copy link

When will this be merged? I can't install this on a PHP 7.3 system :(

@kadler
Copy link
Contributor Author

kadler commented Apr 25, 2019

Merged in dc392b1

@kadler kadler closed this Apr 25, 2019
@kadler kadler deleted the php73 branch March 25, 2021 16:16
@NattyNarwhal NattyNarwhal mentioned this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants