Fixed bug #62500 (Segfault in DateInterval class when extended) #123

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

reeze commented Jul 8, 2012

https://bugs.php.net/bug.php?id=62500

When accessing properties before DateIntervl initialized will cause segfault.
other functions checked this situation but left property getter and setter function.

Contributor

reeze commented Jul 8, 2012

@derick will you take a look at this bug? thanks:)

Hi:
I am sorry to say, your fix is wrong.

  1. thinking of:

class Crasher extends DateInterval {
public $y = "xxx";

  public function __construct($time_spec) {
              var_dump($this->y);
  }

}

your fix will trigger a warning and output a NULL, it's totally wrong.

the same issue also exists in the write context.

  1. there will be a memleak of your fix when the key is not a string.

I will make another fix , thanks

On Sun, Jul 8, 2012 at 4:16 PM, Reeze Xia
reply@reply.github.com
wrote:

https://bugs.php.net/bug.php?id=62500

When accessing properties before DateIntervl initialized will cause segfault.
other functions checked this situation but left property getter and setter function.

You can merge this Pull Request by running:

git pull https://github.com/reeze/php-src fix-62500-DateInterval-segfault

Or you can view, comment on it, or merge it online at:

#123

-- Commit Summary --

  • Fixed bug #62500 (Segfault in DateInterval class when extended)

-- File Changes --

M ext/date/php_date.c (11)
A ext/date/tests/bug62500.phpt (44)

-- Patch Links --

https://github.com/php/php-src/pull/123.patch
https://github.com/php/php-src/pull/123.diff


Reply to this email directly or view it on GitHub:
#123

Git Pull Requests Mailing List (https://github.com/php)
To unsubscribe, visit: http://www.php.net/unsub.php

Laruence Xinchen Hui
http://www.laruence.com/

Comment on behalf of laruence at php.net:

closed

php-pulls closed this Jul 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment