Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

What can trigger this error: Cannot redeclare echoln()


Go to End


9 Posts   2844 Views

Avatar
_dave

Community Member, 7 Posts

21 May 2014 at 2:51am

I get this with dev/build:

Fatal error: Cannot redeclare echoln() (previously declared in thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYaml.php:132) in /var/www/myProject/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYaml.php on line 135

The exact copy of the site works on a Bluehost server, but fails on my ubuntu virtual box dev server. (Worked earlier. )

What should I check first?

Avatar
_dave

Community Member, 7 Posts

21 May 2014 at 3:50am

I tried a clean install. (V.3.1.5)
Installer fails with the same error message.

Avatar
_dave

Community Member, 7 Posts

21 May 2014 at 4:24am

Ok...

After checking all my codes for errors, comparing all files with the files from the last working backup, restarting Apache a few times, trying to locate the source of the problem for a few hours, it turned out a simple restart of the virtual machine fixed the problem.
This was a very productive day...

I still have no idea what caused the problem.

Avatar
Mo

Community Member, 541 Posts

22 May 2014 at 11:38am

Looks like you were somehow including the same file twice. It is difficult to be specfic with issues like this, but it could be related to having to flush the manifest cache.

Maybe your ss install was including the lib by default and you were including it elsewhere?

Mo

Avatar
patricknelson

Community Member, 7 Posts

24 April 2015 at 2:35am

Just wanted to point out that I have precisely the same issue that _dave was having. My solution was the same as well. However, it's *not practical* to constantly restart the virtual machine whenever this happens. I wish we could get to the root of this issue.

Yes, clearly the same file is being included multiple times, but why? What in this PHP code (cache manifest? class loader?) is causing a class file to be loaded multiple times, without conflicting on the class file, but still conflicting on the duplicate function definition? The file (framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYaml.php) contains both a class definition and, for some crazy reason, also a function definition (`echoln()`) which is obviously bad form (why not just use a private method?). It doesn't even look like that function is used in any of the base code I've got checked out here in a generic copy of the SS framework/CMS.

Avatar
patricknelson

Community Member, 7 Posts

24 April 2015 at 2:42am

Edited: 24/04/2015 2:42am

To be more specific, here's the exact error message:

--------------------------------------------------------------------------------------------------------

PHP Fatal error: Cannot redeclare echoln() (previously declared in thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYaml.php:132) in /websites/silverstripe-dev3/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYaml.php on line 135
PHP Stack trace:
PHP 1. {main}() /websites/silverstripe-dev3/framework/cli-script.php:0
PHP 2. require_once() /websites/silverstripe-dev3/framework/cli-script.php:64
PHP 3. Config->pushConfigYamlManifest() /websites/silverstripe-dev3/framework/core/Core.php:118
PHP 4. SS_ConfigManifest->activateConfig() /websites/silverstripe-dev3/framework/core/Config.php:315
PHP 5. require_once() /websites/silverstripe-dev3/framework/core/manifest/ConfigManifest.php:141
PHP 6. SS_ClassLoader->loadClass() /websites/silverstripe-dev3/framework/core/manifest/ConfigManifest.php:0
PHP 7. require_once() /websites/silverstripe-dev3/framework/core/manifest/ClassLoader.php:77
PHP 8. require_once() /websites/silverstripe-dev3/framework/i18n/i18n.php:3
PHP 9. require_once() /websites/silverstripe-dev3/framework/i18n/i18nRailsYamlAdapter.php:3
PHP 10. require_once() /websites/silverstripe-dev3/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/RailsYAML.php:12
PHP 11. require_once() /websites/silverstripe-dev3/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYamlDumper.php:11

--------------------------------------------------------------------------------------------------------

You will notice that the error message shows two different paths to exactly the same file. I wonder if that has anything to do with it? That is, at one point it's included relatively (initially) and the second time it's included absolutely (with the full file path). Also, interestingly, I noticed that even if I put a "return;" statement at the very top of this class file, it still will fail with the same error. That's also after completely deleting the contents of the "silverstripe-cache" directory where the cache manifests are stored. This is a pretty mysterious bug.

Avatar
patricknelson

Community Member, 7 Posts

24 April 2015 at 2:48am

Also, @_dave:

Is there any chance that you happen to be using both Vagrant (as your VM manager) with Virtualbox as your provider along with using Samba/CIFS to mount your files instead of the native VirtualBox file share drivers? In my case I'm using Samba as a speed optimization, but I want to see if there happens to be a connection there as well, just in case that's involved in any way.

Avatar
_dave

Community Member, 7 Posts

24 April 2015 at 8:25pm

@chunk_split:

I don't use Vagrant, just Virtualbox and CIFS to mount a directory from an NTFS partition. (I had caching issues with vboxsf.)

Go to Top