File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl<'a> Arg<'a> {
87
87
{
88
88
self . zval
89
89
. as_mut ( )
90
- . and_then ( |zv| T :: from_zval_mut ( zv) )
90
+ . and_then ( |zv| T :: from_zval_mut ( zv. dereference_mut ( ) ) )
91
91
. ok_or ( self )
92
92
}
93
93
@@ -98,7 +98,7 @@ impl<'a> Arg<'a> {
98
98
where
99
99
T : FromZvalMut < ' a > ,
100
100
{
101
- self . zval . as_mut ( ) . and_then ( |zv| T :: from_zval_mut ( zv) )
101
+ self . zval . as_mut ( ) . and_then ( |zv| T :: from_zval_mut ( zv. dereference_mut ( ) ) )
102
102
}
103
103
104
104
/// Attempts to return a reference to the arguments internal Zval.
Original file line number Diff line number Diff line change @@ -51,6 +51,26 @@ impl Zval {
51
51
}
52
52
}
53
53
54
+ /// Dereference the zval, if it is a reference.
55
+ pub fn dereference ( & self ) -> & Self {
56
+ return self
57
+ . reference ( )
58
+ . or_else ( || self . indirect ( ) )
59
+ . or ( Some ( self ) )
60
+ . unwrap ( ) ;
61
+ }
62
+
63
+ /// Dereference the zval mutable, if it is a reference.
64
+ pub fn dereference_mut ( & mut self ) -> & mut Self {
65
+ if self . is_reference ( ) {
66
+ return self . reference_mut ( ) . unwrap ( ) ;
67
+ }
68
+ if self . is_indirect ( ) {
69
+ return self . indirect_mut ( ) . unwrap ( ) ;
70
+ }
71
+ return self ;
72
+ }
73
+
54
74
/// Returns the value of the zval if it is a long.
55
75
pub fn long ( & self ) -> Option < ZendLong > {
56
76
if self . is_long ( ) {
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ var_dump (get_declared_classes);
4
+ /*
5
+ die;
3
6
require('_utils.php');
4
7
8
+ $v = test_closure();
9
+
5
10
// Closure
6
- assert (test_closure () ('works ' ) === 'works ' );
11
+ assert($closure ('works') === 'works');
7
12
8
13
// Closure once
9
14
$closure = test_closure_once('test');
10
15
11
16
assert(call_user_func($closure) === 'test');
12
17
assert_exception_thrown($closure);
18
+ */
You can’t perform that action at this time.
0 commit comments