diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 55fafcdbe..692fd2969 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -87,8 +87,7 @@ %{ if ($needNewFlow) { $1 = *(($1_ltype *)$obj_value); - } - else { + } else { if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1&_descriptor"); $1 = *tmp; @@ -99,9 +98,16 @@ %{ /* If exit was via exception, PHP NULL is returned so skip the conversion. */ if (!EG(exception)) { - if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); - $result = *tmp; + if ($needNewFlow) { + swig_object_wrapper *obj = SWIG_Z_FETCH_OBJ_P(result); + tmp = ($&1_ltype) &obj->ptr; + c_result = *tmp; + obj->newobject = 0; + } else { + if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + $result = *tmp; + } } %} @@ -110,8 +116,7 @@ %{ if ($needNewFlow) { $1 = ($1_ltype) $obj_value; - } - else { + } else { if (SWIG_ConvertPtr(&$linput, (void **) &$1, $1_descriptor, 0) < 0) SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } @@ -121,8 +126,7 @@ %{ if ($needNewFlow) { $1 = ($1_ltype) $obj_value; - } - else { + } else { if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } @@ -132,8 +136,7 @@ %{ if ($needNewFlow) { $1 = ($1_ltype) $obj_value; - } - else { + } else { if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } @@ -144,8 +147,7 @@ %{ if ($needNewFlow) { $1 = ($1_ltype) $obj_value; - } - else { + } else { if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor"); } @@ -158,8 +160,7 @@ if ($needNewFlow) { SWIG_Z_FETCH_OBJ_P(&$input)->newobject = 0; $1 = ($lower_param *)SWIG_Z_FETCH_OBJ_P(&$input)->ptr; - } - else { + } else { if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 724849d9c..26eab0e62 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -3520,6 +3520,7 @@ done: char temp[24]; sprintf(temp, "%d", idx); Replaceall(tm, "$argnum", temp); + Replaceall(tm, "$needNewFlow", "1"); /* TODO check this */ if (Getattr(n, "wrap:disown")) {