[eluser]Unknown[/eluser]
This is a bug in CodeIgniter 2.1.4. - /database/drivers/oci8/oci8_driver.php
Observed effect: When escaping a string in a like clause, the escape character is added twice to the string.
EG: input string 'ALTS2_02' - output string 'ALTS2!!_02' - expected string 'ALTS2!_02'
Cause: str_replace() replace order. The function replaces _ with !_ , then replaces ! with !!.
Fix: change the order so that the escape character is searched for first.
Fix: line 794 - 796
Original code:
Code:
$str = str_replace(
array(
'%',
'_',
$this->_like_escape_chr
),
array(
$this->_like_escape_chr.'%',
$this->_like_escape_chr.'_',
$this->_like_escape_chr.$this->_like_escape_chr
),
$str
);
Fixed code:
Code:
$str = str_replace(
array(
$this->_like_escape_chr,
'%',
'_',
),
array(
$this->_like_escape_chr.$this->_like_escape_chr,
$this->_like_escape_chr.'%',
$this->_like_escape_chr.'_',
),
$str
);