SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Central Illinois
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very strange problem with include() and require()

    This is bizarre. I'm going to describe the problem as verbosely as possible so it will hopefully be clear exactly what's going on:

    I have a main "functions.php" file that I require_once() on every page of my site.

    In functions.php, I require_once() a file called vars.php.

    Also in functions.php, there is a single function that uses ob_start("ob_gzhandler")

    Everything works fine so far. However....

    If I try to include another file in functions.php, my pages won't load and give an "invalid or unsupported encryption" error.

    Somehow, even just copying vars.php, renaming it, and requiring the newvars.php file from functions.php still causes the error.

    Permissions on the files are the same. Nothing relevant in .htaccess either.

    However, if I comment out the ob_start("ob_gzhandler") from the function that uses it, everything is fine.

    What in the world is going on here? It seems completely illogical and unreal.

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2010
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you using ob_start("ob_gzhandler") before any output or you already outputted something?

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Central Illinois
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's before any output. However, note that simply renaming the vars.php file and including that from functions.php also produces the error, with no changes actually made to either file. That's part of what makes this so bizarre.

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Central Illinois
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, making some progress...it appears to be related to text encoding. But it's still really weird.

    My default character set is UTF-8, set in my .htaccess file. functions.php and all the files I've tried to include from it were encoded with UTF-8. Somehow, although it works fine to include vars.php as UTF-8, any other files I want to include need to be encoded as ISO-8859-1.

    I have no clue why this would be and can't figure out how in the world a UTF-8 encoded file can include ONE other specific UTF-8 file but needs all the others to be ISO-8859-1, when the default character set is UTF-8 anyway. I would have thought that, if anything, the files would all need to be the same text encoding, but that's sure not the case here.

    Any ideas?


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
  •