php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81297 Improve __toString() return for internal deprecated functions
Submitted: 2021-07-26 07:49 UTC Modified: 2021-08-09 12:08 UTC
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: herobrine135111 at gmail dot com Assigned:
Status: Open Package: Reflection related
PHP Version: 8.0.8 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: herobrine135111 at gmail dot com
New email:
PHP Version: OS:

 

 [2021-07-26 07:49 UTC] herobrine135111 at gmail dot com
Description:
------------
ReflectionFunction and ReflectionMethod __toString() method for internal deprecated functions returns strange looking <internal, deprecated:libxml> instead of <internal:libxml, deprecated>

Test script:
---------------
<?php
// libxml_disable_entity_loader is deprecated in PHP 8
echo (new ReflectionFunction('libxml_disable_entity_loader'));

Expected result:
----------------
Function [ <internal:libxml, deprecated> function libxml_disable_entity_loader ] {

  - Parameters [1] {
    Parameter #0 [ <optional> bool $disable = true ]
  }
  - Return [ bool ]
}

Actual result:
--------------
Function [ <internal, deprecated:libxml> function libxml_disable_entity_loader ] {

  - Parameters [1] {
    Parameter #0 [ <optional> bool $disable = true ]
  }
  - Return [ bool ]
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-26 23:09 UTC] a at b dot c dot de
"internal" and "deprecated" are flags describing the status of the function, and "libxml" is name of the containing extension.

This isn't new with 8.0; 7.4 described is_real() the same way: "<internal, deprecated:standard>".

So while the punctuation might be better (an additional space after the colon, say), the words are in the right order.
 [2021-08-09 12:08 UTC] cmb@php.net
-Summary: Incorrect __toString() return for internal deprecated functions +Summary: Improve __toString() return for internal deprecated functions -Type: Bug +Type: Feature/Change Request
 [2021-08-09 12:08 UTC] cmb@php.net
> So while the punctuation might be better (an additional space
> after the colon, say), the words are in the right order.

Right.  Would be trivial to fix[1], but I don't see it as a bug.

[1] <https://github.com/php/php-src/blob/php-7.4.22/ext/reflection/php_reflection.c#L742>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC