php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37797 Lambda unexpected string
Submitted: 2006-06-14 01:54 UTC Modified: 2006-06-14 05:47 UTC
From: whitephoenix at mail dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.1.4 OS: tested on WinXP
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: whitephoenix at mail dot ru
New email:
PHP Version: OS:

 

 [2006-06-14 01:54 UTC] whitephoenix at mail dot ru
Description:
------------
Its seems, PHP should show error with type E_WARNING. If it's wrong, then i think, NUL-byte is unexpected there.

Reproduce code:
---------------
<?php
// ASCII in hex
function show_callback($m) {return '['.dechex(ord($m[0])).']';}
function show($result) {echo preg_replace_callback('~\W~','show_callback',$result)."\n";}
// Execution
for ($i = 0; $i < 5; $i++)
{
 $callback = create_function('$php','undefined();');
 $string = substr($callback,0); // or other function, for example, strval() or str_replace()...
 show($string);
}
?>

Expected result:
----------------
It seems, PHP should show error with type E_WARNING. If it's wrong, then I think, NUL-byte is unexpected there. Sorry for my English, I know, it's difficult to read.
Thanks!

Actual result:
--------------
[0]lambda_35
[0]lambda_36
[0]lambda_37
[0]lambda_38
[0]lambda_39

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-14 01:59 UTC] whitephoenix at mail dot ru
And if to run it, several times, then, in string "lambda_X", X will be incremented.
 [2006-06-14 05:47 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That\'s how lambda functions work in PHP....
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 21:01:32 2025 UTC