[GH-ISSUE #344] [RuntimeException] SplFileInfo::getMTime() #250

Closed
opened 2026-02-26 02:32:35 +03:00 by kerem · 12 comments
Owner

Originally created by @My1 on GitHub (May 28, 2016).
Original GitHub issue: https://github.com/koel/koel/issues/344

after seeing that my raspi 1b might me too slow for koel I am trying to run this on my laptop for testing and stuff.

This error is quite similar to #285 but as that's closed and wont help me most probably because it aint hebrew I'll open a new issue.

I always get

[RuntimeException]
SplFileInfo::getMTime(): stat failed for T:\path\to\file

T: is just my second harddrive where my music resides.
where the file has some unicode stuff.
for me it triggered for exmaple on ☆ and ~ (a fullwidth version of ~)

but the weirdes thing is that I dont get anything in my error file. I can produce errors myself (already tested with a small test file) so it cant be the permissions.

my environment:
node 4.4.5 with npm 2.15.5
composer 1.1.1
koel pulled yesterday, so it's pretty fresh
PHP 7.0.7 x86 Thread safe
Windows 8.1 x64

I checked PHP and mbstring is enabled in the ini so even that cannot be an obstacle.

Originally created by @My1 on GitHub (May 28, 2016). Original GitHub issue: https://github.com/koel/koel/issues/344 after seeing that my raspi 1b might me too slow for koel I am trying to run this on my laptop for testing and stuff. This error is quite similar to #285 but as that's closed and wont help me most probably because it aint hebrew I'll open a new issue. I always get ``` [RuntimeException] SplFileInfo::getMTime(): stat failed for T:\path\to\file ``` T: is just my second harddrive where my music resides. where the file has some unicode stuff. for me it triggered for exmaple on ☆ and ~ (a fullwidth version of ~) but the weirdes thing is that I dont get anything in my error file. I can produce errors myself (already tested with a small test file) so it cant be the permissions. my environment: node 4.4.5 with npm 2.15.5 composer 1.1.1 koel pulled yesterday, so it's pretty fresh PHP 7.0.7 x86 Thread safe Windows 8.1 x64 I checked PHP and mbstring is enabled in the ini so even that cannot be an obstacle.
kerem closed this issue 2026-02-26 02:32:35 +03:00
Author
Owner

@phanan commented on GitHub (May 29, 2016):

Maybe relevant: https://github.com/laravel/framework/issues/5221

<!-- gh-comment-id:222372938 --> @phanan commented on GitHub (May 29, 2016): Maybe relevant: https://github.com/laravel/framework/issues/5221
Author
Owner

@My1 commented on GitHub (May 29, 2016):

I dont really know. this says something about the sessions but the issue seems with the unicode (especially because it gets through when I rename it.

<!-- gh-comment-id:222373159 --> @My1 commented on GitHub (May 29, 2016): I dont really know. this says something about the sessions but the issue seems with the unicode (especially because it gets through when I rename it.
Author
Owner

@phanan commented on GitHub (Jun 9, 2016):

Don't think this is a Koel issue per se.

<!-- gh-comment-id:224930627 --> @phanan commented on GitHub (Jun 9, 2016): Don't think this is a Koel issue per se.
Author
Owner

@BernardGoldberger commented on GitHub (Aug 10, 2016):

I found a simple way around this issue, modify the mtime variable with some gibberish in App/Models/File.php L70 like so,

    public function __construct($path, $getID3 = null)
    {
        $this->splFileInfo = $path instanceof SplFileInfo ? $path : new SplFileInfo($path);
        $this->setGetID3($getID3);
        $this->mtime = '12345';
        $this->path = $this->splFileInfo->getPathname();
        $this->hash = self::getHash($this->path);
        $this->song = Song::find($this->hash);
    }

It took me a while to figure this out, but in fact all the other components do not experience any issues with Unicode including getID3 or any of the other splFileInfo variables.

Of course this workaround only works if you don't care to run a force sync every time you do a scan.

@phanan Do you know of any other way to get the modified time so I can give it a test to see if it will work with Unicode?

<!-- gh-comment-id:238941387 --> @BernardGoldberger commented on GitHub (Aug 10, 2016): I found a simple way around this issue, modify the `mtime` variable with some gibberish in `App/Models/File.php L70` like so, ``` public function __construct($path, $getID3 = null) { $this->splFileInfo = $path instanceof SplFileInfo ? $path : new SplFileInfo($path); $this->setGetID3($getID3); $this->mtime = '12345'; $this->path = $this->splFileInfo->getPathname(); $this->hash = self::getHash($this->path); $this->song = Song::find($this->hash); } ``` It took me a while to figure this out, but in fact all the other components do not experience any issues with Unicode including `getID3` or any of the other `splFileInfo` variables. Of course this workaround only works if you don't care to run a force sync every time you do a scan. @phanan Do you know of any other way to get the modified time so I can give it a test to see if it will work with Unicode?
Author
Owner

@phanan commented on GitHub (Aug 11, 2016):

Can you try $this->mtime = filemtime($this->path); after the $this->path = $this->splFileInfo->getPathname(); line?

<!-- gh-comment-id:239052310 --> @phanan commented on GitHub (Aug 11, 2016): Can you try `$this->mtime = filemtime($this->path);` after the `$this->path = $this->splFileInfo->getPathname();` line?
Author
Owner

@BernardGoldberger commented on GitHub (Aug 11, 2016):

Same error.

<!-- gh-comment-id:239053504 --> @BernardGoldberger commented on GitHub (Aug 11, 2016): Same error.
Author
Owner

@BernardGoldberger commented on GitHub (Aug 11, 2016):

To think out of the box, what about using some widows library to get this info and tie it to a if Windows.

<!-- gh-comment-id:239053728 --> @BernardGoldberger commented on GitHub (Aug 11, 2016): To think out of the box, what about using some widows library to get this info and tie it to a `if Windows`.
Author
Owner

@JosephSilber commented on GitHub (Aug 11, 2016):

Of course this workaround only works if you don't care to run a force sync every time you do a scan.

At the very least this should be in a try/catch block:

try {
    $this->mtime = $this->splFileInfo->getMTime();
} catch (\Exception $e) {
    $this->mtime = '12345';
}

At least that way you're only force syncing the files that have special Unicode characters in them.

<!-- gh-comment-id:239057861 --> @JosephSilber commented on GitHub (Aug 11, 2016): > Of course this workaround only works if you don't care to run a force sync every time you do a scan. At the very least this should be in a try/catch block: ``` php try { $this->mtime = $this->splFileInfo->getMTime(); } catch (\Exception $e) { $this->mtime = '12345'; } ``` At least that way you're only force syncing the files that have special Unicode characters in them.
Author
Owner

@phanan commented on GitHub (Aug 11, 2016):

@JosephSilber's idea is exactly what I would do.

<!-- gh-comment-id:239060606 --> @phanan commented on GitHub (Aug 11, 2016): @JosephSilber's idea is exactly what I would do.
Author
Owner

@BernardGoldberger commented on GitHub (Aug 11, 2016):

While the scan does not fail now, it still skips it as being invalid.

I will try to research more ideas for this.

<!-- gh-comment-id:239143235 --> @BernardGoldberger commented on GitHub (Aug 11, 2016): While the scan does not fail now, it still skips it as being invalid. I will try to research more ideas for this.
Author
Owner

@phanan commented on GitHub (Aug 11, 2016):

Can you check the $e variable? I can't reproduce this issue, so this was more or less a blind fix.

<!-- gh-comment-id:239192184 --> @phanan commented on GitHub (Aug 11, 2016): Can you check the `$e` variable? I can't reproduce this issue, so this was more or less a blind fix.
Author
Owner

@BernardGoldberger commented on GitHub (Aug 12, 2016):

Is this what you are looking for?

[2016-08-12 01:36:25] production.DEBUG: RuntimeException: SplFileInfo::getMTime(): stat failed for C:\Benny Freidman 3\?.mp3 in C:\wamp64\www\Beta\koel\app\Models\File.php:75
Stack trace:
#0 C:\wamp64\www\Beta\koel\app\Models\File.php(75): SplFileInfo->getMTime()
#1 C:\wamp64\www\Beta\koel\app\Services\Media.php(76): App\Models\File->__construct(Object(Symfony\Component\Finder\SplFileInfo), Object(getID3))
#2 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(227): App\Services\Media->sync('C:\\Benny Freidm...', Array, false, Object(App\Console\Commands\SyncMedia))
#3 C:\wamp64\www\Beta\koel\app\Console\Commands\SyncMedia.php(67): Illuminate\Support\Facades\Facade::__callStatic('sync', Array)
#4 C:\wamp64\www\Beta\koel\app\Console\Commands\SyncMedia.php(47): App\Console\Commands\SyncMedia->syncAll()
#5 [internal function]: App\Console\Commands\SyncMedia->handle()
#6 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Container\Container.php(507): call_user_func_array(Array, Array)
#7 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Console\Command.php(169): Illuminate\Container\Container->call(Array)
#8 C:\wamp64\www\Beta\koel\vendor\symfony\console\Command\Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Console\Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(791): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Commands\SyncMedia), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\wamp64\www\Beta\koel\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 {main}  
<!-- gh-comment-id:239536871 --> @BernardGoldberger commented on GitHub (Aug 12, 2016): Is this what you are looking for? ``` [2016-08-12 01:36:25] production.DEBUG: RuntimeException: SplFileInfo::getMTime(): stat failed for C:\Benny Freidman 3\?.mp3 in C:\wamp64\www\Beta\koel\app\Models\File.php:75 Stack trace: #0 C:\wamp64\www\Beta\koel\app\Models\File.php(75): SplFileInfo->getMTime() #1 C:\wamp64\www\Beta\koel\app\Services\Media.php(76): App\Models\File->__construct(Object(Symfony\Component\Finder\SplFileInfo), Object(getID3)) #2 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(227): App\Services\Media->sync('C:\\Benny Freidm...', Array, false, Object(App\Console\Commands\SyncMedia)) #3 C:\wamp64\www\Beta\koel\app\Console\Commands\SyncMedia.php(67): Illuminate\Support\Facades\Facade::__callStatic('sync', Array) #4 C:\wamp64\www\Beta\koel\app\Console\Commands\SyncMedia.php(47): App\Console\Commands\SyncMedia->syncAll() #5 [internal function]: App\Console\Commands\SyncMedia->handle() #6 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Container\Container.php(507): call_user_func_array(Array, Array) #7 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Console\Command.php(169): Illuminate\Container\Container->call(Array) #8 C:\wamp64\www\Beta\koel\vendor\symfony\console\Command\Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Console\Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(791): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Commands\SyncMedia), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 C:\wamp64\www\Beta\koel\vendor\symfony\console\Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 C:\wamp64\www\Beta\koel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 C:\wamp64\www\Beta\koel\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 {main} ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#250
No description provided.