ID:               34785
 User updated by:  squasar at eternalviper dot net
 Reported By:      squasar at eternalviper dot net
 Status:           Open
 Bug Type:         MySQLi related
 Operating System: MacOS X 10.4.2/Darwin 8.2.0
 PHP Version:      5.1.0RC1
 New Comment:

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}
 };
 /* }}} */


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to