summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvoisin2017-09-26 16:55:42 +0200
committerjvoisin2017-09-26 16:55:42 +0200
commit3c14dba94e837322e030b19b41654952624cb485 (patch)
tree184dee84d63ba3a85dbc987f23b04120c3f763cd /src
parent4dc382c63f4219cdbf5dd784f0d8025f6af68629 (diff)
Implement, test and document namespace support
Diffstat (limited to 'src')
-rw-r--r--src/config.m43
-rw-r--r--src/tests/config/config_disabled_functions_namespace.ini2
-rw-r--r--src/tests/disabled_functions_namespace.phpt14
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
27if test "$PHP_DEBUG" = "yes"; then 27if 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"
29fi 30fi
30 31
31AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) 32AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre]))
32 33
33if test "$PHP_SNUFFLEUPAGUS" = "yes"; then 34if 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)
38fi 39fi
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 @@
1sp.disable_functions.function("strcmp").drop(); 1sp.disable_functions.function("strcmp").drop();
2sp.disable_functions.function("my_super_namespace::my_function").drop(); 2sp.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--
2Disable functions: namespaces support isn't implemented now 2Disable 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
9namespace my_super_namespace { 9namespace 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}
14namespace my_second_namespace { 14namespace my_second_namespace {
15 function my_function() { 15 function my_function() {
16 echo "2\n"; 16 echo "Second namespace\n";
17 } 17 }
18} 18}
19namespace { 19namespace {
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 {
26my_function(); 26my_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.
32Second namespace
33Anonymous namespace