From 052327f23d49ecb886f22ac3bf713bb423979375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20M=C3=AD=C5=A1ek?= Date: Sat, 5 Nov 2022 00:02:12 +0100 Subject: [PATCH] fixes "System.Reflection.AmbiguousMatchException" ``` System.Reflection.AmbiguousMatchException: Multiple custom attributes of the same type found. at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit) at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](Assembly element) at Pchp.Core.Reflection.PhpStackFrame.get_TypeName() at Pchp.Core.Reflection.PhpStackTrace.FrameLine.ToUserFrame() ``` --- src/Peachpie.Runtime/Reflection/PhpStackTrace.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Peachpie.Runtime/Reflection/PhpStackTrace.cs b/src/Peachpie.Runtime/Reflection/PhpStackTrace.cs index 2f27873c6c..e51850f4ed 100644 --- a/src/Peachpie.Runtime/Reflection/PhpStackTrace.cs +++ b/src/Peachpie.Runtime/Reflection/PhpStackTrace.cs @@ -341,7 +341,8 @@ public string TypeName if (tinfo.IsPublic && tinfo.IsAbstract) // => public static { - if (tinfo.Assembly.IsDefined(typeof(PhpExtensionAttribute))) + var extensionAttrs = Attribute.GetCustomAttributes(tinfo.Assembly, typeof(PhpExtensionAttribute)); + if (extensionAttrs != null && extensionAttrs.Length != 0) { // library function return null;