Question: How can I avoid getting an PHP Incomplete Class i this case?
Background:
The code is a script receiving POST-variables from a form, performing some operations on \ $_SESSION['objectCart']
, and finally re-directing the visitor to another page.
$_SESSION['objectCart']
contains an instance of the 'cart' class defined in the file
__DIR__ . $lib . 'user.class.php'
When I run the script it stops, and further investigation reveals the __PHP__Incomplete Class.
My code:
require_once __DIR__ . $lib . 'utility.class.php';
require_once __DIR__ . $lib . 'productcatalog.class.php';
require_once __DIR__ . $lib . 'user.class.php';
require_once __DIR__ . $lib . 'cart.class.php';
session_start();
print_r( $_SESSION['objectCart'] );
HTML output:
__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => cart [itemsExtended:protected] => Array ( [0] => Array ( [item_name] => ...
SOLUTION - PARTIAL:
A session was started already, as it normally is with this problem. It was identified by placing
echo session_id();
before the cart-class was initiated.