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

ADOConnection::Execute return type too revealing #964

Closed
Itatsi opened this issue Apr 28, 2023 · 1 comment
Closed

ADOConnection::Execute return type too revealing #964

Itatsi opened this issue Apr 28, 2023 · 1 comment

Comments

@Itatsi
Copy link

Itatsi commented Apr 28, 2023

Description

The return type of the ADOConnection::Execute method is defined as folloing:

* @return ADORecordSet|bool

but the docu says: "If the execution succeeds, it returns a recordset. [...] if the execution fails, it returns false."

In the code I could not find a place which returns true. Is there any particular reason why it can return, as defined by phpdoc, bool and not only false?

Environment

  • ADOdb version: master

Expected behavior

`* @return ADORecordSet|false

`### Additional context
the reason I ask is because I usually treat the result as follows:

$res = $db->execute($selectSql);
if ($res && $res->RecordCount() >= 1) {

Here, however, a code analysis by psalm rightly criticizes that it could also return true according to phpdoc.

@Itatsi Itatsi added the triage New issues not yet reviewed by ADOdb developers label Apr 28, 2023
@dregad dregad added bug code cleanup documentation and removed triage New issues not yet reviewed by ADOdb developers labels Apr 28, 2023
@dregad dregad added this to the v5.22.6 milestone Apr 28, 2023
@dregad
Copy link
Member

dregad commented Apr 28, 2023

No reason, just an inconsistency. Thanks for pointing it out.

@dregad dregad self-assigned this Apr 29, 2023
@dregad dregad closed this as completed in aef9e94 May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants