-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'krakjoe:master' into master
- Loading branch information
Showing
19 changed files
with
253 additions
and
53 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
github: krakjoe | ||
custom: https://gofund.me/c34f3dde |
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
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 |
---|---|---|
@@ -1,30 +1,45 @@ | ||
PHP_ARG_ENABLE(uopz, whether to enable uopz support, | ||
[ --enable-uopz Enable uopz support]) | ||
PHP_ARG_ENABLE([uopz], | ||
[whether to enable uopz support], | ||
[AS_HELP_STRING([--enable-uopz], | ||
[Enable uopz support])]) | ||
|
||
PHP_ARG_ENABLE(uopz-coverage, whether to enable uopz coverage support, | ||
[ --enable-uopz-coverage Enable uopz coverage support], no, no) | ||
PHP_ARG_ENABLE([uopz-coverage], | ||
[whether to enable uopz coverage support], | ||
[AS_HELP_STRING([--enable-uopz-coverage], | ||
[Enable uopz coverage support])], | ||
[no], | ||
[no]) | ||
|
||
PHP_ARG_WITH(uopz-sanitize, whether to enable AddressSanitizer for uopz, | ||
[ --with-uopz-sanitize Build uopz with AddressSanitizer support], no, no) | ||
PHP_ARG_WITH([uopz-sanitize], | ||
[whether to enable AddressSanitizer for uopz], | ||
[AS_HELP_STRING([--with-uopz-sanitize], | ||
[Build uopz with AddressSanitizer support])], | ||
[no], | ||
[no]) | ||
|
||
if test "$PHP_UOPZ" != "no"; then | ||
if test "$PHP_UOPZ_SANITIZE" != "no"; then | ||
AS_VAR_IF([PHP_UOPZ_SANITIZE], [no],, [ | ||
EXTRA_LDFLAGS="-lasan" | ||
EXTRA_CFLAGS="-fsanitize=address -fno-omit-frame-pointer" | ||
PHP_SUBST(EXTRA_LDFLAGS) | ||
PHP_SUBST(EXTRA_CFLAGS) | ||
fi | ||
EXTRA_CFLAGS="-fsanitize=address -fno-omit-frame-pointer" | ||
PHP_SUBST([EXTRA_LDFLAGS]) | ||
PHP_SUBST([EXTRA_CFLAGS]) | ||
]) | ||
|
||
PHP_NEW_EXTENSION(uopz, uopz.c src/util.c src/return.c src/hook.c src/constant.c src/function.c src/class.c src/handlers.c src/executors.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) | ||
PHP_ADD_BUILD_DIR($ext_builddir/src, 1) | ||
PHP_ADD_INCLUDE($ext_builddir) | ||
PHP_NEW_EXTENSION([uopz], m4_normalize([ | ||
src/class.c | ||
src/constant.c | ||
src/executors.c | ||
src/function.c | ||
src/handlers.c | ||
src/hook.c | ||
src/return.c | ||
src/util.c | ||
uopz.c | ||
]), | ||
[$ext_shared],, | ||
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) | ||
PHP_ADD_BUILD_DIR([$ext_builddir/src]) | ||
PHP_ADD_INCLUDE([$ext_builddir]) | ||
|
||
AC_MSG_CHECKING([uopz coverage]) | ||
if test "$PHP_UOPZ_COVERAGE" != "no"; then | ||
AC_MSG_RESULT([enabled]) | ||
|
||
PHP_ADD_MAKEFILE_FRAGMENT | ||
else | ||
AC_MSG_RESULT([disabled]) | ||
fi | ||
AS_VAR_IF([PHP_UOPZ_COVERAGE], [no],, [PHP_ADD_MAKEFILE_FRAGMENT]) | ||
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
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
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
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
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
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,114 @@ | ||
--TEST-- | ||
uopz_get_static | ||
--EXTENSIONS-- | ||
uopz | ||
--SKIPIF-- | ||
<?php | ||
uopz_allow_exit(true); | ||
if (version_compare(PHP_VERSION, "8.3.0") < 0) die("skip only for PHP >= 8.3.0"); | ||
?> | ||
--INI-- | ||
uopz.disable=0 | ||
--FILE-- | ||
<?php | ||
class Foo { | ||
public function method() { | ||
static $vars = [1,2,3,4,5]; | ||
static $bar = FOO; | ||
|
||
$vars[] = 6; | ||
} | ||
|
||
public function nostatics() {} | ||
} | ||
const FOO = "bar"; | ||
|
||
function nostatics() {} | ||
|
||
$foo = new Foo(); | ||
|
||
var_dump(uopz_get_static(Foo::class, "method")); | ||
|
||
$foo->method(); | ||
|
||
var_dump(uopz_get_static(Foo::class, "method")); | ||
|
||
try { | ||
uopz_get_static(Foo::class, "none"); | ||
} catch (RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
|
||
try { | ||
uopz_get_static("none"); | ||
} catch (RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
|
||
try { | ||
uopz_get_static(DateTime::class, "__construct"); | ||
} catch(RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
|
||
try { | ||
uopz_get_static("phpversion"); | ||
} catch(RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
|
||
try { | ||
uopz_get_static(Foo::class, "nostatics"); | ||
} catch(RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
|
||
try { | ||
uopz_get_static("nostatics"); | ||
} catch(RuntimeException $ex) { | ||
var_dump($ex->getMessage()); | ||
} | ||
?> | ||
--EXPECTF-- | ||
array(2) { | ||
["vars"]=> | ||
array(5) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(3) | ||
[3]=> | ||
int(4) | ||
[4]=> | ||
int(5) | ||
} | ||
["bar"]=> | ||
NULL | ||
} | ||
array(2) { | ||
["vars"]=> | ||
array(6) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(3) | ||
[3]=> | ||
int(4) | ||
[4]=> | ||
int(5) | ||
[5]=> | ||
int(6) | ||
} | ||
["bar"]=> | ||
string(3) "bar" | ||
} | ||
string(%d) "failed to get statics from method %s::%s, it does not exist" | ||
string(%d) "failed to get statics from function %s, it does not exist" | ||
string(%d) "failed to get statics from internal method %s::%s" | ||
string(%d) "failed to get statics from internal function %s" | ||
string(%d) "failed to set statics in method %s::%s, no statics declared" | ||
string(%d) "failed to set statics in function %s, no statics declared" |
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
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
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
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
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
Oops, something went wrong.