Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74240 invoked by uid 1010); 6 Sep 2005 18:19:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 74225 invoked from network); 6 Sep 2005 18:19:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2005 18:19:56 -0000 X-Host-Fingerprint: 64.233.184.207 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.207:17455] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E4/A5-23233-CCDDD134 for ; Tue, 06 Sep 2005 14:19:56 -0400 Received: by wproxy.gmail.com with SMTP id i28so825746wra for ; Tue, 06 Sep 2005 11:19:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=caGPBaIXRELhzotA0MtZRlOeqVbn/+sievJlzjC8nCBTO1xpQtx6uBuzAvaE9es4jtJWGC4+W8zfj+DXuTEULYeUBuhimKtGRRsi5UH0rnc9b3YG7kuUGD2vo7x4aQtR+EmoqNxN0nLCW43oeTRHExrhXT/bd70pYcwOXIfW4gM= Received: by 10.54.36.9 with SMTP id j9mr4508494wrj; Tue, 06 Sep 2005 11:19:51 -0700 (PDT) Received: by 10.54.107.8 with HTTP; Tue, 6 Sep 2005 11:19:51 -0700 (PDT) Message-ID: <57792e85050906111963cd6303@mail.gmail.com> Date: Tue, 6 Sep 2005 11:19:51 -0700 Reply-To: iamstever@gmail.com To: Scott MacVicar Cc: internals@lists.php.net, Zeev Suraski In-Reply-To: <431D9B9E.6080303@ntlworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <5.1.0.14.2.20050904235929.06963d60@localhost> <431D9B9E.6080303@ntlworld.com> Subject: Re: [PHP-DEV] Re: 5.0.5 From: iamstever@gmail.com (steve) I agree. Having no access MySQL(i) during shutdown has already broken scripts I've used. Thankfully, Jani mentioned the change so I no longer felt like I was going crazy, and I was able to work around it by creating a "shutdown object" that contained references to all the objects it might need, and then used it's destroy call. Same issue in 5.1. If the behavior is to change from what we expect, I'd propose that we add something to the manual. That said, I only found this problem because of strange Fatal Error in Unknown on line 0 errors in the error log. It took me a while to link that to the change in shutdown behavior, and I don't think too many will be able to make the link between the two. My $0.02. -steve-- On 9/6/05, Scott MacVicar wrote: > Zeev Suraski wrote: > > If there are no (ultra last) objections, I'll roll 5.0.5 tomorrow > > morning (.il/Europe time) and post it in the evening. > > > > Zeev >=20 > I'm still objecting to a patch by Jani made in April to move destructor > before shutdown functions. It was in response to the following report, > http://bugs.php.net/bug.php?id=3D30578 >=20 > The problem being other than the fact that it's broken some BC is that > when it comes around to using the shutdown function any objects you > might actually have wished to use have since had their destructor called > closing connections and finalising data. >=20 > All I am proposing is that the shutdown function is run prior to > destruct functions being called as I don't expect to still be able to > access objects after the destructor is called which is still the case. > Changing the order doesn't effect bug 30578 which it was fixing. >=20 > The attached code demonstrates the problem, I'd expect to get the > following output >=20 > __construct > execution > execution > __destruct >=20 > the shutdown function checking the last step run, unfortunately I get >=20 > __construct > execution > __destruct > __destruct >=20 > Even though the destructor has been called I can still access the object > and fetch the value of the step variable. >=20 > Scott >=20 >=20 > =20 > error_reporting(E_ALL); >=20 > class example > { > var $step; > function __construct() > { > echo "__construct\n"; > $this->step =3D '__construct'; > } > function execution() > { > echo "execution\n"; > $this->step =3D 'execution'; > } > function __destruct() > { > echo "__destruct\n"; > $this->step =3D '__destruct'; > } > } > echo "
";
> $obj =3D new example();
> $obj->execution();
>=20
> function shutdown()
> {
>         global $obj;
>         echo $obj->step . "\n";
> }
> register_shutdown_function('shutdown');
> ?>
>=20
> Index: main/main.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /repository/php-src/main/main.c,v
> retrieving revision 1.648
> diff -u -r1.648 main.c
> --- main/main.c 2 Sep 2005 14:08:09 -0000       1.648
> +++ main/main.c 6 Sep 2005 13:12:22 -0000
> @@ -1319,16 +1319,16 @@
>         EG(opline_ptr) =3D NULL;
>         EG(active_op_array) =3D NULL;
>=20
> -       /* 1. Call all possible __destruct() functions */
> +       /* 1. Call all possible shutdown functions registered with regist=
er_shutdown_function() */
> +       if (PG(modules_activated)) zend_try {
> +               php_call_shutdown_functions(TSRMLS_C);
> +       } zend_end_try();
> +
> +       /* 2. Call all possible __destruct() functions */
>         zend_try {
>                 zend_call_destructors(TSRMLS_C);
>         } zend_end_try();
>=20
> -       /* 2. Call all possible shutdown functions registered with regist=
er_shutdown_function() */
> -       if (PG(modules_activated)) zend_try {
> -               php_call_shutdown_functions(TSRMLS_C);
> -       } zend_end_try();
> -
>         /* 3. Flush all output buffers */
>         zend_try {
>                 php_end_ob_buffers((zend_bool)(SG(request_info).headers_o=
nly?0:1) TSRMLS_CC);
>=20
>=20
> Index: main/main.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /repository/php-src/main/main.c,v
> retrieving revision 1.604.2.22
> diff -u -r1.604.2.22 main.c
> --- main/main.c 16 Aug 2005 18:11:34 -0000      1.604.2.22
> +++ main/main.c 6 Sep 2005 13:34:15 -0000
> @@ -1194,14 +1194,14 @@
>                 sapi_send_headers(TSRMLS_C);
>         } zend_end_try();
>=20
> +       if (PG(modules_activated)) zend_try {
> +               php_call_shutdown_functions(TSRMLS_C);
> +       } zend_end_try();
> +
>         zend_try {
>                 zend_call_destructors(TSRMLS_C);
>         } zend_end_try();
>=20
> -       if (PG(modules_activated)) zend_try {
> -               php_call_shutdown_functions(TSRMLS_C);
> -       } zend_end_try();
> -
>         if (PG(modules_activated)) {
>                 zend_deactivate_modules(TSRMLS_C);
>                 php_free_shutdown_functions(TSRMLS_C);
>=20
>=20
> Index: main/main.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /repository/php-src/main/main.c,v
> retrieving revision 1.640.2.4
> diff -u -r1.640.2.4 main.c
> --- main/main.c 2 Sep 2005 14:05:45 -0000       1.640.2.4
> +++ main/main.c 6 Sep 2005 13:17:14 -0000
> @@ -1200,16 +1200,16 @@
>         EG(opline_ptr) =3D NULL;
>         EG(active_op_array) =3D NULL;
>=20
> -       /* 1. Call all possible __destruct() functions */
> +       /* 1. Call all possible shutdown functions registered with regist=
er_shutdown_function() */
> +       if (PG(modules_activated)) zend_try {
> +               php_call_shutdown_functions(TSRMLS_C);
> +       } zend_end_try();
> +
> +       /* 2. Call all possible __destruct() functions */
>         zend_try {
>                 zend_call_destructors(TSRMLS_C);
>         } zend_end_try();
>=20
> -       /* 2. Call all possible shutdown functions registered with regist=
er_shutdown_function() */
> -       if (PG(modules_activated)) zend_try {
> -               php_call_shutdown_functions(TSRMLS_C);
> -       } zend_end_try();
> -
>         /* 3. Flush all output buffers */
>         zend_try {
>                 php_end_ob_buffers((zend_bool)(SG(request_info).headers_o=
nly?0:1) TSRMLS_CC);
>=20
>=20
>=20
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>