PHP5?...

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
jch02140
Posts: 14
Joined: Fri Dec 12, 2003 6:08 am
Contact:

PHP5?...

Post by jch02140 »

Will phpMYFAQ version 2 completely redone using PHP5?...
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: PHP5?...

Post by Thorsten »

Hi,
jch02140 wrote:Will phpMYFAQ version 2 completely redone using PHP5?...
this is the plan...

phpMyFAQ 1.3.9 and later are already running with PHP5.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
moj
Posts: 10
Joined: Sat Nov 06, 2004 2:33 pm

PHP5 in CVS, db class problems

Post by moj »

Just downloaded CVS version to test the Postgres implementation, but I didn't get too far.

I found a couple of problems i the db class:

1. I had to insert a str_replace to replace backslashes to be able to include correct database class.

2 More fatal, the reassign of $this is not allowed in php5 ($this = new $func();) I guess we need some refactoring of this.

I'm on winxp with Apache 2 and PostgreSQL 8 beta4.

/moj
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

is it possible to send me your diffs from the current CVS? Thanks!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
moj
Posts: 10
Joined: Sat Nov 06, 2004 2:33 pm

Post by moj »

Still problems with php5... (CVS version from 2004-12-31)

I think the reassign of $this in the db class is illegal, in php5 $this is readonly.

This is my error message:
Fatal error: Cannot re-assign $this in P:\www\virtualhosts\phpmyfaq\inc\db.php on line 59

The only workaround I can think of is to disable the db class and use the pgsql or other db specific class instead.

Can someone suggest a more elegant solution to this?
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

we need to rewrite the complete DB class to fix this PHP5 only problem. I'll try to do this the next days.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

could you please test the current CVS version with PHP5. I rewrote some of the stuff.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
moj
Posts: 10
Joined: Sat Nov 06, 2004 2:33 pm

Post by moj »

Yes, this seems to fix the reassign $this problem :-)

A few other problems (not related to php5) :
- I get doble linefeeds i all files. In some cases this will lead to problems when ther ins an extra empty line at the end, after "?>", e.g. in db.php and category.php. Maybe this could have something to dio with my CVS client Tortoise?

- Add user with some debug lines:
Debug - function nextID($table, $id)
Debug - query: SELECT max(id) as current_id FROM faquser
Debug - $result: Resource id #20
Debug - num rows: 1

Warning: pg_result() [function.pg-result]: Unable to jump to row 1 on PostgreSQL result index 20 in P:\www\virtualhosts\phpmyfaq\inc\pgsql.php on line 377

I can't se anything wrong with the query. Have also tried with function pg_fetch_result. Still same problem...

/moj
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I don't have double line feeds and I use Tortoise, too. Your reported bug is fixed in CVS.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
moj
Posts: 10
Joined: Sat Nov 06, 2004 2:33 pm

Post by moj »

moj wrote:...
Warning: pg_result() [function.pg-result]: Unable to jump to row 1 on PostgreSQL result index 20 in P:\www\virtualhosts\phpmyfaq\inc\pgsql.php on line 377
...
Solution

Line 377 in inc\pgsql.php:
$currentID = pg_result($result, 1, 'current_id');
change to:
$currentID = pg_result($result, 0, 'current_id');

Row numbering starts from 0 according to docs.
Thorsten
Posts: 15727
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

thanks, it's fixed in CVS.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply