-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.deps | ||
.libs/sigsegv.la | ||
.libs/sigsegv.lai | ||
.libs/sigsegv.o | ||
.libs/sigsegv.so | ||
Makefile | ||
Makefile.fragments | ||
Makefile.global | ||
Makefile.objects | ||
acinclude.m4 | ||
aclocal.m4 | ||
autom4te.cache/output.0 | ||
autom4te.cache/requests | ||
autom4te.cache/traces.0 | ||
config.guess | ||
config.h | ||
config.h.in | ||
config.h.in~ | ||
config.log | ||
config.nice | ||
config.status | ||
config.sub | ||
configure | ||
configure.in | ||
install-sh | ||
libtool | ||
ltmain.sh | ||
missing | ||
mkinstalldirs | ||
modules/sigsegv.la | ||
modules/sigsegv.so | ||
run-tests.php | ||
sigsegv.la | ||
sigsegv.lo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## What is this? | ||
|
||
This is an extension written for testing purposes. | ||
|
||
|
||
## Provided functionalities | ||
|
||
| Function | Expected result | | ||
|-----------|----------------------------------| | ||
| sigsegv() | segmentation fault (core dumped) | | ||
|
||
|
||
## Build | ||
|
||
``` | ||
phpize | ||
./configure --with-sigsegv | ||
make -j | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
php -d extension=modules/sigsegv.so -r "sigsegv();" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
dnl config.m4 for extension sigsegv | ||
|
||
PHP_ARG_WITH(sigsegv, whether to enable sigsegv support, | ||
[ --enable-sigsegv Enable sigsegv]) | ||
|
||
if test "$PHP_SIGSEGV" != "no"; then | ||
PHP_NEW_EXTENSION(sigsegv, sigsegv.c, $ext_shared) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef PHP_SIGSEGV_H | ||
#define PHP_SIGSEGV_H | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "php.h" | ||
|
||
#define PHP_SIGSEGV_NAME "sigsegv" | ||
#define PHP_SIGSEGV_VERSION "0.0.1" | ||
|
||
#endif /* PHP_SIGSEGV_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "php_sigsegv.h" | ||
|
||
PHP_FUNCTION (sigsegv) { | ||
char *damn_pointer = "I am a damn pointer"; | ||
*damn_pointer = "So bad!"; | ||
} | ||
|
||
PHP_MINIT_FUNCTION (sigsegv) { | ||
return SUCCESS; | ||
} | ||
|
||
const zend_function_entry sigsegv_functions[] = { | ||
PHP_FE(sigsegv, NULL) | ||
PHP_FE_END}; | ||
|
||
zend_module_entry sigsegv_module_entry = { | ||
STANDARD_MODULE_HEADER, | ||
PHP_SIGSEGV_NAME, | ||
sigsegv_functions, | ||
PHP_MINIT(sigsegv), | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
PHP_SIGSEGV_VERSION, | ||
STANDARD_MODULE_PROPERTIES }; | ||
|
||
#ifdef COMPILE_DL_SIGSEGV | ||
ZEND_GET_MODULE(sigsegv) | ||
#endif |