Skip to content
Merged
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 Zend/zend_object_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ typedef zend_result (*zend_object_do_operation_t)(uint8_t opcode, zval *result,

struct _zend_object_handlers {
/* offset of real object header (usually zero) */
int offset;
size_t offset;
/* object handlers */
zend_object_free_obj_t free_obj; /* required */
zend_object_dtor_obj_t dtor_obj; /* required */
Expand Down
5 changes: 5 additions & 0 deletions ext/standard/tests/versioning/version_compare.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ foreach ($special_forms as $f1) {
test("1.0$f1", "1.0$f2");
}
}
test("1.2.", "1.2.");
test("1.2..", "1.2..");

print "TESTING OPERATORS\n";
foreach ($special_forms as $f1) {
foreach ($special_forms as $f2) {
Expand Down Expand Up @@ -106,6 +109,8 @@ TESTING COMPARE
1.0pl1 > 1.0rc1
1.0pl1 > 1.0
1.0pl1 = 1.0pl1
1.2. = 1.2.
1.2.. = 1.2..
TESTING OPERATORS
1.0-dev lt 1.0-dev : false
1.0-dev < 1.0-dev : false
Expand Down
10 changes: 9 additions & 1 deletion ext/standard/versioning.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ php_canonicalize_version(const char *version)
}
lp = *p++;
}
*q++ = '\0';

/* Check if the last component is empty (i.e. the last character is a dot)
* and remove it if it is. */
if (*(q - 1) == '.') {
*(q - 1) = '\0';
} else {
*q = '\0';
}

return buf;
}

Expand Down