PHP: fix for the import_nomodule testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3df5063521
commit
9444f2cebe
2 changed files with 29 additions and 3 deletions
20
Examples/test-suite/php/import_nomodule_runme.php
Normal file
20
Examples/test-suite/php/import_nomodule_runme.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require "tests.php";
|
||||
require "import_nomodule.php";
|
||||
|
||||
// No new functions
|
||||
check::functions(array(create_foo,delete_foo,test1));
|
||||
// No new classes
|
||||
check::classes(array(import_nomodule,Bar));
|
||||
// now new vars
|
||||
check::globals(array());
|
||||
|
||||
$f = import_nomodule::create_Foo();
|
||||
import_nomodule::test1($f,42);
|
||||
import_nomodule::delete_Foo($f);
|
||||
|
||||
$b = new Bar();
|
||||
import_nomodule::test1($b,37);
|
||||
|
||||
check::done();
|
||||
?>
|
||||
|
|
@ -1627,8 +1627,14 @@ public:
|
|||
*/
|
||||
Printf(output, "\t\tif (is_resource($r)) {\n");
|
||||
Printf(output, "\t\t\t$class='%s'.substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n", prefix);
|
||||
Printf(output, "\t\t\treturn new $class($r);\n\t\t}\n");
|
||||
Printf(output, "\t\telse return $r;\n");
|
||||
if (Getattr(classLookup(Getattr(n, "type")), "module")) {
|
||||
Printf(output, "\t\t\treturn new $class($r);\n");
|
||||
} else {
|
||||
Printf(output, "\t\t\t$c = new stdClass();\n");
|
||||
Printf(output, "\t\t\t$c->_cPtr = $r;\n");
|
||||
Printf(output, "\t\t\treturn $c;\n");
|
||||
}
|
||||
Printf(output, "\t\t}\n\t\telse return $r;\n");
|
||||
} else {
|
||||
Printf(output, "\t\t$this->%s = $r;\n", SWIG_PTR);
|
||||
Printf(output, "\t\treturn $this;\n");
|
||||
|
|
@ -1928,7 +1934,7 @@ public:
|
|||
|
||||
Printf(s_phpclasses, "class %s%s ", prefix, shadow_classname);
|
||||
String *baseclass = NULL;
|
||||
if (base.item) {
|
||||
if (base.item && Getattr(base.item, "module")) {
|
||||
baseclass = Getattr(base.item, "sym:name");
|
||||
if (!baseclass)
|
||||
baseclass = Getattr(base.item, "name");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue