?
avatar joomdonation
joomdonation
13 Jul 2016

First of all, I am sorry for could not test my extensions with Joomla 3.6.0 before it was released.

Steps to reproduce the issue

After updating to Joomla 3.6.0, our customers reported this fatal error with my extension Events Booking

Fatal error: Cannot redeclare EventbookingBuildRoute() (previously declared in /home1/alamode1/public_html/components/com_eventbooking/router.php:16) in /home1/alamode1/public_html/components/com_eventbooking/router.php on line 16

Expected result

Everything works well as in Joomla 3.5.1

Actual result

Fatal error as stated above

Additional comments

I haven't had a enough time to find out the root of the error yet. However, I think it is related to this PR #9541
1. My component use JLoader::registerPrefix method for auto-loading component classes

JLoader::registerPrefix('Eventbooking', JPATH_BASE . '/components/com_eventbooking');
  1. Joomla routing tries to find the class EventbookingRouter for building SEF urls. As the router in the component still use old format (not class base routing), the class doesn't exist and it seems with the change in JLoader , the file components/com_eventbooking/router.php is included twice and it causes the fatal error.

For now, I fix the issue by changing component router code to use class

class EventbookingRouter extends JComponentRouterBase
{
         public function build(&$query)
         {
         }

        public function parse(&$segments)
        {
        }
}
avatar joomdonation joomdonation - open - 13 Jul 2016
avatar mbabker
mbabker - comment - 13 Jul 2016

That's probably the cause but I wouldn't consider it a backward
compatibility issue. It's indeed an unwanted side effect and it really
only works with the controller.php and router.php files because those would
possibly have a class matching a registered prefix to the autoloader; maybe
the component's entry point file too if you had some class like
EventbookingEventbooking.

On Tuesday, July 12, 2016, Tuan Pham Ngoc notifications@github.com wrote:

First of all, I am sorry for could not test my extensions with Joomla
3.6.0 before it was released.
Steps to reproduce the issue

After updating to Joomla 3.6.0, our customers reported this fatal error
with my extension Events Booking

Fatal error: Cannot redeclare EventbookingBuildRoute() (previously
declared in
/home1/alamode1/public_html/components/com_eventbooking/router.php:16) in
/home1/alamode1/public_html/components/com_eventbooking/router.php on line
16

Expected result

Everything works well as in Joomla 3.5.1
Actual result

Fatal error as stated above
Additional comments

I haven't had a enough time to find out the root of the error yet.
However, I think it is related to this PR #9541
#9541

  1. My component use JLoader::registerPrefix method for auto-loading component classes

JLoader::registerPrefix('Eventbooking', JPATH_BASE . '/components/com_eventbooking');

  1. Joomla routing tries to find the class EventbookingRouter for building SEF urls. As the router in the component still use old format (not class base routing), the class doesn't exist and it seems with the change in JLoader , the file components/com_eventbooking/router.php is included twice and it causes the fatal error.

For now, I fix the issue by changing component router code to use class

class EventbookingRouter extends JComponentRouterBase{ public function build(&$query) { } public function parse(&$segments) { }}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#11088, or mute the thread
https://github.com/notifications/unsubscribe/AAWfoayBoaRJhbjCpvVWj3z-jyZcCbktks5qVF0XgaJpZM4JLCHb
.

avatar joomdonation
joomdonation - comment - 13 Jul 2016

Thanks Michael for your response. For my extensions, the only affected file is router.php, it is an easy and quick fix, so I am not worry about it. I just reported it here in case someone else has same issue could see the reason and can address it.

avatar mbabker
mbabker - comment - 13 Jul 2016

Honestly the only fix is reverting that pull request and removing the
ability to autoload files without being nested in a directory. Depends how
strongly people feel about it I guess.

On Tuesday, July 12, 2016, Tuan Pham Ngoc notifications@github.com wrote:

Thanks Michael for your response. For my extensions, the only affected
file is router.php, it is an easy and quick fix, so I am not worry about
it. I just reported it here in case someone else has same issue could see
the reason and can address it.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#11088 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAWfoUcZpk6spkdMNXsy8sqt_NGPMX_Lks5qVGGFgaJpZM4JLCHb
.

avatar joomdonation
joomdonation - comment - 13 Jul 2016

I think it will only happens with components use JLoader::registerPrefix to autoload component's classes like in my case. Joomla core components don't use it (?), so hopefully, there are not many extensions get this issue

avatar brianteeman
brianteeman - comment - 13 Jul 2016

Lets leave this open for a few weeks in case anyone else reports it. If not then we can close this


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11088.

avatar brianteeman brianteeman - change - 13 Jul 2016
Labels Added: ?
avatar PhilETaylor
PhilETaylor - comment - 13 Jul 2016

+1
+1
+1

3 so far today :)

avatar phproberto
phproberto - comment - 13 Jul 2016

I can confirm this issue loading duplicated routers.

The main issue is that router is checking things based in routers' class names:
https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/router/site.php#L717

That's checking if a class exists but old routers are based in functions so it tries to require the file.

Also the loader is using include here:
https://github.com/joomla/joomla-cms/blob/staging/libraries/loader.php#L599

Switching that to include_once fixed the issue here but I don't know if that can cause some side effects (In fact I think require_once would be better there because if a class is not loaded a bigger issue will happen?)

So as I see it there are 2 possible solutions:

  • Do the function verification that is done here before the getComponentRouter() require_once
  • Switch that include in JLoader to include_once (or require_once if you have time to fix further issues)
avatar rwestpga
rwestpga - comment - 13 Jul 2016

Hi everyone. I can confirm the same issue as i was testing the Joomla 3.6 upgrade on my demo site:

Fatal error: Cannot redeclare EventbookingBuildRoute() (previously declared in /var/www/vhosts/demo.rwmbeta.com/public_html/components/com_eventbooking/router.php:16) in /var/www/vhosts/demo.rwmbeta.com/public_html/components/com_eventbooking/router.php on line 374


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11088.

avatar joomdonation
joomdonation - comment - 13 Jul 2016

@rwestpga For Events Booking, please update to 2.8.1 and it will work well

avatar brianteeman brianteeman - change - 23 Jul 2016
Category Router / SEF
avatar brianteeman brianteeman - change - 23 Jul 2016
Status New Confirmed
avatar brianteeman
brianteeman - comment - 7 Sep 2016

Setting to needs review


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11088.

avatar brianteeman brianteeman - change - 7 Sep 2016
Status Confirmed Needs Review
avatar PhilETaylor
PhilETaylor - comment - 11 Oct 2016

That's probably the cause but I wouldn't consider it a backward
compatibility issue

Honestly the only fix is reverting that pull request and removing the
ability to autoload files without being nested in a directory. Depends how
strongly people feel about it I guess.

I guess people dont feel strongly about it based on the activity - I strike to close this?

avatar joomdonation joomdonation - change - 12 Oct 2016
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2016-10-12 01:13:06
Closed_By joomdonation
avatar joomdonation joomdonation - close - 12 Oct 2016
avatar joomdonation
joomdonation - comment - 12 Oct 2016

Yes, we should close this issue. I had converted all of my extensions to use class base router, so it is no longer an issue anymore. Let's move forward!

avatar joomdonation joomdonation - close - 12 Oct 2016
avatar nmemory
nmemory - comment - 20 Oct 2016

On preview I get:
Cannot redeclare EventbookingBuildRoute() (previously declared in /home/franklinhighscho/public_html/components/com_eventbooking/router.php:16) in /home/franklinhighscho/public_html/components/com_eventbooking/router.php on line 357

Has there been a fix discovered? Thanks!

avatar joomdonation
joomdonation - comment - 20 Oct 2016

@nmemory Update your site to latest version of Events Booking and the error will be gone

If you could not afford to purchase latest version to update, submit a support ticket and we will help modifying the router file to get it works with latest version of Joomla

avatar nmemory
nmemory - comment - 20 Oct 2016

Thank you. I'm new here... where do I submit a support ticket?

avatar joomdonation
joomdonation - comment - 20 Oct 2016

Go to http://joomdonation.com/support-tickets.html to submit ticket (You need to register for an account on our website to submit ticket)

avatar nmemory
nmemory - comment - 20 Oct 2016

ok, thank you!

avatar nmemory
nmemory - comment - 20 Oct 2016

I submitted a ticket. What is the best way to get the response? Do I sit here and check where the ticket was posted or watch my email? The response time said 24 hours.

Again, thanks!

avatar joomdonation
joomdonation - comment - 20 Oct 2016

Asked you for more information via support ticket (there should be notification sent to you already). Please use our support tickets system to reply, don't submit more comment here.

avatar topvriendj
topvriendj - comment - 5 Nov 2016

Hi there,

This is what i get after updating joomla from 3.6.2 to 3.6.4:
Fatal error: Cannot redeclare EventbookingBuildRoute() (previously declared in /home/topvriendj/domains/wegenercoaching.nl/public_html/components/com_eventbooking/router.php:16) in /home/topvriendj/domains/wegenercoaching.nl/public_html/components/com_eventbooking/router.php on line 358

Who can help me...

avatar PhilETaylor
PhilETaylor - comment - 5 Nov 2016

Who can help me...

If you read the full thread in this issue, its full of things that can help you!

Update your site to latest version of Events Booking and the error will be gone

and

Go to http://joomdonation.com/support-tickets.html to submit ticket (You need to register for an account on our website to submit ticket)

avatar ggppdk
ggppdk - comment - 5 Nov 2016

Most probably you only need to update the component ... and you have your fix ...

avatar topvriendj
topvriendj - comment - 5 Nov 2016

I did try to update but it doesnt work ... :(

avatar PhilETaylor
PhilETaylor - comment - 5 Nov 2016

I did try to update but it doesnt work ... :(

Then you need to contact @joomdonation and seek support for their extension. Support for 3rd party extensions is not available in the Joomla CMS Issue tracker.

Go to http://joomdonation.com/support-tickets.html to submit ticket (You need to register for an account on our website to submit ticket)

avatar topvriendj
topvriendj - comment - 5 Nov 2016

I'm not using this component ... could I deinstall / remove this item in Joomla or is this not possible ?
event_booking

avatar PhilETaylor
PhilETaylor - comment - 5 Nov 2016

BACKUP YOUR SITE then select the event booking items and click uninstalll

avatar ggppdk
ggppdk - comment - 5 Nov 2016

I did try to update but it doesnt work ... :(

A general comment about paid extensions , many have an update URL
ok, but the update URL, will not work without a subscription

  • you will probably need to renew your subscription and then login into the website, and then try to update
  • or after you renew your subscription, just download manually after you subscribe and upgrade

i do not know more i do use this component

avatar topvriendj
topvriendj - comment - 5 Nov 2016

It is fixt, I did uninstall correctly and it works fine again!! Thank you all, I really appreciate you fast replays :)

Add a Comment

Login with GitHub to post a comment