Skip to content
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

Fix Zend_Db issues with php8 #106

Merged
merged 3 commits into from
Oct 1, 2021
Merged

Fix Zend_Db issues with php8 #106

merged 3 commits into from
Oct 1, 2021

Conversation

falkenhawk
Copy link
Member

@falkenhawk falkenhawk commented Sep 25, 2021

  1. (replaces Catch ValueError on PHP 8.0 for Pdo Statement #85) PHP 8.0+ throws ValueError on invalid arguments. Catch ValueError on wrong "fetch" value passed to pdo methods, transform it to expected Zend_Db_Statement_Exception and test for different error message php. Fixes following fatal errors:
  • PDOStatement::setFetchMode(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
  • PDOStatement::fetchAll(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
  • PDOStatement::fetch(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
  1. allow case insensitive comparison in a zend db static test
  • Prevents following test failure: Failed asserting that 'include_once(Test/MyCompany2/Dbadapter.php): Failed to open stream: No such file or directory' contains "failed to open stream".
  1. remove wrong conditions for targeting PHP < 5.2.0 in zend-db tests. Only minor <= 2 was checked, resulting few tests to be skipped on php 8.0 (and 7.0 & 7.1). Removed the false-path completely as php <5.3 is not supported

refs:

glensc and others added 3 commits September 25, 2021 11:46
- PDOStatement::setFetchMode(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
- PDOStatement::fetchAll(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
- PDOStatement::fetch(): Argument #1 ($mode) must be a bitmask of PDO::FETCH_* constants
Prevents following failure:
> Failed asserting that 'include_once(Test/MyCompany2/Dbadapter.php): Failed to open stream: No such file or directory' contains "failed to open stream".
in zend-db tests. Only `minor <= 2` was checked, resulting few tests to be skipped on php 8.0 (and 7.0 & 7.1). Removed the false-path completely as php <5.3 is not supported
@falkenhawk falkenhawk self-assigned this Sep 25, 2021
@falkenhawk
Copy link
Member Author

Note: even though there is still a fatal error caused by ValueError in another place, all (configured) zend-db tests run on php8, which can be checked at https://github.com/zf1s/zf1/runs/3707648107?check_suite_focus=true - only Zend\Db\AllTests.php was executed there.

Note 2: Running Zend\Db\AllTests.php directly with phpunit also omitted other disabled adapters - effectively avoiding a fatal error with missing DB2 constant - so we might not need fixes from #83 after all /cc @glensc

@falkenhawk falkenhawk merged commit 975d3c6 into master Oct 1, 2021
@glensc
Copy link
Contributor

glensc commented Oct 1, 2021

@falkenhawk It's great that you're able to finish my started work.

@falkenhawk falkenhawk deleted the fix-zend-db-php8 branch October 1, 2021 09:51
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.

None yet

3 participants