Doc #80397 [Opn->Nab]: The documentation on this page is ambiguous about example language
| From: | cmb@php.net | Date: | Sun, 22 Nov 2020 13:43:39 +0000 |
| Subject: | Doc #80397 [Opn->Nab]: The documentation on this page is ambiguous about example language | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18145@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80397&edit=1
ID: 80397
Updated by: cmb@php.net
Reported by: jacob at jacobthompson dot com
Summary: The documentation on this page is ambiguous about
example language
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The documentation states:
| While executing in a debug environment, configured with
| --enable-debug and --enable-zend-test, the leak function used in
| the next example is actually implemented by the engine and is
| available to call in userland.
Previous Comments:
------------------------------------------------------------------------
[2020-11-21 20:10:41] girgias@php.net
Internals 2 is about the Zend Engine 2 which powered PHP 5, and most of the info is relevant to the
early versions of it.
More recent internals documentation is best found at https://phpinternalsbook.com and https://www.zend.com/resources/writing-php-extensions
------------------------------------------------------------------------
[2020-11-21 20:03:53] jacob at jacobthompson dot com
Description:
------------
The script example here (https://www.php.net/manual/en/internals2.memory.management.php) fails to
mention how to try the example by setting up your own extension with ext_skel.php and adding the
function provided in this example. It is also ambiguous about whether the example code is in PHP or
c. An experienced developer could probably figure this out with the pointer dereferencing going on,
but it would be helpful if the guide was more clear on what language is being used in the examples
and how it is integrated into an executable and testable target.
Test script:
---------------
//The example code that is referenced on the documentation page.
ZEND_FUNCTION(zend_leak_bytes)
{
zend_long leakbytes = 3;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &leakbytes) == FAILURE) {
return;
}
emalloc(leakbytes);
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80397&edit=1