#34785 [Asn->Csd]: Can not properly subclass mysqli_stmt
| From: | georg@php.net | Date: | Sat, 08 Oct 2005 15:09:22 +0000 |
| Subject: | #34785 [Asn->Csd]: Can not properly subclass mysqli_stmt | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86252@lists.php.net to get a copy of this message | ||
ID: 34785
Updated by: georg@php.net
Reported By: squasar at eternalviper dot net
-Status: Assigned
+Status: Closed
Bug Type: MySQLi related
Operating System: *
PHP Version: 5CVS-2005-10-08 (cvs)
Assigned To: georg
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-10-08 01:38:17] sniper@php.net
Georg, can you check this out please?
------------------------------------------------------------------------
[2005-10-08 01:13:31] squasar at eternalviper dot net
Here's the udiff for the fix:
Index: ext/mysqli/mysqli_fe.c
============================================================
=======
RCS file: /repository/php-src/ext/mysqli/mysqli_fe.c,v
retrieving revision 1.49
diff -u -r1.49 mysqli_fe.c
--- ext/mysqli/mysqli_fe.c 3 Aug 2005 14:07:30 -0000
1.49
+++ ext/mysqli/mysqli_fe.c 7 Oct 2005 23:12:05 -0000
@@ -283,6 +283,7 @@
PHP_FALIAS(reset,mysqli_stmt_reset,NULL)
PHP_FALIAS(prepare,mysqli_stmt_prepare, NULL)
PHP_FALIAS
(store_result,mysqli_stmt_store_result,NULL)
+ PHP_FALIAS(mysqli_stmt,mysqli_stmt_construct,NULL)
{NULL, NULL, NULL}
};
/* }}} */
------------------------------------------------------------------------
[2005-10-08 01:11:32] squasar at eternalviper dot net
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 this bug report at http://bugs.php.net/?id=34785&edit=1