Skip to content

Instantly share code, notes, and snippets.

@as-com
Created December 30, 2013 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save as-com/8185872 to your computer and use it in GitHub Desktop.
Save as-com/8185872 to your computer and use it in GitHub Desktop.
Vanilla Forums Htmlawed preg_replace error, with error given by attempted fix
Fatal Error in PHP.preg_replace();
preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
The error occurred on or near: /home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php
378:
379: function hl_spec($t){
380: // final $spec
381: $s = array();
382: $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*)"/sme', 'substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), "$0"), 1, -1)', trim($t)));
383: for($i = count(($t = explode(';', $t))); --$i>=0;){
384: $w = $t[$i];
385: if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;}
386: $y = $n = array();
Backtrace:
/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.phpPHP::Gdn_ErrorHandler();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php:382] PHP::preg_replace();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php:86] PHP::hl_spec();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/class.htmlawed.plugin.php:82] PHP::htmLawed();
[/home/[...]/forums-[...]-com/library/core/class.format.php:1563] HTMLawedPlugin->Format();
[/home/[...]/forums-[...]-com/library/core/class.format.php:1330] Gdn_Format::Wysiwyg();
[/home/[...]/forums-[...]-com/plugins/Signatures/class.signatures.plugin.php:401] Gdn_Format::To();
[/home/[...]/forums-[...]-com/plugins/Signatures/class.signatures.plugin.php:357] SignaturesPlugin->DrawSignature();
[/home/[...]/forums-[...]-com/library/core/class.pluginmanager.php:705] SignaturesPlugin->DiscussionController_AfterDiscussionBody_Handler();
[/home/[...]/forums-[...]-com/library/core/class.pluginmanager.php:638] Gdn_PluginManager->CallEventHandler();
[/home/[...]/forums-[...]-com/library/core/class.pluggable.php:144] Gdn_PluginManager->CallEventHandlers();
[/home/[...]/forums-[...]-com/applications/vanilla/views/discussion/discussion.php:78] Gdn_Pluggable->FireEvent();
[/home/[...]/forums-[...]-com/applications/vanilla/views/discussion/index.php:30] PHP::include();
[/home/[...]/forums-[...]-com/library/core/class.controller.php:767] PHP::include();
[/home/[...]/forums-[...]-com/library/core/class.controller.php:1233] Gdn_Controller->FetchView();
[/home/[...]/forums-[...]-com/library/core/class.pluggable.php:210] Gdn_Controller->xRender();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] Gdn_Pluggable->__call();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Render();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Index();
[/home/[...]/forums-[...]-com/library/core/class.dispatcher.php:350] PHP::call_user_func_array();
[/home/[...]/forums-[...]-com/index.php:46] Gdn_Dispatcher->Dispatch();
Variables in local scope:
[t] 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash)'
[s] array (
)
Need Help?
If you are a user of this website, you can report this message to a website administrator.
If you are an administrator of this website, you can get help at the Vanilla Community Forums.
Additional information for support personnel:
Application: Vanilla
Application Version: 2.1b2
PHP Version: 5.5.3-1ubuntu2.1
Operating System: Linux
Server Software: Apache/2.4.6 (Ubuntu)
Referer: http://forums.[...].com/categories/general
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Request Uri: /discussion/2/test-discussion
Controller: PHP
Method: preg_replace
Fatal Error in PHP.preg_replace_callback();
preg_replace_callback(): Modifier /e cannot be used with replacement callback
The error occurred on or near: /home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php
389: return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", '`"'),
390: array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""),
391: $m[0]), 1, -1);
392: },
393: trim($t)));
394: for($i = count(($t = explode(';', $t))); --$i>=0;){
395: $w = $t[$i];
396: if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;}
397: $y = $n = array();
Backtrace:
/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.phpPHP::Gdn_ErrorHandler();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php:393] PHP::preg_replace_callback();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php:86] PHP::hl_spec();
[/home/[...]/forums-[...]-com/plugins/HtmLawed/class.htmlawed.plugin.php:82] PHP::htmLawed();
[/home/[...]/forums-[...]-com/library/core/class.format.php:1563] HTMLawedPlugin->Format();
[/home/[...]/forums-[...]-com/library/core/class.format.php:1330] Gdn_Format::Wysiwyg();
[/home/[...]/forums-[...]-com/plugins/Signatures/class.signatures.plugin.php:401] Gdn_Format::To();
[/home/[...]/forums-[...]-com/plugins/Signatures/class.signatures.plugin.php:357] SignaturesPlugin->DrawSignature();
[/home/[...]/forums-[...]-com/library/core/class.pluginmanager.php:705] SignaturesPlugin->DiscussionController_AfterDiscussionBody_Handler();
[/home/[...]/forums-[...]-com/library/core/class.pluginmanager.php:638] Gdn_PluginManager->CallEventHandler();
[/home/[...]/forums-[...]-com/library/core/class.pluggable.php:144] Gdn_PluginManager->CallEventHandlers();
[/home/[...]/forums-[...]-com/applications/vanilla/views/discussion/discussion.php:78] Gdn_Pluggable->FireEvent();
[/home/[...]/forums-[...]-com/applications/vanilla/views/discussion/index.php:30] PHP::include();
[/home/[...]/forums-[...]-com/library/core/class.controller.php:767] PHP::include();
[/home/[...]/forums-[...]-com/library/core/class.controller.php:1233] Gdn_Controller->FetchView();
[/home/[...]/forums-[...]-com/library/core/class.pluggable.php:210] Gdn_Controller->xRender();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] Gdn_Pluggable->__call();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Render();
[/home/[...]/forums-[...]-com/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Index();
[/home/[...]/forums-[...]-com/library/core/class.dispatcher.php:350] PHP::call_user_func_array();
[/home/[...]/forums-[...]-com/index.php:46] Gdn_Dispatcher->Dispatch();
Variables in local scope:
[t] 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash)'
[s] array (
)
Need Help?
If you are a user of this website, you can report this message to a website administrator.
If you are an administrator of this website, you can get help at the Vanilla Community Forums.
Additional information for support personnel:
Application: Vanilla
Application Version: 2.1b2
PHP Version: 5.5.3-1ubuntu2.1
Operating System: Linux
Server Software: Apache/2.4.6 (Ubuntu)
Referer: http://forums.[...].com/categories/general
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Request Uri: /discussion/2/test-discussion
Controller: PHP
Method: preg_replace_callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment