Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

updating comments for HTTPRequest - immutability #2923

Merged
merged 1 commit into from

2 participants

@IgorNadj

SS_HTTPRequest can be read like an array, e.g. echo $request['a'], but cannot be written like an array, e.g. $request['a'] = 5; Added comment to caution people.

See line 375:

/**
 * @ignore
 */
public function offsetSet($offset, $value) {}

/**
 * @ignore
 */
public function offsetUnset($offset) {}

Might be good to write something about how you are supposed to modify a request, or what you are supposed to do instead (a redirect?).

@IgorNadj IgorNadj updating comments for HTTPRequest - immutability
SS_HTTPRequest can be read like an array, e.g. echo $request['a'], but cannot be written like an array, e.g. $request['a'] = 5; Added comment to caution people.

See line 375:
==================================================================
	/**
	 * @ignore
	 */
	public function offsetSet($offset, $value) {}
	
	/**
	 * @ignore
	 */
	public function offsetUnset($offset) {}
==================================================================

Might be good to write something about how you are supposed to modify a request, or what you are supposed to do instead (a redirect?).
7f39fb5
@simonwelsh simonwelsh merged commit 6e7195b into silverstripe:3.1

1 check passed

Details default Scrutinizer: No new issues — Travis: Passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2014
  1. @IgorNadj

    updating comments for HTTPRequest - immutability

    IgorNadj authored
    SS_HTTPRequest can be read like an array, e.g. echo $request['a'], but cannot be written like an array, e.g. $request['a'] = 5; Added comment to caution people.
    
    See line 375:
    ==================================================================
    	/**
    	 * @ignore
    	 */
    	public function offsetSet($offset, $value) {}
    	
    	/**
    	 * @ignore
    	 */
    	public function offsetUnset($offset) {}
    ==================================================================
    
    Might be good to write something about how you are supposed to modify a request, or what you are supposed to do instead (a redirect?).
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  control/HTTPRequest.php
View
3  control/HTTPRequest.php
@@ -4,6 +4,9 @@
* Represents a HTTP-request, including a URL that is tokenised for parsing, and a request method
* (GET/POST/PUT/DELETE). This is used by {@link RequestHandler} objects to decide what to do.
*
+ * Caution: objects of this class are immutable, e.g. echo $request['a']; works as expected,
+ * but $request['a'] = '1'; has no effect.
+ *
* The intention is that a single SS_HTTPRequest object can be passed from one object to another, each object calling
* match() to get the information that they need out of the URL. This is generally handled by
* {@link RequestHandler::handleRequest()}.
Something went wrong with that request. Please try again.