Results 1 to 3 of 3

Thread: $sugar_config variable keeps disappearing in SOAP setup

  1. #1
    hanmari is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    11

    Cool $sugar_config variable keeps disappearing in SOAP setup

    Hello,

    I've been trying to get SOAP calls to work in the latest version (community 5.0), and have run into a few difficulties. Most recently I spent several hours tracing my $sugar_config variable through all of the pages that are required from inside the soap.php file to figure out why my SOAP calls kept losing the information on how to login to my remote mySQL database. All of this information is stored in the config.php file as a variable called $sugar_config, and is referenced by a require in the entryPoint.php page.

    The first problem I ran into is that the DBManagerFactory.php page, which is required further along in the entryPoint.php page, is calling the following line outside of its class declaration:

    global $sugar_config;

    This line is fine when calling from inside a function, but since it is outside of a function, it is wiping out the $sugar_config variable that already exists within the same scope. Is there any reason why this line should stay put? I've commented it out and now my variable can keep going until it runs into the following line in the entryPoint.php page:

    $db = & DBManager :: getInstance();

    This public static call to an uninstantiated class' function was losing the $sugar_config variable as well. I was thinking that I should be able to keep my $sugar_config variable alive through all the require calls that extend from soap.php, but somehow the $sugar_config variable loses scope and the getInstance function can't find it when it tries to pull it in using the global keyword. I was able to work around this problem by registering the $sugar_config variable in the $GLOBALS array. I put the following line of code into entryPoint.php right after the config.php file was required:

    $GLOBALS['sugar_config'] = $sugar_config;

    This workaround seems to force my $sugar_config array to make itself available to the DBManager class. Can anyone think of any reason why the configuration that comes with SugarCRM isn't working the way it was designed? I thought the SOAP setup should be able to work without too much intervention on my part, but am finding that I need to do a significant amount of debugging. If you've run into these problems as well and point me in the right direction in order to avoid similar pitfalls, I would appreciate it.

    Sincerely,
    Dan

  2. #2
    rog211's Avatar
    rog211 is offline Sugar Team Member
    Join Date
    Jun 2005
    Posts
    320

    Default Re: $sugar_config variable keeps disappearing in SOAP setup

    To be honest hanmari, I am not sure why $GLOBALS['sugar_config'] = $sugar_config was not being set in entryPoint in the first place. We use it throughout the app so relying on global $sugar_config to populate the super global is not a safe assumption.
    For some reason I thought that was already there, but I do not see it so I will have to check into it.
    Roger R. Smith
    Application Architect
    SugarCRM Inc.

  3. #3
    hanmari is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    11

    Default Re: $sugar_config variable keeps disappearing in SOAP setup

    I just reinstalled SugarCRM's latest version to see if these files have been updated. Unfortunately, the same errors persist in version 5.0.0d as well as 5.0.0b. I have created a notice in bug tracker about this issue.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SOAP login() - Invalid Username/Password.
    By dsandor in forum Developer Help
    Replies: 12
    Last Post: 2010-12-07, 09:13 AM
  2. GMail IMAP setup & test
    By johnswolter in forum Help
    Replies: 9
    Last Post: 2009-01-23, 12:37 AM
  3. SOAP Performance Issue Loading Accounts
    By artisticlight in forum General Discussion
    Replies: 1
    Last Post: 2007-07-20, 01:39 PM
  4. PHP Warnings after install add-in Module
    By kgeving in forum Help
    Replies: 1
    Last Post: 2006-08-08, 05:54 PM
  5. Replies: 7
    Last Post: 2005-05-10, 08:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •