php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42118 PHP prototyping in methods/functions error with string type.
Submitted: 2007-07-27 00:15 UTC Modified: 2007-07-27 04:35 UTC
From: dinesh at dinsoft dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.3 OS: Windows
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dinesh at dinsoft dot net
New email:
PHP Version: OS:

 

 [2007-07-27 00:15 UTC] dinesh at dinsoft dot net
Description:
------------
The error message produced by PHP is a non sense. This should just work.

Reproduce code:
---------------
class DSProxy {
	function stream_open(string $path, string $mode, int $options, string $opened_path) {
		return false;
	}

        ...
}

stream_wrapper_register('proxy', 'DSProxy') or die("ERROR: Could not register the proxy protocol!\n");

$fp = fopen('proxy://www.dinsoft.net', 'r');

Expected result:
----------------
I expect it to work, or at least to produce a meaning full error message.

Actual result:
--------------
PHP Catchable fatal error:  Argument 1 passed to DSProxy::stream_open() must be
an instance of string, string given in E:\dev\flights\proxy.php on line 8

Catchable fatal error: Argument 1 passed to DSProxy::stream_open() must be an in
stance of string, string given in E:\dev\flights\proxy.php on line 8

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-27 00:21 UTC] dinesh at dinsoft dot net
It is actually not restricted to classes and stream_wrapper_register.
 [2007-07-27 04:35 UTC] jani@php.net
You don't have class called "string" set, do you? 
There is no type hinting for "string" type in PHP..
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC