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
Return to the default flat view Create a new topic Submit Reply
PHP 4.4.0 [message #26305] Wed, 13 July 2005 09:12 Go to previous message
Art Wolf is currently offline  Art Wolf   Ireland
Messages: 16
Registered: May 2005
Location: Dublin, Ireland
Karma:
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;
}



[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Variables?
Next Topic: posting limitation
Goto Forum:
  

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

Current Time: Fri Nov 22 00:10:10 GMT 2024

Total time taken to generate the page: 0.04144 seconds