Problems with legacy Symfony slow porting massive project

So, we have this project MASSIVE bare metal php, which we want to slowly convert to Symfony3

This is an ever-changing and updated project, so we need it to be transparent so as not to disturb the people who use it. They should not notice the difference at all.

So, the solution we decided to try was as follows:

  • Paste the whole application in / web
  • Store the script authenticator in an outdated application (it is too complicated to migrate to a new one and then updates the old one to use the new session system), since all it does is set a pair of $ _SESSION keys
  • Nowhere in the application are any session variables set, just an authenticator.

The problem is that suffering through Legacy Bridge configuration and several stack overflow havent gotten us anywhere.

  • Using Bridge
    Configuring with the bridge referred to in this document did not affect anything, except that the session he was reading did not add anything to the association $_SESSION['_sf2_attributes']or anywhere else for that matter.

  • Using the Bridge Component
    According to this document , which describes the use of the component PhpBridgeSessionStorage, when it is configured, it displays:

ContextErrorException in the classes.php 83 line: Warning: ini_set (): active session. You cannot change session ini settings at this time

, liek . , NONE , , symfony

DefaultController.php on line 16:
array:3 [▼
  "_sf2_attributes" => & []
  "_sf2_flashes" => & []
  "_sf2_meta" => & array:3 [▼
    "u" => 1469839893
    "c" => 1469836213
    "l" => "0"
  ]
]
DefaultController.php on line 17:
Session {#2519 ▼
  #storage: PhpBridgeSessionStorage {#2520 ▼
    #bags: array:2 [▼
      "attributes" => AttributeBag {#2218 ▼
        -name: "attributes"
        -storageKey: "_sf2_attributes"
        #attributes: & []
      }
      "flashes" => FlashBag {#2219 ▼
        -name: "flashes"
        -flashes: & []
        -storageKey: "_sf2_flashes"
      }
    ]
    #started: true
    #closed: false
    #saveHandler: SessionHandlerProxy {#2522 ▼
      #handler: SessionHandler {#2217}
      #wrapper: true
      #saveHandlerName: "files"
    }
    #metadataBag: MetadataBag {#2521 ▼
      -name: "__metadata"
      -storageKey: "_sf2_meta"
      #meta: & array:3 [▼
        "u" => 1469839893
        "c" => 1469836213
        "l" => "0"
      ]
      -lastUsed: 1469839892
      -updateThreshold: "0"
    }
  }
  -flashName: "flashes"
  -attributeName: "attributes"
}

  1. "" SO-

app/config/services.yml : services: session.legacy: class: AppBundle\Session\LegacySessionHandler tags: - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

:

LogicException NativeSessionStorage.php 240: .

, , :

, kernel.request - symfony, - $_SESSION. , $_SESSION .

, . , , ,

, - ...

  1. "F-it"

, _sf2_attributes , var_dump - $_SESSION, , _sf2_attributes, !

. , . symfony.


. , ?

+3
1

, config.yml:

session: 
        storage_id: session.storage.native
        handler_id: session.handler.native_file
        save_path: ~

PHP- : 1) script. 2) Symfony.

$sessPath   = ini_get('session.save_path');
$sessCookie = ini_get('session.cookie_path');
$sessName   = ini_get('session.name');

echo '<br>sessPath: ' . $sessPath;
echo '<br>sessCookie: ' . $sessCookie;
echo '<br>sessName: ' . $sessName;

, session.save_path symfony . symfony $_SESSION.

, config.yml :

save_path: ~

, , symfony $_SESSION:

echo "<pre>"; print_r($_SESSION); echo "</pre>";

" LegacySessionHandler EventSubscriberInterface", stackoverflow. ( 3 )

+1

All Articles