1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

131 Commits

Author SHA1 Message Date
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
Tim Düsterhus
fb91931d66 com_dotnet: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
2025-09-24 18:51:40 +02:00
Tim Düsterhus
510fffc464 com_dotnet: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Christoph M. Becker
252b52ac5a Improve COM ctor exception code for failing ProgIDs (GH-17673)
The `$module_name` of `com::__construct()` can be a ProgID, ClassID or
moniker.  We first try `CLSIDFromString()`, and if that fails, we go
ahead and try to treat the `$module_name` as a moniker.  If that also
fails, we throw an exception with the result of `MkParseDisplayName()`
what would just be `MK_E_SYNTAX` if given a ProgID.  This result is
highly confusing for the common case where a ProgID is given, which is
not registered (e.g. due to a typo).  In this case, we use the original
`HRESULT` (`CO_E_CLASSSTRING`) instead.
2025-02-14 17:44:43 +01:00
Christoph M. Becker
26bf239e6d Resolve -Wincompatible-pointer-types warnings (GH-17456)
The phpdbg issue is a real issue, although it's unlikely that harm can
be done due to stack alignment and little-endianess.  The others seem
to be more cosmetic.
2025-01-13 10:54:13 +01:00
Christoph M. Becker
4b2dc58651 Fix format specifiers and arguments in com_dotnet (GH-15398)
This is mostly about minor glitches (signedness or length confusion),
but also fixes two occasions where `zend_string`s still have been
regarded as `char *`.

We also add a regression test case for failing property name lookup,
since that is the most relevant issue we're fixing here.
2024-08-15 10:59:10 +02:00
Arnaud Le Blanc
11accb5cdf Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Niels Dossche
700fbca58d Change getThis() into ZEND_THIS where possible (#13641) 2024-03-08 22:19:06 +01:00
Jorg Adam Sowa
77ee92a50c Remove unnecessary usage of CONST_CS
Closes GH-9685.
2022-11-28 17:12:07 +01:00
George Peter Banyard
f6616846e1 Revert "Refactor php_com_cache_typelib()"
As php_com_typelibraries is a persistent HashTable we need to insert
a persistent string, therefore initialising a new one.

This reverts commit 0497b2bf4b.
2021-11-03 20:44:12 +00:00
George Peter Banyard
0497b2bf4b Refactor php_com_cache_typelib() 2021-11-03 17:58:18 +00:00
George Peter Banyard
da012ba324 Refactor php_com_locate_typeinfo()
Use zend_string pointers
Use bool
2021-09-29 13:17:20 +01:00
George Peter Banyard
bc8703d861 Use standard bool/zend_result instead of int 2021-09-29 13:17:16 +01:00
George Peter Banyard
9409c8f11b Refactor php_com_olestring_to_string()
Return a zend_string* instead of a char* with an out-param for the length
2021-09-29 13:16:26 +01:00
George Peter Banyard
3dc4863f2b Refactor php_com_get_id_of_name()
Use zend_string*
2021-09-29 13:11:51 +01:00
George Peter Banyard
f3ca081379 Refactor php_com_do_invoke()
Use zend_string*
Return zend_result
2021-09-29 13:11:50 +01:00
DmitryMaksimov
bdf53cc91f Dispatch using LANG_NEUTRAL instead of LOCALE_SYSTEM_DEFAULT
This is relevant wrt. case insensitive identifiers.

Closes GH-7391.
2021-08-23 14:07:23 +02:00
KsaR
01b3fc03c3 Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
George Peter Banyard
e55f0c796c Promote warnings to Error in COM extension
Closes GH-6141
2020-09-21 14:32:00 +01: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
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
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
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
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
Máté Kocsis
aadd3aaed9 Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +01:00
Máté Kocsis
76c45f35f5 Use RETURN_THROWS() during ZPP in bz2, calendar, com_dotnet extensions 2019-12-31 00:21:37 +01:00
Nikita Popov
ac4e0f0852 Make zend_type a 2-field struct
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).

Different types of pointer payloads are distinguished based on bits
in the type_mask.
2019-11-08 15:15:48 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Gabriel Caruso
5d6e923d46 Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00