CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #9920

Comment UID is overwritten in 'aftercommentinsertion'

Added by Sebastiaan de Jonge over 2 years ago. Updated over 2 years ago.

Status:Resolved Start date:2010-09-26
Priority:Must have Due date:
Assignee:Dmitry Dulepov % Done:

100%

Category:Bug
Target version:1.1.0
Votes: 0

Description

I came upon a problem when using the 'aftercommentinsertion' hook inside T3BLOG. The UID of the comment that should be passed on in the parameters is lost, it is called twice with t3lib_DB::sql_insert_id(). The UID is lost because of updateRefIndex(). Which is called directly after insertion of the comment, but before the ID is retreived.

pi1/widgets/blogList/class.singleFunctions.php

744: $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $data);
745: $this->updateRefIndex($table, $GLOBALS['TYPO3_DB']->sql_insert_id());

A solution to this would be to store the UID of the new comment in a local variable before updateRefIndex() is called. And pass this on as hook parameter.

pi1/widgets/blogList/class.singleFunctions.php

$GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $data);
$commentUid = $GLOBALS['TYPO3_DB']->sql_insert_id();
$this->updateRefIndex($table, $GLOBALS['TYPO3_DB']->sql_insert_id());

History

Updated by Dmitry Dulepov over 2 years ago

  • Category set to Bug
  • Status changed from New to Resolved
  • Assignee set to Dmitry Dulepov
  • Priority changed from Should have to Must have
  • Target version set to 1.1.0
  • % Done changed from 0 to 100

Thanks! :)

Also available in: Atom PDF