I got an interesting message on install (along with a white screen)

Warning: Call-time pass-by-reference has been deprecated in /home/content/29/5235629/html/sites/all/modules/counter/counter.install on line 185
Warning: Call-time pass-by-reference has been deprecated in /home/content/29/5235629/html/sites/all/modules/counter/counter.install on line 186

It didnt crash the site, and the module was still enabled. It is probably something to do with the server configuration which I can't tell you too much about, as I have only FTP access to it - it is on godaddy hosting if that gives you any clues....

CommentFileSizeAuthor
#5 counter.patch629 bytesbfr

Comments

murokoma’s picture

Priority: Normal » Critical

Got the exact same problem here on a server that runs several drupal installations smoothly and without any known issues, so I don't think it's a server issue.

After clicking update, I got the following error messsage:

Updating

An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.
Please continue to the error page

An error occurred. http://www.XXXXXXXXXXX.com/update.php?id=21&op=do
Warning: Call-time pass-by-reference has been deprecated in /var/www/vhosts/XXXXXXXXXXX.com/httpdocs/sites/all/modules/counter/counter.install on line 185

Warning: Call-time pass-by-reference has been deprecated in /var/www/vhosts/XXXXXXXXXXX.com/httpdocs/sites/all/modules/counter/counter.install on line 186
{ "status": true, "percentage": 100, "message": "Remaining 0 of 1.\x3cbr/\x3eUpdating counter module" }

set this to critical b/c of the severety of the issue.

murokoma’s picture

Ah, just to let you know, queries were executed, however:

The following queries were executed
counter module
Update #6003

* ALTER TABLE {counter} ADD INDEX counter_date (counter_date)
* ALTER TABLE {counter} ADD INDEX counter_ip (counter_ip)

murokoma’s picture

Oh, and I just saw that the call-time.... error message persists after the update, so on ...../update.php there are still the references to the two lines 185 and 186.

as it seems that the table structure was changed, I would be happy if you could inform me how to proceed from now - is downgrading to the old version possible?

Thanks for your h elp.

DemonGloom’s picture

I got the same problem.. But now I cannot access my /admin pages.. Urls like ?q=admin/settings don't work, too. Going to rollback to previous version.

bfr’s picture

Version: 6.x-2.5 » 6.x-2.3
Status: Closed (fixed) » Active
StatusFileSize
new629 bytes

function counter_update_6003() {
$ret = array();
db_add_index(&$ret, 'counter', 'counter_date', array('counter_date'));
db_add_index(&$ret, 'counter', 'counter_ip', array('counter_ip'));
return $ret;
}

Like the error says, it's deprecated, passing by reference is now automatic in PHP, here's a patch that i think fixes the problem.

I think you will have to uninstall the module completely, then apply the patch and install again.

edit:
Seems to work, however, use with caution until it's confirmed good.

zaphod4269’s picture

anyone come up with a working fix yet?

fabrizioprocopio’s picture

+1
help

laaneoks’s picture

To fix this bug, only changing these next lines is needed
sites/all/modules/counter/counter.install:185
sites/all/modules/counter/counter.install:186
- db_add_index(&$ret, 'counter', 'counter_date', array('counter_date'));
- db_add_index(&$ret, 'counter', 'counter_ip', array('counter_ip'));
+ db_add_index($ret, 'counter', 'counter_date', array('counter_date'));
+ db_add_index($ret, 'counter', 'counter_ip', array('counter_ip'));

We can do so because db_add_index() is declarated in files as

includes/database.mysql-common.inc:432
function db_add_index(&$ret, $table, $name, $fields) {
includes/database.pgsql.inc:827
function db_add_index(&$ret, $table, $name, $fields) {

bfr’s picture

Well, that's what my patch does, but atleast does not seem to work for me very well. There may be some problems with my configuration also.

fabrizioprocopio’s picture

very kind of user posted the patch and the fix, but I'm not a coder, so I don't know how go on, or better... I'm afraid to mistake and crash my (in production) site.
How long approximately for the find the fix directly in the module???
Obviously it's NOT for claim...
:)

tuffnatty’s picture

Status: Active » Needs review

the patch is ok for me

bfr’s picture

Well, i guess the patch then works but my own configuration does not(which is not surprising because i have lot's of custom code messing things around).

#10
The patch just changes two lines in the module, so it should not do any damage on your site, if the counter stops working, it's very easy to reverse.
You can also do the changes manually if you dont know how to patch.

drupalnesia’s picture

Version: 6.x-2.3 » 6.x-2.5

I need more info to make a new release contains the solution for this issue.

Maybe this affect on certain PHP version only.

My testing machine is PHP 5.2.9 and MySQL 5.0.51a.

drupalnesia’s picture

Status: Needs review » Fixed

6.x-2.6: Bug fix: Call-time pass-by-reference has been deprecated patch by bfr (/user/369262)

I have tested that using $ret was safe on PHP 5.2.9, so this automatically fix newer version of PHP that has been deprecated this.

Thanks all for patch and testing!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Active » Closed (fixed)