I'm not sure about this but every time I have a syntax error in my module, I just got a blank page. for example, having code such this:-

$lists = array('name' => 'kkkk', 'address' = 'jb');

in my module code would result in blank page. To confirm this, I put this code in seperate php file, I would got an error:-

Parse error: parse error, unexpected '=', expecting ')' in /home/kamal/public_html/drupal/clinic/test.php on line 3

and yes, php.ini settings is set to E_ALL, display_errors = On.

someone got any idea ? It's really tiring to fix an error that you don't even know. thanks in advance.

Comments

pobster’s picture

I suspect that your problem isn't with that line but the one before it. PHP ignores line breaks in code and so if the last line wasn't ended properly then it'll look to the next line for the rest of the code.

Why not post your code here and I'll take a look at it?

One thing though... Why wouldn't that "$list = array..." end with a blank page? You have to tell code to provide an output with a print/ echo/ return/ etc... command? Simply assigning an array would never result in any screen output? I'm sure you must know this else you wouldn't be programming in PHP in the first place ;o) But this is more just to point out that without the rest of your code no-one can really help you with what you've written above!

More info needed!

Pobster
PS. BTW I bet your logs show the PHP errors? There's a setting in errrr... 'settings' which specifies whether you output errors to the screen or to the watchdog, I bet yours is set to either the watchdog or not set at all...?

k4ml’s picture

here's the code:-

function bug_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      // This description is shown in the listing at admin/modules.
      return t('An example module showing how to define a page to be displayed to the user at a given URL.');
    case 'foo':
      // Here is some help text for a custom page.
      return t('This sentence contains all the letters in the English alphabet.');
  }
}

function bug_menu($may_cache) {
  $items = array();
  if (!$may_cache) {
    $items[] = array(
      'path' => 'bug',
      'callback' = 'bug_page', //note the missing >
      'type' => MENU_CALLBACK,
      'access' => True,
    );
  }
  return $items;
}

function bug_page() {
  print 'hello world';
}

I saved this as bug.module and it will print out the 'hello world' if '>' is not missing in the array. otherwise, I would just get the blank page.

the settings was set to - 'Write the error to logs and screen', which I guess a default. I don't change anything here since I don't even know about it so thanks anyway for mentioning ;)

and there's no error on the watchdog log.

thanks for replying.

Heine’s picture

$lists = array('name' => 'kkkk', 'address' = 'jb');

This parse error, should be logged in the webservers log (error.log).

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

k4ml’s picture

ok I got it. when I checked back my index.php, there's two line error_reporting function that I added sometime ago:-

ini_set('display_errors', 'On');
error_reporting('E_ALL');

php doesn't seem to like this, causing it to fail silently when there is a parse error. And I've just notice that calling that function when display_errors = Off in php.ini doesn't have any effect.

thanks everyone and sorry for the mess.