cvs: pear /Text_Wiki/Text/Wiki/Parse/Cowiki Interwiki.php Wikilink.php
| From: | Justin Patrin | Date: | Tue, 28 Feb 2006 02:26:29 +0000 |
| Subject: | cvs: pear /Text_Wiki/Text/Wiki/Parse/Cowiki Interwiki.php Wikilink.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38718@lists.php.net to get a copy of this message | ||
justinpatrin Tue Feb 28 02:26:29 2006 UTC
Modified files:
/pear/Text_Wiki/Text/Wiki/Parse/Cowiki Interwiki.php Wikilink.php
Log:
Fix undefined offset notices in Cowiki parser's Wikilink and Interwiki rules
http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php?r1=1.1&r2=1.2&diff_format=u
Index: pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php
diff -u pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php:1.1
pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php:1.2
--- pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php:1.1 Thu Jul 21 20:56:13 2005
+++ pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Interwiki.php Tue Feb 28 02:26:29 2006
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Interwiki.php,v 1.1 2005/07/21 20:56:13 justinpatrin Exp $
+* @version $Id: Interwiki.php,v 1.2 2006/02/28 02:26:29 justinpatrin Exp $
*
*/
@@ -95,8 +95,8 @@
{
$options = array(
'site' => $matches[1],
- 'page' => $matches[2],
- 'text' => strlen($matches[2]) ? $matches[2] : $matches[1]
+ 'page' => isset($matches[2]) ? $matches[2] : '',
+ 'text' => isset($matches[2]) && strlen($matches[2]) ? $matches[2]
: $matches[1]
);
return $this->wiki->addToken($this->rule, $options);
@@ -129,7 +129,11 @@
$options = array(
'site' => $matches[1],
'page' => $matches[2],
- 'text' => strlen($matches[4]) ? $matches[4] : (strlen($matches[2]) ?
$matches[2] : $matches[1])
+ 'text' => (isset($matches[4]) && strlen($matches[4])
+ ? $matches[4]
+ : (isset($matches[2]) && strlen($matches[2])
+ ? $matches[2]
+ : $matches[1]))
);
return $this->wiki->addToken($this->rule, $options);
http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php?r1=1.1&r2=1.2&diff_format=u
Index: pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php
diff -u pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php:1.1
pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php:1.2
--- pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php:1.1 Thu Jul 21 20:56:13 2005
+++ pear/Text_Wiki/Text/Wiki/Parse/Cowiki/Wikilink.php Tue Feb 28 02:26:29 2006
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Wikilink.php,v 1.1 2005/07/21 20:56:13 justinpatrin Exp $
+* @version $Id: Wikilink.php,v 1.2 2006/02/28 02:26:29 justinpatrin Exp $
*
*/
@@ -153,8 +153,8 @@
// set the options
$options = array(
'page' => $matches[1],
- 'text' => strlen($matches[6]) ? $matches[6] : $matches[1],
- 'anchor' => $matches[3]
+ 'text' => isset($matches[6]) && strlen($matches[6]) ?
$matches[6] : $matches[1],
+ 'anchor' => isset($matches[3]) && strlen($matches[3]) ?
$matches[3] : ''
);
if ($options['text'] == $options['page']) {
$options['text'] = '';
@@ -191,6 +191,9 @@
/*if ($matches[3]{0} == '!') {
return $matches[1] . substr($matches[3], 1) . $matches[4] . $matches[7];
}*/
+ if (!isset($matches[4])) {
+ $matches[4] = '';
+ }
if ($matches[2] == '))' && $matches[7] == '((') {
return $matches[1] . $matches[3] . $matches[4];
}