Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for issue #5395 #5396

Merged
merged 6 commits into from

2 participants

@franz-deleon

@Ocramius has noted the method is going to be depracte but i thought id try to do a quick patch

@franz-deleon franz-deleon commented on the diff
library/Zend/ServiceManager/ServiceManager.php
((37 lines not shown))
* @param bool $checkAbstractFactories
* @param bool $usePeeringServiceManagers
* @return bool
*/
public function has($name, $checkAbstractFactories = true, $usePeeringServiceManagers = true)
{
- if ($this->canCreate($name, $checkAbstractFactories)) {
+ if (is_string($name)) {

move the is_string check first since most usage of this function are string based

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#5396] CS fixes
- Move opening conditional statement to same line as condition
- s/name/rName/ in string check for canonical name
- Trigger E_USER_DEPRECATED error from canCreate()
1dda94c
@weierophinney weierophinney merged commit c6f2af4 into zendframework:develop

1 check failed

Details default The Travis CI build failed
@weierophinney weierophinney was assigned
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-servicemanager
@weierophinney weierophinney Merge pull request zendframework/zf2#5396 from franz-deleon/develop be837f8
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-servicemanager
@weierophinney weierophinney [zendframework/zf2#5396] CS fixes
- Move opening conditional statement to same line as condition
- s/name/rName/ in string check for canonical name
- Trigger E_USER_DEPRECATED error from canCreate()
9545e2d
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-servicemanager
@weierophinney weierophinney Merge branch 'feature/5396' into develop e60ed4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2013
  1. @weierophinney

    Merge branch 'hotfix/5374-cleanup'

    weierophinney authored
    Fix CS and testing issues introduced by security fix for #5374
  2. @weierophinney

    CS fixes

    weierophinney authored
    - trailing whitespace
  3. @weierophinney

    Merge branch 'hotfix/cs' into develop

    weierophinney authored
    Fixes CS issues
Commits on Nov 1, 2013
  1. @franz-deleon
  2. @franz-deleon
  3. @franz-deleon
This page is out of date. Refresh to see the latest.
View
19 library/Zend/ServiceManager/ServiceManager.php
@@ -639,7 +639,24 @@ public function doCreate($rName, $cName)
}
/**
- * @param string|array $name
+ * Determine if we can create an instance.
+ * Proxies to has()
+ *
+ * @param string|array $name
+ * @param bool $checkAbstractFactories
+ * @return bool
+ * @deprecated this method is being deprecated as of zendframework 2.2, and may be removed in future major versions
+ */
+ public function canCreate($name, $checkAbstractFactories = true)
+ {
+ return $this->has($name, $checkAbstractFactories, false);
+ }
+
+ /**
+ * Determine if an instance exists.
+ *
+ * @param string|array $name An array argument accepts exactly two values.
+ * Example: array('canonicalName', 'requestName')
* @param bool $checkAbstractFactories
* @param bool $usePeeringServiceManagers
* @return bool
View
8 tests/ZendTest/Http/PhpEnvironment/RemoteAddressTest.php
@@ -65,7 +65,7 @@ public function testSetGetUseProxy()
$this->remoteAddress->setUseProxy(false);
$this->assertFalse($this->remoteAddress->getUseProxy());
}
-
+
public function testSetGetDefaultUseProxy()
{
$this->remoteAddress->setUseProxy();
@@ -83,7 +83,7 @@ public function testSetTrustedProxies()
public function testGetIpAddress()
{
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
- $this->assertEquals('127.0.0.1', $this->remoteAddress->getIpAddress());
+ $this->assertEquals('127.0.0.1', $this->remoteAddress->getIpAddress());
}
public function testGetIpAddressFromProxy()
@@ -122,9 +122,9 @@ public function testGetIpAddressFromProxyFakeData()
'192.168.0.10', '10.0.0.1', '10.0.0.2'
));
$_SERVER['REMOTE_ADDR'] = '192.168.0.10';
- // 1.1.1.1 is the first IP address from the right not representing a known proxy server; as such, we
+ // 1.1.1.1 is the first IP address from the right not representing a known proxy server; as such, we
// must treat it as a client IP.
$_SERVER['HTTP_X_FORWARDED_FOR'] = '8.8.8.8, 10.0.0.2, 1.1.1.1, 10.0.0.1';
$this->assertEquals('1.1.1.1', $this->remoteAddress->getIpAddress());
}
-}
+}
Something went wrong with that request. Please try again.