Project

General

Profile

Actions

Bug #15710

closed

Error in class.t3lib_db.php: fullQuoteArray doesn't quote first element

Added by Stephan Struckmann about 18 years ago. Updated about 18 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2006-02-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Try the following:
t3lib_div::debug($GLOBALS['TYPO3_DB']->fullQuoteArray(array("1f1336d533f72e1aa2d515cd0ea1427c","1f1336d533f72e1aa2d515cd0ea1427c"),""));

The result is:
----------------------------------------------------+ |0|1f1336d533f72e1aa2d515cd0ea1427c | |1|'1f1336d533f72e1aa2d515cd0ea1427c'|
----------------------------------------------------+

The first element is not quoted. I don't know, if the function should be called that way, but acutally it is (by class.t3lib_refindex.php for example in line 147 (exec_DELETEquery) in method updaterefindextable.

I found the reason: In class.t3lib_db.php in the function fullQuoteArray($arr, $table, $noQuote="") the noQuote-parameter has a default value: (string) ""
if it is left out, the noQuote-Array will become something like array(0 => ""). Thats why the entry with the key 0 in the error-example is not quoted: It's in the noQuote-Parameter, even if there is no such parameter.

The simple solution is to remove the default value. The patch:

--- class.t3lib_db.php 2006-02-23 17:25:27.818770500 0100
++ class.t3lib_db.php.old 2006-01-20 02:05:08.000000000 +0100
@ -561,12 +561,13 @ * @return array The input array with the values quoted * @see cleanIntArray()
*/
- function fullQuoteArray($arr, $table, $noQuote) {
+ function fullQuoteArray($arr, $table, $noQuote='') {
if (is_string($noQuote)) {
$noQuote = explode(',',$noQuote);
} elseif (!is_array($noQuote)) {
$noQuote = array();
}
+
foreach($arr as $k => $v) {
if (!in_array($k,$noQuote)) {
$arr[$k] = $this->fullQuoteStr($v, $table);

(issue imported from #M2680)

Actions #1

Updated by Martin Kutschker about 18 years ago

Try code after the 27th January with a changed fucntion signature of fullQuoteArray($arr, $table, $noQuote=FALSE).

Does it work like you expect?

Actions #2

Updated by Stephan Struckmann about 18 years ago

Yes, it does. Thank You and sorry for not checking the CVS since 27th January.

Actions #3

Updated by Martin Kutschker about 18 years ago

Resolution acknowledged by submitter so closing bug.

Actions

Also available in: Atom PDF