Commit graph

83 commits

Author SHA1 Message Date
Christoph M. Becker
a08a2b48b4 Strip trailing line breaks and periods from Windows error messages
PHP error messages should not contain line breaks, so we remove these
from the Windows specific error messages.  We also remove trailing
periods for the same reason.

Closes GH-6423.
2020-11-12 16:42:28 +01:00
Christoph M. Becker
2da00fadc8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #62474: com_event_sink crashes on certain arguments
2020-10-26 11:55:29 +01:00
Christoph M. Becker
f9ba2ca136 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62474: com_event_sink crashes on certain arguments
2020-10-26 11:54:45 +01:00
Christoph M. Becker
7424bfc7ac Fix #62474: com_event_sink crashes on certain arguments
We have to make sure that the variant is of type `VT_DISPATCH` before
we access it as such.

Closes GH-6372.
2020-10-26 11:48:57 +01:00
George Peter Banyard
e55f0c796c Promote warnings to Error in COM extension
Closes GH-6141
2020-09-21 14:32:00 +01:00
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
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
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
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
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
Christoph M. Becker
b0b593504d Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing 'skip' to bug79332.phpt skip message
2020-03-26 23:17:37 +01:00
Christoph M. Becker
cc0c5b9343 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing 'skip' to bug79332.phpt skip message
2020-03-26 23:15:55 +01:00
Lukas Berger
7f9b534e3a Add missing 'skip' to bug79332.phpt skip message
The skip message must start with the word 'skip', otherwise the test will not be skipped.

*Before:*
Running selected tests.
TEST 1/1 [ext/com_dotnet/tests/bug79332.phpt]
========DIFF========
001+ Fatal error: Uncaught Error: Class 'COMPersistHelper' not found in /srv/php/ext/com_dotnet/tests/bug79332.php:2
001- A com_exception has been thrown
002+ Stack trace:
003+ #0 {main}
004+   thrown in /srv/php/ext/com_dotnet/tests/bug79332.php on line 2
========DONE========
FAIL Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt]

*After:*
Running selected tests.
SKIP Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt] reason: com_dotnet extension not available
2020-03-26 23:14:10 +01:00
Christoph M. Becker
b05c7fae33 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79332: php_istreams are never freed
2020-03-02 10:48:14 +01:00
Christoph M. Becker
b9843c9418 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79332: php_istreams are never freed
2020-03-02 10:46:46 +01:00
Christoph M. Becker
2adf1c4d23 Fix #79332: php_istreams are never freed
Releasing the `com_dotnet_istream_wrapper` in `istream_destructor()` is
pointless, since `istream_destructor()` is only called when the
resource is going to be released.  This recursion is not a real issue,
though, since the resource is never exposed to userland, and has at
most refcount 1, so due to well defined unsigned integer underflow, it
never is released twice.  However, returning early in this case causes
a memory leak which needs to be fixed.
2020-03-02 10:45:37 +01:00
Christoph M. Becker
6c7306f45d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79299: com_print_typeinfo prints duplicate variables
2020-02-23 23:35:33 +01:00
Christoph M. Becker
09e7c86779 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79299: com_print_typeinfo prints duplicate variables
2020-02-23 23:34:15 +01:00
Christoph M. Becker
9e6358af36 Fix #79299: com_print_typeinfo prints duplicate variables
`lastid` has to retain its value during the traversal, so we move it to
an outer scope.

Patch contributed by Litiano Moura.
2020-02-23 23:31:36 +01:00
Máté Kocsis
4f89211810
Remove the deprecated reflection export methods
Closes GH-5188
2020-02-19 13:19:37 +01:00
Christoph M. Becker
42e7de1518 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79248: Traversing empty VT_ARRAY throws com_exception
2020-02-08 17:07:49 +01:00
Christoph M. Becker
01eab11cee Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79248: Traversing empty VT_ARRAY throws com_exception
2020-02-08 17:07:02 +01:00
Christoph M. Becker
f649adedfe Fix #79248: Traversing empty VT_ARRAY throws com_exception
If the `VT_ARRAY` is empty, i.e. its upperbound is less than its lower
bound, we must not call `php_com_safearray_get_elem()`, because that
function throws in this case.
2020-02-08 17:05:29 +01:00
Christoph M. Becker
78b71e1e8f Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip test case on x86 where it otherwise fails [ci skip]
2020-02-07 21:11:32 +01:00
Christoph M. Becker
bcfb7b2be9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Skip test case on x86 where it otherwise fails [ci skip]
2020-02-07 21:10:44 +01:00
Christoph M. Becker
674d44ad7c Skip test case on x86 where it otherwise fails [ci skip]
`-2200000000` can't be converted to integer on x86, so the constructor
call would fail.
2020-02-07 21:09:35 +01:00
Christoph M. Becker
4bdc4da1c7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79242: COM error constants don't match com_exception codes
2020-02-07 18:11:41 +01:00
Christoph M. Becker
7f86f9972e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79242: COM error constants don't match com_exception codes
2020-02-07 18:05:10 +01:00
Christoph M. Becker
b9738f5802 Fix #79242: COM error constants don't match com_exception codes
Because a `HRESULT` is a `LONG`[1], no special treatment is required on
x86 platforms to get appropriate values.  On x64 platforms we prefer
positive values, what we could accomplish by casting the `HRESULT`
value to `ULONG` and then to `zend_long`, but since the current
behavior is correct and the performance improvement is negligible, we
defer that to master.

[1] <https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#hresult>
2020-02-07 18:04:14 +01:00
Christoph M. Becker
e1a46de938 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
2020-02-06 15:02:12 +01:00
Christoph M. Becker
0d49cf4ed2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
2020-02-06 15:01:12 +01:00
Christoph M. Becker
5e2ea00b15 Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
Saving under the given `filename` may also work, but since
`::LoadFromFile` uses the `fullpath` we follow suit.
2020-02-06 14:59:55 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Christoph M. Becker
ee6a71ca73 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:51:05 +02:00
Christoph M. Becker
ce035dc4a0 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:49:18 +02:00
Christoph M. Becker
45a7723267 Fix #78694: Appending to a variant array causes segfault
`write_dimension` object handlers have to be able to handle `NULL`
`offset`s; for now we simply throw an exception instead of following
the `NULL` pointer.
2019-10-19 11:47:00 +02:00
Christoph M. Becker
4625fa181f Fix #78650: new COM Crash
As of PHP 7.4.0, the `get_property_ptr_ptr` handler is mandatory; we
implement it to always return `NULL`, which is equivalent to not
setting the handler in former versions.

We add a portable and faster test case than what has been presented in
the bug ticket.
2019-10-09 14:09:02 +02:00
Christoph M. Becker
fb51f2c7ba Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77578: Crash when php unload
2019-03-18 19:26:08 +01:00
Christoph M. Becker
a529826d95 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77578: Crash when php unload
2019-03-18 19:24:56 +01:00
Christoph M. Becker
41bc51ce2d Fix #77578: Crash when php unload
Since we're putting `ITypeLib *`s into the hash, we're getting
`ITypeLib *`s back, not `ITypeLib **`s.
2019-03-18 19:21:38 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Christoph M. Becker
c62e106610 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77621: Already defined constants are not properly reported
2019-02-15 00:39:10 +01:00
Christoph M. Becker
8946ad3000 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77621: Already defined constants are not properly reported
2019-02-15 00:37:39 +01:00