Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

350 lines (245 sloc) 13.3 KB
Sag Changes
Version 1.0.0
Breaking Changes
* setAttachment() has been deprecated by putAttachment(). The new function
takes the same arguments and behaves the same way. (closes #58)
* SagUserUtils now forces the database name to be '_users', which means you
need to be careful if you're reusing the same Sag object between databases.
* Removed the $upload parameter from SagUserUtils->changePassword(), which
means that all calls to this function will result in a PUT to the server.
* Removed the SagUserUtils->makeHash() function as it's deprecated by
security functionality in CouchDB >=1.3.
New Features
* You can now provide a chunk size to break your bulk docs write into
batches, resulting in more than one HTTP request. See the documentation for
`bulk()`. Closes #67.
Fixed Bugs
* Per the documentation, SagUserUtils->getUser() now only returns the
response's body instead of the entire response.
Version 0.9.0
Breaking Changes
* Default to cURL HTTP adapter instead of the native PHP implementation. The
cURL adapter is faster, more stable, and supports SSL.
New Features
* Support for PHP's strict mode. Strict mode is now turned on by default in
PHP as of v5.4.
Fixed Bugs
* Fixed response parsing bug in the cURL HTTP adapter for when HTTP bodies
are received that have empty lines. For example, if a view returns zero
results there is an empty line in the JSON that is returned. (closes #72)
* Fixed parsing of set-cookie header to be case insensitive. (closes #77)
* Fixed following redirects with the cURL HTTP adapter if PHP's open_basedir
php.ini variable is set. (closes #78)
Version 0.8.0
Breaking Changes
* Header keys are automatically lower cased now, whereas they previously kept
their capitalization. Unfortunately different API endpoints would sometimes
capitalize header names different (ex., Etag vs. ETag). Additionally,
BigCouch and Cloudant sometimes have different header capitalization. So,
whereas previously you might have done `$response->headers->Cookie` you
must now do `$response->headers->cookie`.
* We no longer check the PHP install's configuration for a our supported
error_reporting level. This is because too many different types of installs
were causing false positives and false negatives, needlessly breaking
installs. (closes #39)
* Added official support for CouchDB 1.2.x.
* Dropped official support for CouchDB 1.1.x.
New Features
* Support for setPathPrefix() from Sag-JS v0.3.0. Allows you to prepend all
URLs with a string, which is especially useful when going through a proxy.
Fixed Bugs
* SagNativeHTTPAdapter now supports and follows Location headers. (closes
* SagNativeHTTPAdapter's fgets() call no longer hangs on large responses that
are not chunked encoded. This was fixed by providing a line length. Thanks
to skyshard (github/skyshard) for helping with the debug. (closes #41)
* Sag no longer uses ternary short hand that was introduced in PHP 5.3, so
now PHP 5.2 will run without errors. Thanks to Jim Tittsler (github/jimt)
for reporting and submitting the patch. (closes #43)
* Disabled cache sizing for SagMemoryCache due to PHP's memory monitoring
being unreliable. The memory cache is no longer capped by Sag. (closes #22)
* Fixing an issue where the SagHTTPAdapter class's file wasn't being required
properly, causing class not found exceptions.
* No longer redirecting when the server returns a Location header with a 2xx
response. We now only do that redirect on a 3xx header. (Thanks to Greg
Nacu for reporting.)
* We now prevent cURL from sending a "Expect: 100-continue" header, as our
parsing code doesn't support HTTP/1.1's Continue. See for a discussion. (Thanks to Greg
Nacu for reporting and working on this issue.)
Version 0.7.1
Fixed Bugs
* The cURL HTTP library was choking on a HTTP/1.1 Continue header. Only some
installations were running into this problem, depending on their cURL
configuration and version.
Version 0.7.0
New Features
* The HTTP socket code was abstracted out of the core Sag class into its own
HTTP module. It is called SagNativeHTTPAdapter and remains the default
transport mechanism. This allows for drivers to be written that leverage
different HTTP libraries, potentially adding extra functionality. The
SagNativeHTTPAdapter is referenced by the Sag::$HTTP_NATIVE_SOCKETS static
public variable and can be specified with the setHTTPAdapter() function.
(closes #12)
* cURL can now be used when communicating with CouchDB, allowing for
additional functionality. If your system has the cURL PHP extension
installed then you can tell Sag to use it by calling
* SSL is now supported if you use cURL instead of native sockets. This
introduces setSSL() to turn SSL on/off, and setSSLCert() to specify a
certificate file to verify against. Verification is only supported if you
provide a certificate with setSSLCert(). HTTP libraries that do not support
SSL (ie., native sockets) will throw a SagException if you call an SSL
* You can now tell getAllDocs() to sort in descending order. Thanks to cygal
(github/cygal) for the patch and pull request. (closes #31)
Fixed Bugs
* If you set the database name and then set it again with the same value, but
also specify to create the database if it doesn't exist, Sag was previously
not checking to see if it should create the database. This is not fixed:
even if you specify the currentDatabase() value as the name the check will
still run. (closes #33)
Version 0.6.1
Fixed Bugs
* Fixed a typo bug where I was trying to throw the concept of an Exception
instead of an instantiation. Luckily it is rare for this corner case in the
code to run. Thanks to Oliver Kurowski (github/a4mc) for reporting.
(closes #26)
* Fixed a problem with the HTTP/1.1 decoding of chunked message bodies that
was causing continuous change feed requests (/db/_changes?continuous=true)
to fail. (closes #27)
* Fixed a typo bug in examples/phpSessions, changed createdOn to createdAt.
Thanks to Yo-Han (github/yo-han) for finding the bug and submitting the
patch as a pull request. (closes #28)
Version 0.6.0
Breaking Changes
* The HTTP status was incorrectly being added to the root of the response
object in addition to where it belongs in `$resp->headers->_HTTP->status`.
It is now removed. Applications that were using it at the `$resp->status`
should fix their code to use the proper location.
New Features
* Sag's internals now use HTTP/1.1 instead of HTTP/1.0. This requires zero
code changes for your application because Sag's interface is not impacted
by this.
* You can now set cookies that will be sent with every request using
setCookie(), and retrieve them with getCookie().
* SagUserUtils is the first of several utility classes that will be added to
Sag. It gently wraps the Sag interface to make managing CouchDB users much
easier. You can create and get users, and change their password.
* An example of how to proxy the cookie based auth's AuthSession cookie from
your PHP layer to CouchDB, making it easier to have user accounts in your
application without rewriting user management yet again.
* Support for the server level _session object with getSession(). Thanks to
Tim Juravich for the original patch.
Fixed Bugs
* As of CouchDB 1.1.0 inline attachments are sent as multipart HTTP
responses, which was breaking our parser. This is now fixed by always
sending an Accept header for 'application/json'. Thanks to Rob Newson and
Dale Harvey in #couchdb for helping on this. (closes #23)
* Previously an HTTP response code >=400 to a HEAD request would not throw a
SagCouchException because there was no error property in the message body
(because HEAD responses do not have bodies). Now a SagCouchException is
thrown as expected with the exception's code set to the HTTP response code.
This also creates a slight performance boost for parsing HEAD requests.
* When calling setDatabase() and specifying to create the database if it does
not already exist, the logic now uses a HEAD request instead of a GET. This
was a typo/mistake at the time, so it is getting bug status.
Version 0.5.1
Fixed Bugs
* Previously PUT was caching CouchDB's response, which created unexpected
results (the actual data being POST'd was expected to be cached). This is
now fixed: that data provided to post() is combined with the server's
response to create a cacheable object whose headers will not be entirely
accurate. POST is still not cached because CouchDB does not respond with an
E-tag to cache against. Thanks to Peter Kruithof for reporting and original
patch. (closes #17)
* setAttachment() now properly URL encodes the ?rev parameter when you
specify the document's _rev (last function parameter). Thanks to skyshard
for reporting the issue and the fix. (closes #19)
Version 0.5.0
Breaking Changes
* These Sag class functions now return the class's current instance ($this):
decode, setDatabase, setOpenTimeout, setRWTimeout, setCache,
setStaleDefault. This allows configuration functions to be chained before
you make a call to CouchDB. (closes #14)
* Sag->setDatabase() will now URL encode database names that are passed to
it. This may break your code if you were already encoding database names
before passing them. For example,
`$sag->setDatabase(urlencode('some/db'));` will no longer work as expected.
Instead use `$sag->setDatabase('some/db');`.
New Features
* Sag now supports connection pooling for sockets with HTTP's Connection:
Keep-Alive. This means Sag no longer opens and closes a socket for each
request made (better performance). No management is provided for the
maximum number of sockets that can be kept open, since this should be done
at the operating system level (ulimit or pam for Linux/Unix). (closes #15)
* Adding support for CouchDB 1.1.x, while dropping support for 0.11.x - most
of, or all of, 0.11.x will still work with Sag.
* Added the examples/ directory with an example of how one could store PHP
session data in CouchDB. Related blog post:
* Added tests/bootstrap.php to make running the tests easier.
Fixed Bugs
* All functions that take query parameters as function parameters, such as
'startkey' in Sag->getAllDocs(), now URL encode those parameters before
adding them to the URL. However, functions that you pass whole URLs to,
like Sag->get(), do not deconstruct the URL for parameters - you must do
your own URL encoding when providing a full URL to a function.
* Sag->bulk() no longer attempts to cache. This is not a breaking change,
because it was never able to successfully cache before.
Version 0.4.0
New Features
* When initiated, Sag checks the PHP environment for unsupported
error_reporting values. Thanks to Simeon Willbanks. (closes #8, #9)
* setStaleDefault() was created to easily allow developers the choice of
making all of their GET and HEAD requests use stale=ok or not. This is
great for production systems that do all their querying against stale
views, allowing another process to trigger index updates based on the
_changes feed.
* Now when calling setDatabase() you can tell it to create the database if it
does not exist (uses an HTTP GET to check if it exists). If the database
does not exist, then createDatabase() is called to create it.
Fixed Bugs
* Fixed a bug where an invalid Content-Size was being sent even if no data
was passed to the packet.
* Fixed a bug in POST where an incorrect variable name was being used,
allowing improper paths to be sent to CouchDB.
* When caching, bulk() now iterates over the documents it's trying to update
and sends them to the cache. If a document's _deleted property is true,
then it's removed from the cache.
Version 0.3
New Features
* Cookie based authentication. Thanks to Benjamin Young. (closes #1)
* Cache results with the SagCache interface. Currently supports caching to
disk with SagFileCache.
* Support for HEAD requests. Thanks to Doug Cone. (closes #3)
* You can now POST to any URI in the database, adding a second $uri parameter
to the post() function. Allows POST'ing to views. Thanks to Peter Kruithof.
(closes #7)
* Exposing CouchDB's runtime _stats interface with the getStats() function.
Fixed Bugs
* getAllDocs() no longer always includes documents. Thanks to
Version 0.2
* Officially adding support for 1.0.x and dropping support for 0.10.x.
New Features
* Native support for attachments.
* Internal support for different Content-Type values.
* Can set timeout on socket connection.
* Can set timeout on socket read/write.
Fixed Bugs
* Removed leading white space in header values.
* Fixed ending line breaks when sending data via a PUT.
Jump to Line
Something went wrong with that request. Please try again.