diff --git a/Lib/php/std_string.i b/Lib/php/std_string.i index 656765194..f6b036bd8 100644 --- a/Lib/php/std_string.i +++ b/Lib/php/std_string.i @@ -71,8 +71,7 @@ namespace std { %typemap(directorout) string & (std::string *temp) %{ convert_to_string_ex($input); - temp = new std::string; - temp->assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); + temp = new std::string(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); swig_acquire_ownership(temp); $result = temp; %}