Welcome Guest, Not a member yet? Register   Sign In
[Q] cannot pass arguments to __constructor with load->library
#1

[eluser]vlad_ci[/eluser]
Hello
I have moved up to the latest CI (from 1.6.3)
and now writting a Java client to access my web serivces that are in PHP/CI

on a POST call from my Java client,
I am getting a strange error that I think I donot get when calling the same method from AJAX Web browser
(or at least I am not seeing the error ...)

The error is in the fact that I defined a class (this is all PHP 5.2.9/win)
the I am trying to load it with
CI->load->library


$args=1;
$this->load->library('CUsr_BaseData', $args);


--- class ---

class CUsr_BaseData
{
function __construct ($arg ) // <---- error here saying
{

/*
<p>Severity: Warning</p>
<p>Message: Missing argument 1 for CUsr_BaseData::__construct(), called in C:\usr\local\xampp\htdocs\codeigniter\system\libraries\Loader.php on line 931 and defined</p>
<p>Filename: libraries/CUsr_BaseData.php</p>
<p>Line Number: 41</p>


*/
$mydbg= new CMyDebug (__CLASS__,__METHOD__);

}

-----------




and I am getting a PHP error saying that the argument of the constructor is not given
It also says that the 'calling' code in

CI's Loader.php is not passing the argument (line 931). And indeed when I look at the code
there it is not passing any arguments to my class constructor. I assume I am causing somehow CI
to go to this code path and it should go somewhere else instead.

function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
{.....

$CI =& get_instance();
if ($config !== NULL)
{
$CI->$classvar = new $name($config);
}
else
{
$CI->$classvar = new $name;
}

}


I do not have any configuration in /config folder for this library


So I am at a loss why it is happening. I checked the _$REQUEST array
and all the key-value pairs I am passing with my POST are there, the session id is there

Does CI rely on something that may be my client is not doing, or why is this happening?


Thank you in advance,
Vlad


Messages In This Thread
[Q] cannot pass arguments to __constructor with load->library - by El Forum - 04-30-2009, 10:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB