Skip to content

Commit

Permalink
avoid editing managed string, fix version
Browse files Browse the repository at this point in the history
The string buffer pointed to by message_class_name appears to be managed by the php engine, since duplicate strings (e.g. literal class names) are being stored in the same place. Assuming it is much safer to increment the pointer variable itself rather than mess up with the buffer's contents.
Might fix chobie/protoc-gen-php#7
  • Loading branch information
gsnoff committed Oct 31, 2014
1 parent dd38827 commit b358ebd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions extension_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ PHP_METHOD(protocolbuffers_extension_registry, add)
}

if (message_class_name[0] == '\\') {
int x;
for (x = 0; x < message_class_name_len-1; x++) {
message_class_name[x] = message_class_name[x+1];
}
message_class_name[message_class_name_len-1] = '\0';
message_class_name++;
message_class_name_len--;
}

Expand Down
2 changes: 1 addition & 1 deletion php_protocolbuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define PHP_PROTOCOLBUFFERS_H

#define PHP_PROTOCOLBUFFERS_EXTNAME "protocolbuffers"
#define PHP_PROTOCOLBUFFERS_VERSION "0.2.5"
#define PHP_PROTOCOLBUFFERS_VERSION "0.2.6"

#ifdef HAVE_CONFIG_H
#include "config.h"
Expand Down

0 comments on commit b358ebd

Please sign in to comment.