I think I have a corrected a bug with standalone operation of the orginal Bharat Mediratta block-random.php code.
On redhat 9 running kernel 2.4.20-27.9 with the following rpms
# rpm -q httpd php
httpd-2.0.40-21.9
php-4.2.2-17.2
and gallery 1.41, the code would fail after first itteration. Reporting the following error:
Warning: rand() expects parameter 2 to be long, string given in /usr/share/bmfgallery/block-random2.php on line 138
ERROR: requested index [] out of bounds [10]
Fatal error: Call to a member function on a non-object in /usr/share/bmfgallery/classes/Album.php on line 962
Typecasiting the asignment corrected this problem.
# diff block-random.php.orig block-random.php
131c131
< $count = $cache[$album->fields["name"]];
---
> $count = (integer) $cache[$album->fields["name"]];
-scotts
Posts: 2
Thanks alot! I have been trying to figures this one out for a while!
Posts: 7
after trying loads of diff things I got this to eventually work. The solution I feel was a bit complicated. Simple thing to do is :-
1) EDIT block-random.php
2) FIND $count = $cache[$album->fields["name"]];
3) REPLACE IT WITH $count = (integer) $cache[$album->fields["name"]];
Save it. Should then work.