Hi Sven,

Unfortunately we can't start the session before loading config vars from
db as you suggest. The problem here is multishop functionality feature.
As you see configuration vars stored in oxconfig table are shop
dependant and in order to get active shopid, we need a session id. This
applies basically to eShop Enterprise Edition, but basically this is the
reason why session is started first. 

I had a look to the code and see some places could be improved. Just I
am thinking if it works in index.php why you can't call the methods in
exactly the same order in your script? 

And you wrote "oxsession::start tries to use getShopUrl()". It doesn't,
or?

Regards
Tomas Liubinas

> -----Original Message-----
> From: [email protected] [mailto:dev-general-
> [email protected]] On Behalf Of Sven Tietje
> Sent: Saturday, November 07, 2009 3:15 PM
> To: [email protected]
> Subject: [oxid-dev-general] fix / patch for oxconfig - result:
> oxsessionextendable
> 
> hi,
> 
> i just did some crazy stuff (no usage of index.php) - everthing works
> except
> the following message:
> 
> Notice: Trying to get property of non-object in
> /web/oxid-ce/www/core/oxlang.php on line 465 Notice
> 
> so, i have tried to debug. it`s somehow a circle of an inconsistent
> oxconfig
> and the usage of error_reporting( E_ALL ^ E_NOTICE ) in index.php.
> 
> line 393 in oxconfig.php does the following stuff:
> 
>             //starting up the session
>             $ 
> 
>             $sShopID = $this->getShopId();
> 
>             // load now
>             $this->_loadVarsFromDb( $sShopID );
> 
> oxsession::start tries to use getShopUrl() on oxconfig. getShopUrl
also
> uses
> languages to build the url. problem: languages are loaded from db -> 3
> lines
> later :) why to start session before loading config-data from db? the
> oxconfig::getShopId() does not only return an I, it also sets the
shopId
> to
> session.
> 
> you can fix the problem with some little changes in oxconfig.
> 
> first change - change the top block to:
> 
>             $sShopID = $this->getShopId();
> 
>             // load now
>             $this->_loadVarsFromDb( $sShopID );
> 
>             //starting up the session
>             $this->getSession()->start();
> 
>             oxSession::setVar( 'actshop', $this->_iShopId );
> 
> second change - new getShopId() - removal of session value set:
> 
>     public function getShopId()
>     {
>         if ( $this->_iShopId !== null )
>             return $this->_iShopId;
> 
>             $this->_iShopId = $this->getBaseShopId();
> 
>         return $this->_iShopId;
>     }
> 
> 
> the biggest advantage of these changes:
> you are now able to extend oxsession and all the other classes that
are
> loaded first time after oxconfig::init()
> 
> i`d like to see oxid to use that patch. second wish: please remove
your
> error_reporting in your test enviroment. that will make code more
cleaner.
> 
> thanks && nice weekend.
> 
> sven
> 
> _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to