Skip to content

Infinite loop in ClassEntry::instance_of #187

Closed
@ju1ius

Description

@ju1ius
Component Version
ext_php_rs git:master
cargo-php v0.1.7

Extension code:

#[php_function]
pub fn test_instance_of(a: &ZendObject, b: &ZendObject) -> bool {
    get_class_entry(a).instance_of(get_class_entry(b))
}

fn get_class_entry<'a>(obj: &'a ZendObject) -> &'static ClassEntry {
    unsafe { obj.ce.as_ref().unwrap() }
}
<?php

class Base {}
class Child extends Base {}
class GrandChild extends Child {}

var_dump(test_instance_of(new GrandChild, new Base));

Expected behaviour: prints bool(true)

Actual behaviour: loops forever

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions