Skip to content

Deprecated: PHP 8.2: Dynamic property when WSDL element names contain invalid PHP identifiers (e.g. dots) #329

@Smileybob72801

Description

@Smileybob72801

Describe the bug
When generating classes from a WSDL that contains element names with invalid PHP identifiers (e.g. SomethingAuthorization.SomethingAuthorization), the generated PHP classes do not declare corresponding properties.

At runtime, when SoapClient->__soapCall() hydrates the response, PHP creates a dynamic property with the raw name.

On PHP 8.2, this triggers deprecation warnings like:

WARNING: Creation of dynamic property Example\ArrayType\ArrayOfSomething_SomethingAuthorization:$SomethingAuthorization.SomethingAuthorization is deprecated in ...\Example.php on line...

To Reproduce

  1. Generate classes from a WSDL that has element names containing a dot (.).
  2. Call the relevant SOAP operation that returns this element.
  3. Observe that the object ends up with a dynamic property and PHP emits a deprecation warning.

Expected behavior

  • The generator should normalize invalid PHP identifiers into valid property names (e.g. replace . with _).
  • The generated class should declare the property explicitly so hydration does not fall back to dynamic properties.

Ideas for fix

  • During generation, normalize all invalid identifiers in property names (e.g. ._).
  • Ensure the corresponding declared property is created in the generated class.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions