What is a "Volatile" object?

PHP Catchable fatal error: Object of class Volatile could not be converted to string in […]

I’ve searched, ok 5-10min on duckduckgo.com, but there is nothing about volatile object.

Is there someone can explain to me what is a Volatile object in PHP ? (Or give me a link that explain.)

Note: I’m not talking about the error.

If I understand what you’re asking, it’s a term which defines that an objects values/meanings can change depending on when it’s accessed.

(Though you seem like you figured it out, your error is something completely different - Volatile is the name of the object class)

Yeah, exactly.

First, thank for your reply. But sorry but I’m not convinced. It’s a bit small for a explanation. :confused: Maybe a PHP example with a volatile object can help me to understand.

I double checked the PHP documentation, and PHP doesn’t seem to have either a keyword or class named “volatile”. I’ll bet you’re using some third-party library, and that library defined its own class called “Volatile”. And then somewhere, you tried to treat an instance of that class like a string (maybe you tried to concatenate it or something), but presumably the Volatile class didn’t define a __toString() method, and so PHP complains that object of class Volatile could not be converted to string.

EDIT: It’s not obvious to me whether you’re trying to fix your error, or whether the error is merely what got you curious about volatile. But in case it’s the latter…

PHP doesn’t have that keyword or class, so if the question is what is volatile in PHP, then the answer is… nothing. But if you’re curious what volatile typically means in other languages, then Dave’s answer was right, and you can probably find longer explanations on wikipedia.

I’ve just make a global search with phpstom in my project. I didn’t defined any class called Volatile. But it’s probably a class of the pthreads php extension.

If you make a search in this changelog you can see something with volatile.

The error was easily fixed. But that not the interesting content.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.