FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » PHP 4.4.0
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
PHP 4.4.0 [message #26305] Wed, 13 July 2005 05:12 Go to next message
Art Wolf is currently offline  Art Wolf   Ireland
Messages: 16
Registered: May 2005
Location: Dublin, Ireland
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Right well the webserver I'm working off was just upgraded to php 4.4.0 and immediatly I start recieving cron job errors :/

The errors point to

Quote:


Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 180

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 219

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 223

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 219

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 180

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 219

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 223

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 219

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 180

Notice: Only variable references should be returned by reference in
+/webtree/a/art_wolf/rb/FUDforum/include/theme/default/db.inc on line 180



The main part of php's upgrade is to
Quote:

..addresses a serious memory corruption problem within PHP concerning references. If references were used in a wrong way, PHP would often create memory corruptions which would not always surface and be visible.


Looking at the problems it refers to these functions :

Quote:


function &db_rowarr($result)
{
return mysql_fetch_row($result);
}

function &db_saq($q)
{
return mysql_fetch_row(q($q));
}

function &db_sab($q)
{
return mysql_fetch_object(q($q));
}



There is a php bug report on this issue here.

So the scope of what is returned by mysql_fetch_row / _object ends when the function ends. To my understanding then one way around this is to create a new variable in GLOBAL.php and edit the functions like so :

Quote:


./FUDforum/include/GLOBALS.php

$reference_result = "";

./FUDforum/include/theme/default/db.inc

function &db_rowarr($result)
{
$reference_result = mysql_fetch_row($result);
return $reference_result;
}

function &db_saq($q)
{
$reference_result = mysql_fetch_row(q($q));
return $reference_result;
}

function &db_sab($q)
{
$reference_result = mysql_fetchobject(q($q));
return $reference_result;
}



Re: PHP 4.4.0 [message #26307 is a reply to message #26305] Wed, 13 July 2005 05:28 Go to previous messageGo to next message
Art Wolf is currently offline  Art Wolf   Ireland
Messages: 16
Registered: May 2005
Location: Dublin, Ireland
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
This only clears up the problems brought up by the cron job ofcourse - a similure alteration of all the functions would be required.
Re: PHP 4.4.0 [message #26311 is a reply to message #26305] Wed, 13 July 2005 10:57 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
This is fixed in 2.6.15

FUDforum Core Developer
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Variables?
Next Topic: posting limitation
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Dec 14 15:53:35 EST 2017

Total time taken to generate the page: 0.00727 seconds