Commit Graph

483 Commits

Author SHA1 Message Date
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
c98d47696f
Consolidate new union type ZPP macro names
They will now follow the canonical order of types. Older macros are
left intact due to maintaining BC.

Closes GH-6112
2020-09-11 11:00:18 +02:00
Máté Kocsis
f7fbc6333f
Add more precise type info for stubs
Closes GH-6005
2020-09-01 16:35:56 +02:00
Christoph M. Becker
d4d52ba945 Prevent com::__construct() to modify the $server_name array
We switch to `zend_string`s for simplicity, so there's no need to
`convert_to_string()` anymore, what makes the array separation
superfluous.

Closes GH-6040
2020-08-31 17:44:27 +02:00
Christoph M. Becker
f956434df2 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Catch potential exceptions during to string conversion
2020-08-27 10:26:15 +02:00
Christoph M. Becker
296030119c Catch potential exceptions during to string conversion
As of PHP 7.4.0, exceptions are allowed to be thrown from inside
`__toString()` methods; we have to cater to that, and catch these
exceptions early.

Closes GH-6042
2020-08-27 10:23:18 +02:00
Christoph M. Becker
00edc3f4bc Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix com_safearray_proxy related memory management issues
2020-08-26 15:43:43 +02:00
Christoph M. Becker
8e2f219fad Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix com_safearray_proxy related memory management issues
2020-08-26 15:40:57 +02:00
Christoph M. Becker
1b7ee6db88 Fix com_safearray_proxy related memory management issues 2020-08-26 15:39:32 +02:00
Christoph M. Becker
2f9e9d4d97 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Separate COM::__construct()s $server_name array
2020-08-26 15:02:34 +02:00
Christoph M. Becker
b087bd2404 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Separate COM::__construct()s $server_name array
2020-08-26 15:01:22 +02:00
Christoph M. Becker
75ac3f1cba Separate COM::__construct()s $server_name array
This may otherwise be modified.
2020-08-26 15:00:02 +02:00
Christoph M. Becker
fc4a6cda4b Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #64130: COM obj parameters passed by reference are not updated
2020-08-26 14:55:34 +02:00
Christoph M. Becker
1ff981d7a6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64130: COM obj parameters passed by reference are not updated
2020-08-26 14:53:46 +02:00
Christoph M. Becker
5ff15e2651 Fix #64130: COM obj parameters passed by reference are not updated
`ITypeInfo_GetIDsOfNames()` is supposed to fail with `E_NOTIMPL` for
out-of-process servers, thus we should not remove the already available
typeinfo of the object in this case.

We also properly free the `byref_vals`.
2020-08-26 14:50:04 +02:00
Christoph M. Becker
7e5ed818a4 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Avoid double-free
2020-08-25 13:15:06 +02:00
Christoph M. Becker
923a14626c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Avoid double-free
2020-08-25 13:12:41 +02:00
Christoph M. Becker
3324bb893e Avoid double-free
As of commit b2e3fd1[1] the `authid.User` is no longer newly allocated,
so we must not free it.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=b2e3fd1e691b1dc82aaaf4150461db97bd5acf4a>
2020-08-25 13:11:22 +02:00
Christoph M. Becker
e6044d4455 Fix #55847: DOTNET .NET 4.0 GAC new location
If we do not specify the exact version of the .NET framework to use,
the default CLR is loaded, which is typically CLR 2, which is very old.
Therefore, we introduce a `PHP_INI_SYSTEM` setting, which allows users
to choose the desired .NET framework version.  The value of the setting
are the first three parts of the framework's version number, separated
by dots, and prefixed with "v", e.g. "v4.0.30319".  If the value of the
INI setting is `NULL` (the default) or an empty string, the default CLR
is used.

Internally, we switch from the most generic `CoCreateInstance()` to
`CorBindToRuntime()` which is implemented in mscoree.dll.  To avoid the
hard dependency to that library, we load dynamically.

So this fix is supposed to be fully backwards compatible.

Closes GH-5949
2020-08-22 12:42:34 +02:00
Christoph M. Becker
9e930907df Autogenerate function entries for COMPersistHelper
Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2020-08-11 11:42:40 +02:00
Christoph M. Becker
dc5077cc53 Remove practically unused parameter
The `cached` out parameter of `php_com_load_typelib_via_cache()` was
meant to signal whether a particular typelib actually has been cached.
This is not really relevant, though, for the imagined purposes, and
since the parameter is no longer really used, we removed it altohether.
2020-08-11 11:38:43 +02:00
Christoph M. Becker
013dcab344 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #48585: com_load_typelib holds reference, fails on second call
2020-08-11 11:28:41 +02:00
Christoph M. Becker
183b853dc6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #48585: com_load_typelib holds reference, fails on second call
2020-08-11 11:28:07 +02:00
Christoph M. Becker
dc108feab8 Fix #48585: com_load_typelib holds reference, fails on second call
Whether the type library is cached is actually irrelevant here; what
matters is that the symbols are imported, and since these are not
cached, we have to import them for every request.  And we cannot cache
the symbols, because the import depends on the current codepage, but
the codepage is a `PHP_INI_ALL` setting.
2020-08-11 11:26:50 +02:00
Máté Kocsis
046cc5e4c2
Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Nikita Popov
8b77c58130 Accept zend_object* in zend_update_property 2020-08-07 16:40:27 +02:00
Nikita Popov
7991fc2753 Accept zend_object in zend_read_property 2020-08-07 16:40:27 +02:00
Máté Kocsis
0d330e1a02
Add a few missing parameter types in stubs
Related to GH-5627
2020-07-30 14:26:45 +02:00
Máté Kocsis
5770b66722
Cleanup argument handling of Zend functions and methods
Closes GH-5847
2020-07-21 14:47:03 +02:00
Christoph M. Becker
05e9197c51 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #63527: DCOM does not work with Username, Password parameter
2020-07-20 14:45:42 +02:00
Christoph M. Becker
4b96a75ffd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #63527: DCOM does not work with Username, Password parameter
2020-07-20 14:44:18 +02:00
Christoph M. Becker
b2e3fd1e69 Fix #63527: DCOM does not work with Username, Password parameter
We must not mix multibyte and wide character strings in the
`COAUTHIDENTITY` structure.  Using wide character strings throughout
would have the advantage that the remote connection can be established
regardless of the code page of the server, but that would more likely
break BC, so we just drop the wide character string conversion of the
username.
2020-07-20 14:43:29 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
312201dce4 Add get_gc handle for object iterators
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Christoph M. Becker
bf6720d582 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #63208: BSTR to PHP string conversion not binary safe
2020-06-29 19:06:56 +02:00
Christoph M. Becker
4af69b8477 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #63208: BSTR to PHP string conversion not binary safe
2020-06-29 19:06:00 +02:00
Christoph M. Becker
a385cfa7ad Fix #63208: BSTR to PHP string conversion not binary safe
A `BSTR` is similar to a `zend_string`; it stores the length of the
string just before the actual string, and thus the string may contain
NUL bytes.  However, `php_com_olestring_to_string()` is supposed to
deal with arbitrary `OLECHAR*`s which may not be `BSTR`s, so we
introduce `php_com_bstr_to_string()` and use it for the only case where
we actually have to deal with `BSTR`s which may contain NUL bytes.

Contrary to `php_com_olestring_to_string()` we return a `zend_string`,
so we can save the re-allocation when converting to a `zval`.

We also cater to `php_com_string_to_olestring()` not being binary safe,
with basically the same fix we did for `php_com_olestring_to_string()`.
2020-06-29 19:05:02 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Christoph M. Becker
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
Christoph M. Becker
864fb0ec23 Implement #47074: phpinfo() reports "On" as 1 for the some extensions
What is modified as boolean, should also be displayed as boolean.
2020-06-04 11:25:45 +02:00
Tyson Andre
54febdbc7d
Fix other typos in param name/code comments
Closes GH-5502
2020-05-01 12:23:16 +02:00
Alex Dowad
8ddaf13ed3 Code tweaks: Remove unneeded semicolons 2020-04-29 23:17:40 +02:00
Christoph M. Becker
bd7a52c9b2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Move test to its folder
2020-04-16 11:57:54 +02:00
Gabriel Caruso
e88e9afe95 Move test to its folder 2020-04-16 11:56:21 +02:00
George Peter Banyard
af63050071 Remove XFAIL section of a passing COM test
Closes GH-5297
2020-04-14 17:31:06 +02:00
Máté Kocsis
3fe49d81f8
Generate method entries from stubs for a couple of extensions
Closes GH-5368
2020-04-11 13:28:53 +02:00
Christoph M. Becker
175e5ed4bf Fix typo (UNKOWN -> UNKNOWN) 2020-04-09 14:06:11 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Christoph M. Becker
9cb32640af Clean up constructor handling in com_dotnet
We substitute the construction magic with standard constructors, move
the ZPP checks to the beginning of the ctors, and also let the function
entries be generated from the stubs.
2020-04-06 10:53:45 +02:00