Cannot redeclare class in src directory (some case-insensitivity I guess) - Macs only?
Permalink
Mac OSX users got this error "Cannot redeclare class Concrete\Package\BlockDesigner\Src\FieldType\FieldType". Now, this class resides in the packages/block_designer/src/FieldType/ directory as "FieldType.php". I'm assuming it gets autoloaded twice because of case-insensitivity on Mac (OSX) machines. I haven't got any problems with Windows NOR Ubuntu. Can someone point me in the right direction of naming the files and/or directories for 5.7's autoloading? Should the FieldType directory be lowercased, and/or should it be underscored or .... what am I missing here? :)
I only have use statements in other classes. These won't work without the use statement. There are field types that do extend this class, but they aren't named FieldType of course. I did a search for FieldType and couldn't find any (searched case insensitive).
The use statement:
use Concrete\Package\BlockDesigner\Src\FieldType\FieldType;
This error message of "Cannot redeclare" happens upon install. So it seems to be an issue with the installer of C5. But as the install does not succeed, it can not be tried out in the package itself.
The use statement:
use Concrete\Package\BlockDesigner\Src\FieldType\FieldType;
This error message of "Cannot redeclare" happens upon install. So it seems to be an issue with the installer of C5. But as the install does not succeed, it can not be tried out in the package itself.
Are you using $pkgAutoloaderRegistries in your package's controller?
Also instead of
You might want to try
Also instead of
use Concrete\Package\BlockDesigner\Src\FieldType\FieldType;
You might want to try
use Concrete\Package\BlockDesigner\Src\FieldType;
I'm not using $pkgAutoloaderRegistries at all, I'm just making use of the standard C5's autoloading of the "src" directory.
My class is inside src\FieldType\FieldType, so I need to have the double naming here. Otherwise I have to relocate this file and it's namespace of course.
My class is inside src\FieldType\FieldType, so I need to have the double naming here. Otherwise I have to relocate this file and it's namespace of course.
I know I had this problem with one of my add-ons and corrected it (on PC) and it had to do with namespacing I think but I can't remember the specifics.
I didn't keep a copy of your package from the PRB. Would you mind PMing me a copy to have a look, maybe I'll notice something?
I didn't keep a copy of your package from the PRB. Would you mind PMing me a copy to have a look, maybe I'll notice something?
Anyone else can come up with solutions? Still not know why this is only happening on OSX systems...
Can you send me a copy of the package via PM? I'll take a look. Is this happening in 5.7.4 or 5.7.5? Or both?
Not working for me with 5.7.4.2.
Installs on 5.7.5RC1, not fully played with it yet though.
Installs on 5.7.5RC1, not fully played with it yet though.
If it installs correctly on 5.7.5 RC, it should all be OK. The package was giving error upon installation, and you couldn't navigate to the single pages that should be installed with the package, so it's not completed. If you're able to install, everything else should work as well. Do let me know if that's the case, that will mean upcoming 5.7.5 will most likely work (as RC won't change that much I assume).
No problem so far with 5.7.5, however, that means I'll have to wait for a stable 5.7.5 to fully use and implement!
This appears to be a result of autoloading code in 5.7.4 that should work in simple contexts but is problematic in certain other situations. We have removed this code in 5.7.5 but left it in in 5.7.4 because certain add-ons required it. That was probably a bad call – or at least we should have made this easier to opt out of it. It's relatively easy to fix in a few different ways and shouldn't cause any problems in 5.7.5. I'm communicating with the original developer to see if a fix can't make it it into a version that can run in 5.7.4.
Sorry, Away until the 10th September 2015
Everything after src needs to be as you wrote it, no underscore or anything.
Are you sure you don't have a call to auto-load it in your controller?
Another possibility (silly I know) is that another class somewhere is also FieldType