Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.0

Bug #14346 Error in table-handling
Submitted: 2008-07-14 15:39 UTC
From: olatho Assigned: ritzmo
Status: Closed Package: Text_Wiki_Mediawiki (version 0.1.0)
PHP Version: 5.2.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 3 + 24 = ?

 
 [2008-07-14 15:39 UTC] olatho (Ola Thoresen)
Description: ------------ There is an error on the table handling code that makes it impossible to generate a correct table with MediaWiki-syntax. You will either get a missing row, or a "|-" inside the table, but outside any cell. The simple patch below atleast allows me to render a nice table (although it is probably the regexp "$regexRows" that is really the problem. $ diff -u Table.php.orig Table.php --- Table.php.orig 2008-07-14 16:47:41.000000000 +0200 +++ Table.php 2008-07-14 17:28:50.000000000 +0200 @@ -158,6 +158,7 @@ array(&$this, 'processRows'), $expsub ); + $sub = trim(preg_replace("/\|-$/", "", $sub)); $param = array( 'type' => 'table_start', 'level' => $this->_level, Test script: --------------- $table = "{| |- | This is a cell || And another |- | And a new row || And yet another cell |- |}"; require("Text/Wiki/Mediawiki.php"); $wiki = new Text_Wiki_Mediawiki(); echo( $wiki->transform( $table, 'Xhtml' )); Expected result: ---------------- A table with two rows, each with two cells should be rendered. Actual result: -------------- A "|-" is added inside the table, but outside any cell, making it appear before the table content. If I try to remove the last "|-" from the code, the whole last line is written in the same way.

Comments

 [2008-08-18 00:04 UTC] kkauper (Kristian Kauper)
Has there been any activity on this bug? I have experienced the exact same issue, but unfortunately, Ola's patch did not work for me. Tables worked correctly until I upgraded from PHP 5.1 to 5.2.
 [2008-10-15 16:08 UTC] vijay (Vijay Mahrra)
i had the same issue and used this line instead to fix $sub = trim(preg_replace("/(\|-[^<]+)/", '', $sub)); where i search for a "|-" and remove anything after it, up to the next opening less-than
 [2008-10-22 09:45 UTC] oradyvan (Oleksiy Radyvanyuk)
I have experienced similar problem. Here is the patch that worked for me. I was not able to attach the patch file itself via "Add a patch" form, so here it is embedded: Index: W:/home/localhost/www/oradyvan/sites/all/modules/pearwiki_filter/Text/Wiki/Parse/Mediawiki/Table.php =================================================================== --- W:/home/localhost/www/oradyvan/sites/all/modules/pearwiki_filter/Text/Wiki/Parse/Mediawiki/Table.php (revision 180) +++ W:/home/localhost/www/oradyvan/sites/all/modules/pearwiki_filter/Text/Wiki/Parse/Mediawiki/Table.php (revision 181) @@ -153,11 +153,16 @@ } $this->_countRows[$this->_level] = $this->_maxCells[$this->_level] = 0; $this->_countCells[$this->_level] = $this->_spanCells[$this->_level] = array(); + // fixing issue with \z PCRE assertion not working if the string does not end with newline + // by adding one more empty row to the end + $expsub = rtrim($expsub, "\n|-") . "\n|-"; $sub = preg_replace_callback( $this->regexRows, array(&$this, 'processRows'), $expsub ); + // and now removing that empty row from the end + $sub = rtrim($sub, "\n|-"); $param = array( 'type' => 'table_start', 'level' => $this->_level,
 [2009-04-11 23:10 UTC] duli (Luis Marzagao)
The following patch has been added/updated: Patch Name: fix-table-displaying Revision: 1239473426 URL: http://pear.php.net/bugs/patch-display.php?bug=14346&patch=fix-table-displaying&revision=1239473426&display=1
 [2009-04-11 23:12 UTC] duli (Luis Marzagao)
I have the same issue with php 5.2.9. oradyvan's fix has worked flawlessly, while the others didn't on more complex tables. I attached a patch.
 [2009-04-16 20:22 UTC] ritzmo (Moritz Venn)
I actually get the same result no matter if I apply any of the changes or not with the current CVS version - Could someone please verify if this is bound to this specific version?
 [2009-06-04 00:18 UTC] ritzmo (Moritz Venn)
-Status: Open +Status: Closed -Assigned To: +Assigned To: ritzmo
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Since there was no Feedback to my question I assume this bug does only exist in 0.1.0 and is fixed in CVS....