I'm trying to store a lot of POST data in a php session. The data appears to be saved without any problem, but when I try to access the data on the next page load, it is unset. I have no idea what I'm doing wrong. This is the minimum working example that I can make:
index.php
- <?php
- session_start();
- $_SESSION['roles'] = $_POST['ext_roles'];
- var_dump($_SESSION);
session.php
- <?php
- session_start();
- var_dump($_SESSION);
When I make a POST to index.php
, the data is shown as expected:
- /var/www/default/index.php:4:
- array (size=1)
- 'roles' => string '00000000000000000' (length=17)
but when I load session.php
, I get this:
- /var/www/default/session.php:3:
- array (size=1)
- 'roles' => null
It doesn't happen with all data either, just the data that I actually care about. If I just use postman to submit random POST data, it works just as expected, but the data that comes into the initial POST from the external source that I'm trying to save is consistently set to null or an empty array. I am at a complete loss here.
here is the form data that I'm trying to persist with the session:
form.html
- <html>
- <body>
- <form action="index.php" method="post">
- <input type="hidden" name="oauth_consumer_key" value="00000000000000000"/>
- <input type="hidden" name="oauth_signature_method" value="00000000000000000"/>
- <input type="hidden" name="oauth_timestamp" value="00000000000000000"/>
- <input type="hidden" name="oauth_nonce" value="00000000000000000"/>
- <input type="hidden" name="oauth_version" value="00000000000000000"/>
- <input type="hidden" name="context_id" value="00000000000000000"/>
- <input type="hidden" name="context_label" value="00000000000000000"/>
- <input type="hidden" name="context_title" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_api_domain" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_assignment_id" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_assignment_points_possible" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_assignment_title" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_course_id" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_enrollment_state" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_user_id" value="00000000000000000"/>
- <input type="hidden" name="custom_canvas_user_login_id" value="00000000000000000"/>
- <input type="hidden" name="ext_ims_lis_basic_outcome_url"
- value="00000000000000000"/>
- <input type="hidden" name="ext_outcome_data_values_accepted" value="00000000000000000"/>
- <input type="hidden" name="ext_outcome_result_total_score_accepted" value="00000000000000000"/>
- <input type="hidden" name="ext_outcomes_tool_placement_url"
- value="00000000000000000"/>
- <input type="hidden" name="ext_roles"
- value="00000000000000000"/>
- <input type="hidden" name="launch_presentation_document_target" value="00000000000000000"/>
- <input type="hidden" name="launch_presentation_locale" value="00000000000000000"/>
- <input type="hidden" name="launch_presentation_return_url"
- value="00000000000000000"/>
- <input type="hidden" name="lis_course_offering_sourcedid" value="00000000000000000"/>
- <input type="hidden" name="lis_outcome_service_url"
- value="00000000000000000"/>
- <input type="hidden" name="lis_person_contact_email_primary" value="00000000000000000"/>
- <input type="hidden" name="lis_person_name_family" value="00000000000000000"/>
- <input type="hidden" name="lis_person_name_full" value="00000000000000000"/>
- <input type="hidden" name="lis_person_name_given" value="00000000000000000"/>
- <input type="hidden" name="lis_person_sourcedid" value="00000000000000000"/>
- <input type="hidden" name="lti_message_type" value="00000000000000000"/>
- <input type="hidden" name="lti_version" value="00000000000000000"/>
- <input type="hidden" name="oauth_callback" value="00000000000000000"/>
- <input type="hidden" name="resource_link_id" value="00000000000000000"/>
- <input type="hidden" name="resource_link_title" value="00000000000000000"/>
- <input type="hidden" name="roles" value="00000000000000000"/>
- <input type="hidden" name="tool_consumer_info_product_family_code" value="00000000000000000"/>
- <input type="hidden" name="tool_consumer_info_version" value="00000000000000000"/>
- <input type="hidden" name="tool_consumer_instance_contact_email" value="00000000000000000"/>
- <input type="hidden" name="tool_consumer_instance_guid"
- value="00000000000000000"/>
- <input type="hidden" name="tool_consumer_instance_name" value="00000000000000000"/>
- <input type="hidden" name="user_id" value="00000000000000000"/>
- <input type="hidden" name="user_image"
- value="00000000000000000"/>
- <input type="hidden" name="oauth_signature" value="00000000000000000"/>
- <button type="submit" name="submitButton">Go</button>
- </form>
- </body>
- </html>