Bug #3944

Segmentation faults when calling __toString() magic method implicitly

Added by Jesús García Crespo about 9 years ago. Updated over 7 years ago.

Status:VerifiedStart date:
Priority:HighDue date:
Assignee:Jesús García Crespo% Done:


Target version:Release 1.3
Google Code Legacy ID:atom-1995 Tested version:
Sponsored: Requires documentation:


In some situations, specially under fastcgi in prod mode, PHP segfaults trying to call __toString() implicitly. Calling this method explicitly fix the problem, but we have many calls like this in different parts of our code.

It's curious that running in debug mode solves the problem.

It would be interesting to isolate this problem and try running recent PHP versions to check if the problem was solved or trying to track the bug in the PHP project, if exists.

Typical fix, replace this line:

if (1 > strlen($title = $this->resource))


if (1 > strlen($title = $this->resource->__toString()))


#1 Updated by David Juhasz about 9 years ago

  • Priority set to Low

[g] Labels added: Priority-Low

#3 Updated by Jesús García Crespo almost 9 years ago

  • Priority changed from Low to High

We have been calling __toString() explicitly where this problem was reported. We should also check if this problem can be reproduced with the latest PHP releases.

[g] Labels added: Priority-High
[g] Labels removed: Priority-Low

#4 Updated by David Juhasz over 8 years ago

  • Target version set to Release 1.3

Roll over to Release 1.3

[g] Labels added: Milestone-Release-1.3

#5 Updated by Jesús García Crespo over 8 years ago

See 11491. Other commits were done in the past regarding to the same issue.

#6 Updated by Anonymous over 8 years ago

- Missing comment -

#7 Updated by Jesús García Crespo over 8 years ago

See also r11492 and r11493.

#8 Updated by Jesús García Crespo about 8 years ago

  • Status changed from New to Verified

We haven't received any segfault report lately. I will close this issue until further notice.

Also available in: Atom PDF