[TYPO3-commerce] RFC: #10433: Ressource leak in tx_commerce_product::get_Articles_by_AttributeArray

Sebastian Fischer sf at marketing-factory.de
Tue Oct 26 09:28:20 CEST 2010


Am 25.10.2010 16:38, schrieb Michael Knabe:
> This is an SVN patch request.
>
>
>
> Type: Bugfix
>
>
>
> Bugtracker references:
>
> http://forge.typo3.org/issues/10433
>
>
>
> Branches:
>
> trunk
>
>
>
> Problem:
> In the mentioned method
> tx_commerce_product::get_Articles_by_AttributeArray()
> t3lib_db::sql_free_result() is not called if the sql query returned no
> result. As far as I see the if-statement is completely useless, as
> calling t3lib_db::sql_fetch_assoc() is no problem even if the query
> returned no result.
>
> Solution:
> Completely remove the if statement
>
> Cheers,
>
> Michael

-1 by reading

-				if (($result) && ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0)) {
-					while ($return_data = 
$GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
-						$next_array[] = $return_data['uid'];
-					}
-					$GLOBALS['TYPO3_DB']->sql_free_result($result);
+				while ($return_data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+					$next_array[] = $return_data['uid'];
  				}
+				$GLOBALS['TYPO3_DB']->sql_free_result($result);

If i didnt missed anything, this will leave a } of the if-condition 
behind which will lead to an error.

Greetings
Sebastian


More information about the TYPO3-team-commerce mailing list