diff options
| author | jvoisin | 2017-09-26 16:55:42 +0200 |
|---|---|---|
| committer | jvoisin | 2017-09-26 16:55:42 +0200 |
| commit | 3c14dba94e837322e030b19b41654952624cb485 (patch) | |
| tree | 184dee84d63ba3a85dbc987f23b04120c3f763cd /src | |
| parent | 4dc382c63f4219cdbf5dd784f0d8025f6af68629 (diff) | |
Implement, test and document namespace support
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.m4 | 3 | ||||
| -rw-r--r-- | src/tests/config/config_disabled_functions_namespace.ini | 2 | ||||
| -rw-r--r-- | src/tests/disabled_functions_namespace.phpt | 14 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/config.m4 b/src/config.m4 index bf5523a..04eefa2 100644 --- a/src/config.m4 +++ b/src/config.m4 | |||
| @@ -26,13 +26,14 @@ LDFLAGS="$LDFLAGS -lpcre" | |||
| 26 | 26 | ||
| 27 | if test "$PHP_DEBUG" = "yes"; then | 27 | if test "$PHP_DEBUG" = "yes"; then |
| 28 | AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages]) | 28 | AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages]) |
| 29 | CFLAGS="$CFLAGS -g -ggdb -O0" | ||
| 29 | fi | 30 | fi |
| 30 | 31 | ||
| 31 | AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) | 32 | AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) |
| 32 | 33 | ||
| 33 | if test "$PHP_SNUFFLEUPAGUS" = "yes"; then | 34 | if test "$PHP_SNUFFLEUPAGUS" = "yes"; then |
| 34 | if test "$PHP_COVERAGE" = "yes"; then | 35 | if test "$PHP_COVERAGE" = "yes"; then |
| 35 | CFLAGS="$CFLAGS -g --coverage -lgcov -O1 -g" | 36 | CFLAGS="$CFLAGS --coverage -lgcov -O1 -g" |
| 36 | fi | 37 | fi |
| 37 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) | 38 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) |
| 38 | fi | 39 | fi |
diff --git a/src/tests/config/config_disabled_functions_namespace.ini b/src/tests/config/config_disabled_functions_namespace.ini index d09b81b..78c7f92 100644 --- a/src/tests/config/config_disabled_functions_namespace.ini +++ b/src/tests/config/config_disabled_functions_namespace.ini | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | sp.disable_functions.function("strcmp").drop(); | 1 | sp.disable_functions.function("strcmp").drop(); |
| 2 | sp.disable_functions.function("my_super_namespace::my_function").drop(); | 2 | sp.disable_functions.function("my_super_namespace\\my_function").drop(); |
diff --git a/src/tests/disabled_functions_namespace.phpt b/src/tests/disabled_functions_namespace.phpt index 72c7d0b..8934337 100644 --- a/src/tests/disabled_functions_namespace.phpt +++ b/src/tests/disabled_functions_namespace.phpt | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | --TEST-- | 1 | --TEST-- |
| 2 | Disable functions: namespaces support isn't implemented now | 2 | Disable functions in namespaces |
| 3 | --SKIPIF-- | 3 | --SKIPIF-- |
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> |
| 5 | --INI-- | 5 | --INI-- |
| @@ -8,17 +8,17 @@ sp.configuration_file={PWD}/config/config_disabled_functions_namespace.ini | |||
| 8 | <?php | 8 | <?php |
| 9 | namespace my_super_namespace { | 9 | namespace my_super_namespace { |
| 10 | function my_function() { | 10 | function my_function() { |
| 11 | echo "1\n"; | 11 | echo "Should not be printed\n"; |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | namespace my_second_namespace { | 14 | namespace my_second_namespace { |
| 15 | function my_function() { | 15 | function my_function() { |
| 16 | echo "2\n"; | 16 | echo "Second namespace\n"; |
| 17 | } | 17 | } |
| 18 | } | 18 | } |
| 19 | namespace { | 19 | namespace { |
| 20 | function my_function() { | 20 | function my_function() { |
| 21 | echo "3\n"; | 21 | echo "Anonymous namespace\n"; |
| 22 | } | 22 | } |
| 23 | \strcmp("1", "2"); | 23 | \strcmp("1", "2"); |
| 24 | \my_super_namespace\my_function(); | 24 | \my_super_namespace\my_function(); |
| @@ -26,6 +26,8 @@ namespace { | |||
| 26 | my_function(); | 26 | my_function(); |
| 27 | } | 27 | } |
| 28 | ?> | 28 | ?> |
| 29 | --XFAIL-- | ||
| 30 | --EXPECTF-- | 29 | --EXPECTF-- |
| 31 | [snuffleupagus] The call to the function 'strcmp' in %a/tests/disabled_functions_namespace.php:%d has been disabled. | 30 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'strcmp' in %a/disabled_functions_namespace.php:%d has been disabled. |
| 31 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'my_super_namespace\my_function' in %a/disabled_functions_namespace.php:%d has been disabled. | ||
| 32 | Second namespace | ||
| 33 | Anonymous namespace | ||
