CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [Fixed]: Empty File Paths and Force SSL Option in Resource URLs
Pages: [1]

Author Topic: [Fixed]: Empty File Paths and Force SSL Option in Resource URLs  (Read 1571 times)

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
[Fixed]: Empty File Paths and Force SSL Option in Resource URLs
March 04, 2009, 04:51:57 am
I am hoping that someone who knows the civi code can help me back track an error that I'm working on.
The Situation:

PHP throws a fatal error when ever the Save button is selected on CiviCRM » Administer CiviCRM » Global Settings  » Resource URLs if the Yes radio button is selected for Force Secure URLs (SSL).  This results in an HTML response code of 500 rather than the code 200 civi is looking for.

The error results, not in civiCRM, but in the core Joomla script /administrator/components/com_cpanel/admin.cpanel.php, line 17 which reads:
Quote
require_once( JApplicationHelper::getPath( 'admin_html' ) );

JApplicationHelper::getPath should return the path to a specific file on the site. The function is defined as:
Quote
function getPath( $varname , $user_option = null )

Param: $varname
$varname tells Joomla where you want to look in this component
Note: If no $user_option is specified, $user_option will default to "com_<component name>", "mod_<module name>", or <plugin name> depending on if you are using this method from a component, module, or plugin.

The admin_html parameter is defined as:
Quote
admin_html: returns the path to the component's main admin html file
Scope: Admin Only
root / administrator / components / $user_option / admin.<component name>.html.php


This script does not normally throw an error, as it is run every time the Admin control panel loads in the Joomla backend.

Why it fails:
In order to discover what missing file was causing require_once to fail, I inserted the following debug code into  admin.cpanel.php just before the offending line and re-executed the Save on Resource URLs:
Code: [Select]
<?php // php tag added here to get BB code syntax formatting.  Not present at this point in debug code.
// debug code begins
$problem_file = JApplicationHelper::getPath( 'admin_html' );
$f = fopen("/public/www/htdocs/administrator/debug.txt", "a"); 
if (
$problem_file != NULL) {
  
fwrite($f, $problem_file); 
} else {
  
fwrite($f, "problem_file is null");
}
fclose($f);
// debug code ends

The debug.txt file read: problem_file is null

My Question:
What's the next step up the logic chain?  What is civi calling that is causing this script to load so that I can find out why the value is null?



« Last Edit: March 04, 2009, 06:10:13 am by FatherShawn »
Lead Developer, C3 Design.
Twitter: @FatherShawn

FatherShawn

  • Ask me questions
  • ****
  • Posts: 372
  • Karma: 25
    • C3 Design
  • CiviCRM version: 4.2.11
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: [Fixed]: Empty File Paths and Force SSL Option in Resource URLs
March 04, 2009, 06:12:22 am
I realized that the problem statement is designed to dynamically discover the path name.  But I know the path name!  So I replaced the require_once statement with:
Quote
require_once "PATH TO MY JOOMLA/administrator/components/com_cpanel/admin.cpanel.html.php";

and it worked.  Still don't know why it was null, but it works!

Lead Developer, C3 Design.
Twitter: @FatherShawn

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [Fixed]: Empty File Paths and Force SSL Option in Resource URLs

This forum was archived on 2017-11-26.