From db66c95eaf0d4ff0ce6fd4fd2f3d19f24252c2ea Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 9 Feb 2021 17:44:30 -0800 Subject: [PATCH] Added more information to "file already loaded" warning. Also changed it to zend_error() so it is more easily suppressed. --- php/ext/google/protobuf/def.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 9accb1da3681..6e1a7e4e4335 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -916,7 +916,10 @@ static void add_descriptor(DescriptorPool *pool, if (upb_symtab_lookupfile2(pool->symtab, name.data, name.size)) { // Already added. - fprintf(stderr, "WARNING: file was already added\n"); + zend_error(E_USER_WARNING, + "proto descriptor was previously loaded (included in multiple " + "metadata bundles?): " UPB_STRVIEW_FORMAT, + UPB_STRVIEW_ARGS(name)); return; }