Documentation
¶
Index ¶
- Constants
- Variables
- func AddConstantExpressionFrame(ex *phperr.PhpThrow, ctx phpv.Context)
- func AddConstantExpressionFrameAt(ex *phperr.PhpThrow, loc *phpv.Loc)
- func CheckStaticPropIndirectSetVisibility(ctx phpv.Context, c *ZClass, name phpv.ZString) string
- func CheckStaticPropSetVisibility(ctx phpv.Context, c *ZClass, name phpv.ZString) string
- func CheckStaticPropVisibility(ctx phpv.Context, c *ZClass, name phpv.ZString) string
- func CollapseGeneratorRef(v *phpv.ZVal)
- func CopyMethods(src map[phpv.ZString]*phpv.ZClassMethod) map[phpv.ZString]*phpv.ZClassMethod
- func FindIssetDimHandler(cls phpv.ZClass) func(phpv.Context, phpv.ZObject, *phpv.ZVal) (bool, error)
- func FindPropHandlers(cls phpv.ZClass) *phpv.ZClassHandlers
- func FindReadDimHandler(cls phpv.ZClass) func(phpv.Context, phpv.ZObject, *phpv.ZVal) (*phpv.ZVal, error)
- func GeneratorCurrentValueRaw(state *GeneratorState) *phpv.ZVal
- func GeneratorEnsureStarted(ctx phpv.Context, obj *ZObject) error
- func GeneratorForceCloseState(ctx phpv.Context, state *GeneratorState) error
- func GeneratorYieldDelegated(ctx phpv.Context, key, value *phpv.ZVal) (*phpv.ZVal, error)
- func GeneratorYieldFrom(ctx phpv.Context, iterable *phpv.ZVal) (*phpv.ZVal, error)
- func GeneratorYieldValue(ctx phpv.Context, key, value *phpv.ZVal) (*phpv.ZVal, error)
- func GeneratorYieldsRef(o *ZObject) bool
- func GetAttributeFlags(ctx phpv.Context, class phpv.ZClass) int64
- func GetPrivatePropNameExt(class phpv.ZClass, name phpv.ZString) phpv.ZString
- func InitWeakMap()
- func InitWeakReference()
- func IsAttributeClass(class phpv.ZClass) bool
- func IsInGeneratorContext(ctx phpv.Context) bool
- func IsStaticPropAccessible(ctx phpv.Context, c *ZClass, name phpv.ZString) bool
- func NewGeneratorIterator(ctx phpv.Context, obj *ZObject) phpv.ZIterator
- func ScopeName(class phpv.ZClass) string
- func SpawnGenerator(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal) (*phpv.ZVal, error)
- func SpawnGeneratorNamed(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal, funcName string, ...) (*phpv.ZVal, error)
- func SpawnGeneratorWithOptions(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal, ...) (*phpv.ZVal, error)
- func TargetName(target int) string
- func ThrowAttrConstructError(ctx phpv.Context, attrClassName phpv.ZString, attrLoc *phpv.Loc, ...) error
- func ThrowError(ctx phpv.Context, class *ZClass, msg string) error
- func ThrowErrorAt(ctx phpv.Context, class *ZClass, msg string, loc *phpv.Loc) error
- func ThrowErrorCode(ctx phpv.Context, class *ZClass, code int, msg string) error
- func ThrowException(ctx phpv.Context, l *phpv.Loc, msg phpv.ZString, code phpv.ZInt) error
- func ThrowObject(ctx phpv.Context, v *phpv.ZVal) error
- func ValidateAttributeList(ctx phpv.Context, attrs []*phpv.ZAttribute, target int) string
- func ValidateAttributeRepeat(ctx phpv.Context, attrs []*phpv.ZAttribute) string
- func ValidateAttributeTarget(ctx phpv.Context, attr *phpv.ZAttribute, target int) string
- func ValidateInternalAttributeList(ctx phpv.Context, attrs []*phpv.ZAttribute, target int) string
- func WrapCallableWithName(c phpv.Callable, name string) phpv.Callable
- type FiberState
- type FiberStatus
- type GeneratorBodyFunc
- type GeneratorState
- type GeneratorStatus
- type GeneratorYield
- type NativeMethod
- func (m NativeMethod) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)
- func (m NativeMethod) Call(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error)
- func (m NativeMethod) GetType() phpv.ZType
- func (m NativeMethod) Name() string
- func (m NativeMethod) String() string
- func (m NativeMethod) Value() phpv.Val
- func (m NativeMethod) ZVal() *phpv.ZVal
- type NativeMethodNamed
- func (m *NativeMethodNamed) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)
- func (m *NativeMethodNamed) Call(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error)
- func (m *NativeMethodNamed) GetArgs() []*phpv.FuncArg
- func (m *NativeMethodNamed) GetType() phpv.ZType
- func (m *NativeMethodNamed) Name() string
- func (m *NativeMethodNamed) String() string
- func (m *NativeMethodNamed) Value() phpv.Val
- func (m *NativeMethodNamed) ZVal() *phpv.ZVal
- type NativeStaticMethod
- func (m NativeStaticMethod) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)
- func (m NativeStaticMethod) Call(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error)
- func (m NativeStaticMethod) GetType() phpv.ZType
- func (m NativeStaticMethod) Name() string
- func (m NativeStaticMethod) String() string
- func (m NativeStaticMethod) Value() phpv.Val
- func (m NativeStaticMethod) ZVal() *phpv.ZVal
- type SpawnGeneratorOptions
- type ZClass
- func (c *ZClass) BaseName() phpv.ZString
- func (c *ZClass) Compile(ctx phpv.Context) error
- func (c *ZClass) Dump(w io.Writer) error
- func (c *ZClass) FindDeclaredProp(name phpv.ZString) *phpv.ZClassProp
- func (c *ZClass) FindStaticProp(ctx phpv.Context, name phpv.ZString) (*phpv.ZHashTable, bool, error)
- func (c *ZClass) GetMethod(name phpv.ZString) (*phpv.ZClassMethod, bool)
- func (c *ZClass) GetMethods() map[phpv.ZString]*phpv.ZClassMethod
- func (c *ZClass) GetMethodsOrdered() []*phpv.ZClassMethod
- func (c *ZClass) GetName() phpv.ZString
- func (c *ZClass) GetParent() phpv.ZClass
- func (c *ZClass) GetProp(name phpv.ZString) (*phpv.ZClassProp, bool)
- func (c *ZClass) GetStaticProps(ctx phpv.Context) (*phpv.ZHashTable, error)
- func (c *ZClass) GetType() phpv.ZClassType
- func (c *ZClass) Handlers() *phpv.ZClassHandlers
- func (c *ZClass) Implements(class phpv.ZClass) bool
- func (c *ZClass) InstanceOf(parentClass phpv.ZClass) bool
- func (c *ZClass) IsCompoundDump()
- func (c *ZClass) NextInstanceID() int
- func (c *ZClass) ResolveConstants(ctx phpv.Context) error
- func (c *ZClass) Run(ctx phpv.Context) (*phpv.ZVal, error)
- type ZObject
- func CreateZObject(ctx phpv.Context, c phpv.ZClass) (*ZObject, error)
- func NewZObject(ctx phpv.Context, c phpv.ZClass, args ...*phpv.ZVal) (*ZObject, error)
- func NewZObjectEnum(ctx phpv.Context, c phpv.ZClass) *ZObject
- func NewZObjectOpaque(ctx phpv.Context, c phpv.ZClass, v interface{}) (*ZObject, error)
- func SpawnException(ctx phpv.Context, l *phpv.Loc, msg phpv.ZString, code phpv.ZInt, prev *ZObject) (*ZObject, error)
- func (o *ZObject) AllowsDynamicProperties() bool
- func (z *ZObject) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)
- func (z *ZObject) CallDestructor(ctx phpv.Context) error
- func (z *ZObject) CallImplicitDestructor(ctx phpv.Context) error
- func (o *ZObject) CallMethod(ctx phpv.Context, methodName string, args ...*phpv.ZVal) (*phpv.ZVal, error)
- func (o *ZObject) CallMethodInternal(ctx phpv.Context, methodName string, args ...*phpv.ZVal) (*phpv.ZVal, error)
- func (z *ZObject) Clone(ctx phpv.Context) (phpv.ZObject, error)
- func (a *ZObject) Count(ctx phpv.Context) phpv.ZInt
- func (z *ZObject) DecRef(ctx phpv.Context) error
- func (z *ZObject) DecRefImplicit(ctx phpv.Context) error
- func (z *ZObject) DecrJsonApplyCount()
- func (z *ZObject) DecrSerializeApplyCount()
- func (o *ZObject) EnforcePropertyType(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp, value *phpv.ZVal) (*phpv.ZVal, error)
- func (o *ZObject) FindDeclaredProp(keyStr phpv.ZString) *phpv.ZClassProp
- func (a *ZObject) GetClass() phpv.ZClass
- func (o *ZObject) GetDeclClassName(p *phpv.ZClassProp) phpv.ZString
- func (z *ZObject) GetKin(className string) phpv.ZObject
- func (o *ZObject) GetMethod(method phpv.ZString, ctx phpv.Context) (phpv.Callable, error)
- func (z *ZObject) GetObjID() int
- func (z *ZObject) GetObjectID() int
- func (z *ZObject) GetOpaque(c phpv.ZClass) interface{}
- func (z *ZObject) GetOpaqueByName(name string) interface{}
- func (z *ZObject) GetParent() phpv.ZObject
- func (o *ZObject) GetPropValue(p *phpv.ZClassProp) *phpv.ZVal
- func (o *ZObject) GetPropValueOrHook(ctx phpv.Context, p *phpv.ZClassProp) (*phpv.ZVal, bool, error)
- func (o *ZObject) GetProxyInstance() *ZObject
- func (z *ZObject) GetType() phpv.ZType
- func (o *ZObject) HasProp(ctx phpv.Context, key phpv.Val) (bool, error)
- func (o *ZObject) HasPropValue(p *phpv.ZClassProp) bool
- func (a *ZObject) HashTable() *phpv.ZHashTable
- func (z *ZObject) IncRef()
- func (z *ZObject) IncrJsonApplyCount() int32
- func (z *ZObject) IncrSerializeApplyCount() int32
- func (z *ZObject) IsDestructed() bool
- func (o *ZObject) IsLazy() bool
- func (o *ZObject) IsLazyGhost() bool
- func (o *ZObject) IsLazyInitialized() bool
- func (o *ZObject) IsLazyProxy() bool
- func (o *ZObject) IsPropertyHidden(ctx phpv.Context, keyStr phpv.ZString) bool
- func (o *ZObject) IsPropertySkippedForLazy(propName phpv.ZString) bool
- func (o *ZObject) IsReadonlyProperty(keyStr phpv.ZString) bool
- func (o *ZObject) IsReadonlyPropertyInitialized(keyStr phpv.ZString) bool
- func (o *ZObject) IterProps(ctx phpv.Context) iter.Seq[*phpv.ZClassProp]
- func (o *ZObject) MakeLazyGhost(initializer *phpv.ZVal, options int)
- func (o *ZObject) MakeLazyProxy(factory *phpv.ZVal, options int)
- func (o *ZObject) MarkLazyAsInitialized(ctx phpv.Context)
- func (o *ZObject) MarkReadonlyInit(key phpv.ZString)
- func (o *ZObject) MarkReadonlyInitialized(keyStr phpv.ZString)
- func (o *ZObject) NewIterator() phpv.ZIterator
- func (o *ZObject) NewIteratorInScope(scope phpv.ZClass) phpv.ZIterator
- func (o *ZObject) ObjectGet(ctx phpv.Context, key phpv.Val) (*phpv.ZVal, error)
- func (o *ZObject) ObjectGetQuiet(ctx phpv.Context, key phpv.Val) (*phpv.ZVal, bool, error)
- func (o *ZObject) ObjectSet(ctx phpv.Context, key phpv.Val, value *phpv.ZVal) error
- func (o *ZObject) OffsetCheck(ctx phpv.Context, key phpv.Val) (*phpv.ZVal, bool, error)
- func (o *ZObject) OffsetExists(ctx phpv.Context, key phpv.Val) (bool, error)
- func (o *ZObject) OffsetGet(ctx phpv.Context, key phpv.Val) (*phpv.ZVal, error)
- func (o *ZObject) OffsetGetReturnsByRef() bool
- func (o *ZObject) OffsetSet(ctx phpv.Context, key phpv.Val, value *phpv.ZVal) error
- func (o *ZObject) OffsetUnset(ctx phpv.Context, key phpv.Val) error
- func (o *ZObject) ReadParentBacking(ctx phpv.Context, keyStr phpv.ZString, declClass *ZClass) (*phpv.ZVal, error)
- func (z *ZObject) RefCount() int32
- func (o *ZObject) ResolveProxy() *ZObject
- func (o *ZObject) RunGetHookForExport(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp) (*phpv.ZVal, error)
- func (o *ZObject) RunParentGetHook(ctx phpv.Context, keyStr phpv.ZString, hook phpv.Runnable, declClass *ZClass) (*phpv.ZVal, error)
- func (o *ZObject) RunParentSetHook(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp, value *phpv.ZVal, ...) error
- func (z *ZObject) SetDestructed(v bool)
- func (z *ZObject) SetObjectID(id int)
- func (z *ZObject) SetOpaque(c phpv.ZClass, v interface{})
- func (o *ZObject) SetPropValueDirect(prop *phpv.ZClassProp, value *phpv.ZVal) error
- func (o *ZObject) SetRawValueWithoutLazyInit(ctx phpv.Context, propName phpv.ZString, value *phpv.ZVal)
- func (o *ZObject) SkipLazyProperty(ctx phpv.Context, propName phpv.ZString)
- func (o *ZObject) SkipsInitOnSerialize() bool
- func (a *ZObject) String() string
- func (o *ZObject) TriggerLazyInit(ctx phpv.Context) error
- func (o *ZObject) TriggerLazyInitForProp(ctx phpv.Context, propName phpv.ZString) error
- func (o *ZObject) UnmarkReadonlyInit(keyStr phpv.ZString)
- func (z *ZObject) Unwrap() phpv.ZObject
- func (a *ZObject) Value() phpv.Val
- func (o *ZObject) WriteParentBacking(ctx phpv.Context, keyStr phpv.ZString, value *phpv.ZVal, declClass *ZClass)
- func (z *ZObject) ZVal() *phpv.ZVal
Constants ¶
const ( AttributeTARGET_CLASS = 1 AttributeTARGET_FUNCTION = 2 AttributeTARGET_METHOD = 4 AttributeTARGET_PROPERTY = 8 AttributeTARGET_CLASS_CONSTANT = 16 AttributeTARGET_PARAMETER = 32 AttributeTARGET_CONSTANT = 64 AttributeTARGET_ALL = 127 AttributeIS_REPEATABLE = 128 )
PHP 8.5 Attribute class constants
const ( LazyNone = 0 // Not a lazy object LazyGhostUninitialized = 1 // Lazy ghost, not yet initialized LazyProxyUninitialized = 2 // Lazy proxy, not yet initialized LazyGhostInitialized = 3 // Lazy ghost, initialized LazyProxyInitialized = 4 // Lazy proxy, initialized )
Lazy object state constants
const ( LazySkipInitOnSerialize = 8 // Skip initialization during serialize() LazySkipDestructor = 16 // Skip __destruct when resetting to lazy )
Lazy object option flags (matching PHP 8.4 ReflectionClass constants)
Variables ¶
var ArrayAccess = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "ArrayAccess", Methods: map[phpv.ZString]*phpv.ZClassMethod{ "offsetexists": {Name: "offsetExists", Modifiers: phpv.ZAttrPublic, Empty: true}, "offsetget": {Name: "offsetGet", Modifiers: phpv.ZAttrPublic, Empty: true}, "offsetset": {Name: "offsetSet", Modifiers: phpv.ZAttrPublic, Empty: true}, "offsetunset": {Name: "offsetUnset", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> class ArrayAccess
var BackedEnum = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "BackedEnum", Extends: UnitEnum, }
> interface BackedEnum extends UnitEnum Backed enums (with int or string backing type) implicitly implement BackedEnum
FiberResolveCallable is set by the core package to resolve a ZVal into a Callable. This avoids an import cycle between phpobj and core.
var IncompleteClass = &ZClass{ Name: "__PHP_Incomplete_Class", H: &phpv.ZClassHandlers{ HandlePropGetEager: true, HandlePropSet: func(ctx phpv.Context, o phpv.ZObject, key phpv.ZString, value *phpv.ZVal) (bool, error) { if key == "__PHP_Incomplete_Class_Name" { return false, nil } cn := incompleteClassName(o) return true, ThrowError(ctx, Error, fmt.Sprintf( "The script tried to modify a property on an incomplete object. Please ensure that the class definition \"%s\" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition", cn)) }, HandlePropGet: func(ctx phpv.Context, o phpv.ZObject, key phpv.ZString) (*phpv.ZVal, error) { if key == "__PHP_Incomplete_Class_Name" { return nil, nil } cn := incompleteClassName(o) funcName := incompleteClassWarnFuncName(ctx) ctx.Warn("%s(): The script tried to access a property on an incomplete object. Please ensure that the class definition \"%s\" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition", funcName, cn, logopt.NoFuncName(true)) return phpv.ZNULL.ZVal(), nil }, }, }
> class __PHP_Incomplete_Class
var Iterator = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Iterator", Extends: Traversable, Methods: map[phpv.ZString]*phpv.ZClassMethod{ "current": {Name: "current", Modifiers: phpv.ZAttrPublic, Empty: true}, "key": {Name: "key", Modifiers: phpv.ZAttrPublic, Empty: true}, "next": {Name: "next", Modifiers: phpv.ZAttrPublic, Empty: true}, "rewind": {Name: "rewind", Modifiers: phpv.ZAttrPublic, Empty: true}, "valid": {Name: "valid", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> class Iterator
var IteratorAggregate = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "IteratorAggregate", Extends: Traversable, Methods: map[phpv.ZString]*phpv.ZClassMethod{ "getiterator": {Name: "getIterator", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> class IteratorAggregate
var Reflector = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Reflector", Extends: Stringable, Methods: map[phpv.ZString]*phpv.ZClassMethod{ "__tostring": {Name: "__toString", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> interface Reflector extends Stringable
var Serializable = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Serializable", Methods: map[phpv.ZString]*phpv.ZClassMethod{ "serialize": {Name: "serialize", Modifiers: phpv.ZAttrPublic, Empty: true}, "unserialize": {Name: "unserialize", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> class Serializable
var StdClass = &ZClass{
Name: "stdClass",
}
> class StdClass
var Stringable = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Stringable", Methods: map[phpv.ZString]*phpv.ZClassMethod{ "__tostring": {Name: "__toString", Modifiers: phpv.ZAttrPublic, Empty: true}, }, }
> interface Stringable
var Throwable = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Throwable", }
> interface Throwable
var Traversable = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "Traversable", }
> class Traversable
var UnitEnum = &ZClass{ Type: phpv.ZClassTypeInterface, Name: "UnitEnum", }
> interface UnitEnum All PHP enums implicitly implement UnitEnum
var WeakMapClass = &ZClass{Name: "WeakMap", Attr: phpv.ZClassFinal, Implementations: []*ZClass{ArrayAccess, IteratorAggregate}}
> class WeakMap
var WeakReferenceClass = &ZClass{Name: "WeakReference", Attr: phpv.ZClassFinal}
> class WeakReference
Functions ¶
func AddConstantExpressionFrame ¶
AddConstantExpressionFrame prepends a [constant expression]() frame to an exception's stack trace, matching PHP's behavior for errors during class constant expression evaluation. Uses ctx.Loc() for the frame location.
func AddConstantExpressionFrameAt ¶
AddConstantExpressionFrameAt prepends a [constant expression]() frame at the specified location. This variant is used when the caller's location needs to be captured before constant expression evaluation (which may change ctx.Loc() to the definition file).
func CheckStaticPropIndirectSetVisibility ¶
CheckStaticPropIndirectSetVisibility checks asymmetric set visibility for indirect modification of static properties (++, +=, .=, [], &$ref, etc.). Returns an error message string if violated, empty string otherwise.
func CheckStaticPropSetVisibility ¶
CheckStaticPropSetVisibility checks asymmetric set visibility for static properties. Returns an error message string if the set visibility is violated, empty string otherwise.
func CheckStaticPropVisibility ¶
CheckStaticPropVisibility checks if a static property is accessible from the current context. Returns an error message string if inaccessible, or an empty string if accessible.
func CollapseGeneratorRef ¶
CollapseGeneratorRef collapses a reference ZVal that was created during yield-by-reference iteration. When the foreach loop advances past a yielded element, the previous element's reference should be unwrapped (PHP refcount semantics: when only one location holds the reference, it's separated).
func CopyMethods ¶
func CopyMethods(src map[phpv.ZString]*phpv.ZClassMethod) map[phpv.ZString]*phpv.ZClassMethod
func FindIssetDimHandler ¶
func FindIssetDimHandler(cls phpv.ZClass) func(phpv.Context, phpv.ZObject, *phpv.ZVal) (bool, error)
FindIssetDimHandler walks up the class hierarchy looking for a HandleIssetDim handler. Returns the handler function or nil if none found.
func FindPropHandlers ¶
func FindPropHandlers(cls phpv.ZClass) *phpv.ZClassHandlers
FindPropHandlers walks up the class hierarchy looking for a class that has property access handlers defined. Returns the first non-nil ZClassHandlers that has at least one property handler, or nil if none found.
func FindReadDimHandler ¶
func FindReadDimHandler(cls phpv.ZClass) func(phpv.Context, phpv.ZObject, *phpv.ZVal) (*phpv.ZVal, error)
FindReadDimHandler walks up the class hierarchy looking for a HandleReadDim handler. Returns the handler function or nil if none found.
func GeneratorCurrentValueRaw ¶
func GeneratorCurrentValueRaw(state *GeneratorState) *phpv.ZVal
GeneratorCurrentValueRaw returns the raw currentValue from the generator state, bypassing the copy-on-write dup that callZValImpl applies to method return values. Used by CurrentMakeRef to preserve reference semantics for yield-by-reference generators.
func GeneratorEnsureStarted ¶
GeneratorEnsureStarted ensures the generator has been started (runs until the first yield). This is needed before accessing currentValue from outside the generator.
func GeneratorForceCloseState ¶
func GeneratorForceCloseState(ctx phpv.Context, state *GeneratorState) error
GeneratorForceCloseState force-closes a generator given its state directly. This is called by foreach when the loop exits while the generator is suspended.
func GeneratorYieldDelegated ¶
GeneratorYieldDelegated yields a value as part of yield-from delegation. Unlike GeneratorYieldValue, it does NOT update the outer generator's implicit key counter.
func GeneratorYieldFrom ¶
GeneratorYieldFrom delegates to a sub-iterator, yielding all its values. Returns the return value of the sub-generator (or null for non-generators).
func GeneratorYieldValue ¶
GeneratorYieldValue is called from within the generator goroutine to yield a value. It suspends the generator and returns the value sent by the caller via send().
func GeneratorYieldsRef ¶
GeneratorYieldsRef returns true if the generator was declared to yield by reference.
func GetAttributeFlags ¶
GetAttributeFlags returns the Attribute flags for a class, checking if it has the #[Attribute] attribute. Returns -1 if the class is not an attribute class.
func GetPrivatePropNameExt ¶
GetPrivatePropNameExt is the exported version of getPrivatePropName for use by other packages (e.g., the reflection extension).
func InitWeakMap ¶
func InitWeakMap()
func InitWeakReference ¶
func InitWeakReference()
func IsAttributeClass ¶
IsAttributeClass returns true if the given class has the #[Attribute] attribute.
func IsInGeneratorContext ¶
IsInGeneratorContext returns true if ctx is executing inside a generator body. This is used to suppress certain cleanups (e.g. foreach-by-ref ref collapse) that would run at the wrong time due to the generator goroutine's lifecycle.
func IsStaticPropAccessible ¶
IsStaticPropAccessible checks whether the calling context has visibility access to a static property on the given class. Returns true when the property is public, when no declaration is found (the caller will handle the "undeclared" error separately), or when the caller's class satisfies the private/protected rules.
func NewGeneratorIterator ¶
NewGeneratorIterator creates a ZIterator for a Generator ZObject.
func SpawnGenerator ¶
func SpawnGenerator(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal) (*phpv.ZVal, error)
SpawnGenerator creates a new Generator object. The caller provides a body function that will run in a goroutine. This function is the actual body execution (not the outer Call that checks isGenerator).
func SpawnGeneratorNamed ¶
func SpawnGeneratorNamed(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal, funcName string, optionalThis ...phpv.ZObject) (*phpv.ZVal, error)
SpawnGeneratorNamed is like SpawnGenerator but also sets the function name for stack traces and __debugInfo, and accepts optional $this for method generators.
func SpawnGeneratorWithOptions ¶
func SpawnGeneratorWithOptions(ctx phpv.Context, bodyFn GeneratorBodyFunc, args []*phpv.ZVal, opts SpawnGeneratorOptions) (*phpv.ZVal, error)
SpawnGeneratorWithOptions creates a new Generator object with full options.
func TargetName ¶
TargetName returns the human-readable name for an attribute target constant.
func ThrowAttrConstructError ¶
func ThrowAttrConstructError(ctx phpv.Context, attrClassName phpv.ZString, attrLoc *phpv.Loc, attrArgs []*phpv.ZVal, msg string) error
ThrowAttrConstructError throws a TypeError for an attribute constructor argument validation failure. The stack trace is rewritten to show `ClassName->__construct(args)` at the attribute declaration location, matching PHP's behavior where attributes are instantiated lazily on the first call to the decorated function/method.
func ThrowError ¶
ThrowError creates an Error (or subclass) object and throws it
func ThrowErrorAt ¶
func ThrowErrorCode ¶
ThrowErrorCode creates an Error (or subclass) object with a specific error code and throws it
func ThrowException ¶
func ValidateAttributeList ¶
ValidateAttributeList validates all attributes on a target for target matching and repeat constraints. Returns an error string if invalid, empty string if valid.
func ValidateAttributeRepeat ¶
func ValidateAttributeRepeat(ctx phpv.Context, attrs []*phpv.ZAttribute) string
ValidateAttributeRepeat checks if a non-repeatable attribute is used more than once. attrs is the full list of attributes on the target. Returns an error string if invalid, empty string if valid.
func ValidateAttributeTarget ¶
ValidateAttributeTarget checks if an attribute is valid for the given target. Returns an error string if invalid, empty string if valid.
func ValidateInternalAttributeList ¶
ValidateInternalAttributeList validates only internal/built-in attribute classes on a target. Userland attributes are only validated at Reflection newInstance() time. Returns an error string if invalid, empty string if valid.
func WrapCallableWithName ¶
WrapCallableWithName wraps a callable with an explicit name for stack trace display. This is useful when calling native methods via CallZValInternal where the NativeMethod.Name() returns "" and would default to "__construct".
Types ¶
type FiberState ¶
type FiberState struct {
// contains filtered or unexported fields
}
FiberState holds the internal state of a PHP Fiber.
type FiberStatus ¶
type FiberStatus int
FiberStatus tracks the state of a Fiber.
const ( FiberCreated FiberStatus = iota // constructed but not started FiberRunning // currently executing FiberSuspended // suspended via Fiber::suspend() FiberTerminated // finished (returned or threw) )
type GeneratorBodyFunc ¶
GeneratorBodyFunc is the type for the function body of a generator. It takes a context and arguments and returns a value and error. This function type is used to pass the actual body execution (bypassing the generator check in ZClosure.Call) to SpawnGenerator.
type GeneratorState ¶
type GeneratorState struct {
// contains filtered or unexported fields
}
GeneratorState holds the internal state of a PHP Generator.
func GetGeneratorStateFromObject ¶
func GetGeneratorStateFromObject(o *ZObject) *GeneratorState
GetGeneratorStateFromObject returns the GeneratorState for a Generator object, or nil if the object is not a generator.
func (*GeneratorState) GetExecutingFile ¶
func (s *GeneratorState) GetExecutingFile() string
GetExecutingFile returns the file where the generator is currently suspended.
func (*GeneratorState) GetExecutingLine ¶
func (s *GeneratorState) GetExecutingLine() int
GetExecutingLine returns the line where the generator is currently suspended.
func (*GeneratorState) GetFuncName ¶
func (s *GeneratorState) GetFuncName() string
GetFuncName returns the function name associated with the generator.
func (*GeneratorState) IsClosed ¶
func (s *GeneratorState) IsClosed() bool
IsClosed returns true if the generator has finished (closed or returned).
func (*GeneratorState) IsValid ¶
func (s *GeneratorState) IsValid() bool
IsValid returns true if the generator has a current valid value.
type GeneratorStatus ¶
type GeneratorStatus int
GeneratorStatus tracks the state of a Generator.
const ( GeneratorCreated GeneratorStatus = iota // created but not yet advanced GeneratorSuspended // suspended at a yield GeneratorRunning // currently executing GeneratorClosed // finished (returned or closed) )
type GeneratorYield ¶
GeneratorYield carries a yielded key/value pair from the generator goroutine.
type NativeMethod ¶
func (NativeMethod) GetType ¶
func (m NativeMethod) GetType() phpv.ZType
func (NativeMethod) Name ¶
func (m NativeMethod) Name() string
func (NativeMethod) String ¶
func (m NativeMethod) String() string
func (NativeMethod) Value ¶
func (m NativeMethod) Value() phpv.Val
func (NativeMethod) ZVal ¶
func (m NativeMethod) ZVal() *phpv.ZVal
type NativeMethodNamed ¶
type NativeMethodNamed struct {
Fn NativeMethod
Args []*phpv.FuncArg
}
NativeMethodNamed wraps a NativeMethod with parameter name metadata, enabling PHP 8.0 named argument support for native methods.
func (*NativeMethodNamed) GetArgs ¶
func (m *NativeMethodNamed) GetArgs() []*phpv.FuncArg
func (*NativeMethodNamed) GetType ¶
func (m *NativeMethodNamed) GetType() phpv.ZType
func (*NativeMethodNamed) Name ¶
func (m *NativeMethodNamed) Name() string
func (*NativeMethodNamed) String ¶
func (m *NativeMethodNamed) String() string
func (*NativeMethodNamed) Value ¶
func (m *NativeMethodNamed) Value() phpv.Val
func (*NativeMethodNamed) ZVal ¶
func (m *NativeMethodNamed) ZVal() *phpv.ZVal
type NativeStaticMethod ¶
NativeStaticMethod is like NativeMethod but for static methods. It receives the class from context instead of requiring $this.
func (NativeStaticMethod) GetType ¶
func (m NativeStaticMethod) GetType() phpv.ZType
func (NativeStaticMethod) Name ¶
func (m NativeStaticMethod) Name() string
func (NativeStaticMethod) String ¶
func (m NativeStaticMethod) String() string
func (NativeStaticMethod) Value ¶
func (m NativeStaticMethod) Value() phpv.Val
func (NativeStaticMethod) ZVal ¶
func (m NativeStaticMethod) ZVal() *phpv.ZVal
type SpawnGeneratorOptions ¶
type SpawnGeneratorOptions struct {
FuncName string
YieldsRef bool
This phpv.ZObject
StartLine int
StartFile string
}
SpawnGeneratorOptions contains options for spawning a generator.
type ZClass ¶
type ZClass struct {
Name phpv.ZString
L *phpv.Loc
LEnd *phpv.Loc // end line of the class declaration
Type phpv.ZClassType
Attr phpv.ZClassAttr
// string value of extend & implement (used previous to lookup)
ExtendsStr phpv.ZString
ImplementsStr []phpv.ZString
Extends *ZClass
Implementations []*ZClass
Const map[phpv.ZString]*phpv.ZClassConst // class constants
ConstOrder []phpv.ZString // declaration order for deterministic iteration
Props []*phpv.ZClassProp
TraitUses []phpv.ZClassTraitUse
Methods map[phpv.ZString]*phpv.ZClassMethod
MethodOrder []phpv.ZString // declaration order for deterministic iteration
StaticProps *phpv.ZHashTable
Attributes []*phpv.ZAttribute // PHP 8.0 attributes
// class specific handlers
H *phpv.ZClassHandlers
// InternalOnly prevents user classes from implementing/extending this class
InternalOnly bool
// Ext is the extension name for internal classes (e.g. "SPL", "Core", "date")
Ext string
// DocComment is the doc comment (/** ... */) associated with this class
DocComment phpv.ZString
// Enum support (PHP 8.1)
EnumBackingType phpv.ZType // 0 for unit enums, ZtString or ZtInt for backed enums
EnumCases []phpv.ZString // ordered list of case names
EnumError error // non-nil if enum has a catchable error (e.g. duplicate values)
// contains filtered or unexported fields
}
var AllowDynamicPropertiesClass *ZClass
AllowDynamicPropertiesClass is the built-in #[\AllowDynamicProperties] attribute class (PHP 8.2+)
var ArgumentCountError *ZClass
> class ArgumentCountError extends TypeError
var ArithmeticError *ZClass
> class ArithmeticError extends Error
var AssertionError *ZClass
> class AssertionError extends Error
var AttributeClass *ZClass
AttributeClass is the built-in PHP Attribute class used with #[Attribute]
var BadFunctionCallException *ZClass
> class BadFunctionCallException extends LogicException
var BadMethodCallException *ZClass
> class BadMethodCallException extends BadFunctionCallException
var ClosedGeneratorError *ZClass
ClosedGeneratorError is thrown when trying to use a closed generator.
var CompileError *ZClass
> class CompileError extends Error
var DelayedTargetValidationClass *ZClass
DelayedTargetValidationClass is the built-in #[\DelayedTargetValidation] attribute class (PHP 8.5+)
var DeprecatedClass *ZClass
DeprecatedClass is the built-in #[\Deprecated] attribute class (PHP 8.4+)
var DivisionByZeroError *ZClass
> class DivisionByZeroError extends ArithmeticError
var DomainException *ZClass
> class DomainException extends LogicException
var Error *ZClass
> class Error implements Throwable
var ErrorException *ZClass
> class ErrorException extends Exception
var Exception *ZClass
> class Exception
var Fiber *ZClass
Fiber class - final class
var FiberError *ZClass
FiberError class - extends Error
var Generator *ZClass
Generator is the PHP Generator class.
var InvalidArgumentException *ZClass
> class InvalidArgumentException extends LogicException
var LengthException *ZClass
> class LengthException extends LogicException
var LogicException *ZClass
> class LogicException extends Exception
var NoDiscardClass *ZClass
NoDiscardClass is the built-in #[\NoDiscard] attribute class (PHP 8.5+)
var OutOfBoundsException *ZClass
> class OutOfBoundsException extends RuntimeException
var OutOfRangeException *ZClass
> class OutOfRangeException extends LogicException
var OverflowException *ZClass
> class OverflowException extends RuntimeException
var OverrideClass *ZClass
OverrideClass is the built-in #[\Override] attribute class (PHP 8.3+)
var ParseError *ZClass
> class ParseError extends CompileError
var RangeException *ZClass
> class RangeException extends RuntimeException
var ReturnTypeWillChangeClass *ZClass
ReturnTypeWillChangeClass is the built-in #[\ReturnTypeWillChange] attribute class (PHP 8.1+)
var RuntimeException *ZClass
> class RuntimeException extends Exception
var SensitiveParameterClass *ZClass
SensitiveParameterClass is the built-in #[\SensitiveParameter] attribute class (PHP 8.2+)
var SensitiveParameterValueClass *ZClass
SensitiveParameterValueClass is the built-in SensitiveParameterValue class (PHP 8.2+) used to mask sensitive values in stack traces.
var TypeError *ZClass
> class TypeError extends Error
var UnderflowException *ZClass
> class UnderflowException extends RuntimeException
var UnexpectedValueException *ZClass
> class UnexpectedValueException extends RuntimeException
var UnhandledMatchError *ZClass
> class UnhandledMatchError extends Error
var ValueError *ZClass
> class ValueError extends Error
func (*ZClass) FindDeclaredProp ¶
func (c *ZClass) FindDeclaredProp(name phpv.ZString) *phpv.ZClassProp
FindDeclaredProp walks the class hierarchy to find a declared property by name.
func (*ZClass) FindStaticProp ¶
func (c *ZClass) FindStaticProp(ctx phpv.Context, name phpv.ZString) (*phpv.ZHashTable, bool, error)
FindStaticProp looks up a static property by name in the class hierarchy, walking up through parent classes if the property is not found locally. Returns the hash table containing the property and true if found.
func (*ZClass) GetMethods ¶
func (c *ZClass) GetMethods() map[phpv.ZString]*phpv.ZClassMethod
func (*ZClass) GetMethodsOrdered ¶
func (c *ZClass) GetMethodsOrdered() []*phpv.ZClassMethod
GetMethodsOrdered returns methods in PHP declaration order: the class's own methods first (in MethodOrder), then inherited methods from parent, grandparent, etc.
func (*ZClass) GetStaticProps ¶
func (*ZClass) GetType ¶
func (c *ZClass) GetType() phpv.ZClassType
func (*ZClass) Handlers ¶
func (c *ZClass) Handlers() *phpv.ZClassHandlers
func (*ZClass) IsCompoundDump ¶
func (c *ZClass) IsCompoundDump()
IsCompoundDump marks ZClass as a compound statement (ends with "}").
func (*ZClass) NextInstanceID ¶
func (*ZClass) ResolveConstants ¶
ResolveConstants resolves any remaining CompileDelayed constants in the class and its parent classes. Called when the class is first instantiated.
type ZObject ¶
type ZObject struct {
Class phpv.ZClass
CurrentClass phpv.ZClass
// for use with custom extension objects
Opaque map[phpv.ZClass]interface{}
ID int
// Lazy object support (PHP 8.4) - these fields are propagated to wrapper objects
// by the new() method so that wrappers share lazy state with the original.
// LazyState tracks whether this is a lazy ghost/proxy and its initialization state.
// 0 = not lazy, 1 = lazy ghost (uninitialized), 2 = lazy proxy (uninitialized),
// 3 = lazy ghost (initialized), 4 = lazy proxy (initialized)
LazyState int
// LazyInitializer is the callback for ghost objects or the factory for proxy objects.
LazyInitializer *phpv.ZVal
// LazyInstance holds the real object for initialized proxy objects.
LazyInstance *ZObject
// LazySkippedProps tracks properties that have been skipped via
// ReflectionProperty::skipLazyInitialization() - accessing these does not trigger init.
LazySkippedProps map[phpv.ZString]bool
// LazyOptions stores flags passed when the lazy object was created
// (LazySkipInitOnSerialize, LazySkipDestructor).
LazyOptions int
// LazyInitializing is true while the initializer/factory is being called,
// to prevent recursive initialization.
LazyInitializing bool
// contains filtered or unexported fields
}
func CreateZObject ¶
Similar to NewZObject, but without calling the constructor
func NewZObject ¶
func NewZObjectEnum ¶
NewZObjectEnum creates a bare ZObject for an enum case without calling init() or resolving constants. This avoids infinite recursion since enum cases are stored as class constants themselves.
func NewZObjectOpaque ¶
func SpawnException ¶
func (*ZObject) AllowsDynamicProperties ¶
allowsDynamicProperties checks if the object's class allows dynamic property creation. stdClass, classes with #[AllowDynamicProperties], and their descendants are exempt. AllowsDynamicProperties returns true if the object's class allows dynamic property creation.
func (*ZObject) CallDestructor ¶
CallDestructor calls __destruct on this object if it hasn't been called yet. It checks visibility of the destructor against the calling context.
func (*ZObject) CallImplicitDestructor ¶
CallImplicitDestructor calls __destruct without visibility checks. Used for implicit destruction (variable overwrite, shutdown) where PHP always allows the destructor to run regardless of visibility.
func (*ZObject) CallMethod ¶
func (*ZObject) CallMethodInternal ¶
func (o *ZObject) CallMethodInternal(ctx phpv.Context, methodName string, args ...*phpv.ZVal) (*phpv.ZVal, error)
CallMethodInternal is like CallMethod but marks the call as coming from internal code, so that the stack trace entry shows "[internal function]" instead of the filename. Use this when native (Go) implementations of SPL classes call user-overridable hook methods (e.g. beginChildren, endChildren).
func (*ZObject) DecRef ¶
DecRef decrements the object's reference count and calls the destructor (with visibility checks) when the count reaches zero.
func (*ZObject) DecRefImplicit ¶
DecRefImplicit decrements the object's reference count and calls the destructor without visibility checks when the count reaches zero. Used for scope exit where PHP always allows destructors to run.
func (*ZObject) DecrJsonApplyCount ¶
func (z *ZObject) DecrJsonApplyCount()
DecrJsonApplyCount decrements the json_encode recursion guard counter.
func (*ZObject) DecrSerializeApplyCount ¶
func (z *ZObject) DecrSerializeApplyCount()
DecrSerializeApplyCount decrements the serialize recursion guard counter.
func (*ZObject) EnforcePropertyType ¶
func (o *ZObject) EnforcePropertyType(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp, value *phpv.ZVal) (*phpv.ZVal, error)
enforcePropertyType checks that a value is compatible with a typed property's type hint. Returns a coerced value if coercion is needed and possible, or an error if the type is incompatible. In strict_types=1 mode, no coercion is performed (except int->float widening). EnforcePropertyType is the exported wrapper for enforcePropertyType, used by the reflection extension to validate types before direct property writes.
func (*ZObject) FindDeclaredProp ¶
func (o *ZObject) FindDeclaredProp(keyStr phpv.ZString) *phpv.ZClassProp
findDeclaredProp walks the class hierarchy to find a declared property by name. FindDeclaredProp looks up a declared class property by name.
func (*ZObject) GetDeclClassName ¶
func (o *ZObject) GetDeclClassName(p *phpv.ZClassProp) phpv.ZString
GetDeclClassName returns the declaring class name for a private property. It returns the name of the most-ancestral class in the hierarchy that declares the given property (i.e., its Props slice contains a pointer equal to p).
func (*ZObject) GetObjID ¶
GetObjID returns the object's unique ID. Used for temporary object ID recycling when objects are passed as function arguments.
func (*ZObject) GetObjectID ¶
GetObjectID returns the object's unique ID (handle).
func (*ZObject) GetOpaqueByName ¶
GetOpaqueByName looks up opaque data by class name instead of class pointer. This is useful to break initialization cycles where the class variable isn't available yet during init.
func (*ZObject) GetPropValue ¶
func (o *ZObject) GetPropValue(p *phpv.ZClassProp) *phpv.ZVal
GetPropValue returns the value for a class property, handling the mangled name lookup for private properties.
func (*ZObject) GetPropValueOrHook ¶
func (o *ZObject) GetPropValueOrHook(ctx phpv.Context, p *phpv.ZClassProp) (*phpv.ZVal, bool, error)
GetPropValueOrHook returns the value for a class property. For virtual hooked properties with a get hook, it calls the get hook. For backed properties or properties without hooks, it returns the hash table value. Returns (value, hasValue, error).
func (*ZObject) GetProxyInstance ¶
GetProxyInstance returns the real instance for an initialized proxy, or nil. For a lazy proxy that has a nested proxy chain, this resolves through the chain.
func (*ZObject) HasPropValue ¶
func (o *ZObject) HasPropValue(p *phpv.ZClassProp) bool
HasPropValue returns true if the property has a value in the hash table. Returns false for typed properties that have not been initialized.
func (*ZObject) HashTable ¶
func (a *ZObject) HashTable() *phpv.ZHashTable
func (*ZObject) IncrJsonApplyCount ¶
IncrJsonApplyCount increments the json_encode recursion guard counter. Returns the count BEFORE incrementing. If > 0, the object is already being json-encoded.
func (*ZObject) IncrSerializeApplyCount ¶
IncrSerializeApplyCount increments the serialize recursion guard counter. Returns the count BEFORE incrementing. If > 0, the object is already being serialized.
func (*ZObject) IsDestructed ¶
IsDestructed returns whether the destructor has already been called.
func (*ZObject) IsLazy ¶
IsLazy returns true if the object is a lazy object (ghost or proxy) that has not yet been initialized.
func (*ZObject) IsLazyGhost ¶
IsLazyGhost returns true if the object is a lazy ghost (initialized or not).
func (*ZObject) IsLazyInitialized ¶
IsLazyInitialized returns true if the object is a lazy object that has been initialized (either ghost or proxy).
func (*ZObject) IsLazyProxy ¶
IsLazyProxy returns true if the object is a lazy proxy (initialized or not).
func (*ZObject) IsPropertyHidden ¶
isPropertyHidden returns true if the property is declared with restricted visibility (private/protected) and the current calling context doesn't have access. Used by HasProp to decide whether to fall through to __isset. IsPropertyHidden reports whether the named property is declared in the class but not accessible from the current context (private/protected visibility). When true, PHP would normally call __get/__set instead of accessing directly.
func (*ZObject) IsPropertySkippedForLazy ¶
IsPropertySkippedForLazy checks if a property has been marked as "skipped" for lazy initialization purposes.
func (*ZObject) IsReadonlyProperty ¶
IsReadonlyProperty checks if a property is declared as readonly in the class hierarchy. Used for blocking indirect modifications (e.g. $obj->readonlyProp[] = val). Enum properties (name, value) are always treated as readonly.
func (*ZObject) IsReadonlyPropertyInitialized ¶
IsReadonlyPropertyInitialized checks if a readonly property has been initialized. Enum properties (name, value) are always considered initialized.
func (*ZObject) MakeLazyGhost ¶
MakeLazyGhost sets up this object as a lazy ghost with the given initializer. The object's non-skipped properties are cleared (typed properties become uninitialized, untyped properties are removed).
func (*ZObject) MakeLazyProxy ¶
MakeLazyProxy sets up this object as a lazy proxy with the given factory.
func (*ZObject) MarkLazyAsInitialized ¶
MarkLazyAsInitialized marks a lazy object as initialized without calling the initializer. Properties get their default values.
func (*ZObject) MarkReadonlyInit ¶
MarkReadonlyInit marks a readonly property as initialized (for use by native constructors that set properties directly on the hash table without going through ObjectSet).
func (*ZObject) MarkReadonlyInitialized ¶
MarkReadonlyInitialized marks a readonly property as initialized. Used by native constructors that set properties via HashTable directly.
func (*ZObject) NewIterator ¶
func (*ZObject) NewIteratorInScope ¶
NewIteratorInScope creates an iterator that respects property visibility relative to the given scope class. If scope is nil, only public properties are visible (external access). If scope matches the object's class or a parent, protected/private properties become visible accordingly. For lazy objects, this triggers initialization (e.g., for get_object_vars).
For objects with hooked properties, this builds an ordered list of entries that includes virtual hooked properties (calling get hooks to produce values).
Property keys in the hash table: - Public/Protected: bare "name" - Private: "*ClassName:name"
func (*ZObject) ObjectGetQuiet ¶
ObjectGetQuiet is like ObjectGet but returns (value, found, err) without emitting "Undefined property" warnings. Used for write-context auto-vivification paths.
func (*ZObject) OffsetCheck ¶
func (*ZObject) OffsetExists ¶
func (*ZObject) OffsetGetReturnsByRef ¶
OffsetGetReturnsByRef checks whether the ArrayAccess offsetGet method on this object is declared with a return-by-reference signature (&offsetGet). When true, indirect modifications (++, +=, etc.) go through the reference and actually work, so the "Indirect modification has no effect" notice should be suppressed.
func (*ZObject) ReadParentBacking ¶
func (o *ZObject) ReadParentBacking(ctx phpv.Context, keyStr phpv.ZString, declClass *ZClass) (*phpv.ZVal, error)
ReadParentBacking reads the backing value of a parent property directly. Used by parent::$prop::get() when the parent has no get hook.
func (*ZObject) ResolveProxy ¶
ResolveProxy resolves the proxy chain, returning the innermost real object. For initialized proxies, property accesses are delegated to the real instance.
func (*ZObject) RunGetHookForExport ¶
func (o *ZObject) RunGetHookForExport(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp) (*phpv.ZVal, error)
runGetHook executes a property get hook in the context of this object. It uses CallZVal with a HookCallable to create a proper FuncContext with $this bound. RunGetHookForExport calls the get hook for a property, suitable for use in var_export, get_object_vars, and json_encode (which all show hook results). Returns nil if the property has no get hook.
func (*ZObject) RunParentGetHook ¶
func (o *ZObject) RunParentGetHook(ctx phpv.Context, keyStr phpv.ZString, hook phpv.Runnable, declClass *ZClass) (*phpv.ZVal, error)
RunParentGetHook executes a parent class's get hook on this object. Used by parent::$prop::get() in property hooks.
func (*ZObject) RunParentSetHook ¶
func (o *ZObject) RunParentSetHook(ctx phpv.Context, keyStr phpv.ZString, prop *phpv.ZClassProp, value *phpv.ZVal, declClass *ZClass) error
RunParentSetHook executes a parent class's set hook on this object. Used by parent::$prop::set() in property hooks.
func (*ZObject) SetDestructed ¶
SetDestructed sets the destructed flag.
func (*ZObject) SetObjectID ¶
SetObjectID replaces the object's ID (used for catch variable ID recycling).
func (*ZObject) SetPropValueDirect ¶
SetPropValueDirect sets a property value directly, bypassing visibility checks. For private properties, it finds the declaring class and uses the mangled name. This is used by Reflection to set properties regardless of visibility.
func (*ZObject) SetRawValueWithoutLazyInit ¶
func (o *ZObject) SetRawValueWithoutLazyInit(ctx phpv.Context, propName phpv.ZString, value *phpv.ZVal)
SetRawValueWithoutLazyInit sets a property value on a lazy object without triggering initialization.
func (*ZObject) SkipLazyProperty ¶
SkipLazyProperty marks a property as skipped for lazy initialization. When a property is skipped, accessing it does not trigger initialization and it gets its default value.
func (*ZObject) SkipsInitOnSerialize ¶
SkipsInitOnSerialize returns true if this lazy object should not be initialized when serialized (SKIP_INITIALIZATION_ON_SERIALIZE flag).
func (*ZObject) TriggerLazyInit ¶
TriggerLazyInit triggers lazy initialization if the object is lazy and the accessed property is not skipped. Returns true if initialization happened.
func (*ZObject) TriggerLazyInitForProp ¶
TriggerLazyInitForProp triggers lazy initialization if the object is lazy and the given property is not skipped. Returns nil if property is skipped or initialization succeeded.
func (*ZObject) UnmarkReadonlyInit ¶
UnmarkReadonlyInit resets the "initialized" flag for a readonly property, allowing it to be written again. Used by clone-with to override properties that were set by __clone().