Speed version of function debug_buffer

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
pb
Forum Members
Forum Members
Posts: 27
Joined: Sun Jun 01, 2008 8:41 pm

Speed version of function debug_buffer

Post by pb »

This function has 80 references in the source (written in misc.functions.php).

Original:

Code: Select all

function debug_buffer($var, $title="")
{
	global $gCms;
	if ($gCms)
	{
		$config =& $gCms->GetConfig();
	
		//debug_to_log($var, $title='');

		if($config["debug"] == true)
		{
			$gCms->errors[] = debug_display($var, $title, false, true);
		}
	}
}
Speed version:

Code: Select all

function debug_buffer($var, $title="")
{
	global $config,$gCms;	
	if($config['debug']==true && $gCms)
		$gCms->errors[] = debug_display($var, $title, false, true);
}
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Speed version of function debug_buffer

Post by calguy1000 »

You can't rely on $config being global  it isn't supposed to be, and that bug could be fixed at any time.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
pb
Forum Members
Forum Members
Posts: 27
Joined: Sun Jun 01, 2008 8:41 pm

Re: Speed version of function debug_buffer

Post by pb »

Wow  !  See your Filemanager

function GetActionIcon($action) {
global $config;

and 19 occurrences in several source files.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Speed version of function debug_buffer

Post by calguy1000 »

Yes, and I've already told that author to fix those.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
pb
Forum Members
Forum Members
Posts: 27
Joined: Sun Jun 01, 2008 8:41 pm

Re: Speed version of function debug_buffer

Post by pb »

Yes, and I've already told that author to fix those.
Ok more than 10 are in the core, greetings to ted.

There is nothing to fix  it works since some years.
Pierre M.

Re: Speed version of function debug_buffer

Post by Pierre M. »

Free code reviews, quality improvements suggestions, open programming policy... I like free software :-)

Pierre M.
pb
Forum Members
Forum Members
Posts: 27
Joined: Sun Jun 01, 2008 8:41 pm

Re: Speed version of function debug_buffer

Post by pb »

From a dev a expected something more as
  it isn't supposed to be
it is no problem to write this - the result is the same:

Code: Select all

 function debug_buffer($var, $title="")
{
	global $gCms;	
	if($gCms  && $gCms->config['debug']== true)
		$gCms->errors[] = debug_display($var, $title, false, true);
}
 
If someone is writing some code this setting is the best to use:

debug_buffer('__FILE__.' '.__LINE__.' '.__FUNCTION__);


and you have the complete file, the line number and the function (if is).
thoms
Forum Members
Forum Members
Posts: 84
Joined: Tue Dec 25, 2007 5:56 pm

Re: Speed version of function debug_buffer

Post by thoms »

I don't quite understand your attitude.
What do you intend posting good ideas, but refuse to put it in the forge? If you are such a good programmer (obviously you have some skills), what's the problem in looking and posting at the svn (a standard for nearly all open source software)?
What's the point of bashing the dev team? To show that you are so much smarter?
Your contribution to CMSms surely would be very welcome - but there are some rules.
If you don't like the rules, why don't you play at another place?

thoms
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Speed version of function debug_buffer

Post by calguy1000 »

We identified this guy as somebody we banned before.  He's had problems with other websites too, like the AdodbLite and smarty forums.  He's just generally anti-social and doesn't play well with others.

I banned him again.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Tips and Tricks”