Click here to Skip to main content
15,887,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone. I'm interested in building and using php_printer.dll for php 7. I know there are lots of workarounds, but I still would llike to make it possible via this old extension.

I have no experience in developing/updating extensions and writing code at that level. Any help/hint is appreciated and also if I'm missing something to reproduce environment, don't doubt to tell me. After all it's something anyone can use in the near future.


Thanks in advance. Have a nice time.

What I have tried:

I've downloaded files from http://svn.php.net/repository/pecl/printer/trunk/ . Ggenerated and used files are in https://github.com/laeirbag/StuffToShare .

I've also downloaded aditional stuff required while configuring in visual studio 2015 command prompt, plus to the usual (php source code, deps, sdk and so on):

gnu win32 bison
gnu win32 zip
re2c 0.13.4 (because it still demands it even when newer version already exists, but doesn't recognizes it when built and put in path).
lemon parser generator (built because only source code available. Not to be confunded with lemon library for common structures and algorithms).

After that I proceeded to deal with errors this way...

1.- replaced zend_rsrc_list_entry to be zend_resource instead and ZEND_FETCH_RESOURCE( to be zend_fetch_resource( , according to David Sklar words. Also modified zend_fetch_resource(resource, struct, arg1,-1... to be zend_fetch_resource( arg1,resource, -1, as understood.

2.- Replaced Z_STRVAL_PP( to be Z_STRVAL_P( according to a github link

3.- replaced all ZEND_REGISTRER_RESOURCE to be zend_register_resource because I didn't found uppercase references.

4.- replaced every zend_list_delete(Z_RESVAL_PP to be zend_list_close(Z_RES_P( acoording to another github link

5.- Replaced Z_LVAL_PP tp be Z_LVAL_P (github again)

6.- replaced Z_BVAL_PP( to be Z_DVAL_P( according to a thread.

7.- Didn't know what to do with new_value_length, so I just commented line.

8.- Also replaced all zval ** to be zval* . Otherwise any function calling lags.

9.- It also used to reference some non existent files into Release_TS folder. I created them.

The extension can be built, listed included an shown in info. But problems are found.

printer_list() returns a list with many "UNKNOWN: 0" useless names and printer_open() prompts an error when a non existent printer is used in parameter and returns null when a correct name is given, so handle is of no use to proceed with anything.

Looks like default printer settings in php.ini it's now of no use as far as I know, so printer_open without parameters prompts the error mentioned.

php_error_log marks an Unknown list entry type (138416168) in unknown line 0
and marks couldn't connect to printer [\x01] (SOH or StartOfHeader) when called with no parameters.

php_info contents are also kinda weird.

Question still remains about what can be replacement for new_value_length and what else has to be replaced/improved.
Posted
Updated 17-Aug-16 12:47pm
v2
Comments
ZahidNaseem 13-Feb-18 17:22pm    
Wondering if you have solution for printer in PHP7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900