BBCodeParser alerts
| From: | Frederic Poeydomenge | Date: | Thu, 24 Apr 2003 09:31:08 +0000 |
| Subject: | BBCodeParser alerts | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-15446@lists.php.net to get a copy of this message | ||
Hi!
I've corrected 3 alerts in BBCodeParser.php :
- Alerte [2] Invalid argument supplied for foreach() in
/usr/share/pear/HTML/BBCodeParser.php line 179
- Notice [8] Undefined variable: prev in /usr/share/pear/HTML/BBCodeParser.php
line 324
- Alerte [2] offset not contained in string in
/usr/share/pear/HTML/BBCodeParser.php line 289
You can find the patch to the cvs file below
Regards,
--------------------
Frederic Poeydomenge
178,180c178,182 < $baseoptions = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); < foreach ($baseoptions as $k => $v) { < $this->_options[$k] = $v; --- > $baseoptions = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); > if (is_array($baseoptions)) { > foreach ($baseoptions as $k => $v) { > $this->_options[$k] = $v; > } 287a290 > $nextOpenPos = $strLength; 289,290c292 < $nextOpenPos = @strpos($str, $this->_options['open'], $openPos + 1); < if ($nextOpenPos === false) { --- > if ($openPos + 1 > $strLength) { 291a294,298 > } else { > $nextOpenPos = strpos($str, $this->_options['open'], $openPos + 1); > if ($nextOpenPos === false) { > $nextOpenPos = $strLength; > } 324c331 < if ($tag['type'] === 0 && @$prev['type'] === 0) { --- > if ($tag['type'] === 0 && isset($prev) && $prev['type'] === 0) {
178,180c178,182 < $baseoptions = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); < foreach ($baseoptions as $k => $v) { < $this->_options[$k] = $v; --- > $baseoptions = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); > if (is_array($baseoptions)) { > foreach ($baseoptions as $k => $v) { > $this->_options[$k] = $v; > } 287a290 > $nextOpenPos = $strLength; 289,290c292 < $nextOpenPos = @strpos($str, $this->_options['open'], $openPos + 1); < if ($nextOpenPos === false) { --- > if ($openPos + 1 > $strLength) { 291a294,298 > } else { > $nextOpenPos = strpos($str, $this->_options['open'], $openPos + 1); > if ($nextOpenPos === false) { > $nextOpenPos = $strLength; > } 324c331 < if ($tag['type'] === 0 && @$prev['type'] === 0) { --- > if ($tag['type'] === 0 && isset($prev) && $prev['type'] === 0) {