Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:24:55+00:00 2026-06-17T18:24:55+00:00

That is to say, a test for whether or not I can safely gzinflate

  • 0

That is to say, a test for whether or not I can safely gzinflate the string.

If my compressed data has been tampered with I get a “bad data” warning. I don’t want to suppress the warning which means I either have to trap it, or test that it can be gzinflated. The latter is my preferred solution but I just don’t know how.

Something to fit the code sample below would be perfect:

if(i_can_haz_inflate($data))
{
    // go ahead
    $source = gzinflate($data);
}
else
{
    // bad data
}

Edit: Having specified gz(de|in)flate I’ve come to realize that I’m not actually too bothered about the compression algorithm. Are there any out there that are better suited to checking the integrity prior to a decompression attempt?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:24:56+00:00Added an answer on June 17, 2026 at 6:24 pm

    gzinflate() returns the original string if it’s not a gzdeflate() encoded string.

    The most obvious check would be:

    $deflated = @gzinflate($data); // to avoid getting a warning
    if ($data != $deflated && $deflated !== FALSE) {
         $source  = gzinflate($data);
    }
    

    I don’t think there’s another way to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let’s say that my string is: test! I want to get the first character
Let's say I have a subroutine/method that a user can call to test some
I'm curious, how would you test a string and say yep, that is a
I know this has been asked before but I can't find it so... Say
There are other posts that say you can create a control in windows forms
First let me say that I've been searching to find a solution for a
It has been my observation that if free( ptr ) is called where ptr
I just noticed that say http://s7.addthis.com/js/250/addthis_widget.js#pub=PUBID does the equivalent of http://s7.addthis.com/js/250/addthis_widget.js?pub=fct-250 but is much
The idea is that say you have the following table. ------------- | oID |
I've seen a few references that say there is WSGI middleware to do it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.