Skip to content

fix(php): call parent constructor only if it exists in parent class#7810

Merged
baywet merged 9 commits into
microsoft:mainfrom
Michal-Pinchasi:fix/php-parent-constructor-bug
Jun 23, 2026
Merged

fix(php): call parent constructor only if it exists in parent class#7810
baywet merged 9 commits into
microsoft:mainfrom
Michal-Pinchasi:fix/php-parent-constructor-bug

Conversation

@Michal-Pinchasi

@Michal-Pinchasi Michal-Pinchasi commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a bug where parent::__construct(); is generated even if the parent class has no constructor, causing runtime crashes in PHP.

Changes

  • Added a check using parentClass.Methods.Any(...) before writing the constructor parent call.

@Michal-Pinchasi
Michal-Pinchasi requested a review from a team as a code owner June 18, 2026 20:16
@WolfgangHG

Copy link
Copy Markdown
Contributor

Resolves #7809

@baywet baywet linked an issue Jun 22, 2026 that may be closed by this pull request

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Michal-Pinchasi
Thanks for the contribution!

Can you also please:

  • add a unit test to prevent future regressions
  • add a changelog entry (fixed, unreleased)

Thanks!

@Michal-Pinchasi

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@Michal-Pinchasi

Copy link
Copy Markdown
Contributor Author

Hi @baywet
I've added the requested unit test and the changelog entry, and updated the PR.
Thanks!

Comment thread CHANGELOG.md
@baywet
baywet enabled auto-merge (squash) June 22, 2026 14:58
baywet
baywet previously approved these changes Jun 22, 2026

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

@baywet

baywet commented Jun 22, 2026

Copy link
Copy Markdown
Member

Hey @Michal-Pinchasi
We seem to have a regression in DoesNotWriteParentConstructorCallWhenParentHasNoConstructorAsync , can you please check?

auto-merge was automatically disabled June 22, 2026 22:20

Head branch was pushed to by a user without write access

@Michal-Pinchasi

Copy link
Copy Markdown
Contributor Author

Hi @baywet

I investigated the regression and found that parentClass in WriteConstructorParentCall actually represents the current class context (the method's parent) rather than the inherited base class.

I updated the logic to correctly inspect parentClass.StartBlock.Inherits?.TypeDefinition for any existing constructors. I also updated the unit test to verify this scenario properly without side effects from the refiner.

Ready for another look! Thanks!

@baywet
baywet enabled auto-merge (squash) June 23, 2026 18:49
GuillaumeBodson pushed a commit to GuillaumeBodson/Filer that referenced this pull request Jul 10, 2026
Updated
[Microsoft.AspNetCore.Components.Authorization](https://github.com/dotnet/dotnet)
from 10.0.8 to 10.0.9.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.Components.Authorization's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated
[Microsoft.AspNetCore.Components.Web](https://github.com/dotnet/dotnet)
from 10.0.8 to 10.0.9.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.Components.Web's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated
[Microsoft.AspNetCore.Components.WebAssembly](https://github.com/dotnet/dotnet)
from 10.0.8 to 10.0.9.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.Components.WebAssembly's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated
[Microsoft.AspNetCore.Mvc.Testing](https://github.com/dotnet/dotnet)
from 10.0.8 to 10.0.9.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.Mvc.Testing's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated [Microsoft.AspNetCore.OpenApi](https://github.com/dotnet/dotnet)
from 10.0.8 to 10.0.9.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.AspNetCore.OpenApi's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest)
from 18.6.0 to 18.7.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.NET.Test.Sdk's
releases](https://github.com/microsoft/vstest/releases)._

## 18.7.0

## What's Changed
* Add ARM64 msdia140.dll support to test platform packages by
@​jamesmcroft in microsoft/vstest#15689
* Update System.Memory from 4.5.5 to 4.6.3 by @​nohwnd in
microsoft/vstest#15706

## New Contributors
* @​jamesmcroft made their first contribution in
microsoft/vstest#15689

**Full Changelog**:
microsoft/vstest@v18.6.0...v18.7.0

Commits viewable in [compare
view](microsoft/vstest@v18.6.0...v18.7.0).
</details>

Updated [microsoft.openapi.kiota](https://github.com/microsoft/kiota)
from 1.32.2 to 1.32.5.

<details>
<summary>Release notes</summary>

_Sourced from [microsoft.openapi.kiota's
releases](https://github.com/microsoft/kiota/releases)._

## 1.32.5

## Added

- Added the `--allowed-external-origins` parameter to commands that load
OpenAPI descriptions. External references are now not loaded by default
to improve security; use this parameter to allow `*`, full URIs, URI
patterns, full paths, relative paths, or path patterns.
- Added support for the `isNonConsequential` confirmation property in
the AI capabilities extension (`x-ai-capabilities`) and mapped it to the
generated plugin manifest confirmation object (plugin manifest 2.4).
[#​7857](microsoft/kiota#7857)
- Added a DOM-surface regression integration test that diffs the kiota
public API export between the published NuGet generator and the current
changeset to catch breaking changes in generated SDKs.
[#​7858](microsoft/kiota#7858)

### Changed

- Rejected unsafe `static_template.file` references in generated plugin
manifests, preventing path traversal outside the manifest package.
- Workspace client and plugin generation now rejects workspace
configuration entries whose `outputPath` is rooted or escapes the
workspace.
- Sanitized client class and namespace names loaded from settings or the
`x-ms-kiota-info` OpenAPI extension before using them in generated code
and file paths.
- Removed support for specifying dependency install commands through the
`x-ms-kiota-info` OpenAPI description extension.


## 1.32.4

## Added

### Changed

- Fixed a code injection vulnerability in PHP generation by escaping `$`
in double-quoted string literals.
[#​7863](microsoft/kiota#7863)


## 1.32.3

## Added

### Changed

- Fixed a generated-source code injection vulnerability (CWE-94) in the
C# emitter where newlines in an OpenAPI `externalDocs.description` could
break out of the `///` doc comment and inject arbitrary code.
[#​7831](microsoft/kiota#7831)
- Fixed a bug that generares an empty model when allOf inheritance
schema is reached via a composed type
[#​7791](microsoft/kiota#7791)
- Fixed a bug in PHP generation where `parent::__construct()` was
generated for parent classes without a constructor
[#​7809](microsoft/kiota#7809)
[#​7810](microsoft/kiota#7810)


Commits viewable in [compare
view](microsoft/kiota@v1.32.2...v1.32.5).
</details>

Updated
[Testcontainers.PostgreSql](https://github.com/testcontainers/testcontainers-dotnet)
from 4.12.0 to 4.13.0.

<details>
<summary>Release notes</summary>

_Sourced from [Testcontainers.PostgreSql's
releases](https://github.com/testcontainers/testcontainers-dotnet/releases)._

## 4.13.0

# What's Changed

Thank you to everyone who contributed and shared their feedback 🤜🤛.

The NuGet packages for this release have been attested for supply chain
security using [`actions/attest`](https://github.com/actions/attest).
This confirms the integrity and provenance of the artifacts and helps
ensure they can be trusted:
[#​33686956](https://github.com/testcontainers/testcontainers-dotnet/attestations/33686956).

## 🚀 Features

* feat: Add Aspire dashboard module (#​1194) @​NikiforovAll
* feat: Add image name substitution hook (#​1710) @​HofmeisterAn
* feat(CosmosDb): Add get method AccountEndpoint (#​1707) @​srollinet
* feat: Improve image build failure messages (#​1700) @​HofmeisterAn

## 🐛 Bug Fixes

* fix: Restore tar archive write performance regressed by padding trim
(#​1719) @​HofmeisterAn
* chore: Bump Docker.DotNet from 4.3.2 to 4.3.3 (#​1714) @​HofmeisterAn
* chore(AspireDashboard): Cover connection string provider (#​1713)
@​HofmeisterAn

## 📖 Documentation

* docs: Add missing TC languages and reorder docs navigation (#​1711)
@​mdelapenya
* docs: Add note about unsupported BuildKit Dockerfile features (#​1696)
@​HofmeisterAn
* docs: Explain immutable builder behavior (#​1693) @​HofmeisterAn

## 🧹 Housekeeping

* chore: Enable Dependabot cooldown (#​1716) @​HofmeisterAn
* chore: Add nuget.config (#​1715) @​Rob-Hague
* chore(AspireDashboard): Cover connection string provider (#​1713)
@​HofmeisterAn
* chore: Bump Docker.DotNet from 4.2.0 to 4.3.2 (#​1712) @​HofmeisterAn
* chore: Bump sshd-docker image from 1.3.0 to 1.4.0 (#​1709)
@​HofmeisterAn
* chore: Rename runtime label and add buildkit and stale labels (#​1703)
@​HofmeisterAn
* fix: Guard expensive argument evaluation when logging (#​1702)
@​HofmeisterAn
* chore: Defer container ID truncation in logging (#​1701)
@​HofmeisterAn
* chore: Migrate to LoggerMessageAttribute (#​1697) @​HofmeisterAn

## 📦 Dependency Updates

* chore(deps): Bump the actions group with 2 updates (#​1721)
@[dependabot[bot]](https://github.com/apps/dependabot)
* chore(deps): Bump the actions group with 7 updates (#​1717)
@[dependabot[bot]](https://github.com/apps/dependabot)
* chore: Bump Docker.DotNet from 4.3.2 to 4.3.3 (#​1714) @​HofmeisterAn
* chore: Bump Docker.DotNet from 4.2.0 to 4.3.2 (#​1712) @​HofmeisterAn
* chore(deps): Bump the actions group with 4 updates (#​1698)
@[dependabot[bot]](https://github.com/apps/dependabot)


Commits viewable in [compare
view](testcontainers/testcontainers-dotnet@4.12.0...4.13.0).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PHP] Error "staticMethod.notFound" for NOTION.COM api

3 participants