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 6381167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:21:43+00:00 2026-05-25T02:21:43+00:00

I am coding my own var_dump to meet certain requirements which probably only apply

  • 0

I am coding my own var_dump to meet certain requirements which probably only apply to me and have a problem.

The code checks for objects, arrays, etc and finally gets to a stage where it reckons it is left with a number, a string or a boolean.

Of course, a string can actually be a serialized variable, so I want to heck for that …

if (is_string($variable))
{
   // check if it is serialzed; if so, unserialize & dump as an array, \
   // with a suitable header indicating that it was serialized
   try
   {
      $old_error_level= error_reporting(E_ALL ^ E_NOTICE);
      $unserialized_varaible = @unserialize($variable);
      $result .= my_dump($unserialized_varaible, ... <some params>); // recursive call
      $old_error_level= error_reporting($old_error_level);
   }

   catch(Exception $e)    // Treat it as a string
   {
       $old_error_level= error_reporting($old_error_level);
       $result .= GetHtmlForSimpleVariable($variable, ... <some params>);
   }
}

But, what I get when trying to dump a simple, non-serialized, string is

Problem type Notice "unserialize() 
  [<a href='function.unserialize'>function.unserialize</a>]:
  Error at offset 0 of 14 bytes" at line 362 in file my_dump.php<br><br>

Update: the point there is that I want to suppress that E_NOTICE when a string is not a serialized string. I had thought that the @on @unserizlize() would do that, but …

If the string is serialized then everything is hunky dory. If not, then not.

  • 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-05-25T02:21:44+00:00Added an answer on May 25, 2026 at 2:21 am

    When you try to unserialize it, it returns false if it is not serialized. It also returns a an E_NOTICE which is where that output is coming from.

    From the manual:

    In case the passed string is not unserializeable, FALSE is returned
    and E_NOTICE is issued.

    Check if the return value of unserialize ===false

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

Sidebar

Related Questions

I have decided to start doing small coding projects on my own that focus
I'm building my own advertisement platform, and I have a little problem. How can
I want to start coding in Python or Ruby. Since I own a Lego
I have SSRS report with its own datasets coming straight from the database. I
When coding, what in your experience is a better approach? Break the problem down
Im trying to implement my own Huffman Coding algorithm and the priority queue for
Ok, I know about JFreeChart and others, but I'm coding my own simple scatter
I've been coding my own bit-vectors (represented as strict tuples over Word64 values) as
I'd like to avoid coding my own version of IFactory, ILog, IRepository and other
I'm Coding my own HTTP fetcher socket. I use C++ in MVC++ and winsocket2.h

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.