typedef void (*zend_object_write_dimension_t)(zend_object *object, zval *offset, zval *value);
-/* Used to create pointer to the property of the object, for future direct r/w access */
+/* Used to create pointer to the property of the object, for future direct r/w access.
+ * May return one of:
+ * * A zval pointer, without incrementing the reference count.
+ * * &EG(error_zval), if an exception has been thrown.
+ * * NULL, if acquiring a direct pointer is not possible.
+ * In this case, the VM will fall back to using read_property and write_property.
+ */
typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_string *member, int type, void **cache_slot);
/* Used to check if a property of the object exists */
* and could also be E_PARSE, but we use this only during parsing
* and this is during runtime.
*/
- zend_throw_error(NULL, "Cannot create unnamed attribute");
+ zend_throw_error(NULL, "Cannot append to an attribute list");
return &EG(error_zval);
}
goto long_dim;
}
if (!Z_STRLEN_P(member)) {
- php_error_docref(NULL, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
+ zend_value_error("Cannot create %s with an empty name", attribs ? "attribute" : "element");
if (member == &tmp_zv) {
zval_ptr_dtor_str(&tmp_zv);
}
* and could also be E_PARSE, but we use this only during parsing
* and this is during runtime.
*/
- zend_throw_error(NULL, "Cannot create unnamed attribute");
+ zend_value_error("Cannot append to an attribute list");
return &EG(error_zval);
}
if (attribs && !node && sxe->iter.type == SXE_ITER_ELEMENT) {
if (Z_OBJCE_P(value) == sxe_class_entry) {
zval zval_copy;
if (sxe_object_cast_ex(Z_OBJ_P(value), &zval_copy, IS_STRING) == FAILURE) {
- zend_error(E_ERROR, "Unable to cast node to string");
- /* FIXME: Should not be fatal */
+ zend_throw_error(NULL, "Unable to cast node to string");
+ return &EG(error_zval);
}
value_str = Z_STR(zval_copy);
if (member == &tmp_zv) {
zval_ptr_dtor_str(&tmp_zv);
}
- zend_error(E_WARNING, "It is not yet possible to assign complex types to %s", attribs ? "attributes" : "properties");
+ zend_type_error("It's not possible to assign a complex type to %s, %s given", attribs ? "attributes" : "properties", zend_zval_type_name(value));
return &EG(error_zval);
}
}
}
ZVAL_STR(&member, zname);
if (sxe_prop_dim_write(object, &member, NULL, 1, 0, &node) == &EG(error_zval)) {
- return NULL;
+ return &EG(error_zval);
}
type = SXE_ITER_NONE;
name = NULL;
}
if (qname_len == 0) {
- php_error_docref(NULL, E_WARNING, "Element name is required");
- return;
+ zend_argument_value_error(1, "cannot be empty");
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
}
if (qname_len == 0) {
- php_error_docref(NULL, E_WARNING, "Attribute name is required");
- return;
+ zend_argument_value_error(1, "cannot be empty");
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
}
if (ZEND_LONG_EXCEEDS_INT(options)) {
- php_error_docref(NULL, E_WARNING, "Invalid options");
- RETURN_FALSE;
+ zend_argument_value_error(3, "is too large");
+ RETURN_THROWS();
}
docp = xmlReadFile(filename, NULL, (int)options);
}
if (ZEND_SIZE_T_INT_OVFL(data_len)) {
- php_error_docref(NULL, E_WARNING, "Data is too long");
- RETURN_FALSE;
+ zend_argument_value_error(1, "is too long");
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(ns_len)) {
- php_error_docref(NULL, E_WARNING, "Namespace is too long");
- RETURN_FALSE;
+ zend_argument_value_error(4, "is too long");
+ RETURN_THROWS();
}
if (ZEND_LONG_EXCEEDS_INT(options)) {
- php_error_docref(NULL, E_WARNING, "Invalid options");
- RETURN_FALSE;
+ zend_argument_value_error(3, "is too large");
+ RETURN_THROWS();
}
docp = xmlReadMemory(data, (int)data_len, NULL, NULL, (int)options);