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

  • Home
  • SEARCH
  • 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 6672037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:27:40+00:00 2026-05-26T03:27:40+00:00

My PHP code serializes, but doesn’t unserialize, what could be the problem? $serializedColumns =

  • 0

My PHP code serializes, but doesn’t unserialize, what could be the problem?

$serializedColumns = serialize($columnNames);

I have the following resulting html, where i stored the serialized string into a hidden field:

<input id="columns_hidden" name="columns" type="hidden" value="a:3:{i:0;s:8:&quot;Username&quot;;i:1;s:8:&quot;Password&quot;;i:2;s:11:&quot;AccessLevel&quot;;}">

The request is sent to ‘AddData.php’, i where i have my unserialize code like this:

$columns =  unserialize($_REQUEST['columns']);

when i call print_r on $columns, it returns a blank string.

when i call print_r on $_REQUEST['columns'], it returns:

a:3:{i:0;s:8:\"Username\";i:1;s:8:\"Password\";i:2;s:11:\"AccessLevel\";}

  • 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-26T03:27:40+00:00Added an answer on May 26, 2026 at 3:27 am

    This is actually a comment, but I put it here for more attention: Don’t do that.

    Why? – Whenever you unserialize data provided by a request blindly, PHP does more than you think. This can create objects which are dangerous for your application and you can not do a thing against that.

    The hidden input can be easily edited and manipulated with a DOM editor or JavaScript to include harmful code or malicious requests can be fired against your site bringing it down quickly.

    Alternatives – Instead use some form of data that you can process more easily, for example, use json_encode / json_decode or a classic implode / explode:

    $serializedColumns = implode(',', $columnNames);
    

    and

    $columns =  explode(',', $_REQUEST['columns']);
    

    this is much more failsafe and sane because it’s static data processing.

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

Sidebar

Related Questions

I have the following PHP code: echo ' <td id='.$metaso['semanaventa'].'td1><form id='.$metaso['semanaventa'].'form name='.$metaso['semanaventa'].'form class=dinamic action=compromiso_funciones.php
The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128.
I am running following PHP code to interact with a MS Access database. $odbc_con
I am using following PHP code to connect to MS Access database: $odb_conn =
Say i have this PHP code: $FooBar = a string; i then need a
I am using the following code to post my form data to player/index.php and
im trying to achieve the following, in php i have a form like this:
I have a php page with the follow javascript code in it: $(#saveButton).click(function() {
I have this ajax jquery code: var form = document.getElementById('frm'); var data_string = form.serialize();
here my code- $things = serialize($_POST['things']); echo $things; require 'database.php'; $q = INSERT INTO

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.