--TEST-- GH-15711 (SoapClient can't convert BackedEnum to scalar value) --EXTENSIONS-- soap --INI-- soap.wsdl_cache_enabled=0 --FILE-- ['book' => 'book']]); echo "--- Test with backed enum ---\n"; $book = new stdClass(); $book->base64 = StringBackedEnum::First; $book->string = StringBackedEnum::Second; $book->any = StringBackedEnum::Third; $book->hexbin = StringBackedEnum::Fourth; $book->nmtokens = StringBackedEnum::Fifth; $book->integer = IntBackedEnum::First; $book->short = IntBackedEnum::Second; try { $client->dotest($book); } catch (Throwable) {} echo "--- Test with non-backed enum ---\n"; $book = new stdClass(); $book->base64 = NonBackedEnum::First; $book->string = NonBackedEnum::First; $book->any = NonBackedEnum::First; $book->hexbin = NonBackedEnum::First; $book->nmtokens = NonBackedEnum::First; $book->integer = NonBackedEnum::First; $book->short = NonBackedEnum::First; try { $client->dotest($book); } catch (ValueError $e) { echo "ValueError: ", $e->getMessage(), "\n"; } echo "--- Test with mismatched enum backing type ---\n"; $book->integer = StringBackedEnum::First; $book->short = StringBackedEnum::First; try { $client->dotest($book); } catch (ValueError $e) { echo "ValueError: ", $e->getMessage(), "\n"; } ?> --EXPECT-- --- Test with backed enum --- QmFja2luZ1ZhbHVlMQ==BackingValue2ThirdBackingValue34261636B696E6756616C756534BackingValue512 --- Test with non-backed enum --- ValueError: Non-backed enums have no default serialization --- Test with mismatched enum backing type --- ValueError: String-backed enum cannot be serialized as int