Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104375 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17061 invoked from network); 13 Feb 2019 01:31:01 -0000 Received: from unknown (HELO mail-vs1-f65.google.com) (209.85.217.65) by pb1.pair.com with SMTP; 13 Feb 2019 01:31:01 -0000 Received: by mail-vs1-f65.google.com with SMTP id n10so161209vso.13 for ; Tue, 12 Feb 2019 14:14:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=bxBTo00FYgSCvejFb52wsD8/sWP8LmaokEKU3aRiuDE=; b=Y3+VQGMiZvnpfB0ZSXuxgcqPlAUyVPI/wY1/M+Mp/o8csdAWx3rOWAxK5bmGQgzASX S9GaN3ZeCY6NiCA7i5N+r+lrWrKgRFPmUxj7Evf1kheYvBiujmhdgVj5dtV0n5YTr2br 2uKzNVCEniEXB3yu+lGa0AU+hlsEhk6N616piy+sjxmVf/xMi+VxzsplMMxDNR9ra4qN qKzbkHfH/reCvcYSTkEKxbcUdQifNDeOLhTwpvtoH/e13qpwrFWUiNBPKHDY+xslHy0e YAQ7Fa7OnwXZIQX3/WUWqK+hnRvyyi2sGrWCp3pVPJ/A5Ahrx8fkXg9NxYUuuKD8TcYf bqbw== X-Gm-Message-State: AHQUAuY6Fe1IZbX6x8gMdw49jf74Rm+QNYsbrlQpDIDXFK5fq+mF/pxP f7Dj1XOHWsJg7vctjHtchES0RLfygIYoIydJW9I= X-Google-Smtp-Source: AHgI3IY1DSHpEwiKfMgjLhzszi98Xbal0YeI1v0ZVmL1Fc0pE6sWGEXxbag9/1s02Xvhfb2yMTHja9NJK2TcXo0YIwI= X-Received: by 2002:a67:eed1:: with SMTP id o17mr2684758vsp.174.1550009639917; Tue, 12 Feb 2019 14:13:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: bishop@php.net Date: Tue, 12 Feb 2019 17:13:33 -0500 Message-ID: To: Sara Golemon Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000fc60740581b9bd09" Subject: Re: [PHP-DEV] Convert ext/xml to use an object instead of resource From: bishop@php.net (Bishop Bettini) --000000000000fc60740581b9bd09 Content-Type: text/plain; charset="UTF-8" On Tue, Feb 12, 2019 at 11:21 AM Sara Golemon wrote: > On Tue, Feb 12, 2019 at 10:18 AM Nikita Popov > wrote: > > Very much opposed to any kind of special handling for is_resource(). We > > used to do this for is_object() and __PHP_Incomplete_Class and I'm very > > happy to be rid of this special behavior. Let's not add is back in a new > > place. > > > Agreed. This is something that we discuss every time a resource->object > conversion comes up and we always agree that special-casing lies the way of > madness and the tiny fraction of user code that actually checks this can > adapt `if (is_resource($x) || $x instanceof NewClassName)` Done and > sorted. Let's skip this repeat of the past and move forward with the > killing all resources with fire. > Ok. Thinking longer range, perhaps we should prepare users for these transitions by improving the documentation. For example, xml_parser_create returns false on failure, but the manual makes no mention of this. If we had this documented, we might see more if (false == $x) in the wild than the (worse IMO) if (is_resource($x)). It might also help to comment on resource factories that working with the return value as a resource proper is discouraged. I'll do this for xml_parser_create*. --000000000000fc60740581b9bd09--