Skip to content

Call to undefined method Uri\Rfc3986\Uri::withScheme() #19532

@arshidkv12

Description

@arshidkv12

Description

The following code:

$uri1 = new Uri\Rfc3986\Uri("HTTPS://example.com");
 
$uri1 = $uri1->withScheme('http');

echo $uri1->getScheme();

Resulted in this output:

Fatal error: Uncaught Error: Call to undefined method Uri\Rfc3986\Uri::withScheme() in /Users/arshid/Desktop/php85-src/test.php:13
Stack trace:
#0 {main}
  thrown in /Users/arshid/Desktop/php85-src/test.php on line 13

But I expected this output instead:

http

PHP Version

PHP 8.5.0-dev (cli) (built: Aug 20 2025 17:13:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0-dev, Copyright (c), by Zend Technologies

Operating System

Mac

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions