Re: [PHP] 5.2.9 changes - phpwiki

2009-03-31 Thread Charles Sprickman

On Mon, 30 Mar 2009, Michael A. Peters wrote:


Charles Sprickman wrote:

Hello all,

Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9.  After 
the upgrade, phpwiki (1.3.14) started spitting out the following two 
errors, both of which are basically leaving the wiki dead in the water:


[30-Mar-2009 22:01:23] PHP Parse error:  syntax error, unexpected T_CLONE, 
expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : 
eval()'d code on line 2
[30-Mar-2009 22:01:23] PHP Fatal error:  Class 
'WikiDB_backend_PearDB_PearDB' not found in 
/usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25





first error is in this block:

/**
 * safe php4 definition for clone.
 * php5 copies objects by reference, but we need to clone deep copy in
   some places.
 * (BlockParser)
 * We need to eval it as workaround for the php5 parser.
 * See http://www.acko.net/node/54
 */
if (!check_php_version(5)) {
eval('
function clone($object) {
  return $object;
}
');
}


I know nothing about phpwiki - but it looks like check_php_version() is a 
function they have defined?


Because reading the code, if check_php_version(5) is support to return true 
for php 5 then the eval should only be triggered if the version of php is not 
5 - in which case, where phpwiki is broken is in the check_php_version() 
function.


What happens when you run

?php
if (check_php_version(5)) {
  echo php 5;
  } else {
  echo not php 5;
  }
?

of course you'll need to copy their check_php version() function into your 
page.


Well, I fixed it...  Two things:

-Since I'm running php5 and I know it, I removed the version check above. 
That got me past one error.
-Next I started getting bizarre errors everywher preg_match() was called. 
That stumped me for a bit then I found that between 5.2.8 and 5.2.9 my 
saved compile options changed and I had NOT used the built-in PCRE 
library.  Switching to the built-in one fixed the preg_match() errors, 
which in turn let config.php build the right path to the PEAR includes...


Thanks!

Charles


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] 5.2.9 changes - phpwiki

2009-03-30 Thread Charles Sprickman

Hello all,

Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9.  After 
the upgrade, phpwiki (1.3.14) started spitting out the following two 
errors, both of which are basically leaving the wiki dead in the water:


[30-Mar-2009 22:01:23] PHP Parse error:  syntax error, unexpected T_CLONE, 
expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : 
eval()'d code on line 2
[30-Mar-2009 22:01:23] PHP Fatal error:  Class 
'WikiDB_backend_PearDB_PearDB' not found in 
/usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25


Looking at the changelog, I'm simply not seeing anything that would cause 
this.


Snippets of both files are below.  Looking for any pointers - I need to 
get the wiki up and running again and phpwiki releases are few and far 
between.


Thanks,

Charles

first error is in this block:

/**
 * safe php4 definition for clone.
 * php5 copies objects by reference, but we need to clone deep copy in
   some places.
 * (BlockParser)
 * We need to eval it as workaround for the php5 parser.
 * See http://www.acko.net/node/54
 */
if (!check_php_version(5)) {
eval('
function clone($object) {
  return $object;
}
');
}

And the second error is in here:

 function WikiDB_SQL ($dbparams) {
$backend = 'PearDB';
if (is_array($dbparams['dsn']))
$backend = $dbparams['dsn']['phptype'];
elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
$backend = $m[1];
if ($backend == 'postgres7') { // ADODB cross-compatiblity hack 
(for uni

t testing)
$backend = 'pgsql';
if (is_string($dbparams['dsn']))
$dbparams['dsn'] = $backend . ':' . 
substr($dbparams['dsn'], 10)

;
}
include_once (lib/WikiDB/backend/PearDB_.$backend..php);
$backend_class = WikiDB_backend_PearDB_.$backend;
$backend =  new $backend_class($dbparams);
if (DB::isError($backend-_dbh)) return;
$this-WikiDB($backend, $dbparams);
}

The variable $backend is getting futzed up somewhere...

Not much to go on, I know...



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php