Giter Club home page Giter Club logo

devsense / phalanger Goto Github PK

View Code? Open in Web Editor NEW
381.0 50.0 94.0 68.97 MB

PHP 5.4 compiler for .NET/Mono frameworks. Predecessor to the opensource PeachPie project (www.peachpie.io).

Home Page: http://v4.php-compiler.net/

License: Apache License 2.0

C# 88.92% PHP 7.55% ASP 0.03% HTML 1.64% CSS 0.07% Java 0.43% Visual Basic 0.19% JavaScript 0.02% XSLT 0.05% Batchfile 0.06% Lex 0.36% Yacc 0.69% Shell 0.01%
php compiler csharp c-sharp dotnet-framework deprecated

phalanger's Introduction

Phalanger - the PHP language compiler for .NET Framework

Introducing full-featured PHP 5.4 runtime & compiler for .NET/Mono frameworks. Phalanger is an open-source implementation of PHP, compatible with the vast array of existing PHP code. In addition Phalanger gives PHP-application developers lot of new possibilities; it improves the performance, allows to use modern environments and takes advantage of seamless .NET integration.

Status

Phalanger is a predecessor of Peachpie compiler (https://github.com/peachpiecompiler/peachpie) - PHP 7.1 compiler for .NET and .NET Core frameworks.

Visual Studio Integration

Phalanger is integrated into Visual Studio so it gives code colorization, debugging and IntelliSense capabilities.

  • Syntax highlighting
  • Compilation & Debugging
  • Installs Phalanger binaries

Download on https://visualstudiogallery.msdn.microsoft.com/419916fb-ec89-4f18-ba97-75cf66037797

phalanger's People

Contributors

arctidog avatar ashod avatar bfistein avatar david-garcia-garcia avatar endel avatar jakubmisek avatar maitredede avatar miloslav avatar proff avatar robertleeplummerjr avatar steve-s avatar weirdan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phalanger's Issues

Implementation of 'htmlspecialchars' is not complete

the htmlspecialchars will not translate any word in this list
"&", """, "'", "<", ">"

but HtmlSpecialCharsEncode does not implements the logic, so if the input contains any words in the list above, the output will be unexpected.
eg. & will be translated to &

found the issue when woking with wordpress 4.6.1

Overriding offsetGet in class that implements ArrayAccess throws internal error when parsing to pure+ mode

the implementation is very simple:

public class Test implements ArrayAccess {
    public function &offsetGet( $offset )
    {
        return $this->__get( $offset );
    }
}

The actual code is here: https://github.com/robertleeplummerjr/redbean/blob/master/RedBeanPHP/OODBBean.php
The command that triggers it: https://github.com/robertleeplummerjr/redbean.net/blob/master/build.bat

The error:

error PHP2007: Internal error! 
Please, report this bug via http://phalanger.codeplex.com/workitem/list/basic.
Additional information: 
Method 'offsetGet' in type 'RedBeanPHP.OODBBean' from assembly 'RedBean, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at PHP.Core.Reflection.PhpType.Bake()
   at PHP.Core.Reflection.PureCompilationUnit.Bake()
   at PHP.Core.Reflection.PureCompilationUnit.Compile(IEnumerable`1 sourceFiles, PureAssemblyBuilder assemblyBuilder, CompilationContext context, Encoding encoding)
   at PHP.Core.Emit.PureAssemblyBuilder.Build(IEnumerable`1 sourceFiles, CompilationContext context)
   at PHP.Core.ApplicationCompiler.Compile(ApplicationContext applicationContext, CompilerConfiguration config, ErrorSink errorSink, CompilationParameters ps)

Node cannot be used in configuration file located on virtual path ':machine:' because it defines application wide configuration.

After fallowing tutorial here http://wiki.phpcompiler.net/Installation/3.0/Linux under Ubuntu 12.04 Version information: Mono Runtime Version: 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.1); ASP.NET Version: 4.0.30319.1 i get exception:
[System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0 at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 at PHP.Core.ConfigurationSectionHandler.GetConfig (PHP.Core.ApplicationContext appContext, System.String sectionName) [0x00000] in <filename unknown>:0 at PHP.Core.Configuration.Load (PHP.Core.ApplicationContext appContext) [0x00000] in <filename unknown>:0 at PHP.Core.Configuration.Reload (PHP.Core.ApplicationContext appContext, Boolean reloadFromFile) [0x00000] in <filename unknown>:0 at PHP.Core.ScriptContext.InitWebRequest (PHP.Core.ApplicationContext appContext, System.Web.HttpContext context) [0x00000] in <filename unknown>:0 at PHP.Core.RequestContext.Initialize (PHP.Core.ApplicationContext appContext) [0x00000] in <filename unknown>:0 at PHP.Core.RequestContext.Initialize (PHP.Core.ApplicationContext appContext, System.Web.HttpContext context) [0x00000] in <filename unknown>:0 at PHP.Core.RequestHandler.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0 at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0 [System.Configuration.ConfigurationErrorsException]: Node cannot be used in configuration file located on virtual path &#39;:machine:&#39; because it defines application wide configuration. at PHP.Core.PhpConfigurationContext.EnsureApplicationConfig (System.Xml.XmlNode node) [0x00000] in <filename unknown>:0 at PHP.Core.ConfigurationSectionHandler.Create (PHP.Core.PhpConfigurationContext parent, System.Web.Configuration.HttpConfigurationContext context, System.Xml.XmlNode section) [0x00000] in <filename unknown>:0 at PHP.Core.ConfigurationSectionHandler.Create (System.Object parent, System.Object configContext, System.Xml.XmlNode section) [0x00000] in <filename unknown>:0
while trying to execute file a.php:
`

ASP Test Page ` I am using nginx + fcgi like this: `fastcgi-mono-server4 /applications=/:. /socket=tcp:127.0.0.1:9000 /verbose=True /printlog=True /loglevels=All` The only web and machine configs present are in `/etc/mono/4.0` I think that exception should provide info: 1. Which node can not be used 2. On which virtual path

Phalanger behaves unexpectedly with magic constructor

I've been asked to create a new issue here regarding a post I made in Devsense's forum. I think I ran into a bug in Phalanger's parser, or the compiler. I'm not sure.

My application is built with CodeIgniter framework and using Wanwizard's DataMapper ORM to abstract the data layer. The problem is that DataMapper's core class' constructor is built to be backwards compatible with PHP 4 (check the problematic source), so it uses a constructor pattern like this:

class InfiniteLoop {
   public function __construct($param) {
      $this -> InfiniteLoop($param);
   }

   public function InfiniteLoop($param) {
      echo 'We did it!';
   }
}

Phalanger crashes with a Stack Overflow exception because apparently calling the $this->InfiniteLoop method makes Phalanger call __construct method again... creating the awful infinite loop and eventually throwing the Stack Overflow exception.

Obviously the workaround is to simply remove __construct or refactor it to something like this:

class InfiniteLoop {
   public function __construct($param) {
      echo 'We did it!';
   }
}

I can do that, but it's obviously not a good idea to mess with third party libraries that will get updated eventually. It's bad practice. Also, I believe there's still a few scripts around that try to be backwards compatible with PHP 4 (insane I think, but still) that could benefit from fixing this little bug.

I'm using Phalanger 3. I don't know if it's already fixed or marked as "won't fix" in Phalanger 4.

Internal error on Zend Framework 2

I tried compiling Zend Framwork 2 on the current master of Phalanger and got the following error:

error PHP2007: Internal error!
Please, report this bug via http://www.codeplex.com/WorkItem/List.aspx?ProjectName=Phalanger.
Additional information:
Assertion failed:
at PHP.Core.Debug.Fail (System.String message) [0x00000] in :0
at PHP.Core.Debug.Assert (Boolean condition) [0x00000] in :0
at PHP.Core.TextErrorSink.Add (Int32 id, System.String message, ErrorSeverity severity, Int32 group, System.String fullPath, ErrorPosition pos) [0x00000] in :0
at PHP.Core.ErrorSink.Add (ErrorInfo info, System.String message, System.String fullPath, ErrorPosition pos, System.String[] args) [0x00000] in :0
at PHP.Core.ErrorSink.Add (ErrorInfo info, System.String fullPath, ErrorPosition pos, System.String arg) [0x00000] in :0
at (wrapper remoting-invoke-with-check) PHP.Core.ErrorSink:Add (PHP.Core.ErrorInfo,string,PHP.Core.ErrorPosition,string)
at PHP.Core.InvalidSourceException.Report (PHP.Core.ErrorSink errorSink) [0x00000] in :0
at PHP.Core.ApplicationCompiler.Compile (PHP.Core.ApplicationContext applicationContext, PHP.Core.CompilerConfiguration config, PHP.Core.ErrorSink errorSink, PHP.Core.CompilationParameters ps) [0x00000] in :0
at PHP.Core.PhpNetCompiler.Compile (System.Collections.Generic.List`1 args) [0x00000] in :0

are there any other files you need for this issue?

curl_setopt does not allow an empty string value as an array value

I was trying to pass in an array of key value pairs with curl_setopt with CurlOption = CURLOPT_POSTFIELDS. One of my array values was an empty string. I debugged the code to CurlForm.Create. The first character in the string is compared to "@" to determine if the array needs to be treated as a file (per the comment). But the string is not first checked to determine if the length of the string is >= 1. The PHP run-time allows for an empty string, so the Phalanger Curl extensions should too. I also need to test the possibility of a null value in the run-time so that Phalanger's behavior is exactly the same as the official PHP run-time. I will do a pull request tonight or tomorrow night and fix this issue.

mbstring serialize/unserialize incorrect behaviour compared to PHP

serializing a multibyte character and then unserializing it again in Phalanger causes character to change when echoed as shown in the testcase below.

Phalanger behaves differently to PHP in this respect:

  • PHP will return é in both echo attempts with $val1 and $val2 respectively.
  • Phalanger will return é from $val1, but ? from $val2..
<?php
$val1 = 'é';
$val2 = unserialize(serialize($val1));

$EOL = "<br>\n";

// let's test equality of the supposedly equal characters
echo ($val1 === $val2 ? 'Equal' : 'Not Equal') . $EOL; // Returns 'Equal', because $val1 === $val2 === 'é'
echo htmlentities($val1) . $EOL; // Returns html entity for 'é'
echo htmlentities($val2) . $EOL; // Returns '?' (Note that $val1 === $val2 !)

Missing Methods and function from DateTime

DateTime class is missing: CreateFromFormat() and Diff - also missing corresponding procedural functions: date_create_from_format & date_diff

I also believe diff will be missing dependency class DateInterval.

These were introduced in PHP 5.3.0

Find Current Page URL

How to find current page URL
$pageURL = $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
getting error "Notice: Undefined offset"

System\Web\HttpContext::$Current->Request->Url->AbsoluteUri;
getting error "Notice: An empty variable used as an object"

bug in strtotime

"20130630 085000" in php parsed fine, in phalangeg parsed to false

Bug in PerlRegExpConverter

I have a problem with following regular expression:
\G(((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object))\s*)

This regular expression gives me different result in phalagner, I assume that the problem is in converting pattern to .net. Pattern is converted to:
\G(?<an0ny_1>((int(?<an0ny_2>eger)?|bool(?<an0ny_3>ean)?|float|double|real|string|binary|array|object))\s*)

I think that after :
\G(?<an0ny_1>(
group name is missing.

The same problem occurs in this regular expression:
/((x)y)/
when I match it against 'xy' I get wrong results:
preg_match('/((x)y)/', 'xy', $matches, null);
$matches[1] == 'x' should be 'xy'
$matches[2] == 'xy' should be 'x'

Incompatible behavior of func_get_args() in a closure

In Phalanger (1d64ede) func_get_args() returns use()'d variables in addition to real arguments, while php and hhvm only return closure's arguments:

$ cat qq.php
<?php
class QQ
{
    public static function main()
    {
        $q = 123;
        $f = function($param) use($q) {
            var_dump(func_get_args());
        };
        $f("asd");
    }
}

$ Deployment/Debug/phpc.exe qq.php /reference:/usr/lib/mono/gac/PhpNetCore/4.0.0.0__0a8e8c4c76728c71/PhpNetCore.dll /reference:/usr/lib/mono/gac/PhpNetClassLibrary/4.0.0.0__4af37afe3cde05fb/PhpNetClassLibrary.dll /out:qq.exe /target:exe /encoding:UTF-8 /pure+ /entrypoint:qq.php /debug+
Phalanger - the PHP Language Compiler - version 4.0
for Microsoft (R) .NET Framework version 4.0
Arguments:
qq.php
/reference:/usr/lib/mono/gac/PhpNetCore/4.0.0.0__0a8e8c4c76728c71/PhpNetCore.dll
/reference:/usr/lib/mono/gac/PhpNetClassLibrary/4.0.0.0__4af37afe3cde05fb/PhpNetClassLibrary.dll
/out:qq.exe
/target:exe
/encoding:UTF-8
/pure+
/entrypoint:qq.php
/debug+

Encoding  cannot be loaded.
fileEncoding=""

Loaded libraries:
PhpNetCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71
Base Library (PhpNetClassLibrary)

Performing compilation ...

Statistics:
Compiled in 0:00.280.
AST: LibraryFunctionCalls = 2, UnknownFunctionCalls = 0


Build complete -- 0 errors, 0 warnings.

$ ./qq.exe
Encoding  cannot be loaded.
fileEncoding=""

array(2) {
  [0]=>
  int(123)
  [1]=>
  string(3) "asd"
}

$ php -r 'echo phpversion() . PHP_EOL; require "qq.php"; QQ::main();'
5.6.16-2
array(1) {
  [0] =>
  string(3) "asd"
}

See https://3v4l.org/GoUiU for more environments (various php & hhvm versions).

Support for PDO's FETCH_OBJ and FETCH_CLASS?

There is a plan to support more PDO's fetch methods?

I've seen here that the only supported fetch methods by Phalanger are PDO_FETCH_ASSOC, PDO_FETCH_NUM and PDO_FETCH_BOTH.

PHP Documentation: http://php.net/manual/pt_BR/pdostatement.fetch.php

It would be great to have support to these too:

PDO::FETCH_CLASS: returns a new instance of the requested class, mapping the columns of the result set to named properties in the class. If fetch_style includes PDO::FETCH_CLASSTYPE
PDO::FETCH_OBJ: returns an anonymous object with property names that correspond to the column names returned in your result set

Timeout in stream_set_timeout passes seconds to CLR instead of milliseconds

If I'm reading the code correctly, ClassLibrary/Streams.cs (starting at line 1249), appears to receive the timeout in seconds and call

PhpStream.SetTimeout(StreamParameterOptions.ReadTimeout, timeout)

This then calls the following two lines in Core/PhpStream.CLR.cs (line 487):

socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout);

According to the documentation for that socket option (http://msdn.microsoft.com/en-us/library/fs3sawaa.aspx), the value should be passed in milliseconds, not seconds.

problems with array_splice

in some places in my legacy project functions used array_splice for remove elements in subarray of array passed via parameter, but after it return in parent function i got changed array in parent function. For now i can't reproduce this bug. Change PhpArray.Copy body to "return this.DeepCopy();" solves problem.

wordpress latest version compliant

Any plans to make phalanger compatible with latest wordpress version?
it seems don't support latest wordpress (maybe some functionalities are missing?)

Error compiling parameterized attribute

When I tried to use NUnit I encountered the following error:

❯ ~/src/Phalanger/Deployment/Release/phpc.exe /pure+ /target:dll /lang:clr /out:obj/Debug/tests/XDebug.Protocol.test.dll test/Unit/Xdebug.Protocol.test.php $(pkg-config --libs nunit| sed s%-r:%/r:%g)
Phalanger - the PHP Language Compiler - version 4.0
for Microsoft (R) .NET Framework version 4.0
Encoding  cannot be loaded.
fileEncoding=""

Performing compilation ...
error PHP2007: Internal error! 
Please, report this bug via http://phalanger.codeplex.com/workitem/list/basic.
Additional information: 
Cannot convert to type System.Object[]
Parameter name: target_type
  at PHP.Core.ConvertToClr.ObjectToType (System.Object obj, System.Type target_type) <0x40cb6a00 + 0x00127> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+CustomAttributeCompiler.Emit (PHP.Core.CodeGenerator codeGen, IPhpCustomAttributeProvider target, Boolean force) <0x40cb51f0 + 0x003cf> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+CustomAttributeCompiler.Emit (PHP.Core.CodeGenerator codeGen, IPhpCustomAttributeProvider target) <0x40cb51c0 + 0x0001b> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.CustomAttributeCompilerHelper.Emit (PHP.Core.AST.CustomAttribute node, PHP.Core.CodeGenerator codeGen, IPhpCustomAttributeProvider target) <0x40cb5180 + 0x00030> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+CustomAttributesCompiler.Emit (PHP.Core.AST.CustomAttributes node, PHP.Core.CodeGenerator codeGenerator, IPhpCustomAttributeProvider target) <0x40cb50a0 + 0x0007b> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.CustomAttributesCompilerHelper.Emit (PHP.Core.AST.CustomAttributes node, PHP.Core.CodeGenerator codeGenerator, IPhpCustomAttributeProvider target) <0x40cb5050 + 0x00037> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+TypeMemberDeclCompiler`1[T].Emit (T node, PHP.Core.CodeGenerator codeGenerator) <0x40cb6900 + 0x00057> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+MethodDeclCompiler.Emit (PHP.Core.AST.MethodDecl node, PHP.Core.CodeGenerator codeGenerator) <0x40cb64d0 + 0x00027> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+TypeMemberDeclCompiler`1[T].PHP.Core.Compiler.AST.ITypeMemberDeclCompiler.Emit (PHP.Core.AST.TypeMemberDecl node, PHP.Core.CodeGenerator codeGenerator) <0x40cb6470 + 0x00055> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+TypeDeclCompiler.EmitDefinition (PHP.Core.CodeGenerator codeGenerator) <0x40cb4340 + 0x00159> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+TypeDeclCompiler.Emit (PHP.Core.AST.TypeDecl node, PHP.Core.CodeGenerator codeGenerator) <0x40cb40f0 + 0x00027> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+StatementCompiler`1[T].PHP.Core.Compiler.AST.IStatementCompiler.Emit (PHP.Core.AST.Statement node, PHP.Core.CodeGenerator codeGenerator) <0x40cb3f90 + 0x00052> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.StatementUtils.Emit (PHP.Core.AST.Statement statement, PHP.Core.CodeGenerator codeGenerator) <0x40cb3f50 + 0x00036> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+NamespaceDeclCompiler.Emit (PHP.Core.AST.NamespaceDecl node, PHP.Core.CodeGenerator codeGenerator) <0x40cb3ff0 + 0x0008b> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+StatementCompiler`1[T].PHP.Core.Compiler.AST.IStatementCompiler.Emit (PHP.Core.AST.Statement node, PHP.Core.CodeGenerator codeGenerator) <0x40cb3f90 + 0x00052> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.StatementUtils.Emit (PHP.Core.AST.Statement statement, PHP.Core.CodeGenerator codeGenerator) <0x40cb3f50 + 0x00036> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.NodeCompilers+GlobalCodeCompiler.Emit (PHP.Core.AST.GlobalCode ast, PHP.Core.CodeGenerator codeGenerator) <0x40cb2650 + 0x0023b> in <filename unknown>:0 
  at PHP.Core.Compiler.AST.GlobalCodeCompilerHelper.Emit (PHP.Core.AST.GlobalCode ast, PHP.Core.CodeGenerator codeGenerator) <0x40cb25f0 + 0x00036> in <filename unknown>:0 
  at PHP.Core.Reflection.CompilationSourceUnit.Emit (PHP.Core.CodeGenerator codeGenerator) <0x40cb1ad0 + 0x00123> in <filename unknown>:0 
  at PHP.Core.Reflection.PureCompilationUnit.Compile (IEnumerable`1 sourceFiles, PHP.Core.Emit.PureAssemblyBuilder assemblyBuilder, PHP.Core.CompilationContext context, System.Text.Encoding encoding) <0x40b997d0 + 0x0064b> in <filename unknown>:0 
  at PHP.Core.Emit.PureAssemblyBuilder.Build (IEnumerable`1 sourceFiles, PHP.Core.CompilationContext context) <0x40b92990 + 0x00073> in <filename unknown>:0 
  at PHP.Core.ApplicationCompiler.Compile (PHP.Core.ApplicationContext applicationContext, PHP.Core.CompilerConfiguration config, PHP.Core.ErrorSink errorSink, PHP.Core.CompilationParameters ps) <0x40b8e8e0 + 0x0083c> in <filename unknown>:0 


Build complete -- 1 error, 0 warnings.

Source code:

<?php
namespace Weirdan\Xdebug\Protocol\Tests;


use NUnit\Framework\TestFixtureAttribute as TestFixture,
    NUnit\Framework\TestAttribute as Test,
    NUnit\Framework\TestCaseAttribute as TestCase,
    NUnit\Framework\Assert,
    NUnit\Framework\Is;

[assembly:\Export]

[TestFixture]
class TestBasic
{
    [TestCase(12)]
    [\Export]
    function testSomething($arg)
    {
        Assert::That($arg, Is::EqualTo(12));
    }
}

If I take out [TestCase(12)] attribute (or replace it with [Test]) it compiles ok.

TestCaseAttribute is defined like this:

namespace NUnit.Framework
{
    [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
    public class TestCaseAttribute : Attribute, ITestCaseData
    {
        //
        // Properties
        //
        public object[] Arguments { get; }

        public IList Categories { get; }

        public string Category { get; set; }

        public string Description { get; set; }

        public Type ExpectedException { get; set; }

        public string ExpectedExceptionName { get; set; }

        public string ExpectedMessage { get; set; }

        public object ExpectedResult { get; set; }

        public bool Explicit { get; set; }

        public bool HasExpectedResult { get; }

        public bool Ignore { get; set; }

        public bool Ignored { get; set; }

        public string IgnoreReason { get; set; }

        public MessageMatch MatchType { get; set; }

        public string Reason { get; set; }

        public object Result { get; set; }

        public string TestName { get; set; }

        //
        // Constructors
        //
        public TestCaseAttribute (params object[] arguments);

        public TestCaseAttribute (object arg);

        public TestCaseAttribute (object arg1, object arg2);

        public TestCaseAttribute (object arg1, object arg2, object arg3);
    }
}

Support for PHP 5.4 traits

Does Phalanger already supports traits?

I'm trying to build this simple example from PHP documentation:

<?php
class Base {
    public function sayHello() {
        echo 'Hello ';
    }
}

trait SayWorld {
    public function sayHello() {
        parent::sayHello();
        echo 'World!';
    }
}

class MyHelloWorld extends Base {
    use SayWorld;
}

$o = new MyHelloWorld();
$o->sayHello();

Errors and stack trace using Visual Studio 2013 and Phalanger 4.0:

Error   1   The class 'SayWorld' has no parent  c:\users\endel\documents\visual studio 2013\Projects\PhalangerTraits\PhalangerTraits\index.php  10  10  PhalangerTraits
Error   2   Internal error! 
Please, report this bug via http://phalanger.codeplex.com/workitem/list/basic.
Additional information: 
The method or operation is not implemented.
   at PHP.Core.Compiler.AST.NodeCompilers.TraitsUseCompiler.Analyze(TraitsUse node, Analyzer analyzer)
   at PHP.Core.Compiler.AST.NodeCompilers.TypeMemberDeclCompiler`1.PHP.Core.Compiler.AST.ITypeMemberDeclCompiler.Analyze(TypeMemberDecl node, Analyzer analyzer)
   at PHP.Core.Compiler.AST.NodeCompilers.TypeDeclCompiler.Analyze(TypeDecl node, Analyzer analyzer)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Analyze(Statement node, Analyzer analyzer)
   at PHP.Core.Compiler.AST.NodeCompilers.GlobalCodeCompiler.Analyze(GlobalCode ast, Analyzer analyzer)
   at PHP.Core.Analyzer.Analyze(CompilationSourceUnit sourceUnit)
   at PHP.Core.Reflection.ScriptCompilationUnit.AnalyzeRecursively(Analyzer analyzer)
   at PHP.Core.Reflection.InclusionGraphBuilder.AnalyzeDfsTree(PhpSourceFile rootSourceFile)
   at PHP.Core.Emit.ScriptAssemblyBuilder.CompileScripts(IEnumerable`1 sourceFiles, CompilationContext context)
   at PHP.Core.Emit.ScriptAssemblyBuilder.Build(IEnumerable`1 sourceFiles, CompilationContext context)
   at PHP.Core.ApplicationCompiler.Compile(ApplicationContext applicationContext, CompilerConfiguration config, ErrorSink errorSink, CompilationParameters ps)
        -1  0   PhalangerTraits

Since the error tells about "PhalangerTraits", I suppose it is implemented somehow, correct? Am I missing something here?

Thank you.

sending file with curl

Hi,

I'm trying to send a file with curl, but I'm getting an exception. Here is a php code - it works well with php cli interpreter

$data = array(
'file' => '@'.realpath($reportValue['file']),
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$head = curl_exec($ch); <-- this throws an error
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

Here is an exception that I get:

(translation)
Unhandled exception: PHP.Core.PhpNetInternalException: Guarded call InnerException: The process can not access the file 'C: \ Users \ Michal \ AppData \ Local \ Temp \ testfile.txt "because it is being used by another process.

Is there any way to get working file sending over curl?

Best regards,
Michal

Wyjątek nieobsłużony: PHP.Core.PhpNetInternalException: Guarded call InnerException: Proces nie może uzyskać dostępu do pliku "C:\Users\Michal\AppData\Local\Temp\testfile.txt", ponieważ jest on używany przez inny proces.
at w System.IO._Error.WinIOError(Int32 errorCode, String maybeFullPath)
w System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
w System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
w System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
w PHP.Library.Curl.HttpFormDataUploader.UploadForm(CurlForm form)
w PHP.Library.Curl.CurlHttp.Execute(PhpCurlResource curl, CURLcode& result)
w PHP.Library.Curl.Curl.Execute(PhpResource ch)
w PHP.Core.ScriptContext.CallInternal(Dictionary2 localVariables, NamingContext namingContext, Object name, String fallbackName, DRoutineDesc& routineHint,ScriptContext context) w PHP.Core.ScriptContext.CallValue(Dictionary2 localVariables, NamingContextnamingContext, Object name, String fallbackName, DRoutineDesc& routineHint, ScriptContext context)
w <ww.php>.WorkWatcherClient.sendReports(ScriptContext ) w P:\misc\client\ww.php:wiersz 90
w <ww.php>.WorkWatcherClient.process(ScriptContext ) w P:\misc\client\ww.php:wiersz 44
w <ww.php>.WorkWatcherClient.start(ScriptContext ) w P:\misc\client\ww.php:wiersz 125
w start
(WorkWatcherClient , ScriptContext )
w System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
w <ww.php>.<Script>.

(ScriptContext , Dictionary2 <locals>, DObject <self>, DTypeDesc <includer>, Boolean <request>) w P:\misc\client\ww.php:wiersz 133 w PHP.Core.ScriptContext.GuardedMain(Object mainRoutine) w PHP.Core.ScriptContext.GuardedCall[TData,TResult](Converter2 routine, TData data, Boolean allowUserExceptions)
---> System.IO.IOException: Proces nie może uzyskać dostępu do pliku "C:\Users\Michal\AppData\Local\Temp\testfile.txt", ponieważ jest on używany przez inny proces.
w System.IO._Error.WinIOError(Int32 errorCode, String maybeFullPath)
w System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
w System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
w System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
w PHP.Library.Curl.HttpFormDataUploader.UploadForm(CurlForm form)
w PHP.Library.Curl.CurlHttp.Execute(PhpCurlResource curl, CURLcode& result)
w PHP.Library.Curl.Curl.Execute(PhpResource ch)
w PHP.Core.ScriptContext.CallInternal(Dictionary2 localVariables, NamingContext namingContext, Object name, String fallbackName, DRoutineDesc& routineHint, ScriptContext context) w PHP.Core.ScriptContext.CallValue(Dictionary2 localVariables, NamingContext namingContext, Object name, String fallbackName, DRoutineDesc& routineHint, ScriptContext context)
w <ww.php>.WorkWatcherClient.sendReports(ScriptContext ) w P:\misc\client\ww.php:wiersz 90
w <ww.php>.WorkWatcherClient.process(ScriptContext ) w P:\misc\client\ww.php:wiersz 44
w <ww.php>.WorkWatcherClient.start(ScriptContext ) w P:\misc\client\ww.php:wiersz 125
w start
(WorkWatcherClient , ScriptContext )
w System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
w <ww.php>.<Script>.(ScriptContext , Dictionary2 <locals>, DObject <self>, DTypeDesc <includer>, Boolean <request>) w P:\misc\client\ww.php:wiersz 133 w PHP.Core.ScriptContext.GuardedMain(Object mainRoutine) w PHP.Core.ScriptContext.GuardedCall[TData,TResult](Converter2 routine, TData data, Boolean allowUserExceptions)
--- Koniec śladu stosu wyjątków wewnętrznych ---
w PHP.Core.ScriptContext.GuardedCall[TData,TResult](Converter`2 routine, TData data, Boolean allowUserExceptions)
w PHP.Core.ScriptContext.RunApplication(Delegate mainRoutine, String relativeSourcePath, String sourceRoot)
w .Run(String[] )

Bug in array_key_exists

array_key_exists does not behaves as it should, from php documentation:

For backward compatibility reasons, array_key_exists() will also return TRUE if key is a property defined within an object given as array.

Phalanger reports error if input parameter is not array.

bug in library wrappers generator?

        [ImplementsFunction("tieArrayValue")]
        public static object tieArrayValue([PhpRw] ref PhpArray arr, object key, object value)
        {
...
        }

        [ImplementsFunction("tieArrayValue")]
        public static object tieArrayValue([PhpRw] ref PhpArray arr, object key)
        {
...
        }
    public static object tieArrayValue([In] object obj0, [In] PhpStack obj1)
    {
      switch (obj1.ArgCount)
      {
        case 2:
          PhpReference phpReference1 = obj1.PeekReferenceUnchecked(0); //why 0? it's throws exception
          PhpArray phpArray1 = phpReference1.value as PhpArray;
          // ISSUE: explicit reference operation
          // ISSUE: variable of a reference type
          PhpArray& arr1 = @phpArray1;
          object key1 = obj1.PeekValueUnchecked(2);
          obj1.RemoveFrame();
          object obj2 = Common.tieArrayValue(arr1, key1);
          phpReference1.value = (object) phpArray1;
          return obj2;
        case 3:
          PhpReference phpReference2 = obj1.PeekReferenceUnchecked(0); //why 0? it's throws exception
          PhpArray phpArray2 = phpReference2.value as PhpArray;
          // ISSUE: explicit reference operation
          // ISSUE: variable of a reference type
          PhpArray& arr2 = @phpArray2;
          object key2 = obj1.PeekValueUnchecked(2);
          object obj3 = obj1.PeekValueUnchecked(3);
          obj1.RemoveFrame();
          object obj4 = Common.tieArrayValue(arr2, key2, obj3);
          phpReference2.value = (object) phpArray2;
          return obj4;
        default:
          PhpException.InvalidArgumentCount((string) null, "tieArrayValue");
          return (object) null;
      }
    }

preg_match_all() with PREG_OFFSET_CAPTURE returns differently than PHP

This might actually be a bug with PHP, but Phalanger acts differently from PHP that can cause problems.

When an optional matching group doesn't match in a preg_match_all() call with PREG_OFFSET_CAPTURE, PHP returns "" (an empty string) for that group, whereas Phalanger returns array("",0).

Reproduction code:

preg_match_all('/(x)?/', '', $m, PREG_OFFSET_CAPTURE);
print '<pre>'; var_dump($m); print '</pre>';

PHP returns:

<pre>array(2) {
  [0]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(0) ""
      [1]=>
      int(0)
    }
  }
  [1]=>
  array(1) {
    [0]=>
    string(0) ""
  }
}
</pre>

Phalanger:

<pre>array(2) {
  [0]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(0) ""
      [1]=>
      int(0)
    }
  }
  [1]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(0) ""
      [1]=>
      int(0)
    }
  }
}
</pre>

Phalanger 3.0
PHP 5.0.4 – 5.5.18.

BUG with strings

$val1 = 'é'; $val2 = unserialize(serialize($val1));
$EOL = "<br>\n";

echo ($val1 === $val2 ? 'Equal' : 'Not Equal') . $EOL; // Returns 'Equal', because $val1 === $val2 === 'é'
echo htmlentities($val1) . $EOL; // Returns html entity for 'é'
echo htmlentities($val2) . $EOL; // Returns '?' (Note that $val1 === $val2 !)

BTW: I'm using the ISO-8859-1 charset

HTTPS wrapper not available?

Hi there,

Trying to use file_get_contents() for an https:// url however I'm getting

Notice: file_get_contents(): Unable to find the wrapper 'https' - did you forget to enable it when you configured PHP?

Normally (without Phalanger), enabling the openssl module would provide this wrapper, however adding the php_openssl.mng assembly does not resolve this.

Even with php_openssl.mng added (and confirmed that it's loaded through a call to phpinfo()), a check of stream_get_wrappers() only returns 'ftp' and 'http' (twice, oddly)

Is there something else I need to do to enable the https stream wrapper in Phalanger?

Cheers,
Eion

Bug in clone()

This test-case shows 'A is wrong' instead of 'A is ok':

$a = new stdClass();
$a->test = 'ok';
$ptr = & $a->test; // <--- This reference corrupts $a's clonation
$b = clone($a);
$b->test = "wrong";
die('A is ' . $a->test);

Note that even doing unset($ptr) doesn't workarround the bug:

$ptr = & $a->test; // This reference corrupts $a's clonation
unset($ptr);

100,000 different script method, program memory is very large, can add unload temp assembly public method??

100,000 different script method, program process memory is very large, can add unload temp assembly public method?? , have a better solution?????

Thank you very much.

Assembly beisen_AppFramework_TempFile_0CF8D27731D05A79C556E0E242E4E4D88#35863539#08d2e17a0584efaf, Version 1.0.0.0
Assembly beisen_AppFramework_TempFile_000B2394F04EC39A533F92CC2F63FFD0
8#35863539#08d2e11ae09dcbd0, Version 1.0.0.0
..........

http://dfiles.tita.com/portal/110006/19c825bb1ccb4f87b628f23a9102408d.jpg

http://dfiles.tita.com/portal/110006/8c45ebaa82b64a3fb781b1dc1ced893d.jpg

http://dfiles.tita.com/portal/110006/b5ea45c093934cae90b451d466bf8cd6.jpg

http://dfiles.tita.com/portal/110006/0c3f793f05aa4620b6b589b12db73656.jpg

http://dfiles.tita.com/portal/110006/1e57a9c492bb431ca125900bd8cbc34c.jpg

http://dfiles.tita.com/portal/110006/7652d9f427fb4bae9808d10c5d8cb4aa.jpg

my c# code:

  private static ScriptContext _scriptContext;

  static PhpDynamicScript()
    {
        _scriptFileHashDict = new Dictionary<string, string>();
        _scriptContext = new ScriptContext(ApplicationContext.Default);
        _scriptContext.GlobalVariables["_logger"] =
           _scriptContext.NewObject(@"Beisen\Logging\LogWrapper"); ;
        Tools.CreateDirectory(DynamicScriptEngineSettings.Instance.ScriptTempFile);
    }



  private bool ExecuteDynamicScript(string code, out string errorMsg)
    {
        code = "<? " + code + " ?>";
        errorMsg = string.Empty;
        try
        {
            string scriptHash = Tools.GetScriptHash(code);
            string scriptFileFullName =      Path.Combine(DynamicScriptEngineSettings.Instance.ScriptTempFile, scriptHash);
            string scriptFile = GenerateScriptFile(scriptFileFullName, code);
            _scriptContext.Include(scriptFile, true);
            _compiled = true;
            return true;
        }
        catch (Exception ex)
        {
            _logger.Error(new CompileErrorException("compile error",ex));
            errorMsg = "compile error";
            return false;
        }
    }

   public T CallFunction<T>(string functionName, params object[] parameters)
    {
        ArgumentHelper.AssertNotEmpty(functionName, "functionName");
        if (_scriptContext != null)
        {
            var result = InternalCallFunction(functionName, parameters);
            if (result == null)
                return default(T);
            if (result is ClrObject)
            {
                var clrObject = ((ClrObject) result); 
                dynamic realObj = (T)clrObject.RealObject;
                if (clrObject.RuntimeFields != null)
                    foreach (var field in clrObject.RuntimeFields)
                        realObj[field.Key.String] = field.Value;
                return realObj;
            }
            return (T)result;
        }
        return default(T);
    }


  private object InternalCallFunction(string functionName, params object[] parameters)
    { 
        if (!_scriptContext.DeclaredFunctions.ContainsKey(functionName))
        {
            _logger.Error(
                new ScriptFunctionNotFoundException(String.Format("TenantId:{0},FunctionName:{1},Language:{2}",
                    _tenantId, functionName, Language)));
            return null;
        }
        var result = _scriptContext.Call(functionName, parameters);
        if (result != null && result.Value != null)
            return result.Value;
        return null;
    }

Thank you very much, have a better solution?????

phpc crash

Additional information:
Cannot create an instance of PHP.Core.Compiler.AST.NodeCompilers+ClassConstUseCompiler`1[T] because Type.ContainsGenericParameters is true.

To reproduce, try to compile file "Mobile_Detect.php" from http://mobiledetect.net/

Priority : low (IMO)

Building in non-pure mode fails

I'm trying to compile the following script with Phalanger built on Mono:

<?php
phpinfo();

and I'm getting the following error:

[weirdan@virtual-debian-home]❯ mono --debug Source/PhpNetCompiler/bin/Debug/phpc.exe /reference:/home/weirdan/src/Phalanger/Source/PhpNetCompiler/bin/Debug/PhpNetCore.dll /reference:/home/weirdan/src/Phalanger/Source/ClassLibrary/Bin/Debug/PhpNetClassLibrary.dll /encoding:UTF-8 qq.php
Phalanger - the PHP Language Compiler - version 3.0
for Microsoft (R) .NET Framework version 4.0
Arguments:
/reference:/home/weirdan/src/Phalanger/Source/PhpNetCompiler/bin/Debug/PhpNetCore.dll
/reference:/home/weirdan/src/Phalanger/Source/ClassLibrary/Bin/Debug/PhpNetClassLibrary.dll
/encoding:UTF-8
qq.php

Encoding  cannot be loaded.
fileEncoding=""

Loaded libraries:
PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71
Base Library (PhpNetClassLibrary)

Performing compilation ...
qq.php
Generating code ...
Generating assembly ...
error PHP2007: Internal error!
Please, report this bug via http://www.codeplex.com/WorkItem/List.aspx?ProjectName=Phalanger.
Additional information:
Assertion failed:
  at PHP.Core.Debug.Fail (System.String message) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:121
  at PHP.Core.Debug.Assert (Boolean condition) [0x00007] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:64
  at PHP.Core.Reflection.MultiScriptAssembly.GetModule (PHP.Core.PhpSourceFile sourceFile) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Reflection/Assemblies.CLR.cs:386
  at PHP.Core.Emit.MultiScriptAssemblyBuilder.GetEntryScriptBuilder () [0x0000d] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:750
  at PHP.Core.Emit.ScriptAssemblyBuilder.EmitEntryPoint (System.Reflection.Emit.MethodBuilder methodBuilder) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:571
  at PHP.Core.Emit.PhpAssemblyBuilder.CreateEntryPoint () [0x00070] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:374
  at PHP.Core.Emit.PhpAssemblyBuilder.Save () [0x00019] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:220
  at PHP.Core.ApplicationCompilerManager.Finish (Boolean successful) [0x0002a] in /home/weirdan/src/Phalanger/Source/Core/Compiler/Managers.CLR.cs:139
  at PHP.Core.Emit.ScriptAssemblyBuilder.CompileScripts (IEnumerable`1 sourceFiles, PHP.Core.CompilationContext context) [0x00093] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:550
  at PHP.Core.Emit.ScriptAssemblyBuilder.Build (IEnumerable`1 sourceFiles, PHP.Core.CompilationContext context) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Emit/AssemblyBuilders.CLR.cs:516
  at PHP.Core.ApplicationCompiler.Compile (PHP.Core.ApplicationContext applicationContext, PHP.Core.CompilerConfiguration config, PHP.Core.ErrorSink errorSink, PHP.Core.CompilationParameters ps) [0x001b3] in /home/weirdan/src/Phalanger/Source/Core/Compiler/AppCompiler.CLR.cs:1339


Statistics:
Compiled in 0:00.178.
AST: LibraryFunctionCalls = 1, UnknownFunctionCalls = 0


Build complete -- 1 error, 0 warnings.

mono --version output:

Mono JIT compiler version 3.0.6 (Debian 3.0.6+dfsg2-4)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

This is apparently caused by wrong comparison result when comparing an instance of PHP.Core.FullPath to null here: https://github.com/DEVSENSE/Phalanger/blob/master/Source/Core/Compiler/AppCompiler.CLR.cs#L1286

To check that I'm not mistaken about the cause of the problem I wrote the following simple test program:

using System;
using PHP.Core;

namespace PHP
{
    class FullPathTest
    {
        public static void Main (string[] args)
        {
            FullPath fp = new FullPath ("/etc/passwd");

            Console.WriteLine ("Comparing with == : " + (fp == null ? "true" : "false") + "; expected: false");
            Console.WriteLine ("Comparing with != : " + (fp != null ? "true" : "false") + "; expected: true");
            Console.WriteLine ();

            Console.WriteLine ("Comparing with (object)== : " + ((object) fp == null ? "true" : "false") + "; expected: false");
            Console.WriteLine ("Comparing with (object)!= : " + ((object) fp != null ? "true" : "false") + "; expected: true");
            Console.WriteLine ();

            Console.WriteLine ("Comparing with .Equals() : " + (fp.Equals (null) ? "true" : "false") + "; expected: false");
            Console.WriteLine ("Comparing with (object).Equals() : " + (((object)fp).Equals (null) ? "true" : "false") + "; expected: false");
        }
    }
}

And here are results I'm getting:

Comparing with == : true; expected: false
Comparing with != : false; expected: true

Comparing with (object)== : false; expected: false
Comparing with (object)!= : true; expected: true

Comparing with .Equals() : false; expected: false
Comparing with (object).Equals() : false; expected: false

Building with /pure+ switch works as expected (because entry_point_file is not used in that mode).

Can't compile with VS2012

Hi,

On a fresh computer with only VS2012, I can't compile the Core project :

  • in the file Tools\UpdateFileVersionFromChangeset.cmd, on first line there should be VS110COMNTOOLS instead of VS100COMNTOOLS.
  • after that, I still have errors in the .cmd execution. So I commented it in the project pre-build events
  • And last, lots of "error CS2001: Source file 'Compiler\AST\ArrayEx.cs' could not be found"

problems with .net 4.6

in .net 4.6 anonymous delegates compiles as instance methods even if target is 4.5 and this code is not working:

            Func<object,object> isNotPhpReference = (obj) =>
            {
               Debug.Assert( !(obj is PhpReference) );
               return obj;
            };

            return Expression.Call(null, isNotPhpReference.Method, objEx);

must use static mehods

        private static object IsNotPhpReference(object obj)
        {
            Debug.Assert(!(obj is PhpReference));
            return obj;
        }

issue with <?xml in php files

Mono JIT compiler version 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012)
Phalanger - the PHP Language Compiler - version 3.0

The code line that phalanger is trying to compile is:

It seems that Phalanger assumes that <? is always php and doesn't take into account if it is used for xml.

Object reference error while including non pure mode dll

I want to consume simple php library in c# application, for that I have simple php class like below,

class SampleObj
{
    public $Message = "Hello world!";

    function Write($arg)
    {
        echo $arg."\n";
    }

    function Add($a, $b)
    {
        return $a + $b;
    }
}

I am converting this into dll using below command

phpc /target:dll /out:objects.dll objects.php

Now i am using it in c# console application by below code

ScriptContext ctx = ScriptContext.CurrentContext;
ctx.Output = Console.Out;
ctx.Include("objects.php", false);

I have also added below in App.config file and gave reference to objects.dll in project references

<phpNet>
    <classLibrary>
      <add assembly="mscorlib"/>
      <!--<add assembly="objects, Version=1.0.0.0" />-->
      <add url="objects.dll" />
    </classLibrary>
</phpNet>

Still I am having exception like below

{"Library assembly 'file:///C:/CSharpConsole/bin/Debug/objects.dll' could not be loaded. Object reference not set to an instance of an object."}

at PHP.Core.AssemblyLoader.Load(String assemblyName, Uri assemblyUrl, LibraryConfigStore config)
at PHP.Core.PhpConfigurationContext.LoadLibrary(String assemblyName, Uri assemblyUrl, String sectionName, XmlNode node)
at PHP.Core.LibrariesConfigurationList.LoadLibrariesNoLock(Func5 callback, Action1 parseSectionCallback)
at PHP.Core.ConfigurationSectionHandler.GetConfig(ApplicationContext appContext, String sectionName)
at PHP.Core.Configuration.Load(ApplicationContext appContext)
at PHP.Core.ScriptContext..ctor(ApplicationContext appContext)
at PHP.Core.ScriptContext.CreateDefaultScriptContext()
at PHP.Core.ScriptContext.get_CurrentContext()
at CSharpConsole.Program.Main(String[] args) in C:\Users\rushi.PROMACT\Downloads\ducktyping\CSharpConsole\Program.cs:line 28
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

What could be the issue?

Help, Custom entity class, can not convert type to [PHP.Core.IPhpVariable]

=====c# code:======

static void Main(string[] args)
{
ScriptContext context = ScriptContext.CurrentContext;
context.Output = Console.Out;
context.Include(@"C:\script.php", true);
PhpReference r = context.Call("myTest", new WebClient(), new Student() { Age = 20, UserName = "David" });
Console.WriteLine(r.Value);
Console.ReadLine();

}

 public class Student
    {
        public string UserName { get; set; }
        public int Age { get; set; }
    }

=====script file:=====

Age=1000; echo $student->Age; //error,why?? //echo $student->UserName; //$page = $webClient->DownloadString('http://www.google.com'); //echo $page; return $student; } ``` ?>

PhpNetMsSql Transactions Bug on Mono/Linux

Using managed extension "PhpNetMsSql"...

$con = mssql_pconnect('<host>,<port>', '<user>', '<pass>');
mssql_select_db('<database>');
mssql_query('BEGIN TRANSACTION');

Throws:

Warning: mssql_query(): Command execution failed: Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.

This happens only on Mono/Linux. On Windows, it's working fine.

clr_create_thread fails

I can't get clr_create_thread to work.

Source code:

<?php
class M
{
    public static function Main()
    {
        (new self)->run();
    }

    public function run()
    {
        clr_create_thread([$this, 'inthread']);
    }

    public function inthread()
    {
        while (true) {
            echo ".";
            System\Threading\Thread::Sleep(2);
        }
    }
}

Compile log:

[weirdan@virtual-debian-home]..phalanger-xdebug/application❯ /home/weirdan/src/Phalanger/Source/PhpNetCompiler/bin/Debug/phpc.exe /config:phalanger.xml /debug+ /lang:CLR /pure+ /encoding:UTF-8 /target:exe /out:qq.exe q.php
Phalanger - the PHP Language Compiler - version 3.0
for Microsoft (R) .NET Framework version 4.0
Arguments:
/config:phalanger.xml
/debug+
/lang:CLR
/pure+
/encoding:UTF-8
/target:exe
/out:qq.exe
q.php

Encoding  cannot be loaded.
fileEncoding=""

/home/weirdan/src/phalanger-xdebug/application/phalanger.xml
Loaded libraries:
Base Library (PhpNetClassLibrary)
XmlDom (PhpNetXmlDom)
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f

Performing compilation ...

Statistics:
Compiled in 0:00.252.
AST: LibraryFunctionCalls = 1, UnknownFunctionCalls = 0


Build complete -- 0 errors, 0 warnings.

This throws the following exception:

[weirdan@virtual-debian-home]..phalanger-xdebug/application❯ mono --debug qq.exe
Encoding  cannot be loaded.
fileEncoding=""


Unhandled Exception:
PHP.Core.PhpNetInternalException: Guarded call
InnerException: Assertion failed:
at   at PHP.Core.Debug.Fail (System.String message) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:121
  at PHP.Core.Debug.Assert (Boolean condition) [0x00007] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:64
  at PHP.Core.Reflection.ClrObject.WrapRealObject (System.Object instance) [0x0000e] in /home/weirdan/src/Phalanger/Source/Core/Reflection/Objects.cs:2901
  at PHP.Library.Clr.CreateClrThread (PHP.Core.PhpCallback callback, System.Object[] args) [0x00000] in <filename unknown>:0
  at M.run (PHP.Core.ScriptContext ) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:11
  at M.Main (PHP.Core.ScriptContext <context>) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:6
  at M.Main (System.Object instance, PHP.Core.PhpStack stack) [0x00000] in <filename unknown>:0
  at PHP.Core.ScriptContext.GuardedMain (System.Object mainRoutine) [0x0000f] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2252
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x00050] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2152
 ---> PHP.Core.Debug+AssertException: Assertion failed:
  at PHP.Core.Debug.Fail (System.String message) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:121
  at PHP.Core.Debug.Assert (Boolean condition) [0x00007] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:64
  at PHP.Core.Reflection.ClrObject.WrapRealObject (System.Object instance) [0x0000e] in /home/weirdan/src/Phalanger/Source/Core/Reflection/Objects.cs:2901
  at PHP.Library.Clr.CreateClrThread (PHP.Core.PhpCallback callback, System.Object[] args) [0x00000] in <filename unknown>:0
  at M.run (PHP.Core.ScriptContext ) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:11
  at M.Main (PHP.Core.ScriptContext <context>) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:6
  at M.Main (System.Object instance, PHP.Core.PhpStack stack) [0x00000] in <filename unknown>:0
  at PHP.Core.ScriptContext.GuardedMain (System.Object mainRoutine) [0x0000f] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2252
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x00050] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2152
  --- End of inner exception stack trace ---
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x000a9] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2175
  at (wrapper remoting-invoke-with-check) PHP.Core.ScriptContext:GuardedCall (System.Converter`2<object, object>,object,bool)
  at PHP.Core.ScriptContext.RunApplication (System.Delegate mainRoutine, System.String relativeSourcePath, System.String sourceRoot) [0x00111] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.CLR.cs:138
  at <Global>.Run (System.String[] ) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: PHP.Core.PhpNetInternalException: Guarded call
InnerException: Assertion failed:
at   at PHP.Core.Debug.Fail (System.String message) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:121
  at PHP.Core.Debug.Assert (Boolean condition) [0x00007] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:64
  at PHP.Core.Reflection.ClrObject.WrapRealObject (System.Object instance) [0x0000e] in /home/weirdan/src/Phalanger/Source/Core/Reflection/Objects.cs:2901
  at PHP.Library.Clr.CreateClrThread (PHP.Core.PhpCallback callback, System.Object[] args) [0x00000] in <filename unknown>:0
  at M.run (PHP.Core.ScriptContext ) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:11
  at M.Main (PHP.Core.ScriptContext <context>) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:6
  at M.Main (System.Object instance, PHP.Core.PhpStack stack) [0x00000] in <filename unknown>:0
  at PHP.Core.ScriptContext.GuardedMain (System.Object mainRoutine) [0x0000f] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2252
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x00050] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2152
 ---> PHP.Core.Debug+AssertException: Assertion failed:
  at PHP.Core.Debug.Fail (System.String message) [0x00001] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:121
  at PHP.Core.Debug.Assert (Boolean condition) [0x00007] in /home/weirdan/src/Phalanger/Source/Core/Utils.cs:64
  at PHP.Core.Reflection.ClrObject.WrapRealObject (System.Object instance) [0x0000e] in /home/weirdan/src/Phalanger/Source/Core/Reflection/Objects.cs:2901
  at PHP.Library.Clr.CreateClrThread (PHP.Core.PhpCallback callback, System.Object[] args) [0x00000] in <filename unknown>:0
  at M.run (PHP.Core.ScriptContext ) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:11
  at M.Main (PHP.Core.ScriptContext <context>) [0x00001] in /home/weirdan/src/phalanger-xdebug/application/q.php:6
  at M.Main (System.Object instance, PHP.Core.PhpStack stack) [0x00000] in <filename unknown>:0
  at PHP.Core.ScriptContext.GuardedMain (System.Object mainRoutine) [0x0000f] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2252
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x00050] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2152
  --- End of inner exception stack trace ---
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x000a9] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.cs:2175
  at (wrapper remoting-invoke-with-check) PHP.Core.ScriptContext:GuardedCall (System.Converter`2<object, object>,object,bool)
  at PHP.Core.ScriptContext.RunApplication (System.Delegate mainRoutine, System.String relativeSourcePath, System.String sourceRoot) [0x00111] in /home/weirdan/src/Phalanger/Source/Core/ScriptContext.CLR.cs:138
  at <Global>.Run (System.String[] ) [0x00000] in <filename unknown>:0

The reason seems to be that PHP.Library.Clr.CreateClrThread() tries to call PHP.Core.Reflection.ClrObject.WrapRealObject() on the result of ThreadPool.QueueUserWorkItem() (which is boolean) here, however ClrObject.WrapRealObject() does not work on primitive values (asserted via call to !PhpVariable.HasPrimitiveType() here)

Cannot compile using static methods

Hi @jakubmisek,

I'm trying to compile hook with Phalanger, but the following line of code is causing "method or operation is not implemented:": https://github.com/doubleleft/hook/blob/bde2b2e705a5f1d6323b6c7684be19e17afbae96/src/Database/Schema/Builder.php#L84

return static::migrate($model, $config);

After changing from static::migrate to self::migrate it compiles. It's strange because there is other static:: call in the same file here.

Do you have any hint?

Compilation error:

Error   70  Internal error! 
Please, report this bug via http://phalanger.codeplex.com/workitem/list/basic.
Additional information: 
The method or operation is not implemented.
   at PHP.Core.CodeGenerator.EmitLoadStaticTypeDesc(ResolveTypeFlags flags)
   at PHP.Core.Reflection.StaticType.EmitLoadTypeDesc(CodeGenerator codeGenerator, ResolveTypeFlags flags)
   at PHP.Core.CodeGenerator.EmitRoutineOperatorCall(DType type, Expression targetExpr, String routineFullName, String fallbackRoutineFullname, Expression routineNameExpr, CallSignature callSignature, AccessType access)
   at PHP.Core.Reflection.UnknownMethod.EmitCall(CodeGenerator codeGenerator, String fallbackQualifiedName, CallSignature callSignature, IPlace instance, Boolean runtimeVisibilityCheck, Int32 overloadIndex, DType type, Span position, AccessType access, Boolean callVirt)
   at PHP.Core.Compiler.AST.NodeCompilers.DirectStMtdCallCompiler.Emit(DirectStMtdCall node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.ExpressionCompiler`1.PHP.Core.Compiler.AST.IExpressionCompiler.Emit(Expression node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.AstNodeExtension.Emit(Expression node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.JumpStmtCompiler.EmitReturnObject(Expression expr, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.JumpStmtCompiler.Emit(JumpStmt node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Emit(Statement node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(Statement statement, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(IEnumerable`1 statements, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.BlockStmtCompiler.Emit(BlockStmt node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Emit(Statement node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(Statement statement, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.IfStmtCompiler.Emit(IfStmt node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Emit(Statement node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(Statement statement, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(IEnumerable`1 statements, CodeGenerator codeGenerator)
   at PHP.Core.CodeGenerator.EmitArgfullOverloadBody(PhpRoutine routine, IEnumerable`1 body, Span entirePosition, Int32 declarationBodyPosition)
   at PHP.Core.Compiler.AST.NodeCompilers.MethodDeclCompiler.Emit(MethodDecl node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.TypeMemberDeclCompiler`1.PHP.Core.Compiler.AST.ITypeMemberDeclCompiler.Emit(TypeMemberDecl node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.TypeDeclCompiler.EmitDefinition(CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.TypeDeclCompiler.Emit(TypeDecl node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Emit(Statement node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(Statement statement, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.NamespaceDeclCompiler.Emit(NamespaceDecl node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.StatementCompiler`1.PHP.Core.Compiler.AST.IStatementCompiler.Emit(Statement node, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.StatementUtils.Emit(Statement statement, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.NodeCompilers.GlobalCodeCompiler.Emit(GlobalCode ast, CodeGenerator codeGenerator)
   at PHP.Core.Compiler.AST.GlobalCodeCompilerHelper.Emit(GlobalCode ast, CodeGenerator codeGenerator)
   at PHP.Core.Reflection.CompilationSourceUnit.Emit(CodeGenerator codeGenerator)
   at PHP.Core.Reflection.ScriptCompilationUnit.Emit(CodeGenerator codeGenerator)
   at PHP.Core.Reflection.InclusionGraphBuilder.EmitAllUnits(CodeGenerator codeGenerator)
   at PHP.Core.Emit.ScriptAssemblyBuilder.CompileScripts(IEnumerable`1 sourceFiles, CompilationContext context)
   at PHP.Core.Emit.ScriptAssemblyBuilder.Build(IEnumerable`1 sourceFiles, CompilationContext context)
   at PHP.Core.ApplicationCompiler.Compile(ApplicationContext applicationContext, CompilerConfiguration config, ErrorSink errorSink, CompilationParameters ps)
        -1  0   HookDotNet

Another thing to note is that static and self are different according to class inheritance in PHP.

file_exists() should check MSA libraries

Some PHP apps use file_exists() for checking whether a .PHP file exists or not.
For example, for checking if a module is installed, or to find out where it is installed.
Even if PHP files are compiled and not on the filesystem, IMO file_exists() should check inside MSA in order to increase compatibility.
Does it make sense?

Nuget package

Hi,

I think this could be a good idea to have Phalanger deployed with a Nuget package :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.