Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
39159c89
Commit
39159c89
authored
Dec 14, 2017
by
Bo Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept DatetimeInterface in fromDatetime
parent
1a549d9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
message.c
php/ext/google/protobuf/message.c
+6
-11
protobuf.c
php/ext/google/protobuf/protobuf.c
+8
-1
No files found.
php/ext/google/protobuf/message.c
View file @
39159c89
...
...
@@ -1123,21 +1123,16 @@ PHP_METHOD(Timestamp, fromDateTime) {
zval
*
datetime
;
zval
member
;
if
(
zend_parse_parameters
(
ZEND_NUM_ARGS
()
TSRMLS_CC
,
"z"
,
&
datetime
)
==
FAILURE
)
{
return
;
}
zend_class_entry
*
ce
=
Z_OBJCE_P
(
datetime
);
PHP_PROTO_CE_DECLARE
datetime_ce
;
if
(
php_proto_zend_lookup_class
(
"
\\
Datetime"
,
9
,
&
datetime_ce
)
==
FAILURE
)
{
PHP_PROTO_CE_DECLARE
date_interface_ce
;
if
(
php_proto_zend_lookup_class
(
"
\\
DatetimeInterface"
,
18
,
&
date_interface_ce
)
==
FAILURE
)
{
zend_error
(
E_ERROR
,
"Make sure date extension is enabled."
);
return
;
}
if
(
!
instanceof_function
(
PHP_PROTO_CE_UNREF
(
datetime_ce
),
ce
TSRMLS_CC
))
{
zend_error
(
E_USER_ERROR
,
"Expect Datetime."
);
if
(
zend_parse_parameters
(
ZEND_NUM_ARGS
()
TSRMLS_CC
,
"O"
,
&
datetime
,
date_interface_ce
)
==
FAILURE
)
{
zend_error
(
E_USER_ERROR
,
"Expect DatetimeInterface."
);
return
;
}
...
...
php/ext/google/protobuf/protobuf.c
View file @
39159c89
...
...
@@ -182,8 +182,15 @@ zend_function_entry protobuf_functions[] = {
ZEND_FE_END
};
static
const
zend_module_dep
protobuf_deps
[]
=
{
ZEND_MOD_OPTIONAL
(
"date"
)
ZEND_MOD_END
};
zend_module_entry
protobuf_module_entry
=
{
STANDARD_MODULE_HEADER
,
STANDARD_MODULE_HEADER_EX
,
NULL
,
protobuf_deps
,
PHP_PROTOBUF_EXTNAME
,
// extension name
protobuf_functions
,
// function list
PHP_MINIT
(
protobuf
),
// process startup
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment