[PHP-DEV] Bug #10790 Updated: Cannot redeclare function/class from included file

2001-05-13 Thread christian . huff

ID: 10790
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Scripting Engine problem
Operating system: Win2k,IIS5
PHP Version: 4.0.5
Description: Cannot redeclare function/class from included file

Shall I post my configuration files? Just in case it might help with the 
reconstruction of that error...

Previous Comments:
---

[2001-05-10 12:25:26] [EMAIL PROTECTED]
Using include_once() does not make any difference.

---

[2001-05-10 11:50:27] [EMAIL PROTECTED]
What if you use include_once() instead of include() ?
Does it make any difference?

--Jani


---

[2001-05-10 10:57:59] [EMAIL PROTECTED]
Now this is what happens: I include a .php-file for database access via ODBC. While I 
was trying to make things 'easier', I stumbled across a problem: Classes and functions 
declared in an included file seem to work at first glance, but when reloaded, the 
declaration fails: 

Fatal error: Cannot redeclare class odbc_obj in E:Web-ProjekteTestodbc.php on line 5

If I move the declaration of the class into the index.php, the script complains about 
being unable to redeclare connexecute(). Reloading again after the error, the script 
works, but thereafter, it refuses again and so on and on.


--- odbc.php ---

$conn_id = odbc_pconnect (TEST, , );
global $conn_id;

class odbc_obj {
var $result;
  
function set_rs ($res) {
$this-result = $res;
}

function out ($eingabe) {
$retval = odbc_result($this-result,$eingabe);
return $retval;
}
}

function ConnExecute($sql)
{
  global $conn_id,$did;
  $did = odbc_exec ($conn_id, $sql);

  $retval = new odbc_obj;
  $retval-set_rs ($did);
  return $retval;
}

--- index.php ---
include(odbc.php);

$sql = some sql query string;
$rs = ConnExecute($sql);


---


Full Bug description available at: http://bugs.php.net/?id=10790


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #10790: Cannot redeclare function/class from included file

2001-05-10 Thread christian . huff

From: [EMAIL PROTECTED]
Operating system: Win2k,IIS5
PHP version:  4.0.5
PHP Bug Type: Scripting Engine problem
Bug description:  Cannot redeclare function/class from included file

Now this is what happens: I include a .php-file for database access via ODBC. While I 
was trying to make things 'easier', I stumbled across a problem: Classes and functions 
declared in an included file seem to work at first glance, but when reloaded, the 
declaration fails: 

Fatal error: Cannot redeclare class odbc_obj in E:\Web-Projekte\Test\odbc.php on line 5

If I move the declaration of the class into the index.php, the script complains about 
being unable to redeclare connexecute(). Reloading again after the error, the script 
works, but thereafter, it refuses again and so on and on.


--- odbc.php ---

$conn_id = odbc_pconnect (TEST, , );
global $conn_id;

class odbc_obj {
var $result;
  
function set_rs ($res) {
$this-result = $res;
}

function out ($eingabe) {
$retval = odbc_result($this-result,$eingabe);
return $retval;
}
}

function ConnExecute($sql)
{
  global $conn_id,$did;
  $did = odbc_exec ($conn_id, $sql);

  $retval = new odbc_obj;
  $retval-set_rs ($did);
  return $retval;
}

--- index.php ---
include(odbc.php);

$sql = some sql query string;
$rs = ConnExecute($sql);



-- 
Edit Bug report at: http://bugs.php.net/?id=10790edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #10790 Updated: Cannot redeclare function/class from included file

2001-05-10 Thread christian . huff

ID: 10790
User Update by: [EMAIL PROTECTED]
Old-Status: Feedback
Status: Open
Bug Type: Scripting Engine problem
Operating system: Win2k,IIS5
PHP Version: 4.0.5
Description: Cannot redeclare function/class from included file

Using include_once() does not make any difference.

Previous Comments:
---

[2001-05-10 11:50:27] [EMAIL PROTECTED]
What if you use include_once() instead of include() ?
Does it make any difference?

--Jani


---

[2001-05-10 10:57:59] [EMAIL PROTECTED]
Now this is what happens: I include a .php-file for database access via ODBC. While I 
was trying to make things 'easier', I stumbled across a problem: Classes and functions 
declared in an included file seem to work at first glance, but when reloaded, the 
declaration fails: 

Fatal error: Cannot redeclare class odbc_obj in E:Web-ProjekteTestodbc.php on line 5

If I move the declaration of the class into the index.php, the script complains about 
being unable to redeclare connexecute(). Reloading again after the error, the script 
works, but thereafter, it refuses again and so on and on.


--- odbc.php ---

$conn_id = odbc_pconnect (TEST, , );
global $conn_id;

class odbc_obj {
var $result;
  
function set_rs ($res) {
$this-result = $res;
}

function out ($eingabe) {
$retval = odbc_result($this-result,$eingabe);
return $retval;
}
}

function ConnExecute($sql)
{
  global $conn_id,$did;
  $did = odbc_exec ($conn_id, $sql);

  $retval = new odbc_obj;
  $retval-set_rs ($did);
  return $retval;
}

--- index.php ---
include(odbc.php);

$sql = some sql query string;
$rs = ConnExecute($sql);


---


Full Bug description available at: http://bugs.php.net/?id=10790


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]