Skip to content

RFC: Constructor behaviour of internal classes #1178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Prev Previous commit
Next Next commit
Reverted change to function name and added note of why it is differen…
…t from the class it is actually changing.
  • Loading branch information
Danack committed Mar 15, 2015
commit 6b232643e5c3b8f20a968e040b7c75695608a15b
7 changes: 4 additions & 3 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ ZEND_END_ARG_INFO()
RETURN_FALSE; \
} \

static PHP_FUNCTION(dbrow_constructor) /* {{{ */
//The class is called PDORow in userland, it is called PDOStatement in the manual.
static PHP_FUNCTION(dbstmt_constructor) /* {{{ */
{
// php_error_docref(NULL, E_ERROR, "You should not create a PDOStatement manually");
zend_throw_exception_ex(php_pdo_get_exception(), 0, "You may not create a PDORow manually");
}
/* }}} */
Expand Down Expand Up @@ -2641,7 +2641,8 @@ static union _zend_function *row_get_ctor(zend_object *object)
ctor.type = ZEND_INTERNAL_FUNCTION;
ctor.function_name = zend_string_init("__construct", sizeof("__construct") - 1, 0);
ctor.scope = pdo_row_ce;
ctor.handler = ZEND_FN(dbrow_constructor);
//The class is called PDORow in userland, it is called PDOStatement in the manual.
ctor.handler = ZEND_FN(dbstmt_constructor);
ctor.fn_flags = ZEND_ACC_PUBLIC;

return (union _zend_function*)&ctor;
Expand Down