From: Joel U. <uck...@no...> - 2006-01-11 21:55:18
|
Thus spake Joel Uckelman: > Just now I discovered something anomalous when using DBA. (I haven't tested > yet whether this afflicts other backends.) For a while now a wiki I run would > occasionally be unable to load some (but not all) pages, and would fail as so > : > > Fatal Error: > > lib/WikiDB.php:661: Error: <br />/home/uckelman/projects/phpwiki/lib/WikiDB.p > hp:661: : Assertion failed <br /> > > The offending assertion is: > > assert(is_string($pagename) and $pagename != ''); > > which I found quite perplexing. The problem isn't database corruption, > so far as I can see, since I can edit all of the pages which fail this > assertion and the text in the edit box is correct. > > But when DEBUG is nonzero, this problem does not occur! Why? > Well, the assert is part of this bit of code: > > if (DEBUG) { > if (!(is_string($pagename) and $pagename != '')) { > if (function_exists("xdebug_get_function_stack")) { > echo "xdebug_get_function_stack(): "; var_dump(xdebug_get_function_stack() > ); > } elseif (function_exists("debug_backtrace")) { // >= 4.3.0 > printSimpleTrace(debug_backtrace()); > } > trigger_error("empty pagename", E_USER_WARNING); > return false; > } > } else > assert(is_string($pagename) and $pagename != ''); > > > With DEBUG=1, for example, I get the "empty pagename" warning, but the page > outputs correctly, and I also get this notice, twice: > > lib/stdlib.php:2028: Notice[8]: Array to string conversion > > When $pagename is nonempty and not a string (the failure case) it comes > up in my test wiki as 'Array'. > > Something's screwed up here... I'm going to mess with this some more this > evening. Any idea what might be wrong? > I see now in the change log for lib/WikiDB.php that as of 1.137 "getPageLinks returns now an array of hashes", which explains the change of behavior... WikiDB_PageIterator::next() doesn't like it that it's getting an array of hashes instead of an array of page names. getPageLinks calls getLinks, which is where the WikiDB_PageIterator is constructed. I'm a bit in the dark about how to fix this, as the note seems to indicate that the change to getPageLinks was intentional and isn't itself a bug. -- J. |
From: Reini U. <ru...@x-...> - 2006-02-19 19:14:25
|
Joel Uckelman schrieb: > Thus spake Joel Uckelman: >> Just now I discovered something anomalous when using DBA. (I haven't tested >> yet whether this afflicts other backends.) For a while now a wiki I run would >> occasionally be unable to load some (but not all) pages, and would fail as so >> : >> >> Fatal Error: >> >> lib/WikiDB.php:661: Error: <br />/home/uckelman/projects/phpwiki/lib/WikiDB.p >> hp:661: : Assertion failed <br /> >> >> The offending assertion is: >> >> assert(is_string($pagename) and $pagename != ''); >> >> which I found quite perplexing. The problem isn't database corruption, >> so far as I can see, since I can edit all of the pages which fail this >> assertion and the text in the edit box is correct. >> >> But when DEBUG is nonzero, this problem does not occur! Why? >> Well, the assert is part of this bit of code: >> >> if (DEBUG) { >> if (!(is_string($pagename) and $pagename != '')) { >> if (function_exists("xdebug_get_function_stack")) { >> echo "xdebug_get_function_stack(): "; var_dump(xdebug_get_function_stack() >> ); >> } elseif (function_exists("debug_backtrace")) { // >= 4.3.0 >> printSimpleTrace(debug_backtrace()); >> } >> trigger_error("empty pagename", E_USER_WARNING); >> return false; >> } >> } else >> assert(is_string($pagename) and $pagename != ''); >> >> >> With DEBUG=1, for example, I get the "empty pagename" warning, but the page >> outputs correctly, and I also get this notice, twice: >> >> lib/stdlib.php:2028: Notice[8]: Array to string conversion >> >> When $pagename is nonempty and not a string (the failure case) it comes >> up in my test wiki as 'Array'. >> >> Something's screwed up here... I'm going to mess with this some more this >> evening. Any idea what might be wrong? >> > > I see now in the change log for lib/WikiDB.php that as of 1.137 "getPageLinks > returns now an array of hashes", which explains the change of behavior... > WikiDB_PageIterator::next() doesn't like it that it's getting an array of > hashes instead of an array of page names. getPageLinks calls getLinks, which > is where the WikiDB_PageIterator is constructed. I'm a bit in the dark > about how to fix this, as the note seems to indicate that the change to > getPageLinks was intentional and isn't itself a bug. I didn't finish yet the link code. So CVS is a bit broken. -- Reini Urban http://phpwiki.org/ http://helsinki.at/ http://spacemovie.mur.at/ |