Skip to content

Commit

Permalink
Fix read property rv segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcole1340 committed Sep 24, 2021
1 parent 3ff2dfd commit 8d6f5f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 3 additions & 14 deletions example/skel/test.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<?php

test_zval(['hello' => 'world']);
//include 'vendor/autoload.php';

//$ext = new ReflectionExtension('skel');

//dd($ext);

//$x = fn_once();
//$x();
//$x();

//// $x = get_closure();

//// var_dump($x(5));
$x = new TestClass;
var_dump($x);
var_dump($x->b);
4 changes: 4 additions & 0 deletions src/php/types/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::{
class::ClassEntry,
enums::DataType,
exceptions::PhpException,
flags::ZvalTypeFlags,
types::{array::OwnedHashTable, string::ZendString},
},
};
Expand Down Expand Up @@ -659,7 +660,10 @@ impl ZendObjectHandlers {
let self_ = obj.obj.assume_init_mut();
let mut props = T::get_properties();
let prop = props.remove(prop_name.as_str().ok_or("Invalid property name given")?);

// retval needs to be treated as initialized, so we set the type to null
let rv_mut = rv.as_mut().ok_or("Invalid return zval given")?;
rv_mut.u1.type_info = ZvalTypeFlags::Null.bits();

Ok(match prop {
Some(prop) => {
Expand Down

0 comments on commit 8d6f5f4

Please sign in to comment.