October: Cannot use File as File because the name is already in use

Created on 19 Oct 2017  路  8Comments  路  Source: octobercms/october

Expected behavior

Access to backend, menu Settings > Mail Templates must show all normal setting

Actual behavior

Access to backend, menu Settings > Mail Templates show error exception
Cannot use File as File because the name is already in use
/home/cms/public_html/modules/system/models/MailTemplate.php line 4

The log doesn't show any stack trace

Reproduce steps

This happen after update to build 426

October build

426

PHP Version

7.0.9

Review Needed Unconfirmed Bug

Most helpful comment

The MediaManager issue would be the same thing as this because it's been moved to Backend\Widgets, which already had a Backend\WidgetsForm class. I'll need to discuss this with @daftspunk, the solution is probably to use those aliases under another name:

use Form as FormAlias;
use File as FileAlias;

and then update the references in the files that use those aliases to call methods on FormAlias instead of Form.

All 8 comments

Looks like this would be caused by the fact that there is a System\ModelsFile class in the same namespace (see https://stackoverflow.com/a/17747378/6652884) but I have no idea why it would only just now become an issue for you.
What build of October were you previously running?
What is your server environment like? i.e. what server software are you using?

Also, could you check if this also affects Mail Layout, Mail Partials, and Mail Brand Settings?

This affect Mail Layout, Mail Partials, and Mail Brand Settings too. And the same issue affect to MediaManager, but with Form class instead of File.

I have another OC (same server) with build 424 and I can access to Mail Templates, but if I send an email, I have this exception.

Cannot use File as File because the name is already in use

The server is an Ubuntu Linux 15.10
Apache 2.4.23
PHP 7.0.9

The environment is development, this installation is for devel and test plugins and themes.
Plugins installed:

  • PlanetaDelEste.SignOut | 1.0.1
  • RainLab.User | 1.4.3
  • RainLab.Location | 1.0.7
  • RainLab.Notify | 1.0.2
  • RainLab.Blog | 1.2.19
  • RainLab.GoogleAnalytics | 1.2.2
  • RainLab.Translate | 1.3.1
  • RainLab.UserPlus | 1.1.0
  • RainLab.Pages | 1.2.17
  • Romanov.ClearCacheWidget | 1.2.4
  • October.Drivers | 1.1.1
  • Flynsarmy.IdeHelper | 1.0.6
  • October.Demo | 1.0.1
  • October.Test | 1.0.3
  • PlanetaDelEste.Features | 1.0.12
  • PlanetaDelEste.Widgets | 1.0.9
  • PlanetaDelEste.SocialPublish | 1.1.9
  • Bedard.Debugbar | 2.0.0
  • RainLab.BlogVideo | 1.1.2
  • RainLab.Forum | 1.1.1
  • Samuell.ContentEditor | 1.0.7
  • Martin.Forms | 1.4.5.1
  • OFFLINE.SiteSearch | 1.3.5
  • Indikator.Backend | 1.6.5

The MediaManager issue would be the same thing as this because it's been moved to Backend\Widgets, which already had a Backend\WidgetsForm class. I'll need to discuss this with @daftspunk, the solution is probably to use those aliases under another name:

use Form as FormAlias;
use File as FileAlias;

and then update the references in the files that use those aliases to call methods on FormAlias instead of Form.

Great, this simple solution works fine. I tested without problems.

@alvaro-canepa @korneliuskristianr Could you please test https://github.com/octobercms/october/commit/d292eeb85ecb57f2aa84ab573ea6467584f268e2?

Thanks, works fine!

[Symfony\Component\Debug\Exception\FatalErrorException]
Cannot use File as File because the name is already in use
solution this pb?

@bouzidseyf full stack trace please, and what version of October are you using?

Was this page helpful?
0 / 5 - 0 ratings