Skip to content

Commit

Permalink
adjust output to PHP 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rubio committed May 25, 2015
1 parent 2a102f7 commit 7c8e77f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 61 deletions.
8 changes: 4 additions & 4 deletions src/ephp_func_vars.erl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ empty(_Context, {_,Value}) ->

gettype(_Context, {_,Value}) when is_boolean(Value) -> <<"boolean">>;
gettype(_Context, {_,Value}) when is_integer(Value) -> <<"integer">>;
gettype(_Context, {_,Value}) when is_float(Value) -> <<"double">>;
gettype(_Context, {_,Value}) when is_float(Value) -> <<"float">>;
gettype(_Context, {_,Value}) when is_binary(Value) -> <<"string">>;
gettype(_Context, {_,Value}) when ?IS_DICT(Value) -> <<"array">>;
gettype(_Context, {_,Value}) when is_record(Value, reg_instance) -> <<"object">>;
Expand Down Expand Up @@ -216,7 +216,7 @@ var_dump_fmt(_Context, Value, _Spaces) when is_integer(Value) ->
<<"int(",(ephp_util:to_bin(Value))/binary, ")\n">>;

var_dump_fmt(_Context, Value, _Spaces) when is_float(Value) ->
<<"double(",(ephp_util:to_bin(Value))/binary, ")\n">>;
<<"float(",(ephp_util:to_bin(Value))/binary, ")\n">>;

var_dump_fmt(_Context, Value, _Spaces) when is_binary(Value) ->
Size = ephp_util:to_bin(byte_size(Value)),
Expand Down Expand Up @@ -244,13 +244,13 @@ var_dump_fmt(Context, Value, Spaces) when is_list(Value) ->
Res ++ case var_dump_fmt(Context, Val, <<Spaces/binary, ?SPACES_VD>>) of
V when is_binary(V) ->
[
<<Spaces/binary, "[", KeyBin/binary, "] =>\n",
<<Spaces/binary, "[", KeyBin/binary, "]=>\n",
Spaces/binary, V/binary>>
];
V when is_list(V) ->
Elements = ephp_util:to_bin(length(Val)),
[
<<Spaces/binary, "[", KeyBin/binary, "] =>\n">>,
<<Spaces/binary, "[", KeyBin/binary, "]=>\n">>,
<<Spaces/binary,"array(", Elements/binary, ") {\n">>
] ++ V ++ [
<<Spaces/binary, "}\n">>
Expand Down
42 changes: 21 additions & 21 deletions test/code/array_01.out
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
array(0) {
}
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
int(2)
[2] =>
[2]=>
int(3)
}
array(2) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
int(2)
}
array(2) {
["a"] =>
string(7) "a thing"
["h"] =>
["a"]=>
string(5) "hello"
["b"]=>
string(7) "a thing"
}
array(2) {
["a"] =>
string(7) "a thing"
["h"] =>
["a"]=>
string(5) "hello"
["b"]=>
string(7) "a thing"
}
array(2) {
[0] =>
[0]=>
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
int(2)
[2] =>
[2]=>
int(3)
}
[1] =>
[1]=>
array(2) {
[0] =>
[0]=>
string(1) "a"
[1] =>
[1]=>
string(1) "b"
}
}
array(1) {
["hola"] =>
["hola"]=>
array(2) {
[0] =>
[0]=>
string(1) "1"
[1] =>
[1]=>
string(1) "2"
}
}
6 changes: 3 additions & 3 deletions test/code/array_01.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
$_MESSAGE = array( 0 => 1, 1 => 2 );
var_dump($_MESSAGE);

$_MESSAGE = array( 'h' => 'hello', 'a' => 'a thing' );
$_MESSAGE = array( 'a' => 'hello', 'b' => 'a thing' );
var_dump($_MESSAGE);

$_MESSAGE = array(
'h' => 'hello',
'a' => 'a thing',
'a' => 'hello',
'b' => 'a thing',
);
var_dump($_MESSAGE);

Expand Down
54 changes: 27 additions & 27 deletions test/code/test_func_var_dump.out
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
array(3) {
[0] =>
[0]=>
array(2) {
[0] =>
[0]=>
string(1) "a"
[1] =>
[1]=>
string(1) "b"
}
[1] =>
double(4.5)
[2] =>
[1]=>
float(4.5)
[2]=>
string(4) "hola"
}
[2] =>
[2]=>
int(3)
}
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
array(3) {
[0] =>
[0]=>
array(2) {
[0] =>
[0]=>
string(1) "a"
[1] =>
[1]=>
string(1) "b"
}
[1] =>
double(4.5)
[2] =>
[1]=>
float(4.5)
[2]=>
string(4) "hola"
}
[2] =>
[2]=>
int(3)
}
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
array(3) {
[0] =>
[0]=>
array(2) {
[0] =>
[0]=>
string(1) "a"
[1] =>
[1]=>
string(1) "b"
}
[1] =>
double(4.5)
[2] =>
[1]=>
float(4.5)
[2]=>
string(4) "hola"
}
[2] =>
[2]=>
int(3)
}
12 changes: 6 additions & 6 deletions test/code/test_include_value.out
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
int(2)
[2] =>
[2]=>
int(3)
}
array(3) {
[0] =>
[0]=>
int(1)
[1] =>
[1]=>
int(2)
[2] =>
[2]=>
int(3)
}
bool(true)

0 comments on commit 7c8e77f

Please sign in to comment.