Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120872 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48760 invoked from network); 31 Jul 2023 19:31:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Jul 2023 19:31:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AA33D18005D for ; Mon, 31 Jul 2023 12:31:29 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com [209.85.221.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 31 Jul 2023 12:31:26 -0700 (PDT) Received: by mail-vk1-f177.google.com with SMTP id 71dfb90a1353d-4866aa2ae63so1711412e0c.2 for ; Mon, 31 Jul 2023 12:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690831885; x=1691436685; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=scN1TmDqwDGcZkgI/0V9PyhTDMCiDAwjF6IuDVKA1uY=; b=CikyFutaFZQ9ut4qhClpmZGwAP8mUWUEdLeYVw1roFOkUcHS8Ma7ErXNl8jZg3MMut SLr2heC2FIlLC1xweJcuAbtMH21s23orPgxP+A3mxQMG7huwtY49/DOLa3r19YCndpz9 zlfh4iPZg+JbkVnrFIGRi23SsZlgEN/xLpbFFgg+mUjWEZLAWDwXXwiKIXZufvBs9zOb +Z2KPSjON3Eypaj9n/kIHlDh3TCzoHYBwXRHzt8OfpEChS447tu5ZKnxjRINQxpLZUZj w99jhYrAuo/0Ib8aOmPSLniUMy0c4oR49b0fOFKHl87+mKkNIUFX9ehHDWF9IvbZB9Td QdlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690831885; x=1691436685; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=scN1TmDqwDGcZkgI/0V9PyhTDMCiDAwjF6IuDVKA1uY=; b=f5Pvs6tz6AHzhVSC+T96gAjDJywzpjIIQj+4UX8AkoZ+4JIFPUf+TK+Ptyv0A4upJt IUPhT5QQQPQ6spUn8bzSWJMswAmFB99rf/aQHAPG9VeNQB1XoMJ6XfC2Ua2fsSv9U4h8 wbtczm4azvPeIx1VvLIthsl2PowLXDt9YzN/YyvqV07nHBtoNLxiB9ZR6iAWzwBcHL/W nBzbrWfW49x/VS1BVNR4y08vcWh8vKm03gzaZKgkE0G5UovnFL0UKE9sCjR93qL7toha +zwnlU8UKyCn+9oj1a2EVWpKBjryaNEjV3zWsft5va4q0pnVUCLqJ8sEjtnduQ8xUiaL vjMA== X-Gm-Message-State: ABy/qLYwmHqeQbXQFWlvc1or3k8GWnB7ame3gSTP8+sD/ZdQpkeWdYNt QgpxD31QMg3zILUJ8q9caGpnHzCIR5vD6r1u4JE4XZWwgb7xRw== X-Google-Smtp-Source: APBJJlF5uVFgBlyb0tLCo0X+T/L0feH5e6cURDk/2YyILqpufWxw684x/NvRj2/DgEy1/iYMqEJoJlUgIWFZOpoOiQA= X-Received: by 2002:a1f:4394:0:b0:485:ac24:df1 with SMTP id q142-20020a1f4394000000b00485ac240df1mr873245vka.12.1690831885156; Mon, 31 Jul 2023 12:31:25 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 31 Jul 2023 12:31:14 -0700 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Arginfo Mismatch For Optional Parameters From: sutabi@gmail.com (Joseph Montanez) Hello, I am a little confused about this while working on my extension. I've compiled PHP with --enable-debug and this only produces a fatal error when used with that flag, without debug it runs fine. "Fatal error: Arginfo / zpp mismatch during call of raylib\Vector3::__construct()" Here is the c code snippet of my code that produces the error: ZEND_BEGIN_ARG_INFO_EX(arginfo_vector3__construct, 0, 0, 0) ZEND_ARG_TYPE_MASK(0, x, IS_DOUBLE, "0") ZEND_ARG_TYPE_MASK(0, y, IS_DOUBLE, "0") ZEND_ARG_TYPE_MASK(0, z, IS_DOUBLE, "0") ZEND_END_ARG_INFO() PHP_METHOD(Vector3, __construct) { double x; bool x_is_null = 1; double y; bool y_is_null = 1; double z; bool z_is_null = 1; ZEND_PARSE_PARAMETERS_START(0, 3) Z_PARAM_OPTIONAL Z_PARAM_DOUBLE_OR_NULL(x, x_is_null) Z_PARAM_DOUBLE_OR_NULL(y, y_is_null) Z_PARAM_DOUBLE_OR_NULL(z, z_is_null) ZEND_PARSE_PARAMETERS_END(); php_raylib_vector3_object *intern = Z_VECTOR3_OBJ_P(ZEND_THIS); if (x_is_null) { x = 0.0f; } if (y_is_null) { y = 0.0f; } if (z_is_null) { z = 0.0f; } intern->vector3->data = (Vector3) { .x = (float) x, .y = (float) y, .z = (float) z }; } Then the line of PHP code: $position = new Vector3(4.0, 2.0, 4.0); I am confused because these are all optional parameters, and it should work? If I exclude the parameters in my PHP code it works fine. If I swap the following: ZEND_BEGIN_ARG_INFO_EX(arginfo_vector3__construct, 0, 0, 0) ZEND_ARG_TYPE_MASK(0, x, IS_DOUBLE, "0") ZEND_ARG_TYPE_MASK(0, y, IS_DOUBLE, "0") ZEND_ARG_TYPE_MASK(0, z, IS_DOUBLE, "0") ZEND_END_ARG_INFO() For the following: ZEND_BEGIN_ARG_INFO_EX(arginfo_vector3__construct, 0, 0, 0) ZEND_ARG_INFO(0, x) ZEND_ARG_INFO(0, y) ZEND_ARG_INFO(0, z) ZEND_END_ARG_INFO() Then it works fine. Can I not use ZEND_ARG_TYPE_MASK in this context? I only put the type mask with the default value so it works better with PHP's built-in reflection, so is this not possible? I've seen similar uses with Tidy and Soap extensions so I'm a little baffled on why it's an issue here. I think the only difference is that where the ARG_INFO is, is in the header files versus the C files of those extensions. Thanks, Joseph Montanez