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

adodb_throw() does not respect @ operator on PHP 8 #981

Closed
1 task done
dregad opened this issue Jun 10, 2023 · 0 comments
Closed
1 task done

adodb_throw() does not respect @ operator on PHP 8 #981

dregad opened this issue Jun 10, 2023 · 0 comments
Assignees
Labels
bug core ADOdb core (library and base classes) PHP8 PHP 8 compatibility issues
Milestone

Comments

@dregad
Copy link
Member

dregad commented Jun 10, 2023

Description

When using Exceptions, ADOdb is throwing an error even when the function is called with error suppression operator.

Environment

  • ADOdb version: 5.22.5
  • Driver or Module: exceptions
  • Database type and version: any
  • PHP version: 8.0+
  • Platform: any
  • I have tested that the problem is reproducible in the master branch / hotfix branch

Steps to reproduce

include 'adodb.inc.php';
include 'adodb-exceptions.inc.php';
$db = ADONewConnection('pgsql');
$db->connect(...);
var_dump(@$db->insert_id());

PHP Fatal error: Uncaught ADODB_Exception: postgres9 error: [-1: ERROR: lastval is not yet defined in this session] in EXECUTE("SELECT lastval()") in /Users/dregad/dev/adodb/adodb-exceptions.inc.php:89

Expected behavior

Output bool(false), no exception thrown.

Additional context

Problem noticed while investigating #979.

@dregad dregad added bug PHP8 PHP 8 compatibility issues labels Jun 10, 2023
@dregad dregad added this to the v5.22.6 milestone Jun 10, 2023
@dregad dregad self-assigned this Jun 10, 2023
@dregad dregad mentioned this issue Jun 10, 2023
dregad added a commit that referenced this issue Jun 10, 2023
error_reporting()'s return value for suppressed errors changed from 0 to
4437 in PHP 8.0.0 [1]. As a result, adodb_throw() throws exceptions when
it is not expected to.

Fixes #981

[1]: https://www.php.net/manual/en/language.operators.errorcontrol.php
@dregad dregad closed this as completed Jun 10, 2023
NathanGibbs3 added a commit to NathanGibbs3/ADOdb that referenced this issue Jun 11, 2023
NathanGibbs3 added a commit to NathanGibbs3/ADOdb that referenced this issue Jun 11, 2023
NathanGibbs3 added a commit to NathanGibbs3/ADOdb that referenced this issue Jun 11, 2023
@dregad dregad added the core ADOdb core (library and base classes) label Jun 12, 2023
dregad pushed a commit that referenced this issue Jun 12, 2023
error_reporting()'s return value for suppressed errors changed from 0 to
4437 in PHP 8.0.0 [1]. 

Follow up on commit 943ac8a.

Fixes #981 (PR #984)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core ADOdb core (library and base classes) PHP8 PHP 8 compatibility issues
Projects
None yet
Development

No branches or pull requests

1 participant