Beispiel #1
0
 public static void f7(params PhpArray[] args)
 {
     foreach (PhpArray arg in args)
     {
         PhpVariable.Dump(arg);
     }
 }
Beispiel #2
0
        public static void __dump_session()
        {
            TextWriter o = ScriptContext.CurrentContext.Output;

            HttpContext context = HttpContext.Current;

            if (context == null)
            {
                o.WriteLine("HTTP CONTEXT NULL"); return;
            }

            HttpSessionState state = context.Session;

            if (context == null)
            {
                o.WriteLine("SESSION NULL"); return;
            }

            PhpArray a = new PhpArray();

            foreach (string name in state)
            {
                a[name] = state[name];
            }

            PhpVariable.Dump(o, a);
        }
Beispiel #3
0
 public static void f5(params double[] args)
 {
     foreach (double arg in args)
     {
         PhpVariable.Dump(arg);
     }
 }
Beispiel #4
0
 public static void f2(params int[] args)
 {
     foreach (int arg in args)
     {
         PhpVariable.Dump(arg);
     }
 }
Beispiel #5
0
 public static void f3(params object[] args)
 {
     foreach (object arg in args)
     {
         PhpVariable.Dump(arg);
     }
 }
Beispiel #6
0
        public static void DebugDump(object var)
        {
            StringWriter s = new StringWriter();

            PhpVariable.Dump(s, var);
            Debug.WriteLine("DEBUG", s.ToString());
        }
Beispiel #7
0
 public static void f1(params PhpReference[] args)
 {
     foreach (PhpReference arg in args)
     {
         PhpVariable.Dump(arg.value);
         arg.value = "hello";
     }
 }
Beispiel #8
0
        public static void Dump(params object[] variables)
        {
            TextWriter output = ScriptContext.CurrentContext.Output;

            foreach (object variable in variables)
            {
                PhpVariable.Dump(output, variable);
            }
        }
Beispiel #9
0
        public void TestRandomKeys()
        {
            PhpArray a = PhpArray.Keyed("Server1", 1, "Server2", 2, "Server3", 3);

            PhpVariable.Dump(a);
            string result = PhpArrays.RandomKeys(a) as string;

            Assert.IsTrue(result == "Server1" || result == "Server2" || result == "Server3");
        }
Beispiel #10
0
        public static void Info(ScriptContext /*!*/ scriptContext)
        {
            TextWriter  output = scriptContext.Output;
            HttpContext ctx    = HttpContext.Current;

            output.WriteLine("<br><div style='background-color:oldlace'><H3>Phalanger debug info:</H3><PRE>");

            output.WriteLine("</PRE><H3>HttpRuntime</H3><PRE>");

            output.WriteLine("AppDomainAppId = {0}", HttpRuntime.AppDomainAppId);
            output.WriteLine("AppDomainAppPath = {0}", HttpRuntime.AppDomainAppPath);
            output.WriteLine("AppDomainAppVirtualPath = {0}", HttpRuntime.AppDomainAppVirtualPath);
            output.WriteLine("AppDomainId = {0}", HttpRuntime.AppDomainId);
            output.WriteLine("AspInstallDirectory = {0}", HttpRuntime.AspInstallDirectory);
            output.WriteLine("BinDirectory = {0}", HttpRuntime.BinDirectory);
            output.WriteLine("ClrInstallDirectory = {0}", HttpRuntime.ClrInstallDirectory);
            try
            {
                output.WriteLine("CodegenDir = {0}", HttpRuntime.CodegenDir);
            }
            catch (Exception)
            {
                output.WriteLine("CodegenDir = N/A");
            }
            output.WriteLine("MachineConfigurationDirectory = {0}", HttpRuntime.MachineConfigurationDirectory);

            output.WriteLine("</PRE><H3>Worker Process</H3><PRE>");

            output.Write("Worker processes: ");
            if (ctx != null)
            {
                foreach (ProcessInfo pi in ProcessModelInfo.GetHistory(20))
                {
                    output.Write(pi.ProcessID + ";");
                }
                output.WriteLine();

                output.WriteLine("Current Worker Process start time: {0}", ProcessModelInfo.GetCurrentProcessInfo().StartTime);
            }
            else
            {
                output.WriteLine("N/A");
            }

            Process proc = Process.GetCurrentProcess();

            output.WriteLine("Current process: Id = {0}", proc.Id);
            output.WriteLine("Current PrivateMemorySize: {0} MB", proc.PrivateMemorySize64 / (1024 * 1024));
            output.WriteLine("Current WorkingSet: {0} MB", proc.WorkingSet64 / (1024 * 1024));
            output.WriteLine("Current VirtualMemorySize: {0} MB", proc.VirtualMemorySize64 / (1024 * 1024));
            output.WriteLine("Current thread: HashCode = {0}", Thread.CurrentThread.GetHashCode());
            output.WriteLine("Current domain: {0}", Thread.GetDomain().FriendlyName);

            AppDomainInfo(AppDomain.CurrentDomain, output);
            if (ctx != null)
            {
                AppDomainInfo(AppDomain.CurrentDomain, output);
            }

            output.WriteLine("</PRE><H3>Libraries</H3><PRE>");

            foreach (PhpLibraryAssembly a in scriptContext.ApplicationContext.GetLoadedLibraries())
            {
                a.Descriptor.Dump(output);
            }

            //output.WriteLine("</PRE><H3>Invalidated Precompiled Scripts</H3><PRE>");
            //foreach (string item in WebServerManagersDebug.GetInvalidatedScripts())
            //  output.WriteLine(item);

            output.WriteLine("</PRE><H3>Cache</H3><PRE>");
            foreach (DictionaryEntry item in HttpRuntime.Cache)
            {
                if (item.Value is string)
                {
                    output.WriteLine("{0} => '{1}'", item.Key, item.Value);
                }
                else
                {
                    output.WriteLine("{0} => instance of {1}", item.Key, item.Value.GetType().FullName);
                }
            }

            if (ctx != null)
            {
                output.WriteLine("</PRE><H3>Query Variables</H3><PRE>");
                String[] keys;
                keys = ctx.Request.QueryString.AllKeys;
                for (int i = 0; i < keys.Length; i++)
                {
                    output.WriteLine("{0} = \"{1}\"", keys[i], ctx.Request.QueryString.GetValues(keys[i])[0]);
                }

                if (ctx.Session != null)
                {
                    output.WriteLine("</PRE><H3>Session Variables</H3><PRE>");

                    output.WriteLine("IsCookieless = {0}", ctx.Session.IsCookieless);
                    output.WriteLine("IsNewSession = {0}", ctx.Session.IsNewSession);
                    output.WriteLine("SessionID = {0}", ctx.Session.SessionID);

                    foreach (string name in ctx.Session)
                    {
                        output.Write("{0} = ", name);
                        PhpVariable.Dump(ctx.Session[name]);
                    }
                }

                output.WriteLine("</PRE><H3>Cookies</H3><PRE>");
                foreach (string cookie_name in ctx.Request.Cookies)
                {
                    HttpCookie cookie = ctx.Request.Cookies[cookie_name];
                    Console.WriteLine("{0} = {1}", cookie.Name, cookie.Value);
                }

                output.WriteLine("</PRE><H3>Server Variables</H3><PRE>");

                keys = ctx.Request.ServerVariables.AllKeys;
                for (int i = 0; i < keys.Length; i++)
                {
                    output.WriteLine("{0} = \"{1}\"", keys[i], ctx.Request.ServerVariables.GetValues(keys[i])[0]);
                }
            }
            else
            {
                output.WriteLine("</PRE><H3>Missing HttpContext</H3><PRE>");
            }

            output.WriteLine("</PRE></DIV>");
        }
Beispiel #11
0
 public static void f6(ref PhpArray arg)
 {
     PhpVariable.Dump(arg);
 }
Beispiel #12
0
 public static void f0(PhpReference arg)
 {
     PhpVariable.Dump(arg.value);
     arg.value = "hello";
 }