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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:44:00+00:00 2026-06-07T19:44:00+00:00

UPDATE – I did not find the problem. I’m assuming that the person who

  • 0

UPDATE – I did not find the problem. I’m assuming that the person who deleted their comments was right and either Asset.php or array_shift() was being called twice. What I did find was a sweet spot in another file that handled the form object and allowed me to manipulate the array as I intended without deleting extra elements. Left this up in case anyone wants to browse through it.


I have a website run by a Controller.php that shows different pages according to a GET value run through a switch. The relevant case is:

case 'pgImportAsset': {
  require_once FORMS_DIR.'/Asset.php';

  $form = new ImportAssetForm(&$smarty, &$req);

  if(!empty($_SESSION['list'])){
    $form->processTo(&$smarty, array('pg'=>   'pgImportAsset'));
  } else {
    $form->processTo(&$smarty, array('pg'=> 'pgListClip'));
  }
  break;
}

The $_SESSION[‘list’] variable is an array that stores strings of file names that come from a java applet that uploads those files. The array gets initialized perfectly to something like

Array
(
  [0] => 0.jpg
  [1] => 1.jpg
  [2] => 2.jpg
  [3] => 3.jpg
  [4] => 4.jpg
)

and so on. Here’s where it gets weird. The one line where the array gets decremented is in Asset.php

$this->filename=array_shift($_SESSION['list']);

The array will go into the instance of that page and I’ll have a print_r statement right before and right after that line. Even though the array goes in with all 5 elements in it, the two print statements will show.

Array
(
  [0] => 1.jpg
  [1] => 2.jpg
  [2] => 3.jpg
  [3] => 4.jpg
)
Array
(
  [0] => 2.jpg
  [1] => 3.jpg
  [2] => 4.jpg
)

It gets weirder. Shortly after that line in Asset.php I have this line (I’m using smarty).

$smarty->assign('filename',$this->filename);

And that shows up as the first element, which in this case would be 0.jpg. The value $this->filename then gets sent to a database without any lines of code altering it. What ends up stored in the database is 1.jpg.

I am completely lost and confused. Please help.

More information on it, Asset.php uses an object called ImportAssetForm that expands on the QuickForm library in PEAR as well as a couple other libraries including DB and some others.

This is not my code originally, I’ve just been tasked with changing it. The PEAR libraries are probably dated a little bit, but I don’t have the knowledge of PEAR to go in and completely revamp the site.

  • 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-07T19:44:02+00:00Added an answer on June 7, 2026 at 7:44 pm

    The issue I had was the script reloading due to an error check in my code. Since I didn’t want to disrupt that, I moved the handling of the array to another location that did not execute twice.

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

Sidebar

Related Questions

update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find
UPDATE UPI_ATTRIBUTE SET SITE_INC ='0' WHERE USER_PROFILING_NAME IN ('CAR_IMPLICIT','CAR_EXPLICIT') Above is my query that
UPDATE 6/21/12 I have a form in rails that is working similar to an
Update I want to have an expression (XPath, or Regex Expression, similar) that can
Update 2: thanks again to @deepak-azad, I managed to solve my problem : here
UPDATE: I made a mistake in my debugging - this question is not relavent
UPDATE: Sorry I was wrong with my assumption of the problem. Its due to
Update: The multiple device screen dimensions is a red herring - the problem is
Update: I was able to solve this problem. I just remembered VBA use *
UPDATE: I found that the easiest way is to use AQuery . I need

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.