php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80397 The documentation on this page is ambiguous about example language
Submitted: 2020-11-21 20:03 UTC Modified: 2020-11-22 13:43 UTC
From: jacob at jacobthompson dot com Assigned: cmb (profile)
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jacob at jacobthompson dot com
New email:
PHP Version: OS:

 

 [2020-11-21 20:03 UTC] 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);
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-21 20:10 UTC] 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-22 13:43 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-11-22 13:43 UTC] cmb@php.net
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.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jun 23 18:01:28 2021 UTC