Project

General

Profile

Actions

Bug #17347

closed

Database result not being tested for result

Added by Michael Cannon over 17 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2007-05-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Since the database result isn't being check for a result, PHP Warnings show up. It's suggested to check for a result and if nothing there, return a false, 0, or empty array back to the calling method. This way PHP warnings go away and we're properly checking incoming variables and returning defined negatory results.

--
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/cannon/local/typo3_src-4.1.1/t3lib/class.t3lib_db.php on line 796
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/cannon/local/typo3_src-4.1.1/t3lib/class.t3lib_db.php on line 823
--

Sample fixes.

In t3lib/class.t3lib_db.php
line 796, from `return mysql_fetch_assoc($res);`
to `return $res ? mysql_fetch_assoc($res) : array();`

line 823, from `return mysql_fetch_assoc($res);`
to `return $res ? mysql_fetch_assoc($res) : false;`

Anywhere a mysql_fetch* or like is being called, incoming variable should be checked to exist.
(issue imported from #M5722)

Actions #1

Updated by Alexander Opitz about 11 years ago

  • Status changed from Accepted to Needs Feedback
  • Target version deleted (0)

Hi,

as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #2

Updated by Alexander Opitz almost 11 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Martin Kutschker)
  • Is Regression set to No

No feedback within the last 90 days => closing this ticket.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions

Also available in: Atom PDF