FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17204&edit=1

ID: 17204
Comment by: augusto@phpsp.org.br
Reported By: f dot napoleoni at gmail dot com
Summary: Benchmark_Iterate::run trigger an error of type
E_NOTICE
Status: Open
Type: Feature/Change Request
Package: Benchmark
Operating System: Mac OS X 10.6.2
Package Version: 1.2.7
PHP Version: 5.2.6
Roadmap Versions:
New Comment:

I made a patch with the changes "loige" commented. I belive there won't
be any problems with this changes.

There is also some strict errors when calling non-static methods, but
there is not much to be done with it without adding a lot of useless
coding. So, let it be (I think).


Previous Comments:
------------------------------------------------------------------------

[2010-03-26 11:10:52] loige

I forgot to say that happens to me on Windows with php 5.3.0

------------------------------------------------------------------------

[2010-03-26 11:02:36] loige

I got this problem to.
I think the problem is in the two following lines of the Iterate
class:

99: if (strstr($function_name, '::')) {

104: if (strstr($function_name, '->')) {

the function strstr needs A STRING as parameter, so if an array is
passed it throws the E_NOTICE warning.

Also if we pass a string containing "::", the line

100: $function_name = explode('::', $function_name);

will convert the variable $function_name to an array and the problem
arise again at line 104.

I think this should be fixed with a check like the following:

99: if (is_string($function_name) && strstr($function_name,
'::')) {

104: if (is_string($function_name) && strstr($function_name,
'->')) {

Let me now if someone could provide a fix to this

------------------------------------------------------------------------

[2010-03-08 19:29:35] fnapoleoni

Description:
------------
The interface used in Benchmark_Iterate::run is unclear and trigger an

error of type E_NOTICE.

Should be changed to accept a callback instead of current
implementation.

The change is pretty simple, I could make the change if the package is

unmantained.

Test script:
---------------
require_once 'Benchmark/Iterate.php';

class A {
public function run() {
}
}

$r = new Benchmark_Iterate();
$r->run(2, 'A::run', 1);
echo $r->getOutput();


Expected result:
----------------
The above code should not trigger the error:

Notice: Array to string conversion in Benchmark/Iterate.php on line
104


Actual result:
--------------
The code above trigger the error

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMay 5, '10 at 8:51p
activeMay 5, '10 at 8:51p
posts1
users1
websitepear.php.net

1 user in discussion

Augusto: 1 post

People

Translate

site design / logo © 2022 Grokbase