Jump to content

Fatal Error on Upgrade


Go to solution Solved by Daniel F,

Recommended Posts

Posted

Hello,

I'm attempting to upgrade from v4.6.9 to 4.7.5. I was waiting for my host to provide newer versions of PHP and finally gave up and migrated to a new host.

Everything's working on the new host with my board disabled, but I wanted to upgrade before I opened up my board again. When running the upgrade, I get the following exception:

Fatal error: Declaration of IPS\form\_Log::getItemsWithPermission($where = [], $order = null, $limit = 10, $permissionKey = 'read', $includeHiddenItems = IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags = 0, ?IPS\Member $member = null, $joinContainer = false, $joinComments = false, $joinReviews = false, $countOnly = false, $joins = null, $skipPermission = false, $joinTags = true, $joinAuthor = true, $joinLastCommenter = true, $showMovedLinks = false) must be compatible with IPS\Content\_Item::getItemsWithPermission($where = [], $order = null, $limit = 10, $permissionKey = 'read', $includeHiddenItems = IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags = 0, ?IPS\Member $member = null, $joinContainer = false, $joinComments = false, $joinReviews = false, $countOnly = false, $joins = null, $skipPermission = false, $joinTags = true, $joinAuthor = true, $joinLastCommenter = true, $showMovedLinks = false, $location = null) in /home/public/applications/form/sources/Log/Log.php on line 730

I made sure I had followed the guide for changing hosting providers and everything appears to be fine there. I also downloaded a newer version of the ips4.php file and I pass all requirements (php memory is -1 which is less than 128M, which is why I think that error is shown. Not sure about the undefined array errors).

Could contain: Page, Text

What are my next troubleshooting steps for resolving the upgrade exception?

Posted (edited)

Thanks for the catch there, Daniel! I'll disable the plugin then upgrade again. That plugin has been giving me issues lately because despite having an upgrade itself, upgrading consistently fails. Haven't been able to resolve that one yet.

Also, I made a change to the ips4.php document. I'm no php developer, but I was able to resolve the errors. What seems to be happening is `-1` doesn't match the regex string and the original code makes the assumption that the `memory_limit` will always be in the form of #g, #m, or #k.

In an official change I'd probably check the length of $match before trying to grab the second entry. But this works as a quick proof of concept.

<?php
	$_memoryLimit = @ini_get('memory_limit');
	$memoryLimit = $_memoryLimit;
	if ($memoryLimit != '-1')
	{
		preg_match( "#^(\d+)(\w+)$#", strtolower($memoryLimit), $match );

		if( $match[2] == 'g' )
		{
			$memoryLimit = intval( $memoryLimit ) * 1024 * 1024 * 1024;
		}
		else if ( $match[2] == 'm' )
		{
			$memoryLimit = intval( $memoryLimit ) * 1024 * 1024;
		}
		else if ( $match[2] == 'k' )
		{
			$memoryLimit = intval( $memoryLimit ) * 1024;
		}
		else
		{
			$memoryLimit = intval( $memoryLimit );
		}
	}
?>
<?php if ( $memoryLimit == '-1' || $memoryLimit >= 128 * 1024 * 1024 ): ?>
					<li class="success"><?php echo $_memoryLimit; ?> memory limit.</li>
<?php else: $success = FALSE; ?>
					<li class="fail">Your PHP memory limit is too low. It needs to be set to 128M or more. You should contact your hosting provider or system administrator to ask for this to be changed.</li>
<?php endif; ?>

 

Edited by Foxtrek_64
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...