|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-08 01:11 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 07:00:01 2025 UTC |
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} }; /* }}} */