mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-21 07:37:43 +00:00
[ext] fixed tabs
This commit is contained in:
+34
-34
@@ -78,27 +78,27 @@ ZEND_GET_MODULE(twig)
|
|||||||
|
|
||||||
int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key)
|
int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key)
|
||||||
{
|
{
|
||||||
zval temp;
|
zval temp;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (Z_TYPE_P(array) != IS_ARRAY) {
|
if (Z_TYPE_P(array) != IS_ARRAY) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Z_TYPE_P(key)) {
|
switch (Z_TYPE_P(key)) {
|
||||||
case IS_NULL:
|
case IS_NULL:
|
||||||
return zend_hash_exists(Z_ARRVAL_P(array), "", 1);
|
return zend_hash_exists(Z_ARRVAL_P(array), "", 1);
|
||||||
|
|
||||||
case IS_BOOL:
|
case IS_BOOL:
|
||||||
case IS_DOUBLE:
|
case IS_DOUBLE:
|
||||||
convert_to_long(key);
|
convert_to_long(key);
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
return zend_hash_index_exists(Z_ARRVAL_P(array), Z_LVAL_P(key));
|
return zend_hash_index_exists(Z_ARRVAL_P(array), Z_LVAL_P(key));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
convert_to_string(key);
|
convert_to_string(key);
|
||||||
return zend_symtable_exists(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1);
|
return zend_symtable_exists(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC)
|
int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC)
|
||||||
@@ -123,23 +123,23 @@ int TWIG_INSTANCE_OF_USERLAND(zval *object, char *interface TSRMLS_DC)
|
|||||||
|
|
||||||
zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC)
|
zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
if (Z_TYPE_P(object) == IS_OBJECT) {
|
if (Z_TYPE_P(object) == IS_OBJECT) {
|
||||||
SEPARATE_ARG_IF_REF(offset);
|
SEPARATE_ARG_IF_REF(offset);
|
||||||
zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
|
zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
|
||||||
|
|
||||||
zval_ptr_dtor(&offset);
|
zval_ptr_dtor(&offset);
|
||||||
|
|
||||||
if (!retval) {
|
if (!retval) {
|
||||||
if (!EG(exception)) {
|
if (!EG(exception)) {
|
||||||
zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
|
zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -758,13 +758,13 @@ PHP_FUNCTION(twig_template_get_attributes)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the item to a string
|
// convert the item to a string
|
||||||
ztmpitem = *zitem;
|
ztmpitem = *zitem;
|
||||||
zval_copy_ctor(&ztmpitem);
|
zval_copy_ctor(&ztmpitem);
|
||||||
convert_to_string(&ztmpitem);
|
convert_to_string(&ztmpitem);
|
||||||
item_len = Z_STRLEN(ztmpitem);
|
item_len = Z_STRLEN(ztmpitem);
|
||||||
item = estrndup(Z_STRVAL(ztmpitem), item_len);
|
item = estrndup(Z_STRVAL(ztmpitem), item_len);
|
||||||
zval_dtor(&ztmpitem);
|
zval_dtor(&ztmpitem);
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = "any";
|
type = "any";
|
||||||
|
|||||||
Reference in New Issue
Block a user