andi Tue Nov 18 04:25:05 2003 EDT
Modified files:
/ZendEngine2 zend.c zend_builtin_functions.c zend_constants.c
zend_errors.h zend_language_parser.y
Log:
- Add E_STRICT, to be used to warn purists (like Jani :)
Is it a good time to dredge up the old topic of making a PHP_DEPALIAS() to
act like PHP_FALIAS() but throw an E_STRICT
error saying that the function
has been deprecated?
Here's a patch for review and discussion:
Index: Zend/zend_API.h
RCS file: /repository/ZendEngine2/zend_API.h,v
retrieving revision 1.169
diff -u -r1.169 zend_API.h
--- Zend/zend_API.h 18 Nov 2003 19:18:54 -0000 1.169
+++ Zend/zend_API.h 19 Nov 2003 00:28:55 -0000
@@ -51,6 +51,7 @@
#define ZEND_NAMED_FE(zend_name, name, arg_info)
ZEND_FENTRY(zend_name, name, arg_info, 0)
#define ZEND_FE(name, arg_info)
ZEND_FENTRY(name, ZEND_FN(name), arg_info, 0)
#define ZEND_FALIAS(name, alias, arg_info)
ZEND_FENTRY(name, ZEND_FN(alias), arg_info, 0)
+#define ZEND_DEPALIAS(name, alias, arg_info) ZEND_FENTRY(name,
ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED | ZEND_ACC_PUBLIC)
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name,
ZEND_FN(classname##_##name), arg_info, flags)
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name,
NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
#define ZEND_MALIAS(name, classname, alias, arg_info, flags)
Index: Zend/zend_compile.h
RCS file: /repository/ZendEngine2/zend_compile.h,v
retrieving revision 1.262
diff -u -r1.262 zend_compile.h
--- Zend/zend_compile.h 10 Nov 2003 16:14:44 -0000 1.262
+++ Zend/zend_compile.h 19 Nov 2003 00:28:55 -0000
@@ -100,6 +100,7 @@
#define ZEND_ACC_INTERFACE 0x08
#define ZEND_ACC_ABSTRACT_CLASS 0x10
#define ZEND_ACC_FINAL_CLASS 0x20
+#define ZEND_ACC_DEPRECATED 0x40
/* The order of those must be kept - public < protected < private */
#define ZEND_ACC_PUBLIC 0x100
Index: Zend/zend_execute.c
RCS file: /repository/ZendEngine2/zend_execute.c,v
retrieving revision 1.549
diff -u -r1.549 zend_execute.c
--- Zend/zend_execute.c 10 Nov 2003 16:23:12 -0000 1.549
+++ Zend/zend_execute.c 19 Nov 2003 00:28:55 -0000
@@ -2513,6 +2513,10 @@
NEXT_OPCODE(); /* Never reached */
}
-
if (EX(function_state).function->common.fn_flags &
ZEND_ACC_DEPRECATED) {
-
zend_error(E_STRICT, "%s() has been deprecated and may be
removed in a future version.",
EX(function_state).function->common.function_name);
-
}
-
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *)
EX(opline)->extended_value, NULL);
EX_T(EX(opline)->result.u.var).var.ptr_ptr =
&EX_T(EX(opline)->result.u.var).var.ptr;
Index: main/php.h
RCS file: /repository/php-src/main/php.h,v
retrieving revision 1.200
diff -u -r1.200 php.h
--- main/php.h 3 Nov 2003 14:12:45 -0000 1.200
+++ main/php.h 19 Nov 2003 00:28:55 -0000
@@ -354,6 +354,7 @@
#define PHP_NAMED_FE ZEND_NAMED_FE
#define PHP_FE ZEND_FE
#define PHP_FALIAS ZEND_FALIAS
+#define PHP_DEPALIAS ZEND_DEPALIAS
#define PHP_ME ZEND_ME
#define PHP_MODULE_STARTUP_N ZEND_MODULE_STARTUP_N
Is it a good time to dredge up the old topic of making a PHP_DEPALIAS() to
act like PHP_FALIAS() but throw anE_STRICT
error saying that the function
has been deprecated?
+1
On a related note, since a major PHP version is now being released, perhaps it
is the time to finally remove old deprecated functionality that in many cases
deprecated for years. I propose that we agree on a certain version as a
minimum and remove all deprecated functionality that was marked as such prior
to that version.
Ilia
On a related note, since a major PHP version is now being released,
perhaps it
is the time to finally remove old deprecated functionality that in many
cases
deprecated for years. I propose that we agree on a certain version as a
minimum and remove all deprecated functionality that was marked as such
prior
to that version.
When it comes to removing deprecated functions entirely, I'd favor a
./configure option (--enable-deprecated) which would define
PHP_USE_DEPRECATED. Then those functions could be "removed" with:
#ifdef PHP_USE_DEPRECATED
.
.
.
#endif
This way cruft is left out of a build by default, but can be easily put back
in by those who need it. Then with the next version (5.1? / 6.0?) do the
actual dirty work of taking them out for good. More gentle on the
scripters.
-Sara
This way cruft is left out of a build by default, but can be easily put
back in by those who need it. Then with the next version (5.1? / 6.0?) do
the actual dirty work of taking them out for good. More gentle on the
scripters.
IMHO people will be expecting some functionality breaks if and when they
upgrade to 5.0, not so when upgrading from 5.0 to 5.1. I believe that if we
do not make the change now, we'd need to wait for the next major functionally
altering release to make this change. Which puts this off indefinitely into
the far future.
Ilia
Ilia Alshanetsky wrote:
On a related note, since a major PHP version is now being released, perhaps it
is the time to finally remove old deprecated functionality that in many cases
deprecated for years. I propose that we agree on a certain version as a
minimum and remove all deprecated functionality that was marked as such prior
to that version.
Like call-time pass by ref?
Oliver
GB/E/IT d+ s+:+ a-- C++$ UL++++$ P++++ L+++$ E- W++$ N- ?o ?K w--(---)
!O M+$ V- PS+ PE- Y PGP t++ 5-- X+@ R- tv++ b++(+++) DI++++ D+ G++ e+>++
h(*) r y+(?)
Olivier Hill wrote:
Ilia Alshanetsky wrote:
On a related note, since a major PHP version is now being released,
perhaps it is the time to finally remove old deprecated functionality
that in many cases deprecated for years. I propose that we agree on a
certain version as a minimum and remove all deprecated functionality
that was marked as such prior to that version.Like call-time pass by ref?
Oliver
Has call-time pass by ref really been deprecated for years? I only
started seeing this warning with P5.
BDKR