Comments (5)
I'm not getting this error (PHP 5.4.7), but 0 is a valid file size, so this is more of a Laravel's get_file_size
helper bug, and should be reported there.
But, can you give me an output of this line:
echo @round(0 / pow(1024, floor(log(0, 1024))), 2);
There is a division by zero, but called with @ should return 0 anyways (as it does for me).
from laravel-console.
It return 0 for me. Than, that's interesting. We have the same result, how come I get error exception.
Here comes the error exception:
Unhandled Exception
Message:
Undefined offset: -9223372036854775808
Location:
/home/www/sites/myproject/laravel/helpers.php on line 597
Stack Trace:
0 /home/www/sites/myproject/laravel/laravel.php(40): Laravel\Error::native(8, 'Undefined offse...', '/home/www/sites...', 597)
1 /home/www/sites/myproject/laravel/helpers.php(597): Laravel{closure}(8, 'Undefined offse...', '/home/www/sites...', 597, Array)
2 /home/www/sites/myproject/bundles/console/models/console.php(34): get_file_size(0)
3 /home/www/sites/myproject/bundles/console/controllers/console.php(55): Console::execute('')
4 [internal function]: Console_Console_Controller->post_execute()
5 /home/www/sites/myproject/laravel/routing/controller.php(325): call_user_func_array(Array, Array)
6 /home/www/sites/myprojectw/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('execute', Array)
7 /home/www/sites/myprojectw/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('execute', Array)
8 /home/www/sites/myproject/laravel/routing/route.php(153): Laravel\Routing\Controller::call('console::consol...', Array)
9 /home/www/sites/myproject/laravel/routing/route.php(124): Laravel\Routing\Route->response()
10 /home/www/sites/myproject/laravel/laravel.php(165): Laravel\Routing\Route->call()
11 /home/www/sites/myproject/public/index.php(34): require('/home/www/sites...')
12 {main}
from laravel-console.
Okay, I think I found the problem, the problem is $unit.
$units = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$units[$i];
When set $size to 0, $i will be -INF (-9223372036854775808) in PHP 5.3.10.
So, $units[-INF] does not exist.
Why yours php accept $units[-INF], and mine doesn't?? No idea!
Can you kindly print your $i for me?
from laravel-console.
Should be OK for you now. I've replaced the Laravel's helper with custom function:
function nice_bytesize($size)
{
$units = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
return @round($size / pow(1024, ($i = max(floor(log($size, 1024)), 0))), 2).' '.$units[$i];
}
from laravel-console.
Thanks!!
from laravel-console.
Related Issues (20)
- Migration/Seeding PDO::quote() expects parameter 1 to be string HOT 9
- Screenshot on README uses Laravel 3 order_by instead of orderBy
- Assets published with the wrong name HOT 1
- Reduce Font Size HOT 4
- Unneded variable $restful HOT 1
- Code ended unexpectedly HOT 11
- Not compatible with Laravel 4.1 HOT 1
- Routes do not work. HOT 2
- Error when executing code HOT 3
- Cannot focus editor HOT 2
- Broken in 4.2? HOT 4
- How to use with Homestead? HOT 2
- Tabs (feature request) HOT 1
- NotFoundHttpException HOT 6
- Refactor front-end
- Add queries bookmark feature please HOT 1
- storing snippets HOT 1
- Deprecate in favor of artisan tinker HOT 17
- Standalone package based on this library HOT 3
- I ask you to allow me make it reborn HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-console.