Myopengrid / mwi

[READ ONLY] Myopengrid Opensim Web Interface
http://mwi.myopengrid.com
Other
13 stars 15 forks source link

When changing the default region for users to start, the application throws an Internal Server Error #3

Closed GwynethLlewelyn closed 11 years ago

GwynethLlewelyn commented 11 years ago

There are no errors on the Apache log. Is there any way I can extract more relevant information from somewhere? I know this is not a very useful report....

Running Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.5

Myopengrid commented 11 years ago

If you want to enable debug in the application you can change 'detail' => false, to 'detail' => true, in the file located at application/config/error.php. This issue is happening because the module is failing to connect to the grid database and for some reason the application is "thinking" that the settings are right.

GwynethLlewelyn commented 11 years ago

Thanks!

Here is a trace for the error I get:

Unhandled Exception

Message:

preg_match_all() expects at least 3 parameters, 2 given Location:

/var/www/mwi-master/bundles/opensim/libraries/Vector.php on line 7 Stack Trace:

0 /var/www/mwi-master/laravel/laravel.php(42): Laravel\Error::native(2, 'preg_match_all(...', '/var/www/mwi-ma...', 7)

1 [internal function]: Laravel{closure}(2, 'preg_match_all(...', '/var/www/mwi-ma...', 7, Array)

2 /var/www/mwi-master/bundles/opensim/libraries/Vector.php(7): preg_match_all('/^\s?<\s?.?\d+...', '<128,128,50>')

3 /var/www/mwi-master/bundles/opensim/libraries/Validator.php(8): Opensim\Vector::is_valid('<128,128,50>')

4 /var/www/mwi-master/laravel/validator.php(186): Opensim\Validator->validate_vector('opensim_positio...', '<128,128,50>', Array, Object(Opensim\Validator))

5 /var/www/mwi-master/laravel/validator.php(161): Laravel\Validator->check('opensim_positio...', 'vector')

6 /var/www/mwi-master/laravel/validator.php(147): Laravel\Validator->valid()

7 /var/www/mwi-master/laravel/validator.php(137): Laravel\Validator->invalid()

8 /var/www/mwi-master/bundles/opensim/controllers/backend/settings.php(63): Laravel\Validator->fails()

9 [internal function]: Opensim_Backend_Settings_Controller->put_update()

10 /var/www/mwi-master/laravel/routing/controller.php(325): call_user_func_array(Array, Array)

11 /var/www/mwi-master/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('update', Array)

12 /var/www/mwi-master/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('update', Array)

13 /var/www/mwi-master/bundles/opensim/routes.php(17): Laravel\Routing\Controller::call('opensim::backen...')

14 [internal function]: {closure}()

15 /var/www/mwi-master/laravel/routing/route.php(163): call_user_func_array(Object(Closure), Array)

16 /var/www/mwi-master/laravel/routing/route.php(124): Laravel\Routing\Route->response()

17 /var/www/mwi-master/laravel/laravel.php(167): Laravel\Routing\Route->call()

18 /var/www/mwi-master/public/index.php(39): require('/var/www/mwi-ma...')

19 {main}

I'm using as default start position <128,128,50>.

GwynethLlewelyn commented 11 years ago

Note that other modules do connect correctly to the database; you can see how the relevant data from the regions and total number of users, etc., does, indeed, show correctly on the splash screen: http://opensim.betatechnologies.info/welcome

Myopengrid commented 11 years ago

Yes definitely there is a bug there. I just tried and got the database error. What is the location that you are trying to enter? the vector value? it should be something like <0,0,0>

GwynethLlewelyn commented 11 years ago

Oops. GitHub ate the brackets. Yes, I'm using the default, <128,128,50>

Myopengrid commented 11 years ago

ok I will be looking on it. Thank you

Myopengrid commented 11 years ago

GwynethLlewelyn, I couldn't exactly replicate the issue that you are having, I am not sure if will work, but I tried to add some checking on the vector validation. To update your installation please download the application again and just replace the folder bundles/opensim in your server. Please let me know if you still have the issue.

GwynethLlewelyn commented 11 years ago

No luck. I still get precisely the same error, even on the latest version:

Unhandled Exception

Message:

preg_match_all() expects at least 3 parameters, 2 given
Location:

/var/www/mwi-master/bundles/opensim/libraries/Vector.php on line 14
Stack Trace:

#0 /var/www/mwi-master/laravel/laravel.php(42): Laravel\Error::native(2, 'preg_match_all(...', '/var/www/mwi-ma...', 14)
#1 [internal function]: Laravel\{closure}(2, 'preg_match_all(...', '/var/www/mwi-ma...', 14, Array)
#2 /var/www/mwi-master/bundles/opensim/libraries/Vector.php(14): preg_match_all('/^\s?<\s?\.?\d+...', '<128,128,50>')
#3 /var/www/mwi-master/bundles/opensim/libraries/Validator.php(8): Opensim\Vector::is_valid('<128,128,50>')
#4 /var/www/mwi-master/laravel/validator.php(186): Opensim\Validator->validate_vector('opensim_positio...', '<128,128,50>', Array, Object(Opensim\Validator))
#5 /var/www/mwi-master/laravel/validator.php(161): Laravel\Validator->check('opensim_positio...', 'vector')
#6 /var/www/mwi-master/laravel/validator.php(147): Laravel\Validator->valid()
#7 /var/www/mwi-master/laravel/validator.php(137): Laravel\Validator->invalid()
#8 /var/www/mwi-master/bundles/opensim/controllers/backend/settings.php(63): Laravel\Validator->fails()
#9 [internal function]: Opensim_Backend_Settings_Controller->put_update()
#10 /var/www/mwi-master/laravel/routing/controller.php(325): call_user_func_array(Array, Array)
#11 /var/www/mwi-master/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('update', Array)
#12 /var/www/mwi-master/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('update', Array)
#13 /var/www/mwi-master/bundles/opensim/routes.php(17): Laravel\Routing\Controller::call('opensim::backen...')
#14 [internal function]: {closure}()
#15 /var/www/mwi-master/laravel/routing/route.php(163): call_user_func_array(Object(Closure), Array)
#16 /var/www/mwi-master/laravel/routing/route.php(124): Laravel\Routing\Route->response()
#17 /var/www/mwi-master/laravel/laravel.php(167): Laravel\Routing\Route->call()
#18 /var/www/mwi-master/public/index.php(39): require('/var/www/mwi-ma...')
#19 {main}

You can see how the passed vector certainly looks good.

Database access is definitely working, I get the list of regions on the dropdown, etc.

GwynethLlewelyn commented 11 years ago

Forget it. This is due to PHP 5.3. The third argument of preg_match_all became optional under 5.4, but it's still mandatory under 5.3. A simple fix (which will work both under PHP 5.3 and 5.4) follows:

<?php namespace Opensim;

class Vector {

    public static function is_valid($string)
    {
        if(empty($string))
        {
            return false;
        }

        $string = trim($string);

        $dummy = array();
        return (bool)preg_match_all('/^\s?<\s?\.?\d+\.?\d*?\s?,\s?\.?\d+\.?\d*?\s?,\s?\.?\d+\.?\d*?\s?\>\s?$/i', $string, $dummy);
    }
}

I'll close this issue, since it's fixed :)

Myopengrid commented 11 years ago

The fix was applied to keep compatibility with php5.3. Thank you