Skip to content

Commit

Permalink
add undefined offset notice and test
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rubio committed Feb 2, 2019
1 parent e1ec599 commit 0d66933
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ephp_error.erl
Expand Up @@ -357,6 +357,9 @@ get_message(enoarray, {}) ->
get_message(einvalid, {Function, Spec, Val}) ->
io_lib:format("~s(): Invalid `~s' (~p)", [Function, Spec, Val]);

get_message(eundefvar, {Offset}) when is_integer(Offset) ->
io_lib:format("Undefined offset: ~b", [Offset]);

get_message(eundefvar, {Var}) ->
io_lib:format("Undefined variable: ~s", [Var]);

Expand Down
3 changes: 3 additions & 0 deletions test/code/test_undef_index.out
@@ -0,0 +1,3 @@

Notice: Undefined offset: 100 in {{CWD}}/test/code/test_undef_index.php on line 6
OK
8 changes: 8 additions & 0 deletions test/code/test_undef_index.php
@@ -0,0 +1,8 @@
<?php

error_reporting(E_ALL);

$wp_filter = [];
print $wp_filter[100]["hey"];

print "OK\n";

0 comments on commit 0d66933

Please sign in to comment.