forked from protocolbuffers/protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add json encode/decode for php. (protocolbuffers#3226)
* Add json encode/decode for php. * Fix php conformance test on 32-bit machines. * Fix conformance test for c extension. * Fix comments
- Loading branch information
Showing
36 changed files
with
3,118 additions
and
2,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
define("GOOGLE_INTERNAL_NAMESPACE", "Google\\Protobuf\\Internal\\"); | ||
define("GOOGLE_NAMESPACE", "Google\\Protobuf\\"); | ||
define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\Internal\\"); | ||
|
||
function protobuf_autoloader_impl($class, $prefix) { | ||
$length = strlen($prefix); | ||
if ((substr($class, 0, $length) === $prefix)) { | ||
$path = '../php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php'; | ||
include_once $path; | ||
} | ||
} | ||
|
||
function protobuf_autoloader($class) { | ||
protobuf_autoloader_impl($class, GOOGLE_INTERNAL_NAMESPACE); | ||
protobuf_autoloader_impl($class, GOOGLE_NAMESPACE); | ||
protobuf_autoloader_impl($class, GOOGLE_GPBMETADATA_NAMESPACE); | ||
} | ||
|
||
spl_autoload_register('protobuf_autoloader'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.