Welcome Guest, Not a member yet? Register   Sign In
Painful Problem CI-3.0.1: register_long_arrays
#1

Hello,

I'm getting this error and I can't find a solution I don't even know how to fix it:

A PHP Error was encountered
Severity: Core Error
Message: Directive 'register_long_arrays' is no longer available in PHP
Filename: Unknown
Line Number: 0

I'm using:

HTTP/1.1 500 Internal Server Error
Server: nginx/1.5.0
Date: Thu, 01 Oct 2015 20:33:35 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.6


register_long_arrays is a very outdated config and is no longer available in php.ini

I'm using a shared server and I can't turn on or off this option.

I would like to know where I can disable it in CodeIgniter core.

Thanks for any hint.
Reply
#2

"register_long_arrays" has been deprecated as of 5.3.0 and removed as of 5.4.0. I am using CI on PHP 5.6.x and never got such an error, so I can safely assume that your error is not caused by CI core, but by your code. Even searching through CI 3.0.1 tag on GitHub I could not find any trace of use of "register_long_arrays" or its registered predefined variables.

Are you sure you are not using $HTTP_*_VARS instead of $_GET/$_POST/.... ?
Reply
#3

I did a super find in all files here project & CI for:

$HTTP_*_VARS
$HTTP_SERVER_VARS
$HTTP

Nothing was found.

I just get this error on my production server (PHP/5.5.9-1) my development (X-Powered-ByTongueHP/5.3.17) server this error doesn't show up...
Reply
#4

core/Common.php

function _error_handler.

$is_error = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);

// When an error occurred, set the status header to '500 Internal Server Error'
// to indicate to the client something went wrong.
// This can't be done within the $_error->show_php_error method because
// it is only called when the display_errors flag is set (which isn't usually
// the case in a production environment) or when errors are ignored because
// they are above the error_reporting threshold.
if ($is_error)
{
echo $severity . "<br>";
echo $message . "<br>";
echo $filepath . "<br>";
echo $line . "<br>";
die();
//set_status_header(500);
}


OUTPUT:

16
Directive 'register_long_arrays' is no longer available in PHP
Unknown
0

And because of that set_status_header(500); return Status Code: 500 to my AJAX and the page do not render. And i was thinking the problem was in my nginx proxy. If I comment set_status_header(500); the page loads like a charm.

The problem is: i didn't find yet what is generating the register_long_arrays error. However now I know how to workaround it.
Reply
#5

core/Common.php


Code:
function _shutdown_handler()
    {
        $last_error = error_get_last();
        if (isset($last_error) &&
            ($last_error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)))
            
            var_dump($last_error); die();
        {
            _error_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']);
        }
    }

RESULTS

array(4) {
["type"]=>
int(16)
["message"]=>
string(62) "Directive 'register_long_arrays' is no longer available in PHP"
["file"]=>
string(7) "Unknown"
["line"]=>
int(0)
}
Reply
#6

I found the error:

I did a shell_exec to cat the php.ini of my host provider... and look what I found:

register_long_arrays = On

this directive should be Off or better: commented. or deleted because: "longer available in PHP"

thanks guys for the attention Big Grin Big Grin
Reply




Theme © iAndrew 2016 - Forum software by © MyBB