Internal functions not returning Output Parameters.

Discussion about the open-source Phalanger [?] project.

Internal functions not returning Output Parameters.

Postby kripper » February 19th, 2012, 4:34 am

STATUS: Closed (See comments).

The following problem only occurs when the code is executed from a MSA DLL.
When the code is executed from a PHP file included from the MSA, the problem doesn't occur.

When executing:

Code: Select all
   proc_open($cmd, $descriptor, $pipes);


$pipes isn't returning anything (count($pipes) returns 0 and is_array($pipes) is false).

When adding debug info in Open()...

Code: Select all
      [ImplementsFunction("proc_open")]
      public static PhpResource Open(string command, PhpArray descriptorSpec, out PhpArray pipes)
      {
         // return Open(command, descriptorSpec, out pipes, null, null, null);

            PhpResource tmp = Open(command, descriptorSpec, out pipes, null, null, null);
            Console.WriteLine("command: " + command);
            Console.WriteLine("pipes count: " + pipes.Count);
            return tmp;
      }


...the "pipes" array shows to have elements.

The same code was working in Phalanger 2.1.

Note that if you change the code for:

Code: Select all
      public static PhpResource Open(string command, PhpArray descriptorSpec, out PhpArray pipes)
      {
            pipes = new PhpArray();
            pipes.Add(new PhpString("ok"));
            return null;


...$pipes is still empty.

I'm testing on:
Phalanger 3 - SVN 2012-02-15
Mono 2.10.8 and 2.10.9.
Last edited by kripper on February 19th, 2012, 10:29 am, edited 1 time in total.
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am

Re: Internal functions not returning Output Parameters.

Postby kripper » February 19th, 2012, 10:28 am

Problem solved!

phpc was generating the MSA scripts using machine.conf referencing old 2.1.0.0 assemblies.

IMO, Phalanger should do some compatibility checkings to save debuging hours.
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am

Re: Internal functions not returning Output Parameters.

Postby Jakub Misek » February 19th, 2012, 10:40 am

Ah, good you solved it so quick :)

Phalanger just references anything you give him. There might be cases somebody would like to reference older version of itself etc. In C# you can do the same, and mostly it causes the same issues.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 8 guests

cron

User Control Panel

Login

Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 5 minutes)
Most users ever online was 787 on May 12th, 2024, 11:50 am

Users browsing this forum: No registered users and 8 guests