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

Home » General » PHP discussions » PHP 4.4.0
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP 4.4.0 [message #26305] Wed, 13 July 2005 09: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
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 09: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
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 14:57 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This is fixed in 2.6.15

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

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

Current Time: Sat Nov 23 09:43:11 GMT 2024

Total time taken to generate the page: 0.03270 seconds