{"action":"created","issue":{"url":"https://api.github.com/repos/Gargron/fileupload/issues/56","repository_url":"https://api.github.com/repos/Gargron/fileupload","labels_url":"https://api.github.com/repos/Gargron/fileupload/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/Gargron/fileupload/issues/56/comments","events_url":"https://api.github.com/repos/Gargron/fileupload/issues/56/events","html_url":"https://github.com/Gargron/fileupload/issues/56","id":241002392,"number":56,"title":"ErrorException: \"A non well formed numeric value encountered\" in PHP 7.1","user":{"login":"gthedev","id":19326428,"avatar_url":"https://avatars2.githubusercontent.com/u/19326428?v=3","gravatar_id":"","url":"https://api.github.com/users/gthedev","html_url":"https://github.com/gthedev","followers_url":"https://api.github.com/users/gthedev/followers","following_url":"https://api.github.com/users/gthedev/following{/other_user}","gists_url":"https://api.github.com/users/gthedev/gists{/gist_id}","starred_url":"https://api.github.com/users/gthedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gthedev/subscriptions","organizations_url":"https://api.github.com/users/gthedev/orgs","repos_url":"https://api.github.com/users/gthedev/repos","events_url":"https://api.github.com/users/gthedev/events{/privacy}","received_events_url":"https://api.github.com/users/gthedev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-06T15:49:29Z","updated_at":"2017-07-06T17:51:34Z","closed_at":"2017-07-06T15:54:49Z","body":"When using this library on PHP 7.1 an exception is thrown:\r\n`A non well formed numeric value encountered`\r\n\r\nIt is thrown from `FileUpload::getConfigBytes` method:\r\n\r\n```\r\nprotected function getConfigBytes($val)\r\n    {\r\n        $val  = trim($val);\r\n        $last = strtolower($val[strlen($val) - 1]);\r\n\r\n        switch ($last) {\r\n            case 'g':\r\n                $val *= 1024;\r\n            case 'm':\r\n                $val *= 1024;\r\n            case 'k':\r\n                $val *= 1024;\r\n        }\r\n\r\n        return $this->fixIntegerOverflow($val);\r\n    }\r\n```\r\n\r\nMy set up that triggers this error (in a Laravel 5.2 app):\r\n```\r\n        $sizeValidator = new \\FileUpload\\Validator\\SizeValidator((4*1024*1024));\r\n\r\n        // Simple path resolver, where uploads will be put\r\n        $pathResolver = new \\FileUpload\\PathResolver\\Simple(public_path() . '/uploads/' . $uploadPath);\r\n\r\n        $filesystem = new \\FileUpload\\FileSystem\\Simple();\r\n\r\n        // FileUploader itself\r\n        $fileupload = new \\FileUpload\\FileUpload($_FILES['files'], $_SERVER);\r\n\r\n        // Adding it all together. Note that you can use multiple validators or none at all\r\n        $fileupload->setPathResolver($pathResolver);\r\n        $fileupload->setFileSystem($filesystem);\r\n        $fileupload->addValidator($sizeValidator);\r\n\r\n        // Doing the deed\r\n        list($files, $headers) = $fileupload->processAll();\r\n```\r\n\r\nBacktrace:\r\n```\r\nat FileUpload->getConfigBytes('4M') in FileUpload.php line 532\r\nat FileUpload->validate('/tmp/php28Mk6i', object(File), '0', '0') in FileUpload.php line 367\r\nat FileUpload->process('/tmp/php28Mk6i', 'blank_keyboard_2012_front.jpg', '63221', 'image/jpeg', '0', '0', null) in FileUpload.php line 288\r\nat FileUpload->processAll() in MediaAdminController.php line 207\r\n```"},"comment":{"url":"https://api.github.com/repos/Gargron/fileupload/issues/comments/313470630","html_url":"https://github.com/Gargron/fileupload/issues/56#issuecomment-313470630","issue_url":"https://api.github.com/repos/Gargron/fileupload/issues/56","id":313470630,"user":{"login":"adelowo","id":12677701,"avatar_url":"https://avatars0.githubusercontent.com/u/12677701?v=3","gravatar_id":"","url":"https://api.github.com/users/adelowo","html_url":"https://github.com/adelowo","followers_url":"https://api.github.com/users/adelowo/followers","following_url":"https://api.github.com/users/adelowo/following{/other_user}","gists_url":"https://api.github.com/users/adelowo/gists{/gist_id}","starred_url":"https://api.github.com/users/adelowo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelowo/subscriptions","organizations_url":"https://api.github.com/users/adelowo/orgs","repos_url":"https://api.github.com/users/adelowo/repos","events_url":"https://api.github.com/users/adelowo/events{/privacy}","received_events_url":"https://api.github.com/users/adelowo/received_events","type":"User","site_admin":false},"created_at":"2017-07-06T17:51:34Z","updated_at":"2017-07-06T17:51:34Z","body":"You are using an older version (the code you posted differs from what is here https://github.com/Gargron/fileupload/blob/master/src/FileUpload/FileUpload.php#L521-L538).. Please upgrade"}}
{"actor":{"display_login":"adelowo"}}