1
rsmike
PHP 5 problem - coders, help!
  • 2006/8/22 7:01

  • rsmike

  • Just popping in

  • Posts: 22

  • Since: 2004/4/22


Hi.

My hosting provider uses php 5.1.4 & MySQL 5.0.22, so i'm trying to run latest XOOPS on this.

The system module works fine, but news 1.44 don't work at all. "submit.php" gives me completely blank page, even in debug mode. I found the place in "kernel/user.php" that seems to be a reason:

function getObjects($criteria null$id_as_key false)
    {
        
$ret = array();
        
$limit $start 0;
        
$sql 'SELECT * FROM '.$this->db->prefix('users');
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
            if (
$criteria->getSort() != '') {
                
$sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
            }
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        }
        
$result $this->db->query($sql$limit$start);
        if (!
$result) {
            return 
$ret;
        }
        while (
$myrow $this->db->fetchArray($result)) {
            
$user = new XoopsUser();
            
$user->assignVars($myrow);
            if (!
$id_as_key) {
-->
HERE          $ret[] =& $user;
            } else {
-->
HERE      $ret[$myrow['uid']] =& $user;
            }
            unset(
$user);
        }
        return 
$ret;
    }


When the rows marked are commented, page is shown (not properly of course). When uncommented - blank page.

Can anyone make this code work at PHP5?

2
Dave_L
Re: PHP 5 problem - coders, help!
  • 2006/8/22 14:57

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Is your XOOPS version 2.0.14?

You could insert the following code to help diagnose the problem:

function getObjects($criteria null$id_as_key false)
{
[
color=ff0000]   var_dump('criteria'$criteria'id_as_key'$id_as_key);
   
debug_print_backtrace();[/color]
   
$ret = array();


The output from the added code may be more readable if you view the HTML source of the output.

3
rsmike
Re: PHP 5 problem - coders, help!
  • 2006/8/23 4:49

  • rsmike

  • Just popping in

  • Posts: 22

  • Since: 2004/4/22


Dave,

yes, I use 2.0.14.

I tried to insert this code. When "getObjects" is called from a system module, for login purpose for example (with "criteria" parameter), everything is ok. But when it is called from news module without any criteria (to list all users) - it hangs. Just a blank page, no debug info at all - even with "debug_print_backtrace".

Do you need more info?

Help, please!

4
rsmike
Re: PHP 5 problem - coders, help!
  • 2006/8/24 10:30

  • rsmike

  • Just popping in

  • Posts: 22

  • Since: 2004/4/22


Found errors in logs:

"PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 16 bytes) in (...)kernel/user.php on line 100

PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 58368 bytes) in (....)class/logger_render.php on line 88"

Any ideas? Please! :(

line 100 is "$this->initVar('user_occ', XOBJ_DTYPE_TXTBOX, null, false, 100);"
line 88 is "$ret .= '';"

5
Dave_L
Re: PHP 5 problem - coders, help!
  • 2006/8/24 10:45

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You can increase the available memory from 8M to 16M by adding this to an .htaccess file:

php_value memory_limit 16M

6
rsmike
Re: PHP 5 problem - coders, help!
  • 2006/8/25 5:24

  • rsmike

  • Just popping in

  • Posts: 22

  • Since: 2004/4/22


Thanks. It worked!

Login

Who's Online

382 user(s) are online (309 user(s) are browsing Support Forums)


Members: 0


Guests: 382


more...

Donat-O-Meter

Blocks
Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits