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

ID: 17204
Updated by: daniel.oconnor@gmail.com
Reported By: f dot napoleoni at gmail dot com
Summary: Benchmark_Iterate::run trigger an error of type
E_NOTICE
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Benchmark
Operating System: Mac OS X 10.6.2
Package Version: 1.2.7
PHP Version: 5.2.6
-Assigned To:
+Assigned To: doconnor
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: doconnor
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.




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

[2010-05-05 21:45:14] augusto_hp

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).

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

[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
postedDec 10, '11 at 3:34a
activeDec 10, '11 at 3:34a
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2022 Grokbase