Deleted Added
full compact
zend_API.c (2ca2dc0b) zend_API.c (345e0255)
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |

--- 1394 unchanged lines hidden (view full) ---

1403 if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)) && fptr->common.num_args != 0) {
1404 zend_error(error_type, "Destuctor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME);
1405 } else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) && fptr->common.num_args != 0) {
1406 zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME);
1407 } else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) && fptr->common.num_args != 1) {
1408 zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME);
1409 } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && fptr->common.num_args != 2) {
1410 zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME);
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |

--- 1394 unchanged lines hidden (view full) ---

1403 if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)) && fptr->common.num_args != 0) {
1404 zend_error(error_type, "Destuctor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME);
1405 } else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) && fptr->common.num_args != 0) {
1406 zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME);
1407 } else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) && fptr->common.num_args != 1) {
1408 zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME);
1409 } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && fptr->common.num_args != 2) {
1410 zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME);
1411 } else if (name_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) && fptr->common.num_args != 1) {
1412 zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME);
1413 } else if (name_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) && fptr->common.num_args != 1) {
1414 zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME);
1411 } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && fptr->common.num_args != 2) {
1412 zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME);
1413 }
1414}
1415
1416/* registers all functions in *library_functions in the function hash */
1417ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
1418{
1419 zend_function_entry *ptr = functions;
1420 zend_function function, *reg_function;
1421 zend_internal_function *internal_function = (zend_internal_function *)&function;
1422 int count=0, unload=0;
1423 HashTable *target_function_table = function_table;
1424 int error_type;
1415 } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && fptr->common.num_args != 2) {
1416 zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME);
1417 }
1418}
1419
1420/* registers all functions in *library_functions in the function hash */
1421ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
1422{
1423 zend_function_entry *ptr = functions;
1424 zend_function function, *reg_function;
1425 zend_internal_function *internal_function = (zend_internal_function *)&function;
1426 int count=0, unload=0;
1427 HashTable *target_function_table = function_table;
1428 int error_type;
1425 zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__call = NULL;
1429 zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL;
1426 char *lowercase_name;
1427 int fname_len;
1428 char *lc_class_name;
1429 int class_name_len;
1430
1431 if (type==MODULE_PERSISTENT) {
1432 error_type = E_CORE_WARNING;
1433 } else {

--- 90 unchanged lines hidden (view full) ---

1524 } else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
1525 clone = reg_function;
1526 } else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) {
1527 __call = reg_function;
1528 } else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) {
1529 __get = reg_function;
1530 } else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) {
1531 __set = reg_function;
1430 char *lowercase_name;
1431 int fname_len;
1432 char *lc_class_name;
1433 int class_name_len;
1434
1435 if (type==MODULE_PERSISTENT) {
1436 error_type = E_CORE_WARNING;
1437 } else {

--- 90 unchanged lines hidden (view full) ---

1528 } else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
1529 clone = reg_function;
1530 } else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) {
1531 __call = reg_function;
1532 } else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) {
1533 __get = reg_function;
1534 } else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) {
1535 __set = reg_function;
1536 } else if ((fname_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME))) {
1537 __unset = reg_function;
1538 } else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME))) {
1539 __isset = reg_function;
1532 } else {
1533 reg_function = NULL;
1534 }
1535 if (reg_function) {
1536 zend_check_magic_method_implementation(scope, reg_function, error_type TSRMLS_CC);
1537 }
1538 }
1539 ptr++;

--- 15 unchanged lines hidden (view full) ---

1555 }
1556 if (scope) {
1557 scope->constructor = ctor;
1558 scope->destructor = dtor;
1559 scope->clone = clone;
1560 scope->__call = __call;
1561 scope->__get = __get;
1562 scope->__set = __set;
1540 } else {
1541 reg_function = NULL;
1542 }
1543 if (reg_function) {
1544 zend_check_magic_method_implementation(scope, reg_function, error_type TSRMLS_CC);
1545 }
1546 }
1547 ptr++;

--- 15 unchanged lines hidden (view full) ---

1563 }
1564 if (scope) {
1565 scope->constructor = ctor;
1566 scope->destructor = dtor;
1567 scope->clone = clone;
1568 scope->__call = __call;
1569 scope->__get = __get;
1570 scope->__set = __set;
1571 scope->__unset = __unset;
1572 scope->__isset = __isset;
1563 if (ctor) {
1564 ctor->common.fn_flags |= ZEND_ACC_CTOR;
1565 if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
1566 zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
1567 }
1568 ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1569 }
1570 if (dtor) {

--- 23 unchanged lines hidden (view full) ---

1594 __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1595 }
1596 if (__set) {
1597 if (__set->common.fn_flags & ZEND_ACC_STATIC) {
1598 zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
1599 }
1600 __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1601 }
1573 if (ctor) {
1574 ctor->common.fn_flags |= ZEND_ACC_CTOR;
1575 if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
1576 zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
1577 }
1578 ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1579 }
1580 if (dtor) {

--- 23 unchanged lines hidden (view full) ---

1604 __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1605 }
1606 if (__set) {
1607 if (__set->common.fn_flags & ZEND_ACC_STATIC) {
1608 zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
1609 }
1610 __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1611 }
1612 if (__unset) {
1613 if (__unset->common.fn_flags & ZEND_ACC_STATIC) {
1614 zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __unset->common.function_name);
1615 }
1616 __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1617 }
1618 if (__isset) {
1619 if (__isset->common.fn_flags & ZEND_ACC_STATIC) {
1620 zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __isset->common.function_name);
1621 }
1622 __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
1623 }
1602 efree(lc_class_name);
1603 }
1604 return SUCCESS;
1605}
1606
1607/* count=-1 means erase all functions, otherwise,
1608 * erase the first count functions
1609 */

--- 719 unchanged lines hidden ---
1624 efree(lc_class_name);
1625 }
1626 return SUCCESS;
1627}
1628
1629/* count=-1 means erase all functions, otherwise,
1630 * erase the first count functions
1631 */

--- 719 unchanged lines hidden ---