Welcome Guest, Not a member yet? Register   Sign In
Fatal Memory Error in version 3.1.6+
#1

(This post was last modified: 10-07-2019, 03:34 AM by ciadmin.)

I have never been able to migrate from 3.1.5 to 3.1.6 because of the following error

==================
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/rtsusers/system/core/Loader.php on line 1205

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

===================

I discovered that the problem lies in the file /system/core/Loader.php

If I edit everything in theĀ /system/core/Loader.php in the version 3.1.5 to look likeĀ /system/core/Loader.php in 3.1.11 then all edits cause no problem except the following in the new version.

Code:
// =========== from line 1046... /system/core/Loader.php in 3.1.11 CAUSES FATAL MEMORY ERROR ===========
// Safety: Was the class already loaded by a previous call?
if (class_exists($class, FALSE))
{
$property = $object_name;
if (empty($property))
{
$property = strtolower($class);
isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property];
}

$CI =& get_instance();
if (isset($CI->$property))
{
log_message('debug', $class.' class already loaded. Second attempt ignored.');
return;
}

return $this->_ci_init_library($class, '', $params, $object_name);
}

// Let's search for the requested library file and load it.
foreach ($this->_ci_library_paths as $path)
{
// BASEPATH has already been checked for
if ($path === BASEPATH)
{
continue;
}

$filepath = $path.'libraries/'.$subdir.$class.'.php';
// Does the file exist? No? Bummer...
if ( ! file_exists($filepath))
{
continue;
}

include_once($filepath);
return $this->_ci_init_library($class, '', $params, $object_name);
}

Code:
// =========== /system/core/Loader.php in 3.1.5 WORKS WITHOUT ANY PROBLEM ===========

// Let's search for the requested library file and load it.
foreach ($this->_ci_library_paths as $path)
{
// BASEPATH has already been checked for
if ($path === BASEPATH)
{
continue;
}

$filepath = $path.'libraries/'.$subdir.$class.'.php';

// Safety: Was the class already loaded by a previous call?
if (class_exists($class, FALSE))
{
// Before we deem this to be a duplicate request, let's see
// if a custom object name is being supplied. If so, we'll
// return a new instance of the object
if ($object_name !== NULL)
{
$CI =& get_instance();
if ( ! isset($CI->$object_name))
{
return $this->_ci_init_library($class, '', $params, $object_name);
}
}

log_message('debug', $class.' class already loaded. Second attempt ignored.');
return;
}
// Does the file exist? No? Bummer...
if ( ! file_exists($filepath))
{
continue;
}

include_once($filepath);
return $this->_ci_init_library($class, '', $params, $object_name);
}

Please help me.

EDIT: code tags added for readability. See MyCode

Attached Files
.php   YESworking.php (Size: 36.26 KB / Downloads: 3)
.php   NOTworking.php (Size: 36.21 KB / Downloads: 0)
.html   ERRORmessage.html (Size: 273 bytes / Downloads: 3)
Reply


Messages In This Thread
Fatal Memory Error in version 3.1.6+ - by owino - 10-07-2019, 01:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB