[PEAR-BUG] Req #18605 [Opn->Csd]: Patch DB_DataObject::toArray() to sprintf only as needed

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18605&edit=1

 ID:               18605
 Updated by:       [email protected]
 Reported By:      graylin dot kim at gmail dot com
 Summary:          Patch DB_DataObject::toArray() to sprintf only as
                    needed
-Status:           Open
+Status:           Closed
 Type:             Feature/Change Request
 Package:          DB_DataObject
 Operating System: Windows XP
 Package Version:  SVN
 PHP Version:      5.2.12
-Assigned To:      
+Assigned To:      alan_k
 Roadmap Versions: 
 New Comment:

-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: alan_k
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.

Patch is similar. 

Thanks for spotting this.

http://svn.php.net/viewvc/pear/packages/DB_DataObject/trunk/DataObject.php?
r1=310231&r2=312373&view=patch


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

[2011-06-17 20:24:59] shadesofgraylin

Added #patch
bug:18605;patch:check-formatting-toArray;revision:1308338699;.

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

[2011-06-17 20:23:50] shadesofgraylin

Description:
------------
While, it may be normal usage for DB_DataObject::toArray() to be called
with a format argument, in the instances where it is not (i.e. no
formatting needs to occur) the function runs unnecessarily slow by
calling sprintf('%s') where it has no effect.

I propose changing the $format default to null and checking for the
format prior to any sprintf call to avoid this drag on calls that do not
require formatting.

Locally, I experienced 15+% speed improvement on toArray with no
formatting arguments by patching this change.

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


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18605&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.