From:             squasar at eternalviper dot net
Operating system: MacOS X 10.4.2/Darwin 8.2.0
PHP version:      5.1.0RC1
PHP Bug Type:     MySQLi related
Bug description:  Can not properly subclass mysqli_stmt

Description:
------------
If mysqli_stmt is subclassed (only makes sense in PHP 5.1.0 or 
above), calling parent::__construct() results in "Fatal error: 
Can not call constructor".

Fix:
Index: ext/mysqli/mysqli_fe.c
==============================================================
=====
RCS file: /repository/php-src/ext/mysqli/mysqli_fe.c,v
retrieving revision 1.49
diff -r1.49 mysqli_fe.c
285a286
>       PHP_FALIAS(mysqli_stmt,mysqli_stmt_construct,NULL)


Reproduce code:
---------------
<?php
class my_stmt extends mysqli_stmt {
 public function __construct( $link, $query ) {
  parent::__construct( $link, $query );
 }
}
$conn = new mysqli;
$stmt = new my_stmt( $conn, "SELECT 1 FROM DUAL" );
var_dump( $stmt );
?>

Expected result:
----------------
object(my_stmt)#2 (0) {
}

Actual result:
--------------
Fatal error: Can not call constructor in - on line 4

-- 
Edit bug report at http://bugs.php.net/?id=34785&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34785&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34785&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34785&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34785&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34785&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34785&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34785&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34785&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34785&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34785&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34785&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34785&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34785&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34785&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34785&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34785&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34785&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34785&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34785&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34785&r=mysqlcfg

Reply via email to