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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 33 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC