PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 5.3.0
+- Add new error mode E_DEPRECATED that informs about stuff that gets dropped in
+ later PHP versions. (Lars Strojny, Felipe, Marcus)
- Added and improved PHP syntax and semantics:
. Added NOWDOC. (Gwynne Raskind, Stas, Dmitry)
. Added "?:" operator. (Marcus)
echo "Done\n";
?>
--EXPECTF--
-int(8191)
-int(8191)
-int(6143)
+int(16383)
+int(16383)
+int(14335)
Done
Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly)
--INI--
zend.ze1_compatibility_mode=1
-error_reporting=4095
+error_reporting=E_ALL | E_DEPRECATED | E_STRICT
--FILE--
<?php
$a->y = &new stdClass();
?>
--EXPECTF--
-Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2
+Deprecated: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2
stdClass Object
(
[y] => stdClass Object
echo "Done\n";
?>
--EXPECT--
-int(6143)
+int(14335)
Done
echo "Done\n";
?>
--EXPECT--
-int(8191)
+int(16383)
Done
?>
--EXPECTF--
Notice: Undefined variable: undef2 in %s on line %d
-int(8191)
+int(16383)
Done
?>
--EXPECTF--
Notice: Undefined variable: undef in %s on line %d
-int(8191)
+int(16383)
Done
Notice: Undefined variable: undef_value in %s on line %d
Notice: Undefined variable: undef_name in %s on line %d
-int(6143)
+int(14335)
Done
echo "Done\n";
?>
--EXPECTF--
-int(6143)
+int(14335)
Done
echo "Done\n";
?>
--EXPECTF--
-int(6143)
+int(14335)
Done
?>
--EXPECTF--
Notice: Undefined variable: undef3 in %s on line %d
-int(8191)
+int(16383)
Done
Notice: Undefined variable: blah in %s on line %d
Notice: Undefined variable: undef2 in %s on line %d
-int(8191)
+int(16383)
Done
echo "Done\n";
?>
--EXPECTF--
-int(6143)
-int(6135)
+int(14335)
+int(14327)
Done
--TEST--
is_a() and is_subclass_of() shouldn't call __autoload
--INI--
-error_reporting=4095
+error_reporting=14335
--FILE--
<?php
function __autoload($name) {
var_dump(is_subclass_of("X1", "X2"));
?>
--EXPECTF--
-Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
+Deprecated: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
bool(false)
-Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
+Deprecated: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
bool(true)
-Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
+Deprecated: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
bool(true)
-Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
+Deprecated: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
bool(true)
bool(false)
bool(false)
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
{
if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT;
+ EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
} else {
EG(error_reporting) = atoi(new_value);
}
case E_ERROR:
case E_NOTICE:
case E_STRICT:
+ case E_DEPRECATED:
case E_WARNING:
case E_USER_ERROR:
case E_USER_WARNING:
Returns true if the object is of this class or has this class as one of its parents */
ZEND_FUNCTION(is_a)
{
- zend_error(E_STRICT, "is_a(): Deprecated. Please use the instanceof operator");
+ zend_error(E_DEPRECATED, "is_a(): Deprecated. Please use the instanceof operator");
is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC)
{
#ifdef ilia_0
- zend_error(E_STRICT, "Usage of {} to access string offsets is deprecated and will be removed in PHP 6");
+ zend_error(E_DEPRECATED, "Usage of {} to access string offsets is deprecated and will be removed in PHP 6");
#endif
fetch_array_dim(result, parent, offset TSRMLS_CC);
}
if (original_op==ZEND_SEND_REF
&& !CG(allow_call_time_pass_reference)) {
- zend_error(E_COMPILE_WARNING,
+ zend_error(E_DEPRECATED,
"Call-time pass-by-reference has been deprecated; "
"If you would like to pass it by reference, modify the declaration of %s(). "
"If you would like to enable call-time pass-by-reference, you can set "
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
#define E_USER_NOTICE (1<<10L)
#define E_STRICT (1<<11L)
#define E_RECOVERABLE_ERROR (1<<12L)
+#define E_DEPRECATED (1<<13L)
-#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR)
+#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED)
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
#endif /* ZEND_ERRORS_H */
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
- zend_error(E_STRICT, "Function %s%s%s() is deprecated",
+ zend_error(E_DEPRECATED, "Function %v%s%v() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
| variable '=' expr { zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
| variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
- | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
+ | variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
| T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
| T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); }
| variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
- zend_error(E_STRICT, "Function %s%s%s() is deprecated",
+ zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
- zend_error(E_STRICT, "Function %s%s%s() is deprecated",
+ zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
}
/* Support for the deprecated is_dst parameter */
if (dst != -1) {
- php_error_docref(NULL TSRMLS_CC, E_STRICT, "The is_dst parameter is deprecated");
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "The is_dst parameter is deprecated");
if (gmt) {
/* GMT never uses DST */
if (dst == 1) {
}
if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C), "mysql")) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated; use mysql_query() instead.");
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "This function is deprecated; use mysql_query() instead.");
}
php_mysql_do_query_general(query, mysql_link, id, db, MYSQL_STORE_RESULT, return_value TSRMLS_CC);
Z_TYPE_P(return_value) = IS_STRING;
if (MySG(trace_mode)){
- php_error_docref("function.mysql-real-escape-string" TSRMLS_CC, E_WARNING, "This function is deprecated; use mysql_real_escape_string() instead.");
+ php_error_docref("function.mysql-real-escape-string" TSRMLS_CC, E_DEPRECATED, "This function is deprecated; use mysql_real_escape_string() instead.");
}
}
/* }}} */
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_setting) == FAILURE) {
RETURN_FALSE;
}
+
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "This function is deprecated and removed in PHP 6. See http://php.net/{migrate}#set_magic_quotes_runtime for details.");
+
convert_to_boolean_ex(new_setting);
PG(magic_quotes_runtime) = (zend_bool) Z_LVAL_PP(new_setting);
Get the current active configuration setting of magic_quotes_runtime */
PHP_FUNCTION(get_magic_quotes_runtime)
{
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "This function is deprecated and removed in PHP 6. See http://php.net/{migrate}#get_magic_quotes_runtime for details.");
RETURN_LONG(PG(magic_quotes_runtime));
}
/* }}} */
Get the current active configuration setting of magic_quotes_gpc */
PHP_FUNCTION(get_magic_quotes_gpc)
{
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "This function is deprecated and removed in PHP 6. See http://php.net/{migrate}#get_magic_quotes_gpc for details.");
RETURN_LONG(PG(magic_quotes_gpc));
}
/* }}} */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", Z_STRVAL_P(filename));
RETURN_FALSE;
#else
- php_error_docref(NULL TSRMLS_CC, E_STRICT, "dl() is deprecated - use extension=%s in your php.ini", Z_STRVAL_P(filename));
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", Z_STRVAL_P(filename));
#endif
}
#define USING_ZTS 0
#endif
+/* {{{ php_dl
+ */
PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC) /* {{{ */
{
void *handle;
{
int ret;
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "This function is deprecated; use php_stream_mkdir() instead.");
+
if (PG(safe_mode) && (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
return -1;
}
cat = Z_LVAL_PP(pcategory);
} else { /* FIXME: The following behaviour should be removed. */
char *category;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passing locale category name as string is deprecated. Use the LC_* -constants instead");
+ php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "Passing locale category name as string is deprecated. Use the LC_* -constants instead");
convert_to_string_ex(pcategory);
category = Z_STRVAL_P(*pcategory);
--TEST--
various magic quotes tests
+--INI--
+error_reporting=14335
--FILE--
<?php
echo "Done\n";
?>
--EXPECTF--
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(0)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(0)
+
+Deprecated: set_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#set_magic_quotes_runtime for details. in %s on line %d
bool(true)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(1)
+
+Deprecated: set_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#set_magic_quotes_runtime for details. in %s on line %d
bool(true)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(1)
string(30) "some\'content\'here\"and}there"
+
+Deprecated: set_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#set_magic_quotes_runtime for details. in %s on line %d
bool(true)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(0)
string(27) "some'content'here"and}there"
+
+Deprecated: set_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#set_magic_quotes_runtime for details. in %s on line %d
bool(true)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(1)
string(30) "some\'content\'here\"and}there"
+
+Deprecated: set_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#set_magic_quotes_runtime for details. in %s on line %d
bool(true)
bool(false)
+
+Deprecated: get_magic_quotes_runtime(): This function is deprecated and will be removed in PHP 6. See http://php.net/%s#get_magic_quotes_runtime for details. in %s on line %d
int(0)
string(27) "some'content'here"and}there"
Done
--TEST--
Bug #31402 (unserialize() generates references when it should not)
--INI--
-error_reporting=E_ALL&~E_STRICT
+error_reporting=E_ALL&~E_STRICT&~E_DEPRECATED
--FILE--
<?php
--TEST--
Test setlocale() function : error condition
+--INI--
+error_reporting=14335
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
-- Testing setlocale() function with invalid category --
-Warning: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d
+Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d
Warning: setlocale(): Invalid locale category name TEST, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in %s on line %d
bool(false)
/* fatal errors are real errors and cannot be made exceptions */
break;
case E_STRICT:
+ case E_DEPRECATED:
/* for the sake of BC to old damaged code */
break;
case E_NOTICE:
case E_STRICT:
error_type_str = "Strict Standards";
break;
+ case E_DEPRECATED:
+ error_type_str = "Deprecated";
+ break;
default:
error_type_str = "Unknown error";
break;
--TEST--
Confirm difference between assigning new directly and by reference.
+--INI--
+error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
echo "Compile-time strict error message should precede this.\n";
var_dump($f);
?>
--EXPECTF--
-Strict Standards: Assigning the return value of new by reference is deprecated in %s on line 23
+Deprecated: Assigning the return value of new by reference is deprecated in %s on line 23
Compile-time strict error message should precede this.
$f initially points to the first object:
object(Inc)#%d (1) {
--SKIPIF--
<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip ZE1 does not have static class members'); ?>
--INI--
-error_reporting=4095
+error_reporting=E_ALL | E_STRICT | E_DEPRECATED
--FILE--
<?php
print zend_version()."\n";
print $oop_tester->oop_static()."\n";
?>
--EXPECTF--
-Strict Standards: Assigning the return value of new by reference is deprecated in %s.php on line %d
+Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line %d
%s
foo_static()
foo_global()
--TEST--
Bug #22231 (segfault when returning a global variable by reference)
--INI--
-error_reporting=4095
+error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
class foo {
var_dump($foo->fubar);
?>
--EXPECTF--
-Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d
+Deprecated: Assigning the return value of new by reference is deprecated in %s on line %d
object(foo)#%d (1) {
["fubar"]=>
string(5) "fubar"
--TEST--
Bug #22510 (segfault among complex references)
--INI--
-error_reporting=4095
+error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
class foo
print "I'm alive!\n";
?>
--EXPECTF--
-Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d
+Deprecated: Assigning the return value of new by reference is deprecated in %s on line %d
ok1
bar::run1
foo::method1