Skip to content

Argument #1 ($foo) could not be passed by reference #515

@kakserpom

Description

@kakserpom
use ext_php_rs::types::ZendHashTable;
use ext_php_rs::prelude::*;

#[php_class]
pub struct Example {}

#[php_impl]
impl Example {
    fn __construct() -> Self {
        Self {}
    }
    pub fn foo(&self, foo: Option<&ZendHashTable>) {}
}

#[php_module]
pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
    module.class::<Example>()
}
<?php
$example = new Example;
$example->foo([1,2,3]);
echo $bar;

Note that it works without Option<...>.

This works too:

$foo = [1,2,3];
$example->foo($foo);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions