Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[VarDumper] Add casters for object-converted resources #59035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

alexandre-daubois
Copy link
Member

@alexandre-daubois alexandre-daubois commented Nov 29, 2024

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? yes
Issues -
License MIT

This PR makes up for the backlog of resources transformed into objects in the latest versions of PHP.

✅ Support added (or already existing with an update in AbstractCloner):

  • ext-curl
    • CurlMultiHandle: no information to gather
  • ext-openssl
    • OpenSSLCertificateSigningRequest
    • OpenSSLAsymmetricKey
  • ext-finfo
    • No information to gather
  • ext-sqlite3
    • Sqlite3Result
  • ext-sockets
  • ext-pgsql
    • PgSql\Lob
    • PgSql\Connection
    • PgSql\Result

⚠️ Remaining classes I couldn't test/find enough info yet (introduced in PHP 8.4):

  • Odbc\Connection
  • Odbc\Result
  • Soap\Url
  • Soap\Sdl

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

tedious topic, thanks for working on it

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 3 times, most recently from ed8fdf2 to d382421 Compare November 29, 2024 12:41
@alexandre-daubois
Copy link
Member Author

Revamped the PR, so most things are still in ResourceCaster now. The regression in PHP has been reported to php/php-src#16990, and most casters now "simply" map infos to $a.

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 3 times, most recently from 9830222 to 8ec4800 Compare November 29, 2024 12:51
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

@internal since 7.3 👍

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 3 times, most recently from 34d936d to d0b95fc Compare November 29, 2024 14:10
@alexandre-daubois
Copy link
Member Author

Marked all casters as internal and added UPGRADE-7.3.md.

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 4 times, most recently from 5cf62d8 to 27a573b Compare November 29, 2024 15:15
@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 2 times, most recently from 4952bc6 to 7ea55ce Compare November 29, 2024 15:39
@alexandre-daubois
Copy link
Member Author

Solved by silencing socket_atmark() in the case it cannot be applied on the given socket.

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 3 times, most recently from ec86ba0 to 9d65675 Compare December 2, 2024 09:25
@alexandre-daubois
Copy link
Member Author

The dba_list() regression fix will be released in PHP 8.4.2:

fabpot added a commit that referenced this pull request Dec 6, 2024
This PR was merged into the 6.4 branch.

Discussion
----------

Add CI job for PHP 8.5

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Enables PHP 8.5 nightlies on the CI.

What motivated this early addition is the continuous effort of converting resources to actual classes. PHP 8.5 already embeds features like https://wiki.php.net/rfc/directory-opaque-object, which could already be handled in PRs such as #59035.

Also we'll be able to fix future deprecations as soon as they appear during the next year.

Commits
-------

15d56bb Add an experimental CI job for PHP 8.5
{
if (\PHP_VERSION_ID < 80402 && !\is_resource($dba)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The fix was shipped with PHP 8.4.2.

@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 2 times, most recently from 392eb5a to ece56db Compare January 7, 2025 11:12
public static function castGd(\GdImage $gd, array $a, Stub $stub, bool $isNested): array
{
$a['size'] = imagesx($gd).'x'.imagesy($gd);
$a['trueColor'] = imageistruecolor($gd);
Copy link
Member

Choose a reason for hiding this comment

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

don't these miss the virtual prefix?

Copy link
Member Author

@alexandre-daubois alexandre-daubois Jan 7, 2025

Choose a reason for hiding this comment

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

Virtual prefixes weren't present before the refactoring, but I'm fine adding them, it makes sense

Copy link
Member

Choose a reason for hiding this comment

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

they weren't present because resource's properties are always virtual
now that we deal with objects, we have to make the virtual explicitly

@carsonbot carsonbot changed the title Add casters for object-converted resources [VarDumper] Add casters for object-converted resources Jan 7, 2025
@alexandre-daubois alexandre-daubois force-pushed the casters-resources branch 2 times, most recently from 48619eb to 8c99b6a Compare January 7, 2025 12:53
@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@nicolas-grekas nicolas-grekas merged commit c98cfb6 into symfony:7.3 Jan 9, 2025
10 of 11 checks passed
@alexandre-daubois alexandre-daubois deleted the casters-resources branch January 9, 2025 16:38
@fabpot fabpot mentioned this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants