|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesfix-segfault-in-do_bind_inherited_class-error-printing (last revision 2015-10-11 06:16 UTC by tandre at ifwe dot co)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-10-11 13:49 UTC] felipe@php.net
-Status: Open
+Status: Feedback
-Package: opcache
+Package: Scripting Engine problem
[2015-10-11 13:49 UTC] felipe@php.net
[2015-10-25 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 19:00:01 2025 UTC |
Description: ------------ See this line of code in do_bind_inherited_class (zend_compile.c, line 1038) That code attempted to treat the same zval for op2 both as an object and a string on the same line to print an error message(op2 is actually a string) Existing code: zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(Z_OBJCE_P(op2)), Z_STRVAL_P(op2)); Suggested fix: zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", "trait/interface/class", Z_STRVAL_P(op2)); Because the absense of a class entry triggers this the error, the best thing that could be done would probably be to print an unknown type instead of the object type. The severity is minor. Filing this under Opcache since opcache is the only extension I saw using this function. I haven't been able to make Opcache reach this line of code, but it could theoretically happen. Test script: --------------- // Call C function zend_do_delayed_early_binding on an op_array without creating a class entry for the subclass being bound (for optype ZEND_DECLARE_INHERITED_CLASS)) // In theory, opcache corruption or bugs in other accelerators could trigger this error. Expected result: ---------------- zend_error_noreturn prints a compile error message when the class entry doesn't exist, doesn't segfault. Actual result: -------------- Segfaults while attempting to print an error message