BC Break in Controller Loader, controllers no more present in controller loader. #3576

Closed
Freeaqingme opened this Issue Jan 27, 2013 · 8 comments

Projects

None yet

3 participants

Member

Hi,

I have the following code:

        $controllerLoader = $this->sm->get('controllerloader');
        $controllers = $controllerLoader->getServiceLocator()->getCanonicalNames();

Here the sm property represents the Service Manager. However, some entries (my controllers) that are present in 2.0.6, are no more so in develop.

Diff of the $controllers array:

-array(92) {
+array(102) {
   ["SharedEventManager"]=>
   string(18) "sharedeventmanager"
   ["EventManager"]=>
@@ -46,14 +46,30 @@ array(92) {
   string(13) "consolerouter"
   ["DependencyInjector"]=>
   string(18) "dependencyinjector"
+  ["DiAbstractServiceFactory"]=>
+  string(24) "diabstractservicefactory"
+  ["DiServiceInitializer"]=>
+  string(20) "diserviceinitializer"
+  ["DiStrictAbstractServiceFactory"]=>
+  string(30) "districtabstractservicefactory"
+  ["FilterManager"]=>
+  string(13) "filtermanager"
+  ["FormElementManager"]=>
+  string(18) "formelementmanager"
   ["HttpRouter"]=>
   string(10) "httprouter"
+  ["PaginatorPluginManager"]=>
+  string(22) "paginatorpluginmanager"
   ["Request"]=>
   string(7) "request"
   ["Response"]=>
   string(8) "response"
   ["Router"]=>
   string(6) "router"
+  ["RoutePluginManager"]=>
+  string(18) "routepluginmanager"
+  ["ValidatorManager"]=>
+  string(16) "validatormanager"
   ["ViewHelperManager"]=>
   string(17) "viewhelpermanager"
   ["ViewFeedRenderer"]=>
@@ -78,6 +94,8 @@ array(92) {
   string(16) "dispatchlistener"
   ["RouteListener"]=>
   string(13) "routelistener"
+  ["SendResponseListener"]=>
+  string(20) "sendresponselistener"
   ["Configuration"]=>
   string(13) "configuration"
   ["Console"]=>
@@ -100,18 +118,18 @@ array(92) {
   string(16) "controllerloader"
   ["config"]=>
   string(6) "config"
-  ["Application\Controller\Index"]=>
-  string(26) "applicationcontrollerindex"
-  ["Application\Controller\Api"]=>
-  string(24) "applicationcontrollerapi"
-  ["Application\Controller\Api\Website"]=>
-  string(31) "applicationcontrollerapiwebsite"
-  ["Application\Controller\Api\Website\User"]=>
-  string(35) "applicationcontrollerapiwebsiteuser"
   ["controllerpluginmanager"]=>
   string(23) "controllerpluginmanager"
   ["viewhelpermanager"]=>
   string(17) "viewhelpermanager"
+  ["validatormanager"]=>
+  string(16) "validatormanager"
+  ["filtermanager"]=>
+  string(13) "filtermanager"
+  ["formelementmanager"]=>
+  string(18) "formelementmanager"
+  ["routepluginmanager"]=>
+  string(18) "routepluginmanager"
   ["application"]=>
   string(11) "application"
   ["request"]=>
@@ -124,6 +142,8 @@ array(92) {
   string(16) "dispatchlistener"
   ["viewmanager"]=>
   string(11) "viewmanager"
+  ["sendresponselistener"]=>
+  string(20) "sendresponselistener"
   ["router"]=>
   string(6) "router"
   ["RouteNotFoundStrategy"]=>
@@ -185,10 +205,5 @@ array(92) {
   ["zendservicemanagerservicelocatorinterface"]=>
   string(41) "zendservicemanagerservicelocatorinterface"
 }
Owner

Were those controllers managed via DI, by any chance? Ping @ocramius

On Sunday, January 27, 2013, Dolf Schimmel wrote:

Hi,

I have the following code:

    $controllerLoader = $this->sm->get('controllerloader');
    $controllers = $controllerLoader->getServiceLocator()->getCanonicalNames();

Here the sm property represents the Service Manager. However, some entries
(my controllers) that are present in 2.0.6, are no more so in develop.

Diff of the $controllers array:

+array(102) {
["SharedEventManager"]=>
string(18) "sharedeventmanager"
["EventManager"]=>
@@ -46,14 +46,30 @@ array(92) {
string(13) "consolerouter"
["DependencyInjector"]=>
string(18) "dependencyinjector"
- ["DiAbstractServiceFactory"]=>
- string(24) "diabstractservicefactory"
- ["DiServiceInitializer"]=>
- string(20) "diserviceinitializer"
- ["DiStrictAbstractServiceFactory"]=>
- string(30) "districtabstractservicefactory"
- ["FilterManager"]=>
- string(13) "filtermanager"
- ["FormElementManager"]=>
- string(18) "formelementmanager" ["HttpRouter"]=> string(10)
  "httprouter"
- ["PaginatorPluginManager"]=>
- string(22) "paginatorpluginmanager" ["Request"]=> string(7)
  "request" ["Response"]=> string(8) "response" ["Router"]=> string(6)
  "router"
- ["RoutePluginManager"]=>
- string(18) "routepluginmanager"
- ["ValidatorManager"]=>
- string(16) "validatormanager" ["ViewHelperManager"]=> string(17)
  "viewhelpermanager" ["ViewFeedRenderer"]=> @@ -78,6 +94,8 @@ array(92) {
  string(16) "dispatchlistener" ["RouteListener"]=> string(13) "routelistener"
- ["SendResponseListener"]=>
- string(20) "sendresponselistener" ["Configuration"]=> string(13)
  "configuration" ["Console"]=> @@ -100,18 +118,18 @@ array(92) { string(16)
  "controllerloader" ["config"]=> string(6) "config"
- ["Application\Controller\Index"]=>
- string(26) "applicationcontrollerindex"
- ["Application\Controller\Api"]=>
- string(24) "applicationcontrollerapi"
- ["Application\Controller\Api\Website"]=>
- string(31) "applicationcontrollerapiwebsite"
- ["Application\Controller\Api\Website\User"]=>
- string(35) "applicationcontrollerapiwebsiteuser"
  ["controllerpluginmanager"]=> string(23) "controllerpluginmanager"
  ["viewhelpermanager"]=> string(17) "viewhelpermanager"
- ["validatormanager"]=>
- string(16) "validatormanager"
- ["filtermanager"]=>
- string(13) "filtermanager"
- ["formelementmanager"]=>
- string(18) "formelementmanager"
- ["routepluginmanager"]=>
- string(18) "routepluginmanager" ["application"]=> string(11)
  "application" ["request"]=> @@ -124,6 +142,8 @@ array(92) { string(16)
  "dispatchlistener" ["viewmanager"]=> string(11) "viewmanager"
- ["sendresponselistener"]=>
- string(20) "sendresponselistener" ["router"]=> string(6) "router"
  ["RouteNotFoundStrategy"]=> @@ -185,10 +205,5 @@ array(92) {
  ["zendservicemanagerservicelocatorinterface"]=> string(41)
  "zendservicemanagerservicelocatorinterface" } ```
  
  —
  Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/3576.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

Member

@weierophinney still should be in there. We only removed the initializer, not the abstract factory.

Owner

Dolf - can you provide some code - config, etc - to reproduce, please? The
container contents aren't helping me understand the conditions properly.

On Sunday, January 27, 2013, Marco Pivetta wrote:

@weierophinney https://github.com/weierophinney still should be in
there. We only removed the initializer, not the abstract factory.


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/3576#issuecomment-12763337.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

Member

@weierophinney I got a pointer from Waly on github to remove the 'getServiceLocator()' call. Removing that, gave me the following array:

array(6) {
  ["Application\Controller\Index"]=>
  string(26) "applicationcontrollerindex"
  ["Application\Controller\Api"]=>
  string(24) "applicationcontrollerapi"
  ["Application\Controller\Api\Website"]=>
  string(31) "applicationcontrollerapiwebsite"
  ["Application\Controller\Api\Website\User"]=>
  string(35) "applicationcontrollerapiwebsiteuser"
  ["applicationcontrollerapi"]=>
  string(24) "applicationcontrollerapi"
  ["applicationcontrollerapiwebsite"]=>
  string(31) "applicationcontrollerapiwebsite"
}

Using that array, my code worked again (on 2.1). Right now, I don't have any code that allows you to reproduce this. I could see if I can set up something with the skeleton app though.

Edit: Switching back to 2.0, without the getServiceLocator() call, it works as well. Nevertheless, we still have some bc break going on.

Member

Git bisect rocks...

$ git bisect bad
8fcc2b13ee7fa564b821913abc698d8c5a15ac97 is the first bad commit
commit 8fcc2b13ee7fa564b821913abc698d8c5a15ac97
Author: Deserved <vasilij.syc@gmail.com>
Date:   Sun Jan 13 23:30:20 2013 +0000

    Issue ZF-3347: Allow Parent ServiceManager create service with the same name as in  child ServiceManager

:040000 040000 d459e07b3911fb221889cd61e36157823db91f24 28398fca95889081a48a158e29651e9bcc408b01 M  library
:040000 040000 2b4fa2ef6610d607820b652af4047510a8f0d33d 2606cb7cb023dbcebcd45b33cc7fa82a198a5057 M  tests
@weierophinney weierophinney added a commit that referenced this issue Jan 29, 2013
@weierophinney weierophinney Revert "Merge branch 'ZF-3347' of git://github.com/Deserved/zf2 into …
…hotfix/3424"

This reverts commit b9d1977, reversing
changes made to 054f7a0.

Reverts #3424 due to BC breaks reported in #3576

Conflicts:
	tests/ZendTest/ServiceManager/ServiceManagerTest.php
2a2cfcb
@weierophinney weierophinney added a commit that referenced this issue Jan 29, 2013
@weierophinney weierophinney Revert "Merge branch 'hotfix/3424'"
Reverts #3424 due to BC issue reported in #3576

This reverts commit c8c6375, reversing
changes made to 054f7a0.
c562e2c
Owner

@Freeaqingme Can you please test again? I've reverted the PR that introduced the issue.

Owner

Cannot recreate the issue now locally.

Member

@weierophinney Fix confirmed!

@weierophinney weierophinney added a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
@weierophinney weierophinney Revert "Merge branch 'ZF-3347' of git://github.com/Deserved/zf2 into …
…hotfix/3424"

This reverts commit b9d19770186be6b50e9908c94d495db42034f6df, reversing
changes made to 054f7a0f95bb919cce95faa53ced0a525017602f.

Reverts zendframework/zendframework#3424 due to BC breaks reported in zendframework/zendframework#3576

Conflicts:
	tests/ZendTest/ServiceManager/ServiceManagerTest.php
5b5a4de
@weierophinney weierophinney added a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
@weierophinney weierophinney Revert "Merge branch 'hotfix/3424'"
Reverts zendframework/zendframework#3424 due to BC issue reported in zendframework/zendframework#3576

This reverts commit c8c637523fe1a5705ba01684386a8ef63e675464, reversing
changes made to 054f7a0f95bb919cce95faa53ced0a525017602f.
30d8776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment