mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
RFC: Deprecate remains of string evaluated code assertions (#11671)
Link: https://wiki.php.net/rfc/assert-string-eval-cleanup
This commit is contained in:
parent
591f3f619e
commit
3d4ff5ae22
40 changed files with 498 additions and 188 deletions
18
UPGRADING
18
UPGRADING
|
@ -126,6 +126,12 @@ PHP 8.3 UPGRADE NOTES
|
||||||
. The MT_RAND_PHP Mt19937 variant is deprecated.
|
. The MT_RAND_PHP Mt19937 variant is deprecated.
|
||||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_3#mt_rand_php
|
RFC: https://wiki.php.net/rfc/deprecations_php_8_3#mt_rand_php
|
||||||
|
|
||||||
|
- Standard:
|
||||||
|
. The assert_option() function is now deprecated.
|
||||||
|
. The ASSERT_ACTIVE, ASSERT_BAIL,ASSERT_CALLBACK, ASSERT_EXCEPTION, and
|
||||||
|
ASSERT_WARNING constants have been deprecated.
|
||||||
|
RFC: https://wiki.php.net/rfc/assert-string-eval-cleanup
|
||||||
|
|
||||||
- SQLite3
|
- SQLite3
|
||||||
. Using exceptions is now preferred, warnings will be removed in the future.
|
. Using exceptions is now preferred, warnings will be removed in the future.
|
||||||
Calling SQLite3::enableExceptions(false) will trigger a depreciation warning
|
Calling SQLite3::enableExceptions(false) will trigger a depreciation warning
|
||||||
|
@ -364,6 +370,18 @@ PHP 8.3 UPGRADE NOTES
|
||||||
11. Changes to INI File Handling
|
11. Changes to INI File Handling
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
|
- assert.*
|
||||||
|
. The assert.* INI settings have been deprecated.
|
||||||
|
This comprises the following INI settings:
|
||||||
|
- assert.active
|
||||||
|
- assert.bail
|
||||||
|
- assert.callback
|
||||||
|
- assert.exception
|
||||||
|
- assert.warning
|
||||||
|
If the value of the setting is equal to the default value, no deprecation
|
||||||
|
notice is emitted.
|
||||||
|
The zend.assertions INI setting should be used instead.
|
||||||
|
|
||||||
- zend.max_allowed_stack_size
|
- zend.max_allowed_stack_size
|
||||||
. New INI directive to set the maximum allowed stack size. Possible
|
. New INI directive to set the maximum allowed stack size. Possible
|
||||||
values are `0` (detect the process or thread maximum stack size), `-1`
|
values are `0` (detect the process or thread maximum stack size), `-1`
|
||||||
|
|
|
@ -2,16 +2,24 @@
|
||||||
Pretty printing for arrow functions
|
Pretty printing for arrow functions
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// TODO We're missing parentheses for the direct call
|
// TODO We're missing parentheses for the direct call
|
||||||
assert((fn() => false)());
|
|
||||||
assert((fn&(int... $args): ?bool => $args[0])(false));
|
try {
|
||||||
|
assert((fn() => false)());
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
assert((fn&(int... $args): ?bool => $args[0])(false));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(fn() => false()) failed in %s on line %d
|
assert(): assert(fn() => false()) failed
|
||||||
|
assert(): assert(fn&(int ...$args): ?bool => $args[0](false)) failed
|
||||||
Warning: assert(): assert(fn&(int ...$args): ?bool => $args[0](false)) failed in %s on line %d
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
Bug #70528 (assert() with instanceof adds apostrophes around class name)
|
Bug #70528 (assert() with instanceof adds apostrophes around class name)
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
assert.warning=1
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -11,13 +9,23 @@ namespace Foo;
|
||||||
class Bar {}
|
class Bar {}
|
||||||
|
|
||||||
$bar = "Bar";
|
$bar = "Bar";
|
||||||
assert(new \stdClass instanceof $bar);
|
try {
|
||||||
assert(new \stdClass instanceof Bar);
|
assert(new \stdClass instanceof $bar);
|
||||||
assert(new \stdClass instanceof \Foo\Bar);
|
} catch (\AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
assert(new \stdClass instanceof Bar);
|
||||||
|
} catch (\AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
assert(new \stdClass instanceof \Foo\Bar);
|
||||||
|
} catch (\AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(new \stdClass() instanceof $bar) failed in %sbug70528.php on line %d
|
assert(): assert(new \stdClass() instanceof $bar) failed
|
||||||
|
assert(): assert(new \stdClass() instanceof Bar) failed
|
||||||
Warning: assert(): assert(new \stdClass() instanceof Bar) failed in %sbug70528.php on line %d
|
assert(): assert(new \stdClass() instanceof \Foo\Bar) failed
|
||||||
|
|
||||||
Warning: assert(): assert(new \stdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
AST pretty-peinter
|
AST pretty-peinter
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
try {
|
||||||
assert(0 && ($a = function () {
|
assert(0 && ($a = function () {
|
||||||
global $a, $$b;
|
global $a, $$b;
|
||||||
static $c, $d = 0;
|
static $c, $d = 0;
|
||||||
|
@ -19,7 +19,11 @@ assert(0 && ($a = function () {
|
||||||
yield 1 => 2;
|
yield 1 => 2;
|
||||||
yield from $x;
|
yield from $x;
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
||||||
abstract class A extends B implements C, D {
|
abstract class A extends B implements C, D {
|
||||||
const X = 12;
|
const X = 12;
|
||||||
|
@ -64,7 +68,11 @@ assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use ($c,&$d) : X {
|
assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use ($c,&$d) : X {
|
||||||
final class A {
|
final class A {
|
||||||
final protected function f2() {
|
final protected function f2() {
|
||||||
|
@ -96,7 +104,11 @@ L0:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
|
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
|
||||||
class A {
|
class A {
|
||||||
use T1, T2 {
|
use T1, T2 {
|
||||||
|
@ -108,7 +120,11 @@ assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
|
||||||
use T3;
|
use T3;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function &(array &...$a) {
|
assert(0 && ($a = function &(array &...$a) {
|
||||||
declare(A=1,B=2);
|
declare(A=1,B=2);
|
||||||
try {
|
try {
|
||||||
|
@ -121,7 +137,11 @@ assert(0 && ($a = function &(array &...$a) {
|
||||||
echo 3;
|
echo 3;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function (): ?static {
|
assert(0 && ($a = function (): ?static {
|
||||||
declare(C=1) { echo 1; }
|
declare(C=1) { echo 1; }
|
||||||
$x = '\'"`$a';
|
$x = '\'"`$a';
|
||||||
|
@ -145,10 +165,13 @@ assert(0 && ($a = function (): ?static {
|
||||||
}
|
}
|
||||||
if ($a); else;
|
if ($a); else;
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(0 && ($a = function () {
|
assert(0 && ($a = function () {
|
||||||
global $a;
|
global $a;
|
||||||
global $$b;
|
global $$b;
|
||||||
static $c;
|
static $c;
|
||||||
|
@ -163,9 +186,8 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||||
$y = clone $x;
|
$y = clone $x;
|
||||||
yield 1 => 2;
|
yield 1 => 2;
|
||||||
yield from $x;
|
yield from $x;
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
|
||||||
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
|
|
||||||
abstract class A extends B implements C, D {
|
abstract class A extends B implements C, D {
|
||||||
public const X = 12;
|
public const X = 12;
|
||||||
public const Y = self::X, Z = 'aaa';
|
public const Y = self::X, Z = 'aaa';
|
||||||
|
@ -208,9 +230,8 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
|
||||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
|
|
||||||
final class A {
|
final class A {
|
||||||
protected final function f2() {
|
protected final function f2() {
|
||||||
if (!$x) {
|
if (!$x) {
|
||||||
|
@ -248,9 +269,8 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null, int|floa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
|
||||||
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
|
|
||||||
class A {
|
class A {
|
||||||
use T1, T2 {
|
use T1, T2 {
|
||||||
T1::foo insteadof foo;
|
T1::foo insteadof foo;
|
||||||
|
@ -261,9 +281,8 @@ Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c,
|
||||||
use T3;
|
use T3;
|
||||||
}
|
}
|
||||||
|
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
assert(0 && ($a = function &(array &...$a) {
|
||||||
Warning: assert(): assert(0 && ($a = function &(array &...$a) {
|
|
||||||
declare(A = 1, B = 2);
|
declare(A = 1, B = 2);
|
||||||
try {
|
try {
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -274,9 +293,8 @@ Warning: assert(): assert(0 && ($a = function &(array &...$a) {
|
||||||
} finally {
|
} finally {
|
||||||
echo 3;
|
echo 3;
|
||||||
}
|
}
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
assert(0 && ($a = function (): ?static {
|
||||||
Warning: assert(): assert(0 && ($a = function (): ?static {
|
|
||||||
declare(C = 1) {
|
declare(C = 1) {
|
||||||
echo 1;
|
echo 1;
|
||||||
}
|
}
|
||||||
|
@ -302,4 +320,4 @@ Warning: assert(): assert(0 && ($a = function (): ?static {
|
||||||
if ($a) {
|
if ($a) {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
})) failed in %s on line %d
|
}))
|
||||||
|
|
|
@ -2,23 +2,24 @@
|
||||||
test enable/disable assertions at runtime (assertions not completely disabled)
|
test enable/disable assertions at runtime (assertions not completely disabled)
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=0
|
zend.assertions=0
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("zend.assertions", 0);
|
ini_set("zend.assertions", 0);
|
||||||
var_dump(assert(false));
|
var_dump(assert(false));
|
||||||
var_dump(assert(true));
|
var_dump(assert(true));
|
||||||
ini_set("zend.assertions", 1);
|
ini_set("zend.assertions", 1);
|
||||||
var_dump(assert(false));
|
try {
|
||||||
|
var_dump(assert(false));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
var_dump(assert(true));
|
var_dump(assert(true));
|
||||||
ini_set("zend.assertions", -1);
|
ini_set("zend.assertions", -1);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
assert(): assert(false) failed
|
||||||
Warning: assert(): assert(false) failed in %sexpect_016.php on line 6
|
|
||||||
bool(false)
|
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
||||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_016.php on line 8
|
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %s on line %d
|
||||||
|
|
|
@ -2,18 +2,16 @@
|
||||||
test enable/disable assertions at runtime (assertions completely disabled)
|
test enable/disable assertions at runtime (assertions completely disabled)
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=-1
|
zend.assertions=-1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
ini_set("zend.assertions", 0);
|
||||||
var_dump(assert(false));
|
var_dump(assert(false));
|
||||||
var_dump(assert(true));
|
var_dump(assert(true));
|
||||||
ini_set("zend.assertions", 0);
|
|
||||||
ini_set("zend.assertions", 1);
|
ini_set("zend.assertions", 1);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 2
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
||||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 4
|
|
||||||
|
|
||||||
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 5
|
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %sexpect_017.php on line 5
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
test assertions in namespace
|
test assertions in namespace
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
namespace Foo;
|
namespace Foo;
|
||||||
|
@ -13,21 +12,25 @@ var_dump(\assert(true));
|
||||||
var_dump(assert(false));
|
var_dump(assert(false));
|
||||||
var_dump(assert(true));
|
var_dump(assert(true));
|
||||||
ini_set("zend.assertions", 1);
|
ini_set("zend.assertions", 1);
|
||||||
var_dump(\assert(false));
|
try {
|
||||||
|
var_dump(\assert(false));
|
||||||
|
} catch (\AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
var_dump(\assert(true));
|
var_dump(\assert(true));
|
||||||
var_dump(assert(false));
|
try {
|
||||||
|
var_dump(assert(false));
|
||||||
|
} catch (\AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
var_dump(assert(true));
|
var_dump(assert(true));
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
assert(): assert(false) failed
|
||||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 10
|
|
||||||
bool(false)
|
|
||||||
bool(true)
|
bool(true)
|
||||||
|
assert(): assert(false) failed
|
||||||
Warning: assert(): assert(false) failed in %sexpect_018.php on line 12
|
|
||||||
bool(false)
|
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
test assertions in namespace (assertions completely disabled)
|
test assertions in namespace (assertions completely disabled)
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=-1
|
zend.assertions=-1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
namespace Foo;
|
namespace Foo;
|
||||||
|
|
|
@ -2,16 +2,19 @@
|
||||||
AST pretty-printer
|
AST pretty-printer
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
try {
|
||||||
assert(0 && ($a = function () {
|
assert(0 && ($a = function () {
|
||||||
$var = 'test';
|
$var = 'test';
|
||||||
$str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
|
$str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(0 && ($a = function () {
|
assert(): assert(0 && ($a = function () {
|
||||||
$var = 'test';
|
$var = 'test';
|
||||||
$str = "$var, {$var[1]}, {$var}[], {$var[1]}[], {$var}[], {$var[1]}[]";
|
$str = "$var, {$var[1]}, {$var}[], {$var[1]}[], {$var}[], {$var[1]}[]";
|
||||||
})) failed in %sexpect_020.php on line %d
|
})) failed
|
||||||
|
|
16
Zend/tests/ast/ast_serialize_backtick_literal.phpt
Normal file
16
Zend/tests/ast/ast_serialize_backtick_literal.phpt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--TEST--
|
||||||
|
Serialization of backtick literal is incorrect
|
||||||
|
--INI--
|
||||||
|
zend.assertions=1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
assert(false && `echo -n ""`);
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
assert(): assert(false && `echo -n ""`) failed
|
|
@ -2,12 +2,14 @@
|
||||||
ZEND_POW_ASSIGN
|
ZEND_POW_ASSIGN
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
assert_options(ASSERT_WARNING);
|
try {
|
||||||
assert(false && ($a **= 2));
|
assert(false && ($a **= 2));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(false && ($a **= 2)) failed in %s%ezend-pow-assign.php on line %d
|
assert(): assert(false && ($a **= 2)) failed
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
--TEST--
|
|
||||||
Serialization of backtick literal is incorrect
|
|
||||||
--INI--
|
|
||||||
zend.assertions=1
|
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
|
|
||||||
assert_options(ASSERT_WARNING);
|
|
||||||
assert(false && `echo -n ""`);
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
Warning: assert(): assert(false && `echo -n ""`) failed in %s%east_serialize_backtick_literal.php on line %d
|
|
|
@ -2,35 +2,47 @@
|
||||||
Attributes AST can be exported.
|
Attributes AST can be exported.
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
assert.warning=1
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) { }));
|
try {
|
||||||
|
assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) { }));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn () => 1));
|
try {
|
||||||
|
assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn () => 1));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = new #[A1] class() {
|
assert(0 && ($a = new #[A1] class() {
|
||||||
#[A1]#[A2] const FOO = 'foo';
|
#[A1]#[A2] const FOO = 'foo';
|
||||||
#[A2] public $x;
|
#[A2] public $x;
|
||||||
#[A3] function a() { }
|
#[A3] function a() { }
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
assert(0 && ($a = function () {
|
assert(0 && ($a = function () {
|
||||||
#[A1] class Test1 { }
|
#[A1] class Test1 { }
|
||||||
#[A2] interface Test2 { }
|
#[A2] interface Test2 { }
|
||||||
#[A3] trait Test3 { }
|
#[A3] trait Test3 { }
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) {
|
assert(): assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) {
|
||||||
})) failed in %s on line %d
|
})) failed
|
||||||
|
assert(): assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn() => 1)) failed
|
||||||
Warning: assert(): assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn() => 1)) failed in %s on line %d
|
assert(): assert(0 && ($a = new #[A1] class {
|
||||||
|
|
||||||
Warning: assert(): assert(0 && ($a = new #[A1] class {
|
|
||||||
#[A1]
|
#[A1]
|
||||||
#[A2]
|
#[A2]
|
||||||
public const FOO = 'foo';
|
public const FOO = 'foo';
|
||||||
|
@ -40,9 +52,8 @@ Warning: assert(): assert(0 && ($a = new #[A1] class {
|
||||||
public function a() {
|
public function a() {
|
||||||
}
|
}
|
||||||
|
|
||||||
})) failed in %s on line %d
|
})) failed
|
||||||
|
assert(): assert(0 && ($a = function () {
|
||||||
Warning: assert(): assert(0 && ($a = function () {
|
|
||||||
#[A1]
|
#[A1]
|
||||||
class Test1 {
|
class Test1 {
|
||||||
}
|
}
|
||||||
|
@ -55,4 +66,4 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||||
trait Test3 {
|
trait Test3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
})) failed in %s on line %d
|
})) failed
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test exception doesn't cause RSHUTDOWN bypass, variation 0
|
Test exception doesn't cause RSHUTDOWN bypass, variation 0
|
||||||
--INI--
|
--INI--
|
||||||
assert.bail=1
|
zend.assertions=1
|
||||||
assert.exception=1
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define ("XXXXX", 1);
|
define ("XXXXX", 1);
|
||||||
try {
|
assert(false);
|
||||||
assert(false);
|
|
||||||
} catch (AssertionError $error) {
|
|
||||||
echo "Caught\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTHEADERS--
|
--EXPECTHEADERS--
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Pretty printing for match expression
|
Pretty printing for match expression
|
||||||
--INI--
|
--INI--
|
||||||
assert.exception=0
|
zend.assertions=1
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
assert((function () {
|
assert((function () {
|
||||||
match ('foo') {
|
match ('foo') {
|
||||||
'foo', 'bar' => false,
|
'foo', 'bar' => false,
|
||||||
|
@ -12,13 +13,16 @@ assert((function () {
|
||||||
default => 'b',
|
default => 'b',
|
||||||
};
|
};
|
||||||
})());
|
})());
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: assert(): assert(function () {
|
assert(): assert(function () {
|
||||||
match ('foo') {
|
match ('foo') {
|
||||||
'foo', 'bar' => false,
|
'foo', 'bar' => false,
|
||||||
'baz' => 'a',
|
'baz' => 'a',
|
||||||
default => 'b',
|
default => 'b',
|
||||||
};
|
};
|
||||||
}()) failed in %s on line %d
|
}()) failed
|
|
@ -2,9 +2,9 @@
|
||||||
AST pretty-printer
|
AST pretty-printer
|
||||||
--INI--
|
--INI--
|
||||||
zend.assertions=1
|
zend.assertions=1
|
||||||
assert.exception=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
try {
|
||||||
assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
|
assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
|
||||||
$x = new class {
|
$x = new class {
|
||||||
public $a;
|
public $a;
|
||||||
|
@ -12,12 +12,15 @@ assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
|
||||||
public ?int $c;
|
public ?int $c;
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Warning: assert(): assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
|
assert(): assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
|
||||||
$x = new class {
|
$x = new class {
|
||||||
public $a;
|
public $a;
|
||||||
public int $b;
|
public int $b;
|
||||||
public ?int $c;
|
public ?int $c;
|
||||||
};
|
};
|
||||||
})) failed in %stypes_in_ast.php on line 2
|
})) failed
|
||||||
|
|
|
@ -36,6 +36,15 @@ ZEND_DECLARE_MODULE_GLOBALS(assert)
|
||||||
|
|
||||||
PHPAPI zend_class_entry *assertion_error_ce;
|
PHPAPI zend_class_entry *assertion_error_ce;
|
||||||
|
|
||||||
|
/* Hack to pass a custom stage for the our OnModify handler so that a deprecation warning does not get emitted
|
||||||
|
* when an option is modified via assert_option() function */
|
||||||
|
#define ZEND_INI_STAGE_ASSERT_OPTIONS (1<<6)
|
||||||
|
|
||||||
|
static inline bool php_must_emit_ini_deprecation(int stage)
|
||||||
|
{
|
||||||
|
return stage != ZEND_INI_STAGE_DEACTIVATE && stage != ZEND_INI_STAGE_SHUTDOWN && stage != ZEND_INI_STAGE_ASSERT_OPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
||||||
{
|
{
|
||||||
if (EG(current_execute_data)) {
|
if (EG(current_execute_data)) {
|
||||||
|
@ -44,6 +53,9 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
||||||
ZVAL_UNDEF(&ASSERTG(callback));
|
ZVAL_UNDEF(&ASSERTG(callback));
|
||||||
}
|
}
|
||||||
if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || ZSTR_LEN(new_value))) {
|
if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || ZSTR_LEN(new_value))) {
|
||||||
|
if (php_must_emit_ini_deprecation(stage)) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.callback INI setting is deprecated");
|
||||||
|
}
|
||||||
ZVAL_STR_COPY(&ASSERTG(callback), new_value);
|
ZVAL_STR_COPY(&ASSERTG(callback), new_value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,6 +63,9 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
||||||
pefree(ASSERTG(cb), 1);
|
pefree(ASSERTG(cb), 1);
|
||||||
}
|
}
|
||||||
if (new_value && ZSTR_LEN(new_value)) {
|
if (new_value && ZSTR_LEN(new_value)) {
|
||||||
|
if (php_must_emit_ini_deprecation(stage)) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.callback INI setting is deprecated");
|
||||||
|
}
|
||||||
ASSERTG(cb) = pemalloc(ZSTR_LEN(new_value) + 1, 1);
|
ASSERTG(cb) = pemalloc(ZSTR_LEN(new_value) + 1, 1);
|
||||||
memcpy(ASSERTG(cb), ZSTR_VAL(new_value), ZSTR_LEN(new_value));
|
memcpy(ASSERTG(cb), ZSTR_VAL(new_value), ZSTR_LEN(new_value));
|
||||||
ASSERTG(cb)[ZSTR_LEN(new_value)] = '\0';
|
ASSERTG(cb)[ZSTR_LEN(new_value)] = '\0';
|
||||||
|
@ -62,12 +77,54 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
static PHP_INI_MH(OnUpdateActiveBool)
|
||||||
|
{
|
||||||
|
bool *p = (bool *) ZEND_INI_GET_ADDR();
|
||||||
|
*p = zend_ini_parse_bool(new_value);
|
||||||
|
if (php_must_emit_ini_deprecation(stage) && !*p) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.active INI setting is deprecated");
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PHP_INI_MH(OnUpdateBailBool)
|
||||||
|
{
|
||||||
|
bool *p = (bool *) ZEND_INI_GET_ADDR();
|
||||||
|
*p = zend_ini_parse_bool(new_value);
|
||||||
|
if (php_must_emit_ini_deprecation(stage) && *p) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.bail INI setting is deprecated");
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PHP_INI_MH(OnUpdateExceptionBool)
|
||||||
|
{
|
||||||
|
bool *p = (bool *) ZEND_INI_GET_ADDR();
|
||||||
|
*p = zend_ini_parse_bool(new_value);
|
||||||
|
if (php_must_emit_ini_deprecation(stage) && !*p) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.exception INI setting is deprecated");
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PHP_INI_MH(OnUpdateWarningBool)
|
||||||
|
{
|
||||||
|
bool *p = (bool *) ZEND_INI_GET_ADDR();
|
||||||
|
*p = zend_ini_parse_bool(new_value);
|
||||||
|
if (php_must_emit_ini_deprecation(stage) && !*p) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "assert.warning INI setting is deprecated");
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PHP_INI_BEGIN()
|
PHP_INI_BEGIN()
|
||||||
STD_PHP_INI_BOOLEAN("assert.active", "1", PHP_INI_ALL, OnUpdateBool, active, zend_assert_globals, assert_globals)
|
STD_PHP_INI_BOOLEAN("assert.active", "1", PHP_INI_ALL, OnUpdateActiveBool, active, zend_assert_globals, assert_globals)
|
||||||
STD_PHP_INI_BOOLEAN("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals)
|
STD_PHP_INI_BOOLEAN("assert.bail", "0", PHP_INI_ALL, OnUpdateBailBool, bail, zend_assert_globals, assert_globals)
|
||||||
STD_PHP_INI_BOOLEAN("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals)
|
STD_PHP_INI_BOOLEAN("assert.warning", "1", PHP_INI_ALL, OnUpdateWarningBool, warning, zend_assert_globals, assert_globals)
|
||||||
PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
|
PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
|
||||||
STD_PHP_INI_BOOLEAN("assert.exception", "1", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals)
|
STD_PHP_INI_BOOLEAN("assert.exception", "1", PHP_INI_ALL, OnUpdateExceptionBool, exception, zend_assert_globals, assert_globals)
|
||||||
PHP_INI_END()
|
PHP_INI_END()
|
||||||
|
|
||||||
static void php_assert_init_globals(zend_assert_globals *assert_globals_p) /* {{{ */
|
static void php_assert_init_globals(zend_assert_globals *assert_globals_p) /* {{{ */
|
||||||
|
@ -214,7 +271,7 @@ PHP_FUNCTION(assert_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ZSTR_INIT_LITERAL("assert.active", 0);
|
key = ZSTR_INIT_LITERAL("assert.active", 0);
|
||||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
|
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, ZEND_INI_STAGE_ASSERT_OPTIONS, 0);
|
||||||
zend_string_release_ex(key, 0);
|
zend_string_release_ex(key, 0);
|
||||||
zend_string_release_ex(value_str, 0);
|
zend_string_release_ex(value_str, 0);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +287,7 @@ PHP_FUNCTION(assert_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ZSTR_INIT_LITERAL("assert.bail", 0);
|
key = ZSTR_INIT_LITERAL("assert.bail", 0);
|
||||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
|
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, ZEND_INI_STAGE_ASSERT_OPTIONS, 0);
|
||||||
zend_string_release_ex(key, 0);
|
zend_string_release_ex(key, 0);
|
||||||
zend_string_release_ex(value_str, 0);
|
zend_string_release_ex(value_str, 0);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +303,7 @@ PHP_FUNCTION(assert_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ZSTR_INIT_LITERAL("assert.warning", 0);
|
key = ZSTR_INIT_LITERAL("assert.warning", 0);
|
||||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
|
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, ZEND_INI_STAGE_ASSERT_OPTIONS, 0);
|
||||||
zend_string_release_ex(key, 0);
|
zend_string_release_ex(key, 0);
|
||||||
zend_string_release_ex(value_str, 0);
|
zend_string_release_ex(value_str, 0);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +338,7 @@ PHP_FUNCTION(assert_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ZSTR_INIT_LITERAL("assert.exception", 0);
|
key = ZSTR_INIT_LITERAL("assert.exception", 0);
|
||||||
zend_alter_ini_entry_ex(key, val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
|
zend_alter_ini_entry_ex(key, val, PHP_INI_USER, ZEND_INI_STAGE_ASSERT_OPTIONS, 0);
|
||||||
zend_string_release_ex(val, 0);
|
zend_string_release_ex(val, 0);
|
||||||
zend_string_release_ex(key, 0);
|
zend_string_release_ex(key, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,26 +124,31 @@ const ARRAY_FILTER_USE_KEY = UNKNOWN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
* @deprecated
|
||||||
* @cvalue PHP_ASSERT_ACTIVE
|
* @cvalue PHP_ASSERT_ACTIVE
|
||||||
*/
|
*/
|
||||||
const ASSERT_ACTIVE = UNKNOWN;
|
const ASSERT_ACTIVE = UNKNOWN;
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
* @deprecated
|
||||||
* @cvalue PHP_ASSERT_CALLBACK
|
* @cvalue PHP_ASSERT_CALLBACK
|
||||||
*/
|
*/
|
||||||
const ASSERT_CALLBACK = UNKNOWN;
|
const ASSERT_CALLBACK = UNKNOWN;
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
* @deprecated
|
||||||
* @cvalue PHP_ASSERT_BAIL
|
* @cvalue PHP_ASSERT_BAIL
|
||||||
*/
|
*/
|
||||||
const ASSERT_BAIL = UNKNOWN;
|
const ASSERT_BAIL = UNKNOWN;
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
* @deprecated
|
||||||
* @cvalue PHP_ASSERT_WARNING
|
* @cvalue PHP_ASSERT_WARNING
|
||||||
*/
|
*/
|
||||||
const ASSERT_WARNING = UNKNOWN;
|
const ASSERT_WARNING = UNKNOWN;
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
* @deprecated
|
||||||
* @cvalue PHP_ASSERT_EXCEPTION
|
* @cvalue PHP_ASSERT_EXCEPTION
|
||||||
*/
|
*/
|
||||||
const ASSERT_EXCEPTION = UNKNOWN;
|
const ASSERT_EXCEPTION = UNKNOWN;
|
||||||
|
@ -2264,6 +2269,7 @@ function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $flags =
|
||||||
|
|
||||||
function assert(mixed $assertion, Throwable|string|null $description = null): bool {}
|
function assert(mixed $assertion, Throwable|string|null $description = null): bool {}
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
function assert_options(int $option, mixed $value = UNKNOWN): mixed {}
|
function assert_options(int $option, mixed $value = UNKNOWN): mixed {}
|
||||||
|
|
||||||
/* string.c */
|
/* string.c */
|
||||||
|
|
14
ext/standard/basic_functions_arginfo.h
generated
14
ext/standard/basic_functions_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: b0767630614e040866bd7ffdaf50dd31298a64f3 */
|
* Stub hash: a15bbbd1d29dfd674dd2174b3be5678a0832116a */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
|
||||||
|
@ -3061,7 +3061,7 @@ static const zend_function_entry ext_functions[] = {
|
||||||
ZEND_FE(htmlentities, arginfo_htmlentities)
|
ZEND_FE(htmlentities, arginfo_htmlentities)
|
||||||
ZEND_FE(get_html_translation_table, arginfo_get_html_translation_table)
|
ZEND_FE(get_html_translation_table, arginfo_get_html_translation_table)
|
||||||
ZEND_FE(assert, arginfo_assert)
|
ZEND_FE(assert, arginfo_assert)
|
||||||
ZEND_FE(assert_options, arginfo_assert_options)
|
ZEND_DEP_FE(assert_options, arginfo_assert_options)
|
||||||
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(bin2hex, arginfo_bin2hex)
|
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(bin2hex, arginfo_bin2hex)
|
||||||
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hex2bin, arginfo_hex2bin)
|
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(hex2bin, arginfo_hex2bin)
|
||||||
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strspn, arginfo_strspn)
|
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(strspn, arginfo_strspn)
|
||||||
|
@ -3500,11 +3500,11 @@ static void register_basic_functions_symbols(int module_number)
|
||||||
REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", PHP_COUNT_RECURSIVE, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", PHP_COUNT_RECURSIVE, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", PHP_ASSERT_ACTIVE, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", PHP_ASSERT_ACTIVE, CONST_PERSISTENT | CONST_DEPRECATED);
|
||||||
REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", PHP_ASSERT_CALLBACK, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", PHP_ASSERT_CALLBACK, CONST_PERSISTENT | CONST_DEPRECATED);
|
||||||
REGISTER_LONG_CONSTANT("ASSERT_BAIL", PHP_ASSERT_BAIL, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ASSERT_BAIL", PHP_ASSERT_BAIL, CONST_PERSISTENT | CONST_DEPRECATED);
|
||||||
REGISTER_LONG_CONSTANT("ASSERT_WARNING", PHP_ASSERT_WARNING, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ASSERT_WARNING", PHP_ASSERT_WARNING, CONST_PERSISTENT | CONST_DEPRECATED);
|
||||||
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", PHP_ASSERT_EXCEPTION, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", PHP_ASSERT_EXCEPTION, CONST_PERSISTENT | CONST_DEPRECATED);
|
||||||
REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_PERSISTENT);
|
||||||
|
|
|
@ -36,7 +36,30 @@ $obj = new a();
|
||||||
assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
|
assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
|
||||||
assert($a != 0);
|
assert($a != 0);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.active INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assertion failed 21,"assert($a != 0)"
|
assertion failed 21,"assert($a != 0)"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
class assertion failed 24,"assert($a != 0)"
|
class assertion failed 24,"assert($a != 0)"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
class assertion failed 28,"assert($a != 0)"
|
class assertion failed 28,"assert($a != 0)"
|
||||||
|
|
|
@ -31,6 +31,23 @@ ini_set("assert.callback", "b");
|
||||||
assert($a != 0);
|
assert($a != 0);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assertion failed - a - 18,"assert($a != 0)"
|
assertion failed - a - 18,"assert($a != 0)"
|
||||||
|
|
||||||
|
Deprecated: ini_set(): assert.callback INI setting is deprecated in %s on line %d
|
||||||
assertion failed - b - 22,"assert($a != 0)"
|
assertion failed - b - 22,"assert($a != 0)"
|
||||||
|
|
|
@ -27,6 +27,20 @@ echo "not reached\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: assert(): assert(0) failed in %s on line %d
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Warning: assert(): assert(0) failed in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_BAIL is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
Warning: assert(): assert(0) failed in %s on line %d
|
Warning: assert(): assert(0) failed in %s on line %d
|
||||||
|
|
|
@ -16,7 +16,12 @@ function f1()
|
||||||
var_dump($r2 = assert(0));
|
var_dump($r2 = assert(0));
|
||||||
var_dump($r2 = assert(1));
|
var_dump($r2 = assert(1));
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
f1 called
|
f1 called
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -15,6 +15,11 @@ function f1()
|
||||||
var_dump($r2=assert(0));
|
var_dump($r2=assert(0));
|
||||||
var_dump($r2=assert(1));
|
var_dump($r2=assert(1));
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.active INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -26,12 +26,27 @@ var_dump($n= assert_options(ASSERT_CALLBACK));
|
||||||
assert(0);
|
assert(0);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f1"
|
string(2) "f1"
|
||||||
f1 called
|
f1 called
|
||||||
|
|
||||||
Warning: assert(): assert(0) failed in %s on line 13
|
Warning: assert(): assert(0) failed in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f1"
|
string(2) "f1"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f2"
|
string(2) "f2"
|
||||||
f2 called
|
f2 called
|
||||||
|
|
||||||
Warning: assert(): assert(0) failed in %s on line 17
|
Warning: assert(): assert(0) failed in %s on line %d
|
||||||
|
|
|
@ -19,6 +19,13 @@ var_dump($r2=assert(0 != 0));
|
||||||
echo "If this is printed BAIL hasn't worked";
|
echo "If this is printed BAIL hasn't worked";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_BAIL is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
int(0)
|
int(0)
|
||||||
f1 called
|
f1 called
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,31 @@ echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning"
|
||||||
echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n";
|
echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n";
|
||||||
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
|
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.active INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_ACTIVE is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Initial values: assert_options(ASSERT_ACTIVE) => [0]
|
Initial values: assert_options(ASSERT_ACTIVE) => [0]
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Initial values: assert_options(ASSERT_WARNING) => [0]
|
Initial values: assert_options(ASSERT_WARNING) => [0]
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_BAIL is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Initial values: assert_options(ASSERT_BAIL) => [0]
|
Initial values: assert_options(ASSERT_BAIL) => [0]
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
|
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
|
||||||
Initial values: ini.get("assert.active") => [0]
|
Initial values: ini.get("assert.active") => [0]
|
||||||
Initial values: ini.get("assert.warning") => [0]
|
Initial values: ini.get("assert.warning") => [0]
|
||||||
|
|
|
@ -22,10 +22,23 @@ var_dump($r2=assert(0 == 0));
|
||||||
var_dump($rao=assert_options(ASSERT_WARNING, 0));
|
var_dump($rao=assert_options(ASSERT_WARNING, 0));
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
int(0)
|
int(0)
|
||||||
f1 called
|
f1 called
|
||||||
|
|
||||||
Warning: assert(): assert(0 != 0) failed in %s on line %d
|
Warning: assert(): assert(0 != 0) failed in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_WARNING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
int(1)
|
int(1)
|
||||||
|
|
|
@ -31,10 +31,25 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f1"
|
string(2) "f1"
|
||||||
foo
|
foo
|
||||||
assert(false)
|
assert(false)
|
||||||
|
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
NULL
|
NULL
|
||||||
assert(false)
|
assert(false)
|
||||||
|
|
|
@ -11,6 +11,11 @@ assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; });
|
||||||
assert(0);
|
assert(0);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Hello World!
|
Hello World!
|
||||||
|
|
||||||
Warning: assert(): assert(0) failed in %s on line %d
|
Warning: assert(): assert(0) failed in %s on line %d
|
||||||
|
|
|
@ -31,5 +31,8 @@ try {
|
||||||
} catch (Throwable) {}
|
} catch (Throwable) {}
|
||||||
?>
|
?>
|
||||||
DONE
|
DONE
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
DONE
|
DONE
|
||||||
|
|
|
@ -21,6 +21,13 @@ var_dump($r2 = assert(0 != 0));
|
||||||
echo "If this is printed BAIL hasn't worked";
|
echo "If this is printed BAIL hasn't worked";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_BAIL is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
int(0)
|
int(0)
|
||||||
f1 called
|
f1 called
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,6 @@ try {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assert_options(): Argument #1 ($option) must be an ASSERT_* constant
|
assert_options(): Argument #1 ($option) must be an ASSERT_* constant
|
||||||
|
|
|
@ -9,6 +9,7 @@ var_dump(assert(true));
|
||||||
var_dump(assert(false));
|
var_dump(assert(false));
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
||||||
Warning: assert(): assert(false) failed in %s on line %d
|
Warning: assert(): assert(false) failed in %s on line %d
|
||||||
|
|
|
@ -32,14 +32,14 @@ echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callbac
|
||||||
var_dump($r2=assert(0 != 0));
|
var_dump($r2=assert(0 != 0));
|
||||||
echo"\n";
|
echo"\n";
|
||||||
|
|
||||||
echo "Change callback function using ini.set and test return value \n";
|
echo "Change callback function using ini.set and test return value\n";
|
||||||
var_dump($rv = ini_set("assert.callback","f2"));
|
var_dump($rv = ini_set("assert.callback","f2"));
|
||||||
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
|
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
|
||||||
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
|
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
|
||||||
var_dump($r2=assert(0 != 0));
|
var_dump($r2=assert(0 != 0));
|
||||||
echo"\n";
|
echo"\n";
|
||||||
|
|
||||||
echo "Change callback function using assert_options and test return value \n";
|
echo "Change callback function using assert_options and test return value\n";
|
||||||
var_dump($rv=assert_options(ASSERT_CALLBACK, "f3"));
|
var_dump($rv=assert_options(ASSERT_CALLBACK, "f3"));
|
||||||
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
|
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
|
||||||
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
|
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
|
||||||
|
@ -58,14 +58,14 @@ try {
|
||||||
}
|
}
|
||||||
echo"\n";
|
echo"\n";
|
||||||
|
|
||||||
echo "Reset callback options to use a class method \n";
|
echo "Reset callback options to use a class method\n";
|
||||||
var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert")));
|
var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert")));
|
||||||
var_dump($rao=assert_options(ASSERT_CALLBACK));
|
var_dump($rao=assert_options(ASSERT_CALLBACK));
|
||||||
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
|
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
|
||||||
var_dump($r2=assert(0 != 0));
|
var_dump($r2=assert(0 != 0));
|
||||||
echo"\n";
|
echo"\n";
|
||||||
|
|
||||||
echo "Reset callback options to use an object method \n";
|
echo "Reset callback options to use an object method\n";
|
||||||
$o = new c1();
|
$o = new c1();
|
||||||
var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert")));
|
var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert")));
|
||||||
var_dump($rao=assert_options(ASSERT_CALLBACK));
|
var_dump($rao=assert_options(ASSERT_CALLBACK));
|
||||||
|
@ -78,34 +78,73 @@ assert_options(ASSERT_CALLBACK, 3.141);
|
||||||
var_dump($rao = assert_options(ASSERT_CALLBACK));
|
var_dump($rao = assert_options(ASSERT_CALLBACK));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.warning INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.callback INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
|
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
|
||||||
Initial values: ini.get("assert.callback") => [f1]
|
Initial values: ini.get("assert.callback") => [f1]
|
||||||
f1 called
|
f1 called
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Change callback function using ini.set and test return value
|
Change callback function using ini.set and test return value
|
||||||
|
|
||||||
|
Deprecated: ini_set(): assert.callback INI setting is deprecated in %s on line %d
|
||||||
string(2) "f1"
|
string(2) "f1"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assert_options(ASSERT_CALLBACK) => [f2]
|
assert_options(ASSERT_CALLBACK) => [f2]
|
||||||
ini.get("assert.callback") => [f2]
|
ini.get("assert.callback") => [f2]
|
||||||
f2 called
|
f2 called
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Change callback function using assert_options and test return value
|
Change callback function using assert_options and test return value
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f2"
|
string(2) "f2"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assert_options(ASSERT_CALLBACK) => [f3]
|
assert_options(ASSERT_CALLBACK) => [f3]
|
||||||
ini.get("assert.callback") => [f2]
|
ini.get("assert.callback") => [f2]
|
||||||
f3 called
|
f3 called
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Reset the name of the callback routine to a class method
|
Reset the name of the callback routine to a class method
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "f3"
|
string(2) "f3"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
assert_options(ASSERT_CALLBACK) => [c1]
|
assert_options(ASSERT_CALLBACK) => [c1]
|
||||||
ini.get("assert.callback") => [f2]
|
ini.get("assert.callback") => [f2]
|
||||||
Invalid callback c1, function "c1" not found or invalid function name
|
Invalid callback c1, function "c1" not found or invalid function name
|
||||||
|
|
||||||
Reset callback options to use a class method
|
Reset callback options to use a class method
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(2) "c1"
|
string(2) "c1"
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
string(2) "c1"
|
string(2) "c1"
|
||||||
|
@ -117,13 +156,21 @@ ini.get("assert.callback") => [f2]
|
||||||
Class assertion failed 56, "assert(0 != 0)"
|
Class assertion failed 56, "assert(0 != 0)"
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Reset callback options to use an object method
|
Reset callback options to use an object method
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
string(2) "c1"
|
string(2) "c1"
|
||||||
[1]=>
|
[1]=>
|
||||||
string(6) "assert"
|
string(6) "assert"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
&object(c1)#2 (0) {
|
&object(c1)#2 (0) {
|
||||||
|
@ -137,4 +184,12 @@ Class assertion failed 64, "assert(0 != 0)"
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Set callback to something silly
|
Set callback to something silly
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
float(3.141)
|
float(3.141)
|
||||||
|
|
|
@ -10,4 +10,6 @@ assert.exception=0
|
||||||
assert(0, null);
|
assert(0, null);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: PHP Startup: assert.exception INI setting is deprecated in Unknown on line 0
|
||||||
|
|
||||||
Warning: assert(): Assertion failed in %s on line %d
|
Warning: assert(): Assertion failed in %s on line %d
|
||||||
|
|
|
@ -12,6 +12,9 @@ assert(false, 'Dynamic message: ' . $x);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
Deprecated: Constant ASSERT_CALLBACK is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function assert_options() is deprecated in %s on line %d
|
||||||
string(18) "Dynamic message: x"
|
string(18) "Dynamic message: x"
|
||||||
|
|
||||||
Fatal error: Uncaught AssertionError: Dynamic message: x in %s:%d
|
Fatal error: Uncaught AssertionError: Dynamic message: x in %s:%d
|
||||||
|
|
|
@ -1601,33 +1601,14 @@ session.sid_bits_per_character = 5
|
||||||
; -1: Do not compile at all
|
; -1: Do not compile at all
|
||||||
; 0: Jump over assertion at run-time
|
; 0: Jump over assertion at run-time
|
||||||
; 1: Execute assertions
|
; 1: Execute assertions
|
||||||
; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1)
|
; Changing from or to a negative value is only possible in php.ini!
|
||||||
|
; (For turning assertions on and off at run-time, toggle zend.assertions between the values 1 and 0)
|
||||||
; Default Value: 1
|
; Default Value: 1
|
||||||
; Development Value: 1
|
; Development Value: 1
|
||||||
; Production Value: -1
|
; Production Value: -1
|
||||||
; https://php.net/zend.assertions
|
; https://php.net/zend.assertions
|
||||||
zend.assertions = 1
|
zend.assertions = 1
|
||||||
|
|
||||||
; Assert(expr); active by default.
|
|
||||||
; https://php.net/assert.active
|
|
||||||
;assert.active = On
|
|
||||||
|
|
||||||
; Throw an AssertionError on failed assertions
|
|
||||||
; https://php.net/assert.exception
|
|
||||||
;assert.exception = On
|
|
||||||
|
|
||||||
; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active)
|
|
||||||
; https://php.net/assert.warning
|
|
||||||
;assert.warning = On
|
|
||||||
|
|
||||||
; Don't bail out by default.
|
|
||||||
; https://php.net/assert.bail
|
|
||||||
;assert.bail = Off
|
|
||||||
|
|
||||||
; User-function to be called if an assertion fails.
|
|
||||||
; https://php.net/assert.callback
|
|
||||||
;assert.callback = 0
|
|
||||||
|
|
||||||
[COM]
|
[COM]
|
||||||
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
|
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
|
||||||
; https://php.net/com.typelib-file
|
; https://php.net/com.typelib-file
|
||||||
|
|
|
@ -1603,33 +1603,14 @@ session.sid_bits_per_character = 5
|
||||||
; -1: Do not compile at all
|
; -1: Do not compile at all
|
||||||
; 0: Jump over assertion at run-time
|
; 0: Jump over assertion at run-time
|
||||||
; 1: Execute assertions
|
; 1: Execute assertions
|
||||||
; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1)
|
; Changing from or to a negative value is only possible in php.ini!
|
||||||
|
; (For turning assertions on and off at run-time, toggle zend.assertions between the values 1 and 0)
|
||||||
; Default Value: 1
|
; Default Value: 1
|
||||||
; Development Value: 1
|
; Development Value: 1
|
||||||
; Production Value: -1
|
; Production Value: -1
|
||||||
; https://php.net/zend.assertions
|
; https://php.net/zend.assertions
|
||||||
zend.assertions = -1
|
zend.assertions = -1
|
||||||
|
|
||||||
; Assert(expr); active by default.
|
|
||||||
; https://php.net/assert.active
|
|
||||||
;assert.active = On
|
|
||||||
|
|
||||||
; Throw an AssertionError on failed assertions
|
|
||||||
; https://php.net/assert.exception
|
|
||||||
;assert.exception = On
|
|
||||||
|
|
||||||
; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active)
|
|
||||||
; https://php.net/assert.warning
|
|
||||||
;assert.warning = On
|
|
||||||
|
|
||||||
; Don't bail out by default.
|
|
||||||
; https://php.net/assert.bail
|
|
||||||
;assert.bail = Off
|
|
||||||
|
|
||||||
; User-function to be called if an assertion fails.
|
|
||||||
; https://php.net/assert.callback
|
|
||||||
;assert.callback = 0
|
|
||||||
|
|
||||||
[COM]
|
[COM]
|
||||||
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
|
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
|
||||||
; https://php.net/com.typelib-file
|
; https://php.net/com.typelib-file
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
zend_throw_exception with NULL message
|
zend_throw_exception with NULL message
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
assert_options(ASSERT_EXCEPTION, true);
|
|
||||||
try {
|
try {
|
||||||
$assert = 'assert';
|
$assert = 'assert';
|
||||||
$assert(false);
|
$assert(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue