Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128083 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id E6E0A1A00BC for ; Wed, 16 Jul 2025 13:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752673131; bh=M4k0YF8/m2L94493gJw0F50FTBTF/ythvlTho8eemUk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=D9HTzIFMFMi29TTYpR+vO2NtcrtCk3dUzQn7Hn+64c3z1/IdHu9NHpksECu58ZYDl DlH7TIaX227tjpbfI19ZZUBeVUXGCwo9FjpmHfk2kl45++fNCY8i5Pc3v9BlPOiK0F 6quo6NLcOy7j2ndt/dD1jpABOWZSFSu3wYRfU1Kdqd8tUqCLKL+IvNE8ymiIf0egvt 8nslwkrjkEfeBqPG/o7fD1K4pfm2dwJQgwW6JsT2iIvkVEDzq4YygOGjpi5oLPxw9R V59vSBVhnhwIR/a3RN+flvI5vrqsgbwx4ka0HMPdOzrQZTcvZQQsqH3ExK7jR5drTv SLbFvQry4NKoA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8FDC7180081 for ; Wed, 16 Jul 2025 13:38:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 16 Jul 2025 13:38:50 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id 2adb3069b0e04-5562838ce68so5916845e87.2 for ; Wed, 16 Jul 2025 06:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752673236; x=1753278036; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=xoOBnjm+3beqmtzFuck4lPqZIFli/qqRhX+58pjpmmg=; b=Kv7LpT9i/wvDCwo5n6VGXlaw15t4oEYwXshzmkuliBV5LNOoaohjwdMIFO3y2xhjyd 4/gBYwuz+5AT+UUtmrtGVEQ3Rc96IMSU9dz9xhn2mRSJ36WkefNIbLNbte9ODtt8bkmH NfPem8+EZuiGiMdkQK/018Bjmu4cp7cCEUPasgU/SEHTPfp/PcbHnuqBdaXvOHhB9g/u uSzFGwM3qCbZhpvF1I1+LDrpZii2X5LTWLgmvJVXxG9iJvZU2buHA0ISgr9QJ3qHQYNB 2ZRnzg0NvF1fYQb+NJD91cGct4XS0IARf7HLfUuT2rKH24DQtiUiZxlQ9LMAwLLNchHt wctw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752673236; x=1753278036; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xoOBnjm+3beqmtzFuck4lPqZIFli/qqRhX+58pjpmmg=; b=rS/E5f3W34UIz3Ap+64Cv/sywuWXRs+sZ1ylJeRA40fTiWBt2u4XgA/olkXbabxWQo 5iDDxX22xdp8qlEBTZY3YWYax/P9cF+6N4cexrM9YBEQ8k22MKhD92OhG37gug52z8Ui uhVNydLyMZPkmSzzaTHZpVRYfhtngmnmy+WQ3H3MsF+/IvckSXiKSe3IHVvcNZfzfb8k Hs5zqJKYQIYIyQYq8R8mbRtNQT8XJpC0rnh4CEov9eMXfgzysbq8AEufJaS+0CWSsKq8 +TyFG8xeyhm8a99nWtC6Py5+BbEjNckVkN6G/zCKCyJqIM0dYgWCZOyWcYXkRrRs7SbQ 8eAQ== X-Gm-Message-State: AOJu0Yz/PdQih9V3phQD0l0+b8ZIxHM0d+w8Bygblqz7JWx77NMT43Dy Zb7Y/jBppjSpgep0M7LlbPsHCOS7F6vCBU2y4HEEGn2ys1D3UIohFg+4 X-Gm-Gg: ASbGncsbLOtplYtvDtU1/gsJIlFhUkSP8I/gjh/rmekWr4mozq4+HtCHhxvQBxhXSxr 0Mq11A6u1p3HMFSl6XJbb/zxZ4gCpTLB6tDns/gL0Z2+5BkkEB7qNLz+K1ESzE/YMI9+JDt5lAn y4DIVJywfIEDpOJKXs8VeOqrHuFKnzEnijeojB7xM2BK+c6TRObnHZAw+0R57z5bq6dYjf+lDxt sEvfD8x9onAQASGyYpJJCzb3J6Dpp4zKE1Er5xNJoeD4jw93QtEaRpQMHmB3UkBCBUXJ56/gn5K MxTQFTup0Uk5JjMfzZjLIPW/iwn572HIjgez/VlGBGa1mRVypQRN1XYFw40kT8qdaYzoMqbukK6 XqlF0auCb1NXC7VYhwtFvuis= X-Google-Smtp-Source: AGHT+IGHO2lhUyAcFWri6UOS2g1R/xOlGG3pBPNPCVvGIbHVd2giQkYHlpy04n9NoQb9TUX2YTYFbQ== X-Received: by 2002:a05:6512:39cb:b0:553:a5e0:719c with SMTP id 2adb3069b0e04-55a23f7ff84mr888045e87.51.1752673235473; Wed, 16 Jul 2025 06:40:35 -0700 (PDT) Received: from [192.168.5.10] ([62.119.254.58]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5593c7bb444sm2690845e87.7.2025.07.16.06.40.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jul 2025 06:40:35 -0700 (PDT) Message-ID: Date: Wed, 16 Jul 2025 15:40:34 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [DISCUSSION] bcmath: adding bcgetopts() and bcsetopts() to get or set bcmath options To: Ayesh Karunaratne Cc: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: quakemmo@gmail.com (Quake MMO) On 7/16/25 13:56, Ayesh Karunaratne wrote: >> Would adding a bcgetopts(): int and a bcsetopts(int $opts): void calls >> be useful? >> >> At this time there's no way to influence bcmath's behavior other than >> bcscale(). >> > How about adding these as methods/properties to the `BcMath\Number` class? > > `BcMath\Number` does not use the `bcmath.scale` INI directive, and in > my opinion, it is the correct way to do it. Everything that affects > the operations are just there in the code, and there is no hidden > global state. That would also totally work. Anything that would allow sanitizing the string directly in the extension as opposed to doing it in PHP would be a great progress. I would vouch for the sanitization switch to be a global state setting such as the bcscale, as opposed to (only) be a callable method/function. This way, we would avoid an extra call from PHP for sanitization.