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

The Archive Base Latest Questions

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

This is used to get a list of previously served markers from session: session_start();

  • 0

This is used to get a list of previously served markers from session:

session_start();
if(!isset($_SESSION['markers'])) {
    $_SESSION['markers'] = array(0);
    $list = '0';
} else {
    $list = implode(', ', $_SESSION['markers']);
}

I use $list to get markers not already served:

SELECT * FROM `markers` WHERE {other conditions} AND `marker_id` NOT IN($list) 

Then for each row returned I add the marker id to session:

while ($row = mysqli_fetch_assoc($result)){
  $_SESSION['markers'][] = (int) $row['marker_id'];
  ...
}

However, after serving some markers (say 8, 36) the session looks corrupt. var_dump($_SESSION); outputs:

array(1) {
  ["markers"]=>
  &array(3) {
    [0]=>
    int(0)
    [1]=>
    int(8)
    [2]=>
    int(36)
  }
}

I say it is corrupt because when I manually make a similar array (codepad here) the output does not show a & in the third line – it is array(3), not &array(3). What is causing this?

Update
@Marc B is hinting the session is not corrupt. His take is that we just have a variable ($_SESSION), containing a reference to an array ($markers), instead of the array itself; and that is not a corrupt variable. Well, the session is corrupt for session usage purposes. Two signs:

  1. A second call to the same script (in which I guess the else route is taken) results in a fatal error: Fatal error: Cannot use object of type DOMElement as array in ... on line 47. Line 47 is where we attempt to add a new marker id to the array: $_SESSION['markers'][] = (int) $row['marker_id'];
  2. When I try to unserialize the actual contents of session file it fails (codepad here).
  • 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-25T14:07:22+00:00Added an answer on May 25, 2026 at 2:07 pm

    If you have register_globals to On, global variables associated to $_SESSION variables are references. Source: http://php.net/manual/en/reserved.variables.session.php

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

Sidebar

Related Questions

I get a warning C4355: 'this' : used in base member initializer list from
I've used this MySQL query to get data: SELECT DISTINCT A.*, B.username FROM posts
1. When I used this method, I get a list of events that I'm
I do not get the last version of node-http-proxy working (this used to work
I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this
this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I used to be able to do something like this to get a nested
For example, I get this compiler warning, The event 'Company.SomeControl.SearchClick' is never used. But
how can i get my List view in to string array. here is my
I swear this used to work, but it's not in this case. I'm trying

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.