Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dynamically)
--FILE--
<?php
- error_reporting(E_ALL & !E_STRICT);
-
class A {
function hello() {
echo "Hello World\n";
?>
===DONE===
--EXPECTF--
+Deprecated: Non-static method A::hello() should not be called statically in %s on line %d
Hello World
===DONE===
Bug #40809 (Poor performance of ".=")
--FILE--
<?php
-error_reporting(E_ALL|E_STRICT);
$num_increments = 100;
$num_repeats = 1000;
opcache.enable_cli=0
--FILE--
<?php
-error_reporting(E_ALL|E_STRICT);
class Foo
{
}
set_error_handler(
- array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT
+ array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL
);
$o = new B;
The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occures. (relevant with #60536)
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
private $hello;
Properties should be initialized correctly (relevant to #60536)
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class BaseWithPropA {
private $hello = 0;
Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
private $hello;
Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
protected $hello;
--TEST--
bug67436: E_STRICT instead of custom error handler
-
---INI--
-error_reporting=-1
-
--FILE--
<?php
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
function handle_error($code, $message, $file, $line, $context) {
if (!function_exists("bla")) {
eval('function bla($s) {echo "$s\n";}');
Bug #69388 - Variation
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
function handle_error($code, $message, $file, $line, $context) {
eval('namespace Foo;');
echo "$message\n";
set_error_handler(function() {
// var_dump(func_get_args());
DoesNotExists::$nope = true;
-}, E_ALL | E_STRICT);
+}, E_ALL);
$foo = new Mock_MethodCallbackByReference_7b180d26();
$InvMocker = new PHPUnit_Framework_MockObject_InvocationMocker();
--TEST--
Bug #74408 (Endless loop bypassing execution time limit)
---INI--
-error_reporting = E_ALL | E_DEPRECATED | E_STRICT
--FILE--
<?php
- //php.ini: error_reporting = E_ALL | E_DEPRECATED | E_STRICT
-
class ErrorHandling {
public function error_handler($errno, $errstr, $errfile, $errline) {
--FILE--
<?php
-error_reporting(E_ALL|E_STRICT);
-
class foo {
public function __get($a) {
return new $this;
--TEST--
-Potentially conflicting properties should result in a strict notice. Property use is discorage for traits that are supposed to enable maintainable code reuse. Accessor methods are the language supported idiom for this.
+"Potentially" conflicting trait properties do not result in a strict standards notice anymore
--FILE--
<?php
error_reporting(E_ALL);
}
echo "PRE-CLASS-GUARD-TraitsTest\n";
-error_reporting(E_ALL & ~E_STRICT); // ensuring that it is only for E_STRICT
class TraitsTest {
use THello1;
use THello2;
}
-error_reporting(E_ALL | E_STRICT);
-
echo "PRE-CLASS-GUARD-TraitsTest2\n";
class TraitsTest2 {
Non-conflicting properties should work just fine.
--FILE--
<?php
-error_reporting(E_ALL);
trait THello1 {
public $hello = "hello";
--EXPECTF--
bool(true)
bool(true)
-hello World!
\ No newline at end of file
+hello World!
Conflicting properties with different visibility modifiers should result in a fatal error, since this indicates that the code is incompatible.
--FILE--
<?php
-error_reporting(E_ALL);
trait THello1 {
public $hello;
--EXPECTF--
PRE-CLASS-GUARD
-Fatal error: THello1 and THello2 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
\ No newline at end of file
+Fatal error: THello1 and THello2 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
Conflicting properties with different initial values are considered incompatible.
--FILE--
<?php
-error_reporting(E_ALL);
trait THello1 {
public $hello = "foo";
--EXPECTF--
PRE-CLASS-GUARD
-Fatal error: THello1 and THello2 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
\ No newline at end of file
+Fatal error: THello1 and THello2 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
--TEST--
-The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occures.
+The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are incompatible a fatal error occurs.
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
private $hello;
--TEST--
-Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling.
+Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consistent with normal inheritance handling.
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
private $hello;
--TEST--
-Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling.
+Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consistent with normal inheritance handling.
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class Base {
protected $hello;
Handling of private fields with traits needs to have same semantics as with normal inheritance.
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class BaseWithPropA {
private $hello = 0;
int(0)
["hello":"BaseWithTPropB":private]=>
int(0)
-}
\ No newline at end of file
+}
Handling of public fields with traits needs to have same semantics as with normal inheritance, however, we do add strict warnings since it is easier to run into something unexpeted with changing traits.
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT);
class BaseWithPropA {
public $hello = 0;
object(SubclassB)#3 (1) {
["hello"]=>
int(0)
-}
\ No newline at end of file
+}
echo "Basic test for date_sunrise() and date_sunset()\n";
-// suppress date() function strict msgs
-error_reporting(E_ALL & ~E_STRICT);
-
echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
* Source code: ext/date/php_date.c
* Alias to functions:
*/
-error_reporting(E_ALL | E_STRICT);
//Set the default time zone
date_default_timezone_set("Europe/London");
* Source code: ext/date/php_date.c
* Alias to functions:
*/
-error_reporting(E_ALL | E_STRICT);
//Set the default time zone
date_default_timezone_set("Europe/London");
* Alias to functions:
*/
-error_reporting(E_ALL | E_STRICT);
-
//Set the default time zone
date_default_timezone_set("Europe/London");
Warning: timezone_name_from_abbr() expects at most 3 parameters, 4 given in %s on line %d
bool(false)
-===DONE===
\ No newline at end of file
+===DONE===
--TEST--
Test is_a() function : error conditions - wrong number of args
---INI--
-error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
/* Prototype : proto bool is_a(object object, string class_name, bool allow_string)
Warning: is_a() expects at least 2 parameters, 1 given in %s on line 27
NULL
-Done
\ No newline at end of file
+Done
--TEST--
Test is_a() function : usage variations - wrong type for arg 1
---INI--
-error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
/* Prototype : proto bool is_a(object object, string class_name)
--TEST--
Test is_a() function : usage variations - wrong type for arg 2
---INI--
-error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
/* Prototype : proto bool is_a(object object, string class_name)
--TEST--
Test is_a() function : usage variations - case sensitivity
---INI--
-error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
/* Prototype : proto bool is_a(object object, string class_name)
stream_wrapper_register("var", "VariableStream");
-error_reporting(E_ALL | E_STRICT);
$file = dirname(__FILE__) . '/footest.txt';
$x = str_repeat(1, 8192);
$fp = fopen($file, 'w');
--TEST--
Test is_callable() function : usage variations - defined functions
---INI--
-precision=14
-error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
--TEST--
Test is_callable() function : usage variations - on objects
---INI--
-precision=14
-error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
--TEST--
Test is_callable() function
---INI--
-precision=14
-error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
Warning: is_callable() expects at most 3 parameters, 4 given in %s on line %d
NULL
-===DONE===
\ No newline at end of file
+===DONE===
<?php
if (!extension_loaded('json')) die("skip requires ext/json");
?>
---INI--
-precision=14
-error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
--TEST--
Test is_callable() function : usage variations - on invalid function names
---INI--
-precision=14
-error_reporting = E_ALL & ~E_NOTICE | E_STRICT
--FILE--
<?php
/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
bool(false)
bool(false)
Resource id #%d
-===DONE===
\ No newline at end of file
+===DONE===
--TEST--
Object serialization / unserialization: references amongst properties
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
/* Prototype : proto string serialize(mixed variable)
--TEST--
Object serialization / unserialization: references to external values
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
/* Prototype : proto string serialize(mixed variable)
["c"]=>
&string(14) "obj->c.changed"
}
-Done
\ No newline at end of file
+Done
--TEST--
Object serialization / unserialization: properties reference containing object
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
Ensure by value assignments leave temporaries on the stack, for all sorts of assignees.
--FILE--
<?php
-error_reporting(E_ALL & ~E_STRICT);
function f() { return 0; }
$a[0][1] = 'good';
Ensure foreach splits the iterated entity from its cow reference set, for all sorts of iterated entities.
--FILE--
<?php
- error_reporting(E_ALL & ~E_STRICT);
echo "\n" . '$a' . "\n";
$b = $a = array('original');
Test pass by reference semantics
--FILE--
<?php
-error_reporting(E_ALL | E_STRICT | E_NOTICE);
-
// Simplified array_shift_variation5.phpt
// Showing warning:
// "Only variables should be passed by reference in %s on line %d"
--TEST--
Returning a reference from a function via another function
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
function returnConstantByValue() {
--TEST--
Returning a reference from a static method via another static method
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
class C {
--TEST--
Returning a reference from a non-static method via another non-static method
---INI--
-error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
class C {