Commit graph

603 commits

Author SHA1 Message Date
Niels Dossche
b34b4d54c3 Fix #44383: PHP DateTime not converted to xsd:datetime
Closes GH-12437.
Closes GH-11725.
2023-12-08 17:26:52 +01:00
Niels Dossche
53218b1a32 Mitigate #51561: SoapServer with a extented class and using sessions, lost the setPersistence()
The problem is that in the testcase, the session is started before the
parent class is loaded. This causes an incomplete class in the session
storage. Then in the soap code the check
`Z_OBJCE_P(tmp_soap_p) == service->soap_class.ce` fails because it is
the incomplete class. It is a silent failure.

We cannot fix this easily. But we should let the user know something is
wrong, because it leaves them confused otherwise. So emit an error to
let them know and suggest a fix.

Closes GH-12540.
2023-10-29 12:56:50 +01:00
Viktor Vassilyev
e58af7c160 ext/soap: Add support for clark notation for namespaces in class map
Closes GH-12411.
2023-10-23 23:39:28 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Christoph M. Becker
d758f58672
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:08:50 +02:00
Christoph M. Becker
aba82c74d9
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:08:34 +02:00
Christoph M. Becker
24c297086d
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9720: Null pointer dereference while serializing the response
2022-10-13 16:00:36 +02:00
Christoph M. Becker
e440e37fa8
Fix GH-9720: Null pointer dereference while serializing the response
When traversing the result array, we need to cater to `param_name`
possibly being `NULL`.  Prior to PHP 7.0.0, this was implicitly done
because `param_name` was of type `char*`.

Closes GH-9739.
2022-10-13 15:56:08 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
a05a6c555d
Declare ext/soap constants in stubs (#9124) 2022-07-25 16:40:41 +02:00
Christoph M. Becker
14319c203c
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8578: Error on wrong parameter on SoapHeader constructor
2022-05-19 11:08:27 +02:00
Christoph M. Becker
dd89acaf49
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8578: Error on wrong parameter on SoapHeader constructor
2022-05-19 11:07:29 +02:00
robertnisipeanu
8735ae9d13
Fix GH-8578: Error on wrong parameter on SoapHeader constructor
Closes GH-8579.
2022-05-19 11:03:49 +02:00
Nikita Popov
c5d6f59e96 Use custom object instead of resource for soap server service
The "service" resource is a purely internal structure used by
SoapServer, which userland code cannot interact with. Instead of
storing it as a resource in an object propperty, use a custom
object structure instead.
2021-11-28 18:37:29 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Tim Starling
c96be7b8f2 Use ASCII lower case for misc case folding
Use ASCII case conversion instead of locale-dependent case conversion in
the following places:

* grapheme_stripos() and grapheme_strripos() in the "fast" path
* ldap_get_entries()
* oci_pconnect() for case folding of parameters when constructing a key
  into the connection or session pool
* SoapClient: case folding of function names
* get_meta_tags(): case conversion of property names
* http stream wrapper: header names
* phpinfo(): anchor names
* php_verror(): docref URLs
* rfc1867.c: Content-Type boundary parameter name
* streams.c: stream protocol names

Using locale-dependent case folding for these cases is either
unnecessary or actively incorrect. These functions could have
misbehaved when used with certain locales (e.g. Turkish).

Closes GH-7511.
2021-09-24 09:20:08 +02:00
Nikita Popov
841d0b30eb Slightly clean up cookies handling
Make the property always an array with an empty array default.
Properly separate the array on modification to compensate.
2021-08-20 14:27:24 +02:00
Nikita Popov
50484b59cd Move derefs into accessor macros
These derefs are mostly there to be defensive, but clutter the
code somewhat. Move them directly into the access macros.
2021-08-20 14:15:23 +02:00
Nikita Popov
e6c6abf6b4 Declare remaining SoapClient properties 2021-08-20 12:50:19 +02:00
Nikita Popov
b3b1658492 Remove dead code
This was checking for the headerfault property, but not actually
doing anything with it.
2021-08-20 12:28:58 +02:00
Nikita Popov
aa4898ef2e Use separate property to request digit auth
Currently, _digest is used both to request that digest auth be
used (_digest == null) and to later store the _digest parameters.

This relies on the ability to distinguish between _digest being
null and it being not set, which is not present with declared
properties. (Well, technically it is, we could just leave it
uninitialized, but that would be non-idiomatic.)

Resolve this by splitting into separate _use_digest and _digest
properties.
2021-08-20 10:41:36 +02:00
Nikita Popov
32d663e198 Declare SoapFault properties 2021-08-20 10:08:22 +02:00
Nikita Popov
44befbdc01 Don't convert Error exception to SoapFault
Error exceptions should generally not be converted into domain-
specific exception types. They indicate programming errors that
should not be handled locally.
2021-08-20 10:06:11 +02:00
Nikita Popov
018cb891cf Declare some SoapClient properties
This is only a subset of all properties for now (those without
underscore).
2021-08-19 16:15:41 +02:00
Nikita Popov
e861cb5c31 Simplify some strtolower operations in ext/soap 2021-08-19 16:10:30 +02:00
Nikita Popov
e6d4b3077d Simplify constructor invocation in ext/soap
Use ce->constructor and zend_call_known_instance_method. There
is no need to look up a method with the same name as the class
anymore.
2021-08-19 16:04:43 +02:00
Nikita Popov
7d4f2f5392 Declare SoapHeader properties 2021-08-19 14:27:09 +02:00
Nikita Popov
bdf8b9ed2d Declare SoapServer::$service property 2021-08-19 14:10:21 +02:00
Nikita Popov
c58c926034 Declare SoapVar properties 2021-08-19 12:35:37 +02:00
Nikita Popov
030bb36ed7 Declare SoapParam properties 2021-08-19 11:48:56 +02:00
Nikita Popov
9491694903 Deprecate SoapClient ssl_method option
Instead use ssl stream context options instead. The direct
equivalent would be crypto_method, but min_proto_version /
max_proto_version are recommended instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:36:26 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
George Peter Banyard
e7135cb817
Use zend_string_equals_* API in a couple of more place
Closes GH-6979
2021-05-14 13:45:17 +01:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01: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
a1c6ee2164 Convert error filename to zend_string
Error handling functions/callbacks now accept the error filename
as a zend_string* instead of a const char*.
2021-04-23 11:05:14 +02:00
Nikita Popov
4ce5d2ea88 Add known strings for jit autoglobals
We always create interned strings for all autoglobals anyway, so
we might as well add known strings to make them more widely usable.
2021-04-09 15:37:59 +02:00
George Peter Banyard
84e12626e7 Use zend_string_equals() API instead of strcmp() in SOAP extension 2021-03-17 16:36:16 +00:00
Máté Kocsis
a730dc0cf9
Generate class entries for snmp, soap, sockets, sodium, sqlite3, sysv*, tidy
Closes GH-6696
2021-02-15 11:45:26 +01:00
Nikita Popov
6cef8508b4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't pass null action to __doRequest
2021-02-10 12:04:05 +01:00
Nikita Popov
ce7935e82a Don't pass null action to __doRequest
The parameter is not nullable, so it will be interpreted as
an empty string anyway.

The entire code here is pretty confusing though, and probably
deserves a second loop. The HTTP code only send SOAPAction/action
if soapaction is non-NULL -- but it always is, because it is
accepted through a non-nullable string parameter.

Regarding the SOAPAction header, it appears that always sending
it is actually a requirement of the standard:
> An HTTP client MUST use this header field when issuing a SOAP
> HTTP Request.
Although it does make a distinction between absence of value and
an empty string:
> The header field value of empty string ("") means that the intent
> of the SOAP message is provided by the HTTP Request-URI. No value
> means that there is no indication of the intent of the message.
The empty string interpretation appears to be the desired one.

However, for the action MIME tag the SOAP 1.2 Part 2 specification
says that
> The media type specifies an optional action parameter, which can
> be used to optimize dispatch or routing, among other things.
but also
> The SOAP Action feature defines a single property, which is
> described in Table 14. The value of this property MUST be an
> absolute URI[RFC 3986] and MUST NOT be empty.
which would indicate that we should not be sending an empty
action here.

As I'm not familiar with SOAP and this is long-standing behavior,
I'm just leaving this alone for now...
2021-02-10 12:00:20 +01:00
Nikita Popov
35b2426e21 Merge branch 'PHP-8.0'
* PHP-8.0:
  Clarify that location is required in do_request
  Regenerate arginfo file
2021-02-10 11:19:15 +01:00
Nikita Popov
40ba9f6a1a Clarify that location is required in do_request
As far as I can tell, the location is always non-null here,
and the code wouldn't be able to meaningfully work without a
location.
2021-02-10 11:18:20 +01:00
Nikita Popov
dd64928f38 Merge branch 'PHP-8.0'
* PHP-8.0:
  Accept null $location in SoapClient::__setLocation()
2021-02-10 10:52:28 +01:00
Nikita Popov
788abb8cc8 Accept null $location in SoapClient::__setLocation()
Currently an empty string is used to unset the location. Once
again, it makes more sense to use a null value for this purpose
(though the special behavior of empty strings is retained).

The code comment above the function also explicitly indicates
that null should be accepted, and the function does return null
rather than an empty string for the old location value (if it
is missing).
2021-02-10 10:50:42 +01:00
Nikita Popov
8e7b476d40 Merge branch 'PHP-8.0'
* PHP-8.0:
  Make SoapVar arguments nullable
2021-02-10 10:37:53 +01:00
Nikita Popov
32d128d219 Make SoapVar arguments nullable
$typeName, $typeNamespace, $nodeName and $nodeNamespace all
special-case the empty string and don't set the property entirely
in that case. It makes more sense to use null to indicate absence
here (though of course the empty string behavior is retained).
2021-02-10 10:36:32 +01:00