Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Return value of craft\helpers\App::phpConfigValueInBytes() must be of the type integer, float returned #3717

Closed
BrandonJamesBorders opened this issue Jan 25, 2019 · 4 comments

Comments

@BrandonJamesBorders
Copy link

Description

Installing plugins from the CMS no longer work.

Steps to reproduce

  1. Go to the plugin store page within Craft CMS install.
  2. Find a plugin to install and hit click "Try" or "Install"
  3. See error message.

Additional info

  • Craft version: 3.1.4
  • PHP version: 7.2.8
  • Database driver & version: MySQL 5.5.5
  • Operating System: Windows 10.0.17763.0
@BrandonJamesBorders
Copy link
Author

If I'm assuming correctly that this is related to 3.1.4 and checking of php memory_limit, this is what I get when I run the phpConfigValueInBytes function:

$var = 'memory_limit';
$value = trim(ini_get($var));
$unit = strtolower(substr($value, -1, 1));
$value = (int)$value;
switch ($unit) {
    case 'g':
        $value *= 1024;
    // no break (cumulative multiplier)
    case 'm':
        $value *= 1024;
    // no break (cumulative multiplier)
    case 'k':
        $value *= 1024;
}
var_dump($value)

$value returns float(2147483648)

If I dump out $value * 1024 I get int(2097152), but for somereason when that happens inside the switch statement it converts to a float.

@BrandonJamesBorders
Copy link
Author

So this is a 32-bit PHP error combined with having a memory limit >= 2048M as the result would be 2,147,483,648 and the max integer size on 32-bit PHP is 2,147,483,647.

@BrandonJamesBorders
Copy link
Author

#3721

Proposed fix to change expected response as a float, which suppor

@brandonkelly
Copy link
Member

Thanks for the bug report and investigating it! Fixed for the next release. In the meantime, you can get around it by changing your memory_limit config setting to -1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants