Cool Codes (Syntax Highlighter)
Author Message
This plugin is problematic under PHP 7.x or newer.

This is pretty much a MyBB 1.4/1.6 port of my Syntax Highlighter for MyBB 1.2.
I've also added line numbers to this one.

To resolve speed issues, you may be interested in my preparser cache plugin.

See the following thread for examples of what this looks like: http://mybbhacks.zingaburga.com/showthread.php?tid=33 (note, no code edits required for this version of the plugin)
(This post was last modified: 02-28-2021 08:45 PM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: coolcode-1.26.7z (14.52 KB)
Plugin Version: 1.26
Last Updated: 11-24-2014, 10:39 PM

Downloads: 1,288
MyBB Compatibility: 1.4.x, 1.6.x, 1.8.x
Plugin License: GPLv3
Uploader: ZiNgA BuRgA
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #31
RE: Cool Codes (Syntax Highlighter)
Funny, none of those files changed it seems.  Why would it come up now?
And also, PHP is seriously bizarre.  It typically ignores additional parameters, (possibly for func_get_args), but it doesn't with ob_end_flush

PHP Code:
ob_end_flush(1); //warning
flush(1); //okay
ob_end_clean(1); //warning


Anyway, thanks for reporting - see v1.23 works for you.


My Blog
12-16-2010 10:38 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #32
RE: Cool Codes (Syntax Highlighter)
No errors anymore. However, it seems that it's not parsing it correctly:
http://forums.consoleaddicted.com/Thread-C-C-Snippets

Any idea why? Another thing I've just noticed is that this error shouldn't even happen since I was not viewing the thread above in archive mode. There are not other plugins that make use of ob_end_flush() (at least I've searched all plugins and the only entries were inside the Cool Codes plugin - and I got an error whenever I visited the thread above - no longer though).
12-16-2010 10:29 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #33
RE: Cool Codes (Syntax Highlighter)
That's weird.

When I get home, I'll install a copy of 1.6.1 and see if I can figure it out.

Hmm, it seems that $parser->options has now become public:
http://dev.mybb.com/projects/mybb/reposi...http://dev.mybb.com/projects/mybb/repository/entry/branches/1.6-stable/inc/class_

That'll probably cause an issue for the workaround I made when it was private:

PHP Code:
                if($GLOBALS['mybb']->version_code >= 1500) {
                        $p = (array)$parser;
                        $opts =& $p["\0postParser\0options"];
                } else
                        $opts =& $parser->options;

Maybe change the above to:

PHP Code:
                if($GLOBALS['mybb']->version_code >= 1500 && $GLOBALS['mybb']->version_code <= 1600) {
                        $p = (array)$parser;
                        $opts =& $p["\0postParser\0options"];
                } else
                        $opts =& $parser->options;


My Blog
12-17-2010 09:32 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #34
RE: Cool Codes (Syntax Highlighter)
Yeap that should fix it.

By the way, just in case you may want to look:
http://dev.mybb.com/projects/mybb/reposi...http://dev.mybb.com/projects/mybb/repository/revisions/5179/diff/branches/1.6-stable/inc/class_
http://dev.mybb.com/issues/1148
Actually it doesn't.

Code:
1
2
3
4
5
6
7
8
9
Warning [2] preg_match_all() expects parameter 2 to be string, array given - Line: 515 - File: inc/class_parser.php PHP 5.2.14 (Linux)

/inc/class_parser.php 	515 	preg_match_all
/inc/plugins/coolcode.php 	49 	postParser->parse_badwords
[PHP] 	  	coolcode_start
/inc/class_plugins.php 	101 	call_user_func_array
/inc/class_parser.php 	100 	pluginSystem->run_hooks
/inc/functions_post.php 	570 	postParser->parse_message
/showthread.php 	949 	build_postbit

(This post was last modified: 12-18-2010 04:19 AM by Pirata Nervo.)
12-18-2010 04:15 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #35
RE: Cool Codes (Syntax Highlighter)
Alright, can you try v1.24?
Thanks.

My Blog
12-18-2010 09:10 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #36
RE: Cool Codes (Syntax Highlighter)
Will try it once I manage to get FTP working on my new VPS box.
12-19-2010 01:28 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #37
RE: Cool Codes (Syntax Highlighter)
Works Smile What was the problem?
12-19-2010 03:21 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #38
RE: Cool Codes (Syntax Highlighter)
(12-19-2010 01:28 AM)Pirata Nervo Wrote:  Will try it once I manage to get FTP working on my new VPS box.
You can just use SFTP instead.  FTP just increases the attack vectors on your box...

(12-19-2010 03:21 AM)Pirata Nervo Wrote:  Works Smile What was the problem?
Some bad code I think.  You can do a diff if you're interested.

My Blog
12-19-2010 11:22 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #39
RE: Cool Codes (Syntax Highlighter)
(12-19-2010 11:22 AM)ZiNgA BuRgA Wrote:  
(12-19-2010 01:28 AM)Pirata Nervo Wrote:  Will try it once I manage to get FTP working on my new VPS box.
You can just use SFTP instead.  FTP just increases the attack vectors on your box...

(12-19-2010 03:21 AM)Pirata Nervo Wrote:  Works Smile What was the problem?
Some bad code I think.  You can do a diff if you're interested.

Yeah I had to switch to SFTP, we are using proFTPD and FTP is kinda buggy there. The CEO of the company tried to install pureFTPD with DA but it had many problems during the installation and I agreed to install proFTPD again, so we're using SFTP now, no problems Tongue

How can I download an earlier version to do a diff?
12-19-2010 08:34 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #40
RE: Cool Codes (Syntax Highlighter)
Dunno, I'm lazy and don't keep earlier versions myself.
Just a small bug with calling parse badwords from memory anyway.

My Blog
12-20-2010 08:05 AM
Find all posts by this user Quote this message in a reply


Forum Jump: