Skip to content

($self_) could not be passed by reference #504

@kakserpom

Description

@kakserpom

Related to #502

Fatal error: Uncaught Error: Example::someMethod(): Argument #1 ($self_) could not be passed by reference 
use ext_php_rs::{prelude::*, types::ZendClassObject};
use ext_php_rs::types::Zval;

#[php_class]
pub struct Example {}

#[php_impl]
impl Example {
    pub fn __construct() -> Example {
        Example {}
    }
    pub fn some_method(
        self_: &mut ZendClassObject<Example>,
        str: String,
    ) -> &mut ZendClassObject<Example> {
        self_
    }
}

#[php_module]
pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
    module.class::<Example>()
}
<?php
$example = new Example;
var_dump($example->someMethod('test'));

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingregressionSomething has stopped working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions