On Sun, 13 Jan 2013, Hannes Magnusson wrote:

> > +
> > +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &slave_okay) == FAILURE) {
> > +		return;
> > +	}
> > +
> > +	set_cursor_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, CURSOR_FLAG_SLAVE_OKAY, slave_okay);
> > +
> > +	/* slaveOkay implicitly sets read preferences.
> > +	 *
> > +	 * With slave_okay being true or absent, the RP is switched to SECONDARY
> > +	 * PREFERRED but only if the current configured RP is PRIMARY - so that
> > +	 * other read preferences are not overwritten. As slaveOkay really only
> > +	 * means "read from any secondary" that does not conflict.
> > +	 *
> > +	 * With slave_okay being false, the RP is switched to PRIMARY. Setting it
> > +	 * to PRIMARY when it already is PRIMARY doesn't hurt. */
> 
> What about when I already did setReadPreferences(::RP_NEAREST); then ->slaveOkay(false) ?
> Doesn't the spec say that is an error?

The spec says it is an error for connection string arguments. It's not 
something we can really throw warnings on though, as slaveOkay() in old 
code should still work when you specify a read preference in a 
connection string.