Repository navigation
Version 0.36.0
This release removes the intermediate exceptions from encoding and decoding, decodes through a new ElementLookup, and makes the library a lot faster on large payloads.
Behaviour changes
- Optional nillable elements whose property is not set are now left out on encode instead of being sent as
xsi:nil. Set the property tonullto keep sending the nil. (#79) - Custom
ProvidesObjectDecoderLenslenses now receiveSoap\Encoding\Xml\Node\ElementLookupinstead of the lookup array. Read$lookup->element('name')or$lookup->attribute('name', $namespace)where you read$data['name']. (#80) DocumentToLookupArrayReaderis removed. UseElementLookup::fromElement($element). (#80)- Attributes are read by their exact namespace. An attribute sent in another namespace than the WSDL declares decodes to null, and an attribute no longer decodes into a child element property with the same name. (#80)
- Attributes declared through
refare written in their own namespace, for examplexml:langandtns:code. This follows XSD and differs from ext-soap for refs other thanxml:lang. (#80, php-soap/wsdl-reader#66 and #67) - A custom
ProvidesObjectEncoderLensorProvidesObjectDecoderLenslens that throws now fails the encode or decode with anEncodingException, where it used to read as null. Custom object lenses have to handle their own misses, for example with reflecta'soptional()oroptional_property(). (#84) - Encoders can tell the object encoder what null means for a property through the new
Feature\NullValueAwareinterface and theNullValueHandlingenum. (#83) - Typed soap-enc values inside
xsd:anyType, apache Map and SOAP-ENC Struct slots now decode by theirxsi:typeto the object, array or scalar they describe. Nil Map values and Struct members decode tonullinstead of"". (#76)
Speed
Measured on 3MB payloads against 0.35.0, with the same machine, the same benchmarks and byte-identical output:
| workload | 0.35.0 | 0.36.0 | change |
|---|---|---|---|
| decode sparse (stdClass) | 7.152 s | 0.379 s | -94.7% |
| decode sparse (classmap) | 4.655 s | 0.797 s | -82.9% |
| decode dense (stdClass) | 0.833 s | 0.189 s | -77.3% |
| decode dense (classmap) | 0.517 s | 0.252 s | -51.4% |
| encode sparse (stdClass) | 2.920 s | 0.770 s | -73.6% |
| encode sparse (classmap) | 2.895 s | 0.909 s | -68.6% |
| encode dense (stdClass) | 0.935 s | 0.517 s | -44.7% |
| encode dense (classmap) | 0.920 s | 0.526 s | -42.8% |
The smaller phpbench payloads gain 25% to 75%. (#73, #74, #75, #78, #81, #82, #83, #84, #85, #86)
Dependencies
- veewee/reflecta
^1.2 - veewee/xml
^4.14 - php-soap/wsdl-reader
~0.34
Other
examples/calc-xsd-encoder.phpruns again on the new Dom API. (#87)
Thanks
@ITernovtsii found why a 3MB response took 6 seconds to decode: an exception was thrown and caught for every absent element and every stdClass property. Their #70 showed the problem and the fix, and it started the throwless work in #73 to #75 and most of the speed gains in this release.
@NickSdot found that absent optional properties were sent as xsi:nil (#71) and that attributes and child elements with the same name got mixed up on decode (#72). Both fixes are in this release as #79 and #80, built on top of the throwless lenses, and they confirmed both against their own test suite.
What's Changed
- Measure intermediate throws and record a baseline by @veewee in #73
- Update symfony/var-dumper requirement from ^7.0 || ^6.4 to ^7.0 || ^6.4 || ^8.0 by @dependabot[bot] in #66
- Update guzzlehttp/guzzle requirement from ^7.8 to ^7.8 || ^8.0 by @dependabot[bot] in #68
- Remove intermediate throws from lens reads and untyped scalar decode by @veewee in #74
- Remove the last intermediate throws and guard against new ones by @veewee in #75
- Decode typed soap-enc values inside anyType, Map and Struct slots by @veewee in #76
- Hoist per property type meta out of the object loops by @veewee in #78
- Leave out absent optional nillable elements on encode by @veewee in #79
- Decode through ElementLookup so attributes and child elements stay apart by @veewee in #80
- Skip the encoder for null optional elements that write nothing by @veewee in #83
- Cheaper xsi:nil checks and value reads on decode by @veewee in #85
- Read built in decoder properties from ElementLookup directly by @veewee in #84
- Land the ElementLookup and null handling stack on main by @veewee in #89
- Resolve the xsi:type cache key without building the detected type by @veewee in #82
- Write each element with a plain XMLWriter by @veewee in #86
- Fix the calc XSD encoder example on the new Dom API by @veewee in #87
- Skip xsi:type detection for elements without attributes by @veewee in #81
New Contributors
- @dependabot[bot] made their first contribution in #66
Full Changelog: 0.35.0...0.36.0