Skip to content

Commit 4b0b48d

Browse files
committed
1 parent b141dec commit 4b0b48d

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

test/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CXX_SRC = \
1515
test0003.cpp \
1616
test0004.cpp \
1717
test0005.cpp \
18+
issue114.cpp \
1819
issue234.cpp \
1920
issue249.cpp \
2021
issue254.cpp \

test/issue114.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <vector>
2+
#include "issue114.h"
3+
4+
static Php::Value test114(Php::Parameters& p)
5+
{
6+
int count = p[0].size();
7+
std::vector<Php::Value> v;
8+
for (int i = 0; i<count; ++i) {
9+
v.push_back(p[0][i]);
10+
}
11+
12+
return v;
13+
}
14+
15+
void init_Issue114(Php::Extension& e)
16+
{
17+
e.add<test114>("test114");
18+
}

test/issue114.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef TEST_ISSUE114_H
2+
#define TEST_ISSUE114_H
3+
4+
#include "phpcpp.h"
5+
6+
void init_Issue114(Php::Extension& e);
7+
8+
#endif /* TEST_ISSUE114_H */

test/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "test0003.h"
55
#include "test0004.h"
66
#include "test0005.h"
7+
#include "issue114.h"
78
#include "issue234.h"
89
#include "issue249.h"
910
#include "issue254.h"
@@ -26,6 +27,7 @@ extern "C"
2627
init_Test0004(extension);
2728
init_Test0005(extension);
2829

30+
init_Issue114(extension);
2931
init_Issue234(extension);
3032
init_Issue249(extension);
3133
init_Issue254(extension);

test/tests/issue114.phpt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
(#114)
3+
--SKIPIF--
4+
<?php include 'skipif.inc'; ?>
5+
--FILE--
6+
<?php
7+
$a = array();
8+
$a[] = &$a;
9+
$a[] = "hello";
10+
var_dump($a);
11+
var_dump(test114($a));
12+
?>
13+
--EXPECT--
14+
array(2) {
15+
[0]=>
16+
&array(2) {
17+
[0]=>
18+
*RECURSION*
19+
[1]=>
20+
string(5) "hello"
21+
}
22+
[1]=>
23+
string(5) "hello"
24+
}
25+
array(2) {
26+
[0]=>
27+
&array(2) {
28+
[0]=>
29+
*RECURSION*
30+
[1]=>
31+
string(5) "hello"
32+
}
33+
[1]=>
34+
string(5) "hello"
35+
}

0 commit comments

Comments
 (0)