public static void UndeclaredStaticProperty(string className, string fieldName) { PhpException.Throw(PhpError.Error, CoreResources.GetString("undeclared_static_property_accessed", className, fieldName)); }
public static void StaticPropertyUnset(string className, string fieldName) { PhpException.Throw(PhpError.Error, CoreResources.GetString("static_property_unset", className, fieldName)); }
protected override PhpReference /*!*/ GetArrayItemRefOverride(string key) { PhpException.VariableMisusedAsArray(obj, true); return(new PhpReference()); }
public static void ThisUsedOutOfObjectContext() { PhpException.Throw(PhpError.Error, CoreResources.GetString("this_used_out_of_object")); }
public static void MethodNotAccessible(string className, string methodName, string context, bool isProtected) { PhpException.Throw(PhpError.Error, CoreResources.GetString( isProtected ? "protected_method_called" : "private_method_called", className, methodName, context)); }
public static void NoSuitableOverload(string className, string /*!*/ methodName) { PhpException.Throw(PhpError.Error, CoreResources.GetString( (className != null) ? "no_suitable_method_overload" : "no_suitable_function_overload", className, methodName)); }
protected override DObject EnsureItemIsObjectOverride(object key, ScriptContext /*!*/ context) { // error (postponed error, which cannot be reported by the previous operator): PhpException.VariableMisusedAsObject(obj, false); return(null); }
public static void ConstantNotAccessible(string className, string constName, string context, bool isProtected) { PhpException.Throw(PhpError.Error, CoreResources.GetString( isProtected ? "protected_constant_accessed" : "private_constant_accessed", className, constName, context)); }
protected override PhpArray EnsureItemIsArrayOverride(object key) { // error (postponed error, which cannot be reported by the previous operator): PhpException.VariableMisusedAsArray(obj, false); return(null); }
protected override PhpArray EnsureItemIsArrayOverride() { PhpException.VariableMisusedAsArray(obj, false); return(null); }
protected override void SetArrayItemRefOverride(object key, PhpReference value) { PhpException.VariableMisusedAsArray(obj, true); }
protected override void SetArrayItemOverride(string key, object value) { PhpException.VariableMisusedAsArray(obj, true); }
protected override void SetArrayItemOverride(object value) { PhpException.VariableMisusedAsArray(obj, false); }
public static void UndefinedMethodCalled(string className, string methodName) { PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_method_called", className, methodName)); }
protected override DObject EnsureItemIsObjectOverride(ScriptContext /*!*/ context) { PhpException.VariableMisusedAsObject(obj, false); return(null); }
public static void AbstractMethodCalled(string className, string methodName) { PhpException.Throw(PhpError.Error, CoreResources.GetString("abstract_method_called", className, methodName)); }
/// <summary> /// Sets new session name. /// </summary> /// <param name="request">Valid request context.</param> /// <param name="name">New session name.</param> /// <returns>Whether session name was changed successfully.</returns> public virtual bool SetSessionName(RequestContext /*!*/ request, string name) { PhpException.FunctionNotSupported(PhpError.Notice); return(false); }
public static void PropertyNotAccessible(string className, string fieldName, string context, bool isProtected) { PhpException.Throw(PhpError.Error, CoreResources.GetString( isProtected ? "protected_property_accessed" : "private_property_accessed", className, fieldName, context)); }
/// <summary> /// Returns names and values of properties whose names have been returned by <c>__sleep</c>. /// </summary> /// <param name="instance">The instance being serialized.</param> /// <param name="sleepResult">The array returned by <c>__sleep</c>.</param> /// <param name="context">Current <see cref="ScriptContext"/>.</param> /// <returns>Name-value pairs. Names are properly formatted for serialization.</returns> /// <exception cref="PhpException">Property of the name returned from <c>__sleep</c> does not exist.</exception> /// <remarks> /// This method returns exactly <paramref name="sleepResult"/>'s <see cref="PhpHashtable.Count"/> items. /// </remarks> public static IEnumerable <KeyValuePair <string, object> > EnumerateSerializableProperties( DObject /*!*/ instance, PhpArray /*!*/ sleepResult, ScriptContext /*!*/ context) { foreach (object item in sleepResult.Values) { PhpMemberAttributes visibility; string name = PHP.Core.Convert.ObjectToString(item); string declaring_type_name; string property_name = ParsePropertyName(name, out declaring_type_name, out visibility); DTypeDesc declarer; if (declaring_type_name == null) { declarer = instance.TypeDesc; } else { declarer = context.ResolveType(declaring_type_name); if (declarer == null) { // property name refers to an unknown class -> value will be null yield return(new KeyValuePair <string, object>(name, null)); continue; } } // obtain the property desc and decorate the prop name according to its visibility and declaring class DPropertyDesc property; if (instance.TypeDesc.GetProperty(new VariableName(property_name), declarer, out property) == GetMemberResult.OK && !property.IsStatic) { if ((Enums.VisibilityEquals(visibility, property.MemberAttributes) && visibility != PhpMemberAttributes.Public) || (visibility == PhpMemberAttributes.Private && declarer != property.DeclaringType)) { // if certain conditions are met, serialize the property as null // (this is to precisely mimic the PHP behavior) yield return(new KeyValuePair <string, object>(name, null)); continue; } name = FormatPropertyName(property, property_name); } else { property = null; } // obtain the property value object val = null; if (property != null) { val = property.Get(instance); } else if (instance.RuntimeFields == null || !instance.RuntimeFields.TryGetValue(name, out val)) { // this is new in PHP 5.1 PhpException.Throw(PhpError.Notice, CoreResources.GetString("sleep_returned_bad_field", name)); } yield return(new KeyValuePair <string, object>(name, val)); } }
public static void CannotInstantiateType(string typeName, bool isInterface) { PhpException.Throw(PhpError.Error, CoreResources.GetString( isInterface ? "interface_instantiated" : "abstract_class_instantiated", typeName)); }
public static void UnsupportedOperandTypes() { PhpException.Throw(PhpError.Error, CoreResources.GetString("unsupported_operand_types")); }
public static void PropertyTypeMismatch(string /*!*/ className, string /*!*/ propertyName) { PhpException.Throw(PhpError.Error, CoreResources.GetString("property_type_mismatch", className, propertyName)); }
/// <summary> /// Throws an error because <B>[]</B> cannot be used in read context. /// </summary> public override object Get(object var, ScriptContext context, DTypeDesc caller) { PhpException.Throw(PhpError.Error, CoreResources.operator_array_access_used_for_reading); return(null); }