Re:clases en sesiones
| From: | deinet | Date: | Fri, 05 Jan 2007 13:04:57 +0000 |
| Subject: | Re:clases en sesiones | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-246592@lists.php.net to get a copy of this message | ||
Hi, thank you chucre, but this not is the solution, the session.auto_start
is On, I don't need use session_start() because it is automatic.
This is my script:
<?
include_once 'usuario.class.php';
include_once 'carrito.class.php';
//session_start();
if (!session_id())
{
session_start();
}
if (!isset($_SESSION["ocarrito"])){
$_SESSION["ocarrito"] = new carrito();
}
if (!isset($_SESSION["elusuario"])){
$_SESSION["elusuario"] = new usuario();
}
?>
for your class work, is necessary verify the session_id, like this:
if (!session_id())
session_start();
2007/1/5, deinet < <mailto:lista_php@deinet.net>
lista_php@deinet.net>:
Hello list, i have a problem with sessions and class. I used to work with a
server with session.auto_start=Off, and now I had to move all my sites to
another server with session.auto_start=On, and I have this problem with the
session:
Fatal error: Unknown(): The script tried to execute a method or access a
property of an incomplete object. Please ensure that the class definition
carrito of the object you are trying to operate on was loaded _before_ the
session was started in <archive> on line 43
The problem is the class is charged after the beginning of the session, but
I don't know what to do to make it work, please help me.
P.D.: To put the session.auto_start in Off is not a solution because the
servers administrators don't admit that.
I hope you will understand my problem, sorry for my english.
Thank you very much, Carlos.
--
Fernando Chure
PSL/CE