Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/tests/general_functions/type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ string(6) "double"
string(4) "NULL"
string(7) "boolean"
string(6) "string"
string(12) "unknown type"
string(17) "resource (closed)"
string(8) "resource"
string(6) "object"
bool(true)
Expand Down
15 changes: 3 additions & 12 deletions ext/standard/type.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@ PHP_FUNCTION(gettype)

case IS_OBJECT:
RETVAL_STRING("object");
/*
{
char *result;
int res_len;

res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length;
spprintf(&result, 0, "object of type %s", Z_OBJCE_P(arg)->name);
RETVAL_STRINGL(result, res_len);
efree(result);
}
*/
break;

case IS_RESOURCE:
Expand All @@ -78,8 +67,10 @@ PHP_FUNCTION(gettype)

if (type_name) {
RETVAL_STRING("resource");
break;
} else {
RETVAL_STRING("resource (closed)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of parenthesis introduces more inconsistency and makes it harder to use the output in error messages that already use punctuation. Why not closed resource or unknown resource (== unknown type).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fleshgrinder you can still submit a PR to propose that change :)

}
break;
}

default:
Expand Down