> $db = new DBConnection($properties); > // Notice, still not connected to DB > $third_party_obj->foo($db); > $db->connect();
In the requested feature, the "protection" is in the wrong hands (that of the third party object). You're much better off changing your call to: $third_party_obj->foo(clone $db); S -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php