Comments (9)
I've never mixed include_path
with autoloading, so I'm not really sure what to expect out of it. I'll try that later, in the meanwhile it's probably a stupid question but does /usr/share/php/Predis/Profiles/ServerVersion24.php
actually exist (it should, but since it's a weird issue...).
from predis.
Just a filename error.
filename is autoload.php, while Predis tries to load "Autoloader.php".
Just change to require autoload.php, or rename autoload.php to Autoloader.php and it should work.
from predis.
@persandiex I tried to reproduce your issue using the same sequence of lines (the use \Predis;
is useless here BTW) but I had no luck:
php > require 'Predis/Autoloader.php';
php > use \Predis;
php > Predis\Autoloader::register();
php > $r = new Predis\Client();
php > $r->ping();
php > echo $r->ping();
1
php >
What's strange is that the autoloader does indeed work, or you would get an error as soon as PHP tries to load the Predis\Client
class, not on the server profile class which comes at a later stage and after a few more classes. Without further details, I can't think of anything else other than a misconfiguration of your PHP environment.
@carrier autoload.php
is just an utility file in the repository used to run examples and the test suite, what @persandiex did by requiring Predis/Autoloader.php
is actually correct.
from predis.
@persandiex I couldn't reproduce even when trying with a PEAR installation of Predis. Any update on your issue?
from predis.
I'm closing this issue since no feedback has been provided for a month and I couldn't reproduce it. Feel free to comment with more details if you have some.
from predis.
Hello. I'm having the same issue. I've been able to figure out a workaround, but there must be something I'm doing wrong.
Basically, what happens is this. Check out how this method starts:
public function autoload($className)
{
if (0 !== strpos($className, $this->_prefix)) {
return;
}
If I echo every $className that goes through there, this is what I get:
Predis\Client
Predis\ClientOptions
Predis\Options\ClientProfile
Predis\Options\Option
Predis\Options\IOption
Predis\Options\ClientConnectionFactory
Predis\Options\ClientCluster
Predis\Options\ClientPrefix
Predis\Profiles\ServerProfile
Predis\Profiles\IServerProfile
Predis\Commands\Processors\IProcessingSupport
\Predis\Profiles\ServerVersion24
And bam, here I get an error. You see the difference? ServerVersion24 starts with a backslash while the others don't. I think it works when you do "new \Predis\Class" but it doesn't work (the same thing happens) when Predis tries to autoload a classname that was defined in a text string:
'2.4' => '\Predis\Profiles\ServerVersion24',
If I mass-replace '\Predis with 'Predis (take out initial backslashes in the namespace of classes in strings), then everything works like a charm.
Any idea what could be happening? Because I'm sure this doesn't happen to everyone. I'm using Redis 2.4, OSX, Predis v0.7.0 and PHP 5.3.2.
Thanks
from predis.
@manuelflara thanks for adding more details to this issue, I never had the chance to see this error myself so I couldn't even try to perform some debugging. Fortunately those useless backslashes were removed with commit d9b95d0 just a few days before the release of Predis v0.7.0 as stable, everything should be OK now. Upgrading from a dev version of v0.7.0 is recommended anyway since a few bugs were fixed in the last rush before going stable with the v0.7 branch.
I'm almost sure this is a bug of PHP, but as far as I remember I never encountered this error when using PHP 5.3.2 on Linux so I guess if it's something related to older versions of PHP on OS X. Do you have any opcode cache module or the suhosin patch/module loaded?
from predis.
I was actually surprised yesterday when I downloaded 0.7 again and this time worked! Thanks for the comment :)
from predis.
Hi,
this work fine for me on Centos and PHP7:
require 'Predis/Autoloader.php';
Predis\Autoloader::register();
$client = new Predis\Client();
from predis.
Related Issues (20)
- Provide a hook so that a user can delete something from the cache storage
- Get from local cache
- Determine internal format of the cache (i.e is it key of value/expiration pairs, or something else)
- Save in local cache (presumably with an expiration)
- Cache configuration objects (to support memory, number of keys, etc)
- [v3] cherry-pick opt out setinfo for v3 HOT 1
- Update CLIENT-SETINFO to support suffixes HOT 1
- Missing BITFIELD_RO support HOT 1
- psubscribe seems to swallow exit, exceptions, disconnect, quit calls HOT 4
- Add support for GEOSHAPE index fields and WITHIN and CONTAINS query operators
- Error while writing bytes to the server HOT 3
- Error on RPOP expects exactly 1 argument, 2 given HOT 2
- Explain `expireResoluton` for `SET` HOT 1
- Improve connection speed by running fewer commands
- Question: the `ClientInterface::eval` signature and PhpRedis HOT 1
- Connect to Sentinel with username: how to implement right ? HOT 3
- Add support for HSCAN [NOVALUES]
- Add command filter for CLIENT KILL to support maximum age via [MAXAGE] option
- Support XREAD, XREADGROUP reading from last message of stream
- Supporting redis unstable commands
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from predis.