Fix Notice-Level messages #10
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
OpenSource_Libraries/PHP-EasyMySQLi#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Please mention this issue in your merge request when submitting. Thanks.
Changed title: Fix{-e-} Notice-Level messages → Fix Notice-Level messages
By Alexander Täffner on 2016-05-23T12:31:43 (imported from GitLab project)
Added ~30 label
By Alexander Täffner on 2016-05-23T15:56:55 (imported from GitLab project)
If you execute a select command that returns empty data (e.g. in case when a table is empty), you get a PHP notice level warning in Apache error.log file. It may look like this:
PHP Notice: Undefined offset: 0 in /var/www/html/EasyMySQLi.inc.php on line 498.This warning is produced by the querySingleField function. The same warning also occurs in the querySingleRow function.
By Ramil Valitov on 2016-05-27T11:36:04 (imported from GitLab project)
I see and yes that sounds legit.
In my opinion any of our query-Methods should return null in case of zero lines or an empty array.
Empty array is more comfortable but other way null is more strict.
My Vote goes to null
//Edit: Of course is array only valid for querySingleRow and queryAllRows - for SingleFiled it would always be null. thus we should use null for any query
//Edit 2 - Today is the day of Aunt Edit(h): Further this even makes the issue a bug.
By Alexander Täffner on 2016-05-27T11:41:40 (imported from GitLab project)
Added ~23 ~25 labels
By Alexander Täffner on 2016-05-27T11:41:50 (imported from GitLab project)
mentioned in commit
20251e7942By Ramil Valitov on 2016-05-27T11:42:33 (imported from GitLab project)
mentioned in merge request !20
By Ramil Valitov on 2016-05-27T11:44:05 (imported from GitLab project)
Yes, null is the right choice. Actually, the return value has been automatically null for all functions: queryAllRows, querySingleRow, querySingleField. This fix just removes the PHP warning.
By Ramil Valitov on 2016-05-27T11:51:23 (imported from GitLab project)
Status changed to closed by commit
20251e7942By Ramil Valitov on 2016-05-27T13:44:23 (imported from GitLab project)
Status changed to closed by merge request !20
By Alexander Täffner on 2016-05-27T13:44:23 (imported from GitLab project)