2

Hello everybody php and phalanger experts: I am mainly developing with c#.

PART 0

I need to compile some third party php code (part of phpseclib Crypt, File, Math, Net pure php implementations, and some files using RSA with ctr cyphermode) with phalanger and then reference it from c#.

I found some hints on how to edit existing php code, and to compile it in pure mode here:

http://tomasp.net/blog/aspnettexy.aspx/

PART 1

I understand that file includes are not necessary in a Visual studio project and I removed them all from the php files.

for example:

<?php
// the following line is not necessary so I commented it
// include 'fake/fake.php';// <= here is defined FakeClass
class myClass
{
    function testFake()
    {
        $obj = new FakeClass();
        // .. do some stuff
    }
}
?>

PART 2

I also used the static variable check in the constructor for letting defines being run once as suggested.

<?php

class myClass
{
    function init_defines()
    {// all my define here
    }

    static private $initalized = false;

    public function __construct($param = defaultval)
    {
        parent::__construct($param);
        if (!myClass::$initialized) // ehm is myClass::$initialized correct or just $initialized ?? 
            { $this->init_defines(); myClass::$initialized=true; }

    }
}
?>

I have no idea how to modify the following file that checks if functions are existing:

https://gitlab.cs.man.ac.uk/oliver.kugel/udo_oli/blob/5ddb55202dbf7fa2bbf793f88bb5bc09eadb248b/phpseclib/Crypt/Random.php

Maybe I just do not need this file at all because it's already in the phalanger implementation ??

Thanks in advance, any suggestion about how to address part 0 part 1 or part 2 in the best way is welcome.

neubert
  • 15,947
  • 24
  • 120
  • 212
  • In pure mode, the source files behave like they were all included at application startup. You don't have to check whether a function exists, because you know it in compile time for sure. Either define the function 'crypt_random_string' or not, unconditionally. – Jakub Míšek Oct 01 '16 at 15:33

0 Answers0