Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop in ClassEntry::instance_of #187

Closed
ju1ius opened this issue Nov 16, 2022 · 0 comments · Fixed by #188
Closed

Infinite loop in ClassEntry::instance_of #187

ju1ius opened this issue Nov 16, 2022 · 0 comments · Fixed by #188

Comments

@ju1ius
Copy link
Contributor

ju1ius commented Nov 16, 2022

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

ju1ius added a commit to ju1ius/ext-php-rs that referenced this issue Nov 16, 2022
ju1ius added a commit to ju1ius/ext-php-rs that referenced this issue Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant