I bought this extension for Joomla called JomDirectory and I'm very happy with it. It works fine in Joomla, and it does what I was expecting it to do. The problem comes when I wanted to start personalising more my website than what I can do with Joomla Backend access. I want to work and develop locally, I already have downloaded Eclipse and my full site and configured pretty much everything (I hope). The whole site is accessible through localhost with any problem except the JomDirectory page. It appears completely blank and I can't see any error or message. When I try to inspect the source code it's also completely empty, without even the opening <html> tag. There's nothing.
Any clue what can this be?
I've been searching a bit more... What I found now is where the program stops: This is the file .../legacy.php. The line 211 is the one starting with $result. Never gets back, so never executes the echo $result and that's why I get a blank page, not a PHP error.
public function display($tpl = null)
{
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception)
{
return $result;
}
echo $result;
}
Related
im developing my PHP framework and at the moment im stuck with a strange behaviour in my error-dispatching page.
The page itself is beautiful, it catches and lists all error using a custom error-handler registered with "set_error_handler()" and can print the line, file, invoked variables and such. It even triggers multiple errors perfectly (except for fatal or syntax-errors which causes the script to hold) but still the dispatches the fatal or even syntax error in this case and even shows me, even when its a null-pointer in a template where the error is located which is beautiful and works awesome.
This system works "using set_error_handler"! The entire output (rendering html /php templates) is realised using "ob_start" and "ob_get_clean" - outputbuffer context.
Next I check if the error-handler catched any errors (will be written in an array in the error-handler's class) and if there are errors and error-display is enabled (developer mode = on) the error-dispatcher page will be displayed instead of the page's content.
However since I implemented that I have one strange behaviour which I do not want:
Whenever I use die() inside of outputbuffer context ((ob_start() ... ob_get_clean()) ) The registered error-handler method is called with an empty error-list displayed and even error_get_last() is empty, but still he triggers that damn function.
This is very disturbing as you cant use die to hold the script to test the output of certain variables which is disturbing in development and seems to be an unusual behaviour to me.
I think posting my entire code is making the thing a little bit too complicated for you to understand thatswhy I leave a little draft explaining the situation, its basically same as it looks in my classes:
//index.php
$errorList = array();
function myErrorHandler($errorType, $errorString, $errorFile, $errorLine, array $errorContext) {
global $errorList;
$errorList[] = $errorString;
}
set_error_handler("myErrorHandler");
//Here my classses and entire rest of framework is loaded...()
//Initialise output
$output = "";
//This method parses templates, it remotely close works like that...
function includeTemplate($templatePath) {
global $output;
ob_start("myErrorHandler");
include($templatePath);
$output .= ob_get_clean(); //Attach to output
}
//This method is called at the very end, it flushes the output, wether by displaying error-dispatcher or page content to be shown.
function flush() {
global $output;
if(count($errorList) > 0) {
echo implode("<br />", $errorList);
} else {
echo $output;
}
}
//Template file: registerTemplate.php
<div class="container">
<Some template output here, doesnt matter if an error occured...>
<?php die($var); ?> //<- Error rised -> Entering "myErrorHandler()" -> but why????
</div>
-> This die() above would rise an error because registerTemplate.php was somewhen parsed using includeTemplate("reigsterTemplate"); which is as located within an ob_start() context. It does not matter if an error occured before or not or even if I just place die("!"); without any invoked variable, it will riase an error.
If I put the die() before or after the include_template context, in upper scope it works as usual and the error_handler does not trigger, as it should work.
Can anyone tell me why this is happening? Thanks alot!
(Important: again this code is not realistic I know its just a draft from how the things look like very barely, dont bother with that giving me hints that this is a bad way to do things. The entire thing is perfectly object oriented and very well structured. I just made this little draft to make you guys understand in what order the methods are called and how my problem comes up because posting my code would waste me and you alot of time as it would be too huge and complex here).
I'm trying to get a page from github to be read and executed with PHP upon page load due to it updating often, although while I've managed to format the page to what should be correct, it still doesn't seem to work.
Basically, I've used the file_get_contents to grab all of the information on the page (if I get this working it should potentially work with any page), removed all comments, and now I just need the code to run.
I've heard eval is unsafe, but it's only a personal website and I trust the github page isn't going to use malicious code, but I'm getting a "syntax error, unexpected T_CONSTANT_ENCAPSED_STRING", when the page runs, despite the fact I haven't touched the code and it runs fine if copied and pasted.
Here is the code I've used to remove the comments, I can't see any problem on or around line 391 where it says the error is, http://www.compileonline.com/execute_php_online.php works if you copy and paste it in
#get page data, remove intro comment (unefficient but can be rewritten once working)
$browsercoderaw = explode("*/",file_get_contents("https://raw.githubusercontent.com/cbschuld/Browser.php/master/lib/Browser.php"));
for($i==1;$i<count($browsercoderaw);$i++){
if($i>1){$browsercodejoined.=" */";} # replace */ for other comments so they can be removed later
$browsercodejoined.=$browsercoderaw[$i];}
$browsercode = nl2br(str_replace("?>","",$browsercodejoined));
#remove all /* comments
$commentremove = explode("/*",$browsercode);
$browsercode2 = $commentremove[0];
for($j==1;$j<count($commentremove);$j++){
$commentsplit = explode("*/",$commentremove[$j]);
$browsercode2.=$commentsplit[1];
}
#remove all // comments
$commentremove2 = explode("<br />",$browsercode2);
$browsercode3 = $commentremove2[0];
$linenum = 0;
for($k==1;$k<count($commentremove2);$k++){
$commentsplit = explode("//",$commentremove2[$k]);
if(strlen(trim($commentsplit[0]))>0){
$browsercode3.=$commentsplit[0];
$browsercodereadable.=$linenum.". ".$commentsplit[0]."<br>";
$linenum++;
}
}
echo $browsercodereadable;
eval($browsercode3);
?>
Also, if there is a better way of doing this please say so, I tried include but the webhost doesn't allow fetching urls from other domains. To be fair, I'm not entirely sure if it's the correct use of eval, but it sounds like it should potentially work.
I'm having a pretty serious issue since yesterday when I chmoded my main Apache folder (the one with my scripts etc), I think I've certainly done something wrong because some of my PHP pages won't show up and give me a blank page instead of their content, however the other ones still work.
I've checked my Apache logs and I get a "HTTP/1.1 500 273" error on all the files that show a blank page, as I get a standard "HTTP/1.1 200 2876" on all the operational pages.
I don't know what's going on, and I don't even know if it's an Apache2, a PHP, or a simple Chmod-related problem.
EDIT1: I've checked the chmod value of the concerned files to compare them to the ones that work, and they are all the same: 755
EDIT2: In fact there is just one file that is concerned. And the problem is over when I remove this little PHP code that is at its beginning:
<?php
$handle = fopen("./settings.json","r");
$settings = fread($handle, 512);
$jsonsettings = json_decode($settings, true));
fclose($handle);
function alarmonoffcheck () {
if ($jsonsettings['alarmonoff'] == 'on') {
echo("checked");
}
}
?>
I thought there were multiple files that were concerned because this on is used as an include in a main one, and it prevents any other PHP code from being executed, which unables the next includes in the code to work properly.
EDIT3: I've done some debugging and the line that appears to cause the problem is line number 4. I still don't get it, but at least I know where the problem is!
this should fix it:
$jsonsettings = json_decode($settings, true);
Hi Guys I am getting a blank page and also redirect to assigned role page after clicking Add New User --> System --> Permissions --> User --> Add New User.I checked log, report,exception error file, didn't find any error even it enabled. I cannot add new user.Can someone please point me in the right direction, that would be great.
Thanks in advance.
The error has been fixed by changing content of core function getRowUrl in app\code\core\Mage\Adminhtml\Block\Widget\Grid.php
The core function :
public function getRowUrl($item)
{
$res = parent::getRowUrl($item);
return ($res ? $res : '#');
}
Replaced with:
public function getRowUrl($item)
{
return $this->getUrl('*/*/edit', array('id' => $item->getId()));
}
It worked great.
This is a type of question I have asked before and it was shut down for being to vague.
I know how frustrated you feel since it is impossible to find a solution on the net.
My experience has since taught me that if I get a blank page, it probably means my working environment, webserver, IDE etc has just got too heavy.
My advice:
Restart your apache server
check Firefox is not eating too much memory in the Task Manager
Likewise with your IDE.
Also watch out for the resources being used by the JAVA JAR used by your IDE
Turn off XDebug since it has memory leaks.
Setup a cron to restart apache every hour.
Dont forget to clear the cache too!
I created a few mediawiki custom tags, using the guide found here
http://www.mediawiki.org/wiki/Manual:Tag_extensions
I will post my code below, but the problem is after it hits the first custom tag in the page, it calls it, and prints the response, but does not get anything that comes after it in the wikitext. It seems it just stops parsing the page.
Any Ideas?
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'tagregister';
} else { // Otherwise do things the old fashioned way
$wgExtensionFunctions[] = 'tagregister';
}
function tagregister(){
global $wgParser;
$wgParser->setHook('tag1','tag1func');
$wgParser->setHook('tag2','tag2func');
return true;
}
function tag1func($input,$params)
{
return "It called me";
}
function tag2func($input,$params)
{
return "It called me -- 2";
}
Update: #George Mauer -- I have seen that as well, but this does not stop the page from rendering, just the Mediawiki engine from parsing the rest of the wikitext. Its as if hitting the custom function is signaling mediawiki that processing is done. I am in the process of diving into the rabbit hole but was hoping someone else has seen this behavior.
Never used Mediawiki but that sort of problem in my experience is indicative of a PHP error that occurred but was suppressed either with the # operator or because PHP error output to screen is turned off.
I hate to resort to this debugging method but when absolutely and utterly frustrated in PHP I will just start putting echo statements every few lines (always with a marker so I remember to remove them later), to figure out exactly where the error is coming from. Eventually, you'll get to the bottom of the rabbit hole and figure out exactly what the problematic line of code is.
Silly me.
Had to close the tags.
Instead of<tag1> I had to change it to <tag1 /> or <tag1></tag1>
Now all works!